0 Members and 1 Guest are viewing this topic.
.nolist#include "ti83plus.inc"#include "dcs7.inc".list .org userMem-2 .db $BB,$6DInit: B_CALL (_ClrLCDFull) ld hl,0 Loop: ld b,8 ld ix,MyImage ld a,h push hl call iPutSprite ;Display Image call iFastCopy ;Put it in the buffer B_CALL(_GrBufClr) ;Clears the graph screen pop hl ;Start of gravity code push af push hl ld a,8 add a,l ld e,a ;Sets e to y+8 ld a,h ;Sets a to x call iGetPixel pop hl pop af and (hl) call z,SetGravity ;If pixel below image is white, y=y+1 ;End of gravity code ld a,$FE out (1),a nop nop nop in a,(1) bit 0,a call z,CheckMoveDown bit 1,a call z,CheckMoveLeft bit 2,a call z,CheckMoveRight bit 3,a call z,CheckMoveUp jp LoopSetGravity: inc l retCheckMoveUp: push af ld a,l cp 0 call nz,MoveUp pop af retMoveUp: dec l dec l retCheckMoveDown: push af ld a,l cp 56 call nz,MoveDown pop af retMoveDown: inc l inc l retCheckMoveLeft: push af ld a,h cp 0 call nz,MoveLeft pop af retMoveLeft: dec h dec h retCheckMoveRight: push af ld a,h cp 87 call c,MoveRight pop af retMoveRight: inc h inc h retMyImage: .db $FF,$81,$81,$81,$81,$81,$81,$FF
Np, and another thing: Don't be afraid to use gotos (JP/JR) in ASM. You could save a couple of bytes and some clock cycles by putting your MoveUp/MoveDown/MoveLeft/MoveRight routines inline (instead of in a separate CALL'd subroutine).
;Draw line code push af push hl ld h,0 ld l,63 ld d,95 ld e,63 ld a,1 call fastline pop hl pop af ;End of draw line code ;Start of gravity code push af push hl ld a,8 add a,l ld e,a ;Sets e to y+8 ld a,h ;Sets a to x call iGetPixel pop hl pop af and (hl) call z,SetGravity ;If pixel below image is white, y=y+1 ;End of gravity code
.nolist#include "ti83plus.inc"#include "dcs7.inc".list .org userMem-2 .db $BB,$6DInit: B_CALL (_ClrLCDFull) ld hl,0 Loop: ld b,8 ld ix,MyImage ld a,h push hl call iPutSprite ;Display Image call iFastCopy ;Put it in the buffer B_CALL(_GrBufClr) ;Clears the graph screen pop hl ;Draw line code push af push hl ld h,0 ld l,63 ld d,95 ld e,63 ld a,1 call fastline pop hl pop af ;End of draw line code ;Start of gravity code push af push hl ld a,8 add a,l ld e,a ;Sets e to y+8 ld a,h ;Sets a to x call iGetPixel pop de pop af and (hl) call z,SetGravity ;If pixel below image is white, y=y+1 ld l,e ld h,d ;End of gravity code ld a,$FE out (1),a nop nop nop in a,(1) bit 0,a call z,CheckMoveDown bit 1,a call z,CheckMoveLeft bit 2,a call z,CheckMoveRight bit 3,a call z,CheckMoveUp jp LoopSetGravity: inc e retCheckMoveUp: push af ld a,l cp 0 call nz,MoveUp pop af retMoveUp: dec l dec l retCheckMoveDown: push af ld a,l cp 56 call nz,MoveDown pop af retMoveDown: inc l inc l retCheckMoveLeft: push af ld a,h cp 0 call nz,MoveLeft pop af retMoveLeft: dec h dec h retCheckMoveRight: push af ld a,h cp 87 call c,MoveRight pop af retMoveRight: inc h inc h retMyImage: .db $FF,$81,$81,$81,$81,$81,$81,$FF
.nolist#include "ti83plus.inc"#include "dcs7.inc".list .org userMem-2 .db $BB,$6DInit: B_CALL (_ClrLCDFull) ld hl,0 Loop: ld b,8 ld ix,MyImage ld a,h push hl call iPutSprite ;Display Image call iFastCopy ;Put it in the buffer B_CALL(_GrBufClr) ;Clears the graph screen ;Draw line code ld h,0 ld l,63 ld d,95 ld e,63 ld a,1 call fastline ;End of draw line code ;Start of gravity code ld a,8 add a,l ld e,a ;Sets e to y+8 ld a,h ;Sets a to x call iGetPixel and (hl) call z,SetGravity ;If pixel below image is white, y=y+1 ;End of gravity code pop hl ;Getkeys code ld a,$FE out (1),a nop nop nop in a,(1) bit 1,a call z,CheckMoveLeft bit 2,a call z,CheckMoveRight bit 3,a call z,CheckMoveUp ;End of getkeys code jp LoopSetGravity: inc l retCheckMoveUp: push af ld a,l cp 0 call nz,MoveUp pop af retMoveUp: dec l dec l ret CheckMoveLeft: push af ld a,h cp 0 call nz,MoveLeft pop af retMoveLeft: dec h dec h retCheckMoveRight: push af ld a,h cp 87 call c,MoveRight pop af retMoveRight: inc h inc h retMyImage: .db $FF,$81,$81,$81,$81,$81,$81,$FF
Btw Scout, you're learning ASM as fast as I was, so give yourself a pat on the back.
.nolist#include "ti83plus.inc"#include "dcs7.inc".list .org userMem-2 .db $BB,$6DInit: B_CALL (_ClrLCDFull) ld hl,0 Loop: ld b,8 ld ix,MyImage ld a,h push hl call iPutSprite ;Display Image call iFastCopy ;Put it in the buffer B_CALL(_GrBufClr) ;Clears the graph screen ;Draw line code ld h,0 ld l,63 ld d,95 ld e,63 ld a,1 call fastline ;End of draw line code ;Start of gravity code ld a,8 add a,l ld e,a ;Sets e to y+8 ld a,h ;Sets a to x call iGetPixel pop hl call z,SetGravity ;If pixel below image is white, y=y+1 ;End of gravity code ;Getkeys code ld a,$FE out (1),a nop nop nop in a,(1) bit 1,a call z,CheckMoveLeft bit 2,a call z,CheckMoveRight bit 3,a call z,CheckMoveUp ;End of getkeys code jp LoopSetGravity: inc l retCheckMoveUp: push af ld a,l cp 0 call nz,MoveUp pop af retMoveUp: dec l dec l ret CheckMoveLeft: push af ld a,h cp 0 call nz,MoveLeft pop af retMoveLeft: dec h dec h retCheckMoveRight: push af ld a,h cp 87 call c,MoveRight pop af retMoveRight: inc h inc h retMyImage: .db $FF,$81,$81,$81,$81,$81,$81,$FF
;Start of gravity code ld a,8 add a,l ld e,a ;Sets e to y+8 ld a,h ;Sets a to x call iGetPixel pop hl call z,SetGravity ;If pixel below image is white, y=y+1 ;End of gravity code
call iGetPixel and (hl) call z,SetGravity ;If pixel below image is white, y=y+1 ;End of gravity code pop hl ;Get old hl value ld a,l ;Set a to l to do some math with ti add a,e ;I add e to a ld l,a ;I set l to a, so if anything was increased to 'e', the 'y' position is also increased...SetGravity: ld e,0 inc e ret
.nolist#include "ti83plus.inc"#include "dcs7.inc".list .org userMem-2 .db $BB,$6DInit: B_CALL (_ClrLCDFull) ld hl,0 Loop: ld b,8 ld ix,MyImage ld a,h push hl call iPutSprite ;Display Image call iFastCopy ;Put it in the buffer B_CALL(_GrBufClr) ;Clears the graph screen ;Draw line code ld h,0 ld l,63 ld d,95 ld e,63 ld a,1 call fastline ;End of draw line code ;Start of gravity code ld a,8 add a,l ld e,a ;Sets e to y+8 ld a,h ;Sets a to x call iGetPixel ld e,0 and (hl) call z,SetGravity ;If pixel below image is white, y=y+1 ;End of gravity code pop hl ld a,l add a,e ld l,a ;Getkeys code ld a,$FE out (1),a nop nop nop in a,(1) bit 1,a call z,CheckMoveLeft bit 2,a call z,CheckMoveRight bit 3,a call z,CheckMoveUp ;End of getkeys code jp LoopSetGravity: ld e,0 inc e retCheckMoveUp: push af ld a,l cp 0 call nz,MoveUp pop af retMoveUp: dec l dec l ret CheckMoveLeft: push af ld a,h cp 0 call nz,MoveLeft pop af retMoveLeft: dec h dec h retCheckMoveRight: push af ld a,h cp 87 call c,MoveRight pop af retMoveRight: inc h inc h retMyImage: .db $FF,$81,$81,$81,$81,$81,$81,$FF
; Written for Doors CS 7.0 and higher.nolist#include "ti83plus.inc"#include "dcs7.inc".list .org userMem-2 .db $BB,$6DInit: B_CALL (_ClrLCDFull) set textWrite,(IY + sGrFlags) SET fracDrawLFont,(IY + fontFlags) ld a,1 ld (penCol), a ld a,1 ld (penRow), a ld hl,Title B_CALL (_VPutS) ld h,0 ld l,9 ld d,95 ld e,9 ld a,1 call fastline call iFastCopy B_CALL (_GetKey) ret Title: .db "Hello World",0
p_DispInt: .db 3 B_CALL(_DispHL)