Advertisement
sci4me

Untitled

Jul 20th, 2020
3,830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; This is what I have _right now_. Here's what shows up in the serial port:
  2. ; Note: that $10BF (_eptr) is what used to be $109F; it's different because the code is different.
  3. ; 10BF
  4. ; FC
  5. ; 01F0: 00
  6. ; 01F1: 00
  7. ; 01F2: 00
  8. ; 01F3: 00
  9. ; 01F4: 00
  10. ; 01F5: 0F
  11. ; 01F6: 06
  12. ; 01F7: 4E
  13. ; 01F8: 10
  14. ; 01F8: 10
  15. ; 01F9: F9
  16. ; 01FA: FC
  17. ; 01FB: 66
  18. ; 01FC: 12
  19. ; 01FD: 31
  20. ; 01FE: C0
  21. ; 01FF: 10
  22. ; 0200: 00
  23. ; 0201: 00
  24. ; 0202: 00
  25. ; 0203: 00
  26. ; 0204: 00
  27. ; 0205: 00
  28. ; FC
  29.  
  30. .import __RAM_START__
  31. .segment "EXEHDR"
  32. .addr __RAM_START__
  33. .addr main
  34.  
  35.  
  36. .include "io.inc"
  37. .include "macros.inc"
  38.  
  39.  
  40. .import leds_init
  41. .import leds_set_value
  42. .import acia_init
  43. .import acia_puts
  44. .import acia_putc
  45. .import acia_put_hex_byte
  46. .importzp acia_puts_ptr
  47.  
  48.  
  49. NMIVEC = $00
  50. IRQVEC = $02
  51.  
  52.  
  53. .zeropage
  54. leds_value:     .res 1
  55. t1:             .res 1
  56. t2:             .res 1
  57. ptr1:           .res 2
  58.  
  59.  
  60. .macro rti_jmp addr
  61.     lda #>addr
  62.     pha
  63.     lda #<addr
  64.     pha
  65.     php
  66.     rti
  67. .endmacro
  68.  
  69. .macro f
  70.     jsr acia_put_hex_byte
  71.     lda #10
  72.     jsr acia_putc  
  73. .endmacro
  74.  
  75. .macro f16 addr
  76.     lda #>addr
  77.     jsr acia_put_hex_byte
  78.     lda #<addr
  79.     jsr acia_put_hex_byte
  80.     lda #':'
  81.     jsr acia_putc
  82.     lda #' '
  83.     jsr acia_putc
  84.     lda addr
  85.     jsr acia_put_hex_byte
  86.     lda #10
  87.     jsr acia_putc
  88. .endmacro
  89.  
  90.  
  91. .code
  92. ;.proc main
  93. main:
  94.     sei
  95.     cld
  96.     ldx #$FF
  97.     txs
  98.     ld16 IRQVEC, isr
  99.     cli
  100.  
  101.  
  102.     jsr leds_init
  103.     jsr acia_init
  104.  
  105.  
  106. :   lda SWITCH1
  107.     and #1
  108.     bne :-
  109.  
  110.  
  111.     ld16 ptr1, $0100
  112.     ldx #0
  113.     ldy #0
  114. :   lda #0
  115.     sta (ptr1)
  116.     inc16 ptr1
  117.     iny
  118.     bne :-
  119.     inx
  120.     cpx #3
  121.     bne :-
  122.  
  123.  
  124.     lda #>_eptr
  125.     jsr acia_put_hex_byte
  126.     lda #<_eptr
  127.     jsr acia_put_hex_byte
  128.     lda #10
  129.     jsr acia_putc
  130.  
  131.  
  132.     brk
  133.     _eptr:
  134.  
  135.  
  136. loop:
  137.     lda leds_value
  138.     jsr leds_set_value
  139.  
  140.     inc leds_value
  141.  
  142.     ldx #$FF
  143.     ldy #$FF
  144.     jsr delay
  145.  
  146.     rti_jmp loop
  147. ;.endproc
  148.  
  149.  
  150. .proc isr
  151.     tsx
  152.     txa
  153.     f
  154.  
  155.     f16 $01F0
  156.     f16 $01F1
  157.     f16 $01F2
  158.     f16 $01F3
  159.     f16 $01F4
  160.     f16 $01F5
  161.     f16 $01F6  
  162.     f16 $01F7
  163.     f16 $01F8
  164.     f16 $01F8
  165.     f16 $01F9
  166.     f16 $01FA
  167.     f16 $01FB
  168.     f16 $01FC
  169.     f16 $01FD
  170.     f16 $01FE
  171.     f16 $01FF
  172.     f16 $0200
  173.     f16 $0201
  174.     f16 $0202
  175.     f16 $0203
  176.     f16 $0204
  177.     f16 $0205
  178.  
  179.     tsx
  180.     txa
  181.     f
  182.  
  183.  
  184.     cli
  185.     jmp _eptr
  186.  
  187. :   nop
  188.     bra :-
  189.  
  190.     rti
  191. .endproc
  192.  
  193.  
  194. .proc delay
  195. :   dex
  196.     bne :- 
  197.     dey
  198.     bne :-
  199.     rts
  200. .endproc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement