Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. INIT_Direction EQU 'L'
  2.  
  3. AREA Lauflicht, CODE, READONLY, CODEALIGN
  4.  
  5. IMPORT max6951_init
  6. IMPORT max6951_putRawWord
  7. IMPORT delay
  8.  
  9.  
  10. main PROC ; Main Funktion
  11. global main
  12.  
  13. ldr r5, =max6951_init
  14. blx r5
  15.  
  16. ldr r5, =RunLight
  17. ldr r6, =0x0001
  18. str r6, [r5]
  19.  
  20. ldr r5, =RunDir
  21. ldr r6, =INIT_Direction
  22. strb r6, [r5]
  23.  
  24. endless
  25.  
  26. ;die aktuelle Richtung in die das Lauflicht läuft abfragen
  27. ldr r6, =RunDir
  28. ldrb r0, [r6]
  29. cmp r0, #'L'
  30. beq shiftLeft ;falls Richtung Links
  31. b shiftRight ;falls Richtung nicht Links
  32.  
  33.  
  34. shiftLeft
  35. ldr r5, =RunLight
  36. ldr r0, [r5]
  37. cmp r0, #0x8000
  38. beq ChangeDirToRight
  39.  
  40. lsr r0, #1
  41. str r0, [r5]
  42. b wait
  43.  
  44.  
  45. shiftRight
  46. ldr r5, =RunLight
  47. ldr r0, [r5]
  48. cmp r0, #0x0001
  49. beq ChangeDirToLeft
  50.  
  51. lsr r0, #1
  52. str r0, [r5]
  53. b wait
  54.  
  55.  
  56. ChangeDirToRight
  57. mov r0, #'R'
  58. strb r0, [r6]
  59. b shiftRight
  60.  
  61.  
  62.  
  63. ChangeDirToLeft
  64. mov r0, #'L'
  65. strb r0, [r6]
  66. b shiftLeft
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. wait
  74. ldr r5, =max6951_putRawWord
  75. blx r5
  76.  
  77. mov32 r0, #0xf8000
  78. ldr r5, =delay
  79. blx r5
  80.  
  81. b endless
  82.  
  83. endp
  84.  
  85. align
  86.  
  87.  
  88.  
  89. AREA Variables, DATA, READWRITE, ALIGN=2 ;Variablen
  90.  
  91. RunLight DCD 0x0000
  92. RunDir DCB 'L'
  93.  
  94.  
  95.  
  96. ALIGN
  97.  
  98. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement