12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- dma0:
- rep #$10 : .xl
- sep #$20 : .as
- lda dma_mode
- sta $4300
- lda dma_b_reg
- sta $4301
- lda dma_a_bank
- ldx dma_a_addr
- stx $4302
- sta $4304
- ldx dma_len
- stx $4305
- lda #$01
- sta $420b
- rts
- setup_hdma:
- sep #$20 : .as
- rep #$10 : .xl
- stz $420b
- stz $420c
- lda #$02 ;A to B; direct; 2x single reg
- sta $4320 ;we use ch. 2 for color data
- lda #$22 ;2122 = CG RAM
- sta $4321 ;dest: CG RAM
- lda #^hdma_pal
- ldy #!hdma_pal
- sty $4322
- sta $4324
- lda #$00 ;A to B; direct; 1x single reg
- sta $4310 ;ch. 1 for color address
- lda #$21 ;2121 = CG addr
- sta $4311 ;dest: CG Address
- lda #^hdma_cg_addr
- ldy #!hdma_cg_addr
- sty $4312
- sta $4314
- lda #$00 ;A to B; direct; 1x single reg
- sta $4330 ;ch. 3 for mode switch
- lda #$05 ;2105 = BG mode
- sta $4331
- lda #^hdma_mode
- ldy #!hdma_mode
- sty $4332
- sta $4334
- lda #$03 ;A to B; direct; 2x 2x single reg
- sta $4340 ;ch. 4 for scroll
- lda #$0d ;210d = BG1HOFS
- sta $4341
- lda #^hdma_scroll
- ldy #!hdma_scroll
- sty $4342
- sta $4344
- lda #$01 ;A to B; direct; 1x two reg
- sta $4350 ;ch. 5 for color math
- lda #$31 ;2131 + 2132 = math, color constant
- sta $4351
- lda #^hdma_math
- ldy #!hdma_math
- sty $4352
- sta $4354
- ; lda #$06
- ; sta $420c ;enable HDMA ch. 1+2
- lda #$81 ;VBlank NMI + Auto Joypad Read
- sta $4200 ;enable V-BLANK NMI
- rts
|