0 Members and 2 Guests are viewing this topic.
xpos .equ AppBackUpScreen ; To prevent SMCypos .equ xpos+1 ; Tried +2 and even +9, don't know wether that makes a difference clip_mask .equ ypos+1 ; or not, but just to be sure. It didn't work though... LD A, 38 ; X position to display LD (xpos), A LD A, 54 ; Y position do display LD (ypos), A LD B, 9 ; Length of Sprite in Y direction LD DE, (ypos) LD IX, Sprite ; Label of sprite CALL showspriteShowsprite: ; Show Sprite (XOR) CALL ClipSprXOR b_call _GrBufCpy retClipSprXOR: ; Show Sprite XOR LD A, %11111111 LD (clip_mask), A LD A, E OR A JP M, ClipTop SUB 64 RET NC NEG CP B JR NC, VertClipDone LD B, A JR VertClipDoneClipTop: LD A, B NEG SUB E RET NC PUSH AF ADD A, B LD E, 0 LD B, E LD C, A ADD IX, BC POP AF NEG LD B, AVertClipDone: LD C, 0 LD A, D CP -7 JR NC, ClipLeft CP 96 RET NC CP 89 JR C, HorizClipDoneClipRight: AND 7 LD C, A LD A, %11111111FindRightMask: ADD A, A DEC C JR NZ, FindRightMask LD (clip_mask), A LD A, D JR HorizClipDoneClipLeft: AND 7 LD C, A LD A, %11111111FindLeftMask: ADD A, A DEC C JR NZ, FindLeftMask CPL LD (clip_mask), A LD A, D ADD A, 96 LD C, 12HorizClipDone: LD H, 0 LD D, H LD L, E ADD HL, HL ADD HL, DE ADD HL, HL ADD HL, HL LD E, A SRL E SRL E SRL E ADD HL, DE LD DE, PlotSScreen ADD HL, DE LD D, 0 LD E, C SBC HL, DE AND 7 JR Z, _Aligned LD C, A LD DE, 11_RowLoop: PUSH BC LD B, C LD A, (clip_mask) AND (IX) LD C, 0_ShiftLoop: SRL A RR C DJNZ _ShiftLoop XOR (HL) LD (HL), A INC HL LD A, C XOR (HL) LD (HL), A ADD HL, DE INC IX POP BC DJNZ _RowLoop RET_Aligned: LD DE, 12_PutLoop: LD A, (IX) XOR (HL) LD (HL), A INC IX ADD HL, DE DJNZ _PutLoop RETSprite: .DB %00011000 .DB %01111110 .DB %01111110 .DB %11100111 .DB %11100111 .DB %01111110 .DB %01111110 .DB %00011000 .DB %00011000
xpos .equ AppBackUpScreen ; To prevent SMCypos .equ xpos+1 ; Tried +2 and even +9, don't know wether that makes a difference clip_mask .equ ypos+1 ......LD DE, (ypos)
xpos = 38ypos = 54clip_mask = 255
AppBackUpScreen = 68AppBackUpScreen+1 = 54AppBackUpScreen+2 = 255
LD DE, (ypos)
LD DE, (AppBackUpScreen+1 & AppBackUpScreen+2) ;want DE wil twee bytes, niet een. Dus hij laadt nu wat in AppBackUpScreen+1 staat in E en wat in AppbackUpScreen+2 staat in D
DE = 255+54= 309 ;decimaal
ypos .equ AppBackUpScreenxpos .equ AppBackUpScreen+1clip_mask .equ AppBackUpScreen+2 LD A, 38 LD (xpos), A LD A, 54 ; Y position do display LD (ypos), A LD B, 9 ; Length of Sprite in Y direction LD D, (xpos) ;ik weet niet of D =ypos of E=ypos maar je kan het altijd nog omdraaien LD E, (ypos) LD IX, Sprite ; Label of sprite CALL showsprite
ld hl, $1234 ld (appBackUpScreen), hl
uit mijn hoofd doe zou ik dit doen:Code: [Select]ypos .equ AppBackUpScreenxpos .equ AppBackUpScreen+1clip_mask .equ AppBackUpScreen+2 LD A, 38 LD (xpos), A LD A, 54 ; Y position do display LD (ypos), A LD B, 9 ; Length of Sprite in Y direction LD D, (xpos) ;ik weet niet of D =ypos of E=ypos maar je kan het altijd nog omdraaien LD E, (ypos) LD IX, Sprite ; Label of sprite CALL showspriteik weet dus niet of dit werkt maar in ieder geval moet het probleem wel duidelijk zijn nu...
LD D, (xpos) LD E, (ypos)
ypos .equ AppBackUpScreenxpos .equ AppBackUpScreen+1clip_mask .equ AppBackUpScreen+2 ; Dont think the +2 is needed, because I justdo this:ypos .equ AppBackUpScreenxpos .equ ypos+1 ;I just do the previous statement +1, that doesn't result in errors (I think), becauseclip_mask .equ xpos+1 ;I've even done +9 while the script wasnty working, and it still kept failing