lab_3-3.asm 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. Code:
  2. XDEF Entry
  3. XREF __SEG_END_SSTACK
  4. ; variable/data w
  5. MY_EXTENDED_RAM: SECTION
  6. ARR dc.b $0A,$12,$14,$0C,$0
  7. port_p equ $258
  8. ddrp equ $25A
  9. MY_CONSTANT_ROM: SECTION ; constant/definition section
  10. ; code section
  11. MyCode: SECTION
  12. main:
  13. _Startup:
  14. Entry:
  15. ldaa #$1e ;load the proper direction modes to acc. A
  16. staa ddrp ;push the direction modes into port P DDR
  17. loop: ldx #ARR ;load the start of sequence of bytes to spin the motor into
  18. ;register X
  19. loop1:
  20. ldaa 1,x+ ;load into A the first value of the array
  21. cmpa #0 ;check that we are not at the end of the array
  22. beq loop ;if we are at the end of the array, reload the first array
  23. ;value
  24. staa port_p ;push the value in accumulator A to port P, spinning the ;motor one quarter turn
  25. ldy #30000 ;load into register Y the amount by which we will delay ;loop execution
  26. delay1:
  27. dey ;decrement our delay value by 1
  28. bne delay1 ;if we have not decreased our delay value to zero, continue
  29. ;decrementing our array value
  30. bra loop1 ;repeat the code which turns the motor