#28863 - ozahid - Mon Nov 08, 2004 12:04 am
The following is the code i used to try to move the sprite to a different coording (originally 10,10) when the forward button is pressed. During VDraw it checks for a keydown, if its down it sets r6 to 1. Then in VBlank, if r6 is 1 it updates the attributes to have new X and Y values. Then resets r6 to 0. Now, when I run the file on the emulator it works when you hit forward. However, after that the sprite starts refreshing like crazy, I don't see what I did wrong =(
_________________
http://people.umass.edu/ozahid
Code: |
ldr r0,=0x04000006 ;VCount
ldr r1,=0x04000130 ;key register ldr r2,=0x07000000 ;OAM Reg MOV r5,#10 ;x value MOV r6,#0 ;updated? Inf VDraw LDR r3,[r0] CMP r3,#160 BGE VBlank LDR r4,[r1] ANDS r4,r4,#16 ADDEQ r5,r5,#10 MOVEQ r6,#1 B VDraw VBlank LDR r3,[r0] CMP r3,#160 BLT Inf CMP r6,#1 LDREQ R1,=(SQUARE|COLOR_16|50)|((SIZE_32|50)<<16) STREQ R1,[R2]+4! ;Move to attribute 2 LDREQ R1,=0 ;Tile numbeR 0 STREQ R1,[R2] MOVEQ R6,#0 b VBlank |
_________________
http://people.umass.edu/ozahid