dma.a65 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. dma0:
  2. rep #$10 : .xl
  3. sep #$20 : .as
  4. lda dma_mode
  5. sta $4300
  6. lda dma_b_reg
  7. sta $4301
  8. lda dma_a_bank
  9. ldx dma_a_addr
  10. stx $4302
  11. sta $4304
  12. ldx dma_len
  13. stx $4305
  14. lda #$01
  15. sta $420b
  16. rts
  17. setup_hdma:
  18. sep #$20 : .as
  19. rep #$10 : .xl
  20. stz $420b
  21. stz $420c
  22. lda #$02 ;A to B; direct; 2x single reg
  23. sta $4320 ;we use ch. 2 for color data
  24. lda #$22 ;2122 = CG RAM
  25. sta $4321 ;dest: CG RAM
  26. lda #^hdma_pal
  27. ldy #!hdma_pal
  28. sty $4322
  29. sta $4324
  30. lda #$00 ;A to B; direct; 1x single reg
  31. sta $4310 ;ch. 1 for color address
  32. lda #$21 ;2121 = CG addr
  33. sta $4311 ;dest: CG Address
  34. lda #^hdma_cg_addr
  35. ldy #!hdma_cg_addr
  36. sty $4312
  37. sta $4314
  38. lda #$00 ;A to B; direct; 1x single reg
  39. sta $4330 ;ch. 3 for mode switch
  40. lda #$05 ;2105 = BG mode
  41. sta $4331
  42. lda #^hdma_mode
  43. ldy #!hdma_mode
  44. sty $4332
  45. sta $4334
  46. lda #$03 ;A to B; direct; 2x 2x single reg
  47. sta $4340 ;ch. 4 for scroll
  48. lda #$0d ;210d = BG1HOFS
  49. sta $4341
  50. lda #^hdma_scroll
  51. ldy #!hdma_scroll
  52. sty $4342
  53. sta $4344
  54. lda #$01 ;A to B; direct; 1x two reg
  55. sta $4350 ;ch. 5 for color math
  56. lda #$31 ;2131 + 2132 = math, color constant
  57. sta $4351
  58. lda #^hdma_math
  59. ldy #!hdma_math
  60. sty $4352
  61. sta $4354
  62. ; lda #$06
  63. ; sta $420c ;enable HDMA ch. 1+2
  64. lda #$81 ;VBlank NMI + Auto Joypad Read
  65. sta $4200 ;enable V-BLANK NMI
  66. rts