Guest User

Untitled

a guest
Jul 23rd, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. boardreset
  2. DCB "+---------------------------+",0xA,0xD
  3. DCB "|o.....|.............|.....o|",0xA,0xD
  4. DCB "|.+---.|.-----------.|.---+.|",0xA,0xD
  5. DCB "|.|.......................|.|",0xA,0xD
  6. DCB "|.|.----.-----------.----.|.|",0xA,0xD
  7. DCB "|..........|MMMM|...........|",0xA,0xD
  8. DCB "|.|.----.-----------.----.|.|",0xA,0xD
  9. DCB "|.|...........<...........|.|",0xA,0xD
  10. DCB "|.+---.|.-----------.|.---+.|",0xA,0xD
  11. DCB "|o.....|.............|.....o|",0xA,0xD
  12. DCB "+---------------------------+",0xA,0xD,0
  13.  
  14. >> move pacman
  15. movleft ;move left
  16. LDR r5,[r3] ;load the memmory value the position string points too
  17. LDRB r6,[r5] ;load the charecter position string points too
  18. SUB r5,r5,#1 ;subract to move the position over one
  19. LDRB r7,[r5] ;load the charecter in the next position
  20. BL collision_detect ;check if collision (next charecter passed in r7, op-code returned in r7) and score
  21. CMP r7,#1 ;check if code 1, do not move
  22. BEQ movpout
  23. CMP r7,#2 ;check if ghost
  24. ; BEQ ghost_collision
  25. ;falls through logic, move (code zero)
  26. MOV r7,#0x20
  27. STRB r7,[r5,#1] ;store space in previous possition
  28. STRB r6,[r5] ;store the charecter into new position
  29. STR r5,[r3] ;store the new position string into the position string
  30. MOV r7,#0
  31. STRB r7,[r0] ;update direction
  32. B movpout
  33.  
  34. collision_detect
  35. ;Charecter to check is passed as r7
  36. ;return 0 to move
  37. ;return 1 too not more
  38. STMFD sp!,{r0,r3,r4,lr}
  39. LDR r2,=scoredot
  40. ;Check if wall, |,-,and +
  41. CMP r7,#0x7C ;check if |
  42. BEQ wall
  43. CMP r7,#0x2D ;check if -
  44. BEQ wall
  45. CMP r7,#0x2B ;check is +
  46. BEQ wall
  47. ;check if .
  48. CMP r7,#0x2E ;check if .
  49. BEQ score
  50. ;check if power dot
  51. CMP r7,#0x6F ;check if o
  52. BEQ power_dot
  53. ;check if ghost
  54. ; CMP r7,#0x4D ;check if M
  55. ; BEQ coll_ghost
  56. ; CMP r7,#0x57 ;Check if W
  57. ; BEQ coll_ghost
  58. ;check if pacman
  59. ; CMP r7,#0x3C ;check if <
  60. ; BEQ coll_pac
  61. ;falls through logig, valid place to move
  62. coll_mov
  63. MOV r7,#0
  64.  
  65. SO LDRB r2,[r1] ; load the character of the reset board
  66. CMP r2, #0 ;test to see if the board has been completely refreshed
  67. BEQ collout ;if yes exit this subroutine
  68. STRB r2, [r0] ;update the actual game board
  69. ADD r0,r0,#1 ;increment both board addresses
  70. ADD r1,r1,#1
  71. B SO ;continue to output board
  72.  
  73. wall ;wall is detected
  74. MOV r7,#1 ;return code 0, do not move
  75. collout
  76. LDMFD sp!,{r0,r3,r4,lr}
  77. BX LR
Add Comment
Please, Sign In to add comment