0 Members and 3 Guests are viewing this topic.
Loop: ;Pop hl and save it to b, how do do this? ;Display image ;Store b to hl and then push it ;ClrLCDFull jr Loop
.nolist#include "ti83plus.inc"#include "dcs7.inc".list .org userMem-2 .db $BB,$6DInit: B_CALL (_ClrLCDFull) ld hl,0 Loop: ;Waits for the user to press [CLEAR] 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) B_CALL (_GetCSC) pop hl cp skRight call z,CheckMoveRight jr Loop CheckMoveRight: ld a,h cp 87 call c,MoveRight retMoveRight: inc h inc h retMyImage: .db $FF,$81,$81,$81,$81,$81,$81,$FF
CSC uses a system interrupt (TI's) that does that pause before repeating a key (it's part of the GetCSC routine). I think there's a way to change the pause (you could disable it entirely), but I don't know how that's done.But if you're willing to work with direct input, you can do whatever you want from the key port.
Quote from: Deep Thought on May 15, 2011, 01:20:10 pmCSC uses a system interrupt (TI's) that does that pause before repeating a key (it's part of the GetCSC routine). I think there's a way to change the pause (you could disable it entirely), but I don't know how that's done.But if you're willing to work with direct input, you can do whatever you want from the key port.That's not B_CALL _GetKey is it? I think not
.nolist#include "ti83plus.inc"#include "dcs7.inc".list .org userMem-2 .db $BB,$6DInit: B_CALL (_ClrLCDFull) ld hl,0 Loop: ;Waits for the user to press [CLEAR] 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) ld a,$FB out (1),a in a,(1) cp $FB call z,CheckMoveRight jr Loop CheckMoveRight: ld a,h cp 87 call c,MoveRight 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: ;Waits for the user to press [CLEAR] 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) pop hl :Added pop hl here ld a,$FB out (1),a in a,(1) cp $FB call z,CheckMoveRight jr Loop CheckMoveRight: ld a,h cp 87 call c,MoveRight retMoveRight: inc h inc h retMyImage: .db $FF,$81,$81,$81,$81,$81,$81,$FF
ld a,$FB out (1),a in a,(1) cp $FB call z,CheckMoveRight jr Loop CheckMoveRight: ld a,h cp 87 call c,MoveRight ret
ld a,$FE out (1),a nop nop in a,(1) cp $FB call z,CheckMoveRight ld a,$FE out (1),a nop nop in a,(1) cp $FD call z,CheckMoveLeft ld a,$FE out (1),a nop nop in a,(1) cp $FE call z,CheckMoveDown ld a,$FE out (1),a nop nop in a,(1) cp $F7 call z,CheckMoveUp
ld a,$FE out (1),a nop nop nop in a,(1) bit 0,a call z,CheckMoveRight bit 1,a call z,CheckMoveLeft bit 2,a call z,CheckMoveDown bit 3,a call z,CheckMoveUp
.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) pop hl ld a,$FE out (1),a nop nop nop in a,(1) bit 0,a call z,CheckMoveRight bit 1,a call z,CheckMoveLeft bit 2,a call z,CheckMoveDown bit 3,a call z,CheckMoveUp jr Loop CheckMoveUp: 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
Bit 0 is down, bit 2 is right.
Hence why with _GetCSC (and Axe), down, left, right, and up are 1, 2, 3, and 4
.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 and (hl) call z,SetGravity ;If pixel below image is white, y=y+1 pop hl pop af ;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