0 Members and 5 Guests are viewing this topic.
#include "jade.inc".org $00 jrf(start)sprite:.db $FF.db $FF.db $FF.db $FF.db $FF.db $FF.db $FF.db $FFstart: ldirc(keyMask,3) .db 3,3,1 ldirc(sprite0,5) .dw $100+sprite \ .db 0,0,2loop: cpc(key1,kClear) jrfz(quit) jrb(loop)quit: ldc(status,$80)
#include "jade.inc".org $00 jrf(start)sprite:.db %00111100.db %01100110.db %11000011.db %11100111.db $FF.db $FF.db $FF.db $FFstart: ldirc(keyMask,3) .db 3,1,1 ldirc(sprite0,5) .dw $100+sprite \ .db 0,0,2loop: cpc(key0,kDown) jrfz(goDown) cpc(key0,kUp) jrfz(goUp) cpc(key0,kLeft) jrfz(goLeft) cpc(key0,kRight) jrfz(goRight) cpc(key1,kClear) jrfz(quit) jrb(loop)goDown: addc(sY0,1) jrb(loop)goUp: subc(sY0,1) jrb(loop)goLeft: subc(sX0,1) jrb(loop)goRight: addc(sX0,1) jrb(loop)quit: ldc(status,$80)
;##_key 0_##key0 = 29hkDown = $FEkLeft = $FDkRight = $FBkUp = $F7
;saferam1 =86EChsaferam1 =9872h
;saferam1 =$86EC ;saveSScreen=768;saferam2 =$8A3A ;statVars=531;saferam3 =$8508 ;textShadow=128;saferam4 =$8478 ;OPs=66;saferam5 =$84D3 ;iMathPtrs=10;saferamp =$9872 ;appBackUpScreen=768;saferamp2 =$8251 ;bootTemp=52;gbuf =$9340 ;768 ;graphVariables =$8E67 ;1179 : 494+126(financeVars)+108(smallEditRAM)+157(plus de graphs)+294(tableStuff)
ldirc(keyMask,4) .db 3,1,1,1
"[JADETEST":Asm(prgmJADE
Loop: cpc(key0,kDown) incz(sY0) cpc(key0,kUp) decz(sY0) cpc(key0,kLeft) incz(sX0) cpc(key0,kRight) decz(sX0) cpc(key1,kClear) ldcz(status,$80) jrb(Loop)
bits(const,addr) ;will perform bitwise AND logic, but doesn't change (addr), only flags. Useful to see if one of the bits is set. inv(addr) ;invert the bits rotl(addr) ;rotate the bits left rotr(addr) ;rotate the bits right shftl(addr) ;shift the bits left shftr(addr) ;shift the bits right
0 1 2 3 4 5 6 7 8 9 A B C D E F0 lda() adda() adca() suba() sbca() xora() ora() anda() cpa() inc() rotl() shftl() pusha() pop() inv() ldira()1 ldc() addc() adcc() subc() sbcc() xorc() orc() andc() cpc() dec() rotr() shftr() pushc() ex() bits() ldirc()2 ret() setz() setc() togz() togc() jp1() jp2() jrf() jrb() call1() call2() callf() callb()3 ;Duplicate for execution on the c flag condition4x,5x,6x,7x;Duplicate for execution on the z flag condition8x,9x,Ax,Bx;???Cx,Dx,Ex,Fx
resz() resc()
togzz() togcc()
#include "jade.inc".org $00 jrf(start)sprite:.db %00111100.db %01100110.db %11000011.db %11100111.db $FF.db $FF.db $FF.db $FFstart: ldirc(sprite0,5) .dw $100+sprite \ .db 0,0,2 ldirc(keyMask,2) .db 3,1Loop: orc(status,1) ;set bit 0 of the status portKeyLoop: cpc(key1,kClear) ;Check if clear is pressed ldcz(status,$80) ;Turn off Jade if the z flag is set by writing 80h to the status port cpc(key0,-1) ;test if no keys are being pressed jrbz(KeyLoop) callf(SpriteWait) ;In case not enough time has passed for the sprite to be drawn ldc(sUpdate,0) ;Acknowledge the sprite drawing, allowing it to redraw the sprite (XORing twice results in no change) callf(SpriteWait) ;We need to wait until the sprite is drawn before updating coordinates cpc(key0,kDown) incz(sY0) cpc(key0,kUp) decz(sY0) cpc(key0,kLeft) incz(sX0) cpc(key0,kRight) decz(sX0) ldc(sUpdate,0) ;Acknowledge any sprites drawn, allowing the updated coordinates to be displayed jrb(Loop)SpriteWait: cpa(sUpdate,sMask) ;Check if all of the sprites are drawn retz() jrb(SpriteWait)
I really like the idea of the conditional codes. It's something i really like about ARM assembly, pretty much any instruction can take conditions. So you can do things like addc r1,r2 or even cmpz r1,r2. You can actually also add shifts, so you can do addc r1,r2,r3 LSL 4, which adds r2 + [r3 shifted to the left 4 bits] and stores the result in r1, but only if the carry flag is set (that's one instruction!)
Right now, what does sMask do? I assumed that a sprite wouldn't be processed unless you turned on that sprite's corresponding sMask bit. If i set the sprite delay to 1 and only have one sprite set in the sMask, it'll still process the other 7 sprites before coming back to the one i've enabled?
Also, a double-buffer might work really well here since with 8 sprites not a lot of the screen should be changing at once:http://wikiti.brandonw.net/index.php?title=Z80_Routines:Graphic:Fastcopy#Double-buffered_copy
I think your other ideas are also good, in particular updating the LCD after each sprite is drawn will probably cause quite a bit of a slowdown. Waiting until all sprites have been drawn before updating is probably a good idea. I was also wondering if bit-instructions were going to be added
#include 'Jade.inc'.org $00 jrf(start)sprite:.db %00111100.db %01100110.db %11000011.db %11100111.db $FF.db $FF.db $FF.db $FFstart: ldirc(sLSB0,5) .dw $100+sprite \ .db 0,0,2 ldirc(keyMask,2) .db 3,1 ;Loop: orc(status,2) ;set bit 1 of the status port to draw the sprites orc(status,3) ;set bit 0 and 1 of the status port to update the LCD, then redraw the spritesKeyLoop: cpc(key1,jkClear) ;Check if clear is pressed ldcz(status,$80) ;Turn off Jade if the z flag is set by writing 80h to the status port cpc(key0,-1) ;test if no keys are being pressed jrbz(KeyLoop) cpc(key0,jkDown) incz(sY0) cpc(key0,jkUp) decz(sY0) cpc(key0,jkLeft) incz(sX0) cpc(key0,jkRight) decz(sX0) jrb(Loop)
#include "ti83plus.inc"#include "Jade.inc".org 0scratchmath equ 252scratchmath1 equ 253ballxinc equ 254ballyinc equ 255Start: ldirc(sLSB0,25) .dw $100+ball \ .db 3,3,2 ;load the sprite data for Sprite0. The 2 is for XOR logic. .dw $100+paddle \ .db 0,24,2 ;load the sprite data for Sprite1. The 2 is for XOR logic. .dw $100+paddle \ .db 0,32,2 ;load the sprite data for Sprite2. The 2 is for XOR logic. .dw $100+paddle \ .db 94,24,2 ;load the sprite data for Sprite3. The 2 is for XOR logic. .dw $100+paddle \ .db 94,32,2 ;load the sprite data for Sprite4. The 2 is for XOR logic. ldirc(keyMask,2) .db %00010110,31 ;the second byte is for sMask (the sprite mask) ldc(ballxinc,1) ldc(ballyinc,1)Loop: orc(status,2) ;tell the status port to draw the sprites orc(status,3) ;tell the status port to update the LCD, then draw the spritesKeyLoop: bits(key1,40h) ;check for the Clear key being pressed orcz(status,80h) ;sets bit 7 of the status port if the z flag is set. This turns off Jade. bits(key2,2) ;check if player 2 down key is being pressed togz() jrfz(TestP2Up) cpc(sY3,48) jrfz(TestP2Up) addc(sY3,2) addc(sY4,2)TestP2Up: bits(key2,8) ;check if player 2 down key is being pressed togz() jrfz(TestP1Down) cpc(sY3,0) jrfz(TestP1Down) subc(sY3,2) subc(sY4,2)TestP1Down: bits(key4,2) ;check if player 2 down key is being pressed togz() jrfz(TestP1Up) cpc(sY1,48) jrfz(TestP1Up) addc(sY1,2) addc(sY2,2)TestP1Up: bits(key4,8) ;check if player 2 down key is being pressed togz() jrfz(MoveBall) cpc(sY1,0) jrfz(MoveBall) subc(sY1,2) subc(sY2,2)MoveBall: adda(sX0,ballxinc) callfz(TestP1Collision) cpc(sX0,89) callfz(TestP2Collision) adda(sY0,ballyinc) jrfz(NegYinc) cpc(sY0,60) togz() jrbz(Loop)NegYinc: inv(ballyinc) inc(ballyinc) jrb(loop)TestP1Collision: lda(scratchmath,sY1) jrf(CheckBounds)TestP2Collision: lda(scratchmath,sY3)CheckBounds: lda(scratchmath1,scratchmath) subc(scratchmath,3) ldcc(scratchmath,0) suba(scratchmath,sY0) jrfc(CheckOtherBound)LoseCode: ldc(status,80h)CheckOtherBound: addc(scratchmath1,15) suba(scratchmath1,sY0) jrbc(LoseCode)NegXinc: inv(ballxinc) inc(ballxinc) ret() ball: .db 18h .db 24h .db 24h .db 18h .db 0,0,0,0paddle: .db $C0 .db $C0 .db $C0 .db $C0 .db $C0 .db $C0 .db $C0 .db $C0
1 byte for the file info and type bit 0:1 for the type bit 2 for the save state size (128 bytes or 256) bit 3 set if there is a description bit 4 set if there is an icon1 bytes for the name lengthn bytes for the name2 bytes for the miscellaneous data sizen bytes for miscellaneous data such as description and icon2 bytes for the ROM sizen bytes for ROM data