Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boardreset
- DCB "+---------------------------+",0xA,0xD
- DCB "|o.....|.............|.....o|",0xA,0xD
- DCB "|.+---.|.-----------.|.---+.|",0xA,0xD
- DCB "|.|.......................|.|",0xA,0xD
- DCB "|.|.----.-----------.----.|.|",0xA,0xD
- DCB "|..........|MMMM|...........|",0xA,0xD
- DCB "|.|.----.-----------.----.|.|",0xA,0xD
- DCB "|.|...........<...........|.|",0xA,0xD
- DCB "|.+---.|.-----------.|.---+.|",0xA,0xD
- DCB "|o.....|.............|.....o|",0xA,0xD
- DCB "+---------------------------+",0xA,0xD,0
- >> move pacman
- movleft ;move left
- LDR r5,[r3] ;load the memmory value the position string points too
- LDRB r6,[r5] ;load the charecter position string points too
- SUB r5,r5,#1 ;subract to move the position over one
- LDRB r7,[r5] ;load the charecter in the next position
- BL collision_detect ;check if collision (next charecter passed in r7, op-code returned in r7) and score
- CMP r7,#1 ;check if code 1, do not move
- BEQ movpout
- CMP r7,#2 ;check if ghost
- ; BEQ ghost_collision
- ;falls through logic, move (code zero)
- MOV r7,#0x20
- STRB r7,[r5,#1] ;store space in previous possition
- STRB r6,[r5] ;store the charecter into new position
- STR r5,[r3] ;store the new position string into the position string
- MOV r7,#0
- STRB r7,[r0] ;update direction
- B movpout
- collision_detect
- ;Charecter to check is passed as r7
- ;return 0 to move
- ;return 1 too not more
- STMFD sp!,{r0,r3,r4,lr}
- LDR r2,=scoredot
- ;Check if wall, |,-,and +
- CMP r7,#0x7C ;check if |
- BEQ wall
- CMP r7,#0x2D ;check if -
- BEQ wall
- CMP r7,#0x2B ;check is +
- BEQ wall
- ;check if .
- CMP r7,#0x2E ;check if .
- BEQ score
- ;check if power dot
- CMP r7,#0x6F ;check if o
- BEQ power_dot
- ;check if ghost
- ; CMP r7,#0x4D ;check if M
- ; BEQ coll_ghost
- ; CMP r7,#0x57 ;Check if W
- ; BEQ coll_ghost
- ;check if pacman
- ; CMP r7,#0x3C ;check if <
- ; BEQ coll_pac
- ;falls through logig, valid place to move
- coll_mov
- MOV r7,#0
- SO LDRB r2,[r1] ; load the character of the reset board
- CMP r2, #0 ;test to see if the board has been completely refreshed
- BEQ collout ;if yes exit this subroutine
- STRB r2, [r0] ;update the actual game board
- ADD r0,r0,#1 ;increment both board addresses
- ADD r1,r1,#1
- B SO ;continue to output board
- wall ;wall is detected
- MOV r7,#1 ;return code 0, do not move
- collout
- LDMFD sp!,{r0,r3,r4,lr}
- BX LR
Add Comment
Please, Sign In to add comment