-
Notifications
You must be signed in to change notification settings - Fork 2
/
registers.asm
1248 lines (1179 loc) · 29.8 KB
/
registers.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;===================================================================================================
; KEY
;===================================================================================================
; w - writeable
; r - readable
; 1 - single write
; 2 - double write
; for double write registers, the first write (low byte) is listed first
; f - accessible during fblank
; v - accessible during vblank
; h - accessible during hblank
; a - accessible anytime
; . - unused bit (open bus)
;===================================================================================================
;===================================================================================================
; PPU REGISTERS
;===================================================================================================
;===================================================================================================
; SCREEN SETTINGS
; $2100 w1 fvha
; f... bbbb
; f - force blank (0: disabled | 1: enabled)
; b - screen brightness 0–F
INIDISP = $002100
; OAM CHARACTER ADDRESSES AND OBJECT SIZE
; $2101 w1 fv
; sssnnbbb
; s - object sizes
; sss small large
; 000 8x8 16x16
; 001 8x8 32x32
; 010 8x8 64x64
; 011 16x16 32x32
; 100 16x16 64x64
; 101 32x32 64x64
; 110 16x32 32x64
; 111 16x32 32x32
;
; n - space between object namespaces, $1000 word steps
; b - obj tile address - $2000 word steps
OBSEL = $002101
; OAM ADDRESS ACCESS
; $2102 w1 fv
; $2103 w1 fv
; OAMADDH OAMADDL
; p......a aaaaaaaa
; a - OAM address
; p - object priority cycle (0: OBJ0 highest priority | 1: priority cycles)
OAMADDR = $002102
OAMADDL = $002102
OAMADDH = $002103
; OAM DATA WRITE
; $2104 w1 fv
; xxxxxxxx
; x - OAM data
OAMDATA = $002104
; BACKGROUND MODE AND CHARACTER SIZE
; $2105 w1 fvh
; dcba pmmm
; a - tile size for BG1 (0: 8x8 | 1: 16x16)
; b - tile size for BG2 (0: 8x8 | 1: 16x16)
; c - tile size for BG3 (0: 8x8 | 1: 16x16)
; d - tile size for BG4 (0: 8x8 | 1: 16x16)
; p - BG3 priority in mode 1 (0: normal | 1: highest)
; m - BG mode (0–7)
; BG1 BG2 BG3 BG4 Features
; 00 - 2bpp 2bpp 2bpp 2bpp None
; 01 - 4bpp 4bpp 2bpp ---- None
; 02 - 4bpp 4bpp offs ---- Offset per tile
; 03 - 8bpp 4bpp ---- ---- None
; 04 - 8bpp 2bpp offs ---- Offset per tile
; 05 - 4bpp 2bpp ---- ---- Hires
; 06 - 4bpp ---- offs ---- Hires / Offset per tile
; 07 - 8bpp EXT ---- ---- Affine transformation
BGMODE = $002105
; MOSAIC SIZE AND DESIGNATION
; $2106 w1 fvh
; ssss dcba
; a - mosaic to BG1 (0: disabled | 1: enabled)
; b - mosaic to BG2 (0: disabled | 1: enabled)
; c - mosaic to BG3 (0: disabled | 1: enabled)
; d - mosaic to BG4 (0: disabled | 1: enabled)
; s - pixelation size
MOSAIC = $002106
; BACKGROUND TILEMAP ADDRESS AND TILEMAP SIZE
; $2107 w1 fv
; $2108 w1 fv
; $2109 w1 fv
; $210A w1 fv
; aaaa aavh
; a - tilemap address in $400 word steps
; v - tilemap height (0: 32 tiles | 1: 64 tiles)
; h - tilemap width (0: 32 tiles | 1: 64 tiles)
BG1SC = $002107
BG2SC = $002108
BG3SC = $002109
BG4SC = $00210A
; BACKGROUND CHARACTER ADDRESS
; $210B w1 fv
; $210C w1 fv
; BG12NBA BG34NBA
; bbbbaaaa ddddcccc
; a - base address for BG1 tiles in $1000 word steps
; b - base address for BG2 tiles in $1000 word steps
; c - base address for BG3 tiles in $1000 word steps
; d - base address for BG4 tiles in $1000 word steps
; Just look at the nibbles
; 0 0000 $0000
; 1 0001 $2000
; 2 0010 $4000
; etc...
BG12NBA = $00210B
BG34NBA = $00210C
; BACKGROUND HORIZONTAL AND VERTICAL SCROLL
; $210D w2 fvh
; $210E w2 fvh
; $210F w2 fvh
; $2110 w2 fvh
; $2111 w2 fvh
; $2112 w2 fvh
; $2113 w2 fvh
; $2114 w2 fvh
;
; modes 0–6: oooooooo ......oo
; o - bg offset
;
; mode 7: mmmmmmmm ...mmmmm
; m - mode 7 bg offset
BG1HOFS = $00210D
BG1VOFS = $00210E
BG2HOFS = $00210F
BG2VOFS = $002110
BG3HOFS = $002111
BG3VOFS = $002112
BG4HOFS = $002113
BG4VOFS = $002114
M7HOFS = $00210D
M7VOFS = $00210E
; VRAM ADDRESS INCREMENT AND REMAPPING
; $2115 w1 fv
; a... mmii
; a - increment $2116[2] after (0: $2118 | 1 : $2119)
; m - remap addressing
; 00 = aaaaaaaabbbccccc => aaaaaaaabbbccccc (no remapping)
; 01 = aaaaaaaabbbccccc => aaaaaaaacccccbbb
; 10 = aaaaaaabbbcccccc => aaaaaaaccccccbbb
; 11 = aaaaaabbbccccccc => aaaaaacccccccbbb
;
; i - address increment
; 00 - increment by 1
; 01 - increment by 32
; 10 - increment by 128
; 11 - increment by 128
VMAIN = $002115
; VRAM ADDRESS ACCESS
; $2116 w1 fv
; $2117 w1 fv
; VMADDL VMADDH
; aaaaaaaa aaaaaaaa
; a - VRAM address
VMADDR = $002116
VMADDL = $002116
VMADDH = $002117
; VRAM WRITE DATA
; $2118 w1 fv
; $2119 w1 fv
; VMDATAL VMDATAH
; xxxxxxxx xxxxxxxx
; x - VRAM data
VMDATA = $002118
VMDATAL = $002118
VMDATAH = $002119
; MODE 7 SETTINGS
; $211A w1 fv
; we.. ..vh
; w - tilemap wrapping (0: wrap | 1: no wrap)
; e - empty space filler w/ no wrap (0: transparent | 1: tile 0)
; v - mirror tilemap vertically
; h - mirror tilemap horizontally
M7SEL = $00211A
; MODE 7 TRANSFORMATION PARAMETERS
; $211B w2 fvh
; $211C w2 fvh
; $211D w2 fvh
; $211E w2 fvh
; aaaaaaaa aaaaaaaa
; a - mode 7 parameter value
M7A = $00211B
M7B = $00211C
M7C = $00211D
M7D = $00211E
; #PPUMATH
; SIGNED MULTIPLICATION ARGUMENTS
; $211B w2 fvha
; $211C w1 fvha
; Can also be used for signed multiplication in mode 0–6
; apparently 0 delay with these
;
; PPUMULT16: llllllll hhhhhhhh
; l - low byte of 16-bit multiplicand
; h - high byte of 16-bit multiplicand
;
; PPUMULT8: mmmmmmmm
; m - 8-bit multiplicand
PPUMULT16 = $00211B
PPUMULT8 = $00211C
; MODE 7 CENTER OF TRANSFORMATION COORDINATES
; $211F w2 fvh
; $2120 w2 fvh
; oooooooo ...ooooo
; o - mode 7 axis center
M7X = $00211F
M7Y = $002120
; CGRAM ADDRESS ACCESS
; $2121 w1 fvh
; aaaaaaaa
; a - CGRAM address indexing words
CGADD = $002121
; CGRAM WRITE DATA
; $2122 w2 fvh
; gggrrrrr .bbbbbgg
; r - red component of color
; g - green component of color
; b - blue component of color
CGDATA = $002122
; WINDOW MASK SETTINGS
; $2123 w1 fvh
; $2124 w1 fvh
; $2125 w1 fvh
; W12SEL W34SEL WOBJSEL
; dmckbjai dmckbjai dmckbjai
; i - invert window 1 on BG1/BG3/OBJ (0: normal logic | 1: invert logic)
; a - enable window 1 on BG1/BG3/OBJ (0: disabled | 1: enabled)
;
; j - invert window 2 on BG1/BG3/OBJ (0: normal logic | 1: invert logic)
; b - enable window 2 on BG1/BG3/OBJ (0: disabled | 1: enabled)
;
; k - invert window 1 on BG2/BG4/COL (0: normal logic | 1: invert logic)
; c - enable window 1 on BG2/BG4/COL (0: disabled | 1: enabled)
;
; m - invert window 2 on BG2/BG4/COL (0: normal logic | 1: invert logic)
; d - enable window 2 on BG2/BG4/COL (0: disabled | 1: enabled)
W12SEL = $002123
W34SEL = $002124
WOBJSEL = $002125
; WINDOW POSITION DESIGNATION
; $2126 w1 fvh
; $2127 w1 fvh
; $2128 w1 fvh
; $2129 w1 fvh
;
; WH0 WH1
; llllllll rrrrrrrr
; l - window 1 left edge
; r - window 1 right edge
;
; WH2 WH3
; wwwwwwww eeeeeeee
; w - window 2 left edge
; e - window 2 right edge
WH0 = $002126
WH1 = $002127
WH2 = $002128
WH3 = $002129
WINDOW1L = $002126
WINDOW1R = $002127
WINDOW2L = $002128
WINDOW2R = $002129
; WINDOW MASK LOGIC
; $212A w1 fvh
; $212B w1 fvh
; WBGLOG WOBJLOG
; ddccbbaa ....ccoo
; a - window mask logic for BG1
; b - window mask logic for BG2
; c - window mask logic for BG3
; d - window mask logic for BG4
; o - window mask logic for OBJ
; c - window mask logic for COL
;
; all window masks share the same logic
; 00 - W1 OR W2
; 01 - W1 AND W2
; 10 - W1 XOR W2
; 11 - W1 XNOR W2
WBGLOG = $00212A
WOBJLOG = $00212B
; MAIN AND SUB SCREEN DESIGNATION
; $212C w1 fvh
; $212D w1 fvh
; ...odcba
; a - BG1 (0: disabled | 1: enabled on main/subscreen)
; b - BG2 (0: disabled | 1: enabled on main/subscreen)
; c - BG3 (0: disabled | 1: enabled on main/subscreen)
; d - BG4 (0: disabled | 1: enabled on main/subscreen)
; o - OBJ (0: disabled | 1: enabled on main/subscreen)
TM = $00212C
TS = $00212D
; MAIN AND SUB SCREEN WINDOW MASK DESIGNATION
; $212E w1 fvh
; $212F w1 fvh
; ...odcba
; a - window mask for BG1 (0: disabled | 1: enabled)
; b - window mask for BG2 (0: disabled | 1: enabled)
; c - window mask for BG3 (0: disabled | 1: enabled)
; d - window mask for BG4 (0: disabled | 1: enabled)
; o - window mask for OBJ (0: disabled | 1: enabled)
TMW = $00212E
TSW = $00212F
; COLOR MATH SETTINGS
; $2130 w1 fvh
; bbmm ..sd
; b - clip to black (same logic as m)
; m - prevent color math
; 00 - never
; 01 - outside COL window
; 10 - inside COL window
; 11 - always
;
; s - color source (0: fixed color | 1: subscreen)
; d - direct color mode (0: enabled | 1: disabled)
CGWSEL = $002130
; COLOR MATH DESIGNATION AND OPERATION
; $2131 w1 fvh
; shzo dcba
; s - color operation (0: addition | 1: subtraction)
; h - half color math (0: nothing | 1: final result divided by 2)
; z - color math on CGRAM0 (0: disabled | 1: enabled)
; a - color math on BG1 (0: disabled | 1: enabled)
; b - color math on BG2 (0: disabled | 1: enabled)
; c - color math on BG3 (0: disabled | 1: enabled)
; d - color math on BG4 (0: disabled | 1: enabled)
; o - color math on OBJ (0: disabled | 1: enabled)
CGADSUB = $002131
; COLOR MATH FIXED COLOR DATA
; $2132 w1 fvh
; bgrccccc
; r - red component of fixed color (0: unchanged | 1: change w/ write)
; g - green component of fixed color (0: unchanged | 1: change w/ write)
; b - blue component of fixed color (0: unchanged | 1: change w/ write)
; c - fixed color component value
COLDATA = $002132
; SCREEN INTERLACE AND SYNC SETTINGS
; $2133 w1 fvh
; se.. pvoi
; s - external sync (0: normal | 1: super impose)
; e - mode 7 EXTBG (0: disabled | 1: enabled)
; p - pseudo h512 (0: disabled | 1: enabled - shifts subscreen half dot left)
; v - enable overscan (0: 224 scanlines | 1: 239 scanlines)
; o - object interlace (0: disabled | 1: enabled)
; i - screen interlace (0: disabled | 1: enabled - interlace to source)
SETINI = $002133
; MULTIPLICATION RESULT
; $2134 r1 fvh
; $2135 r1 fvh
; $2136 r1 fvh
; MPYL MPYM MPYH
; llllllll mmmmmmmm hhhhhhhh
; l - low byte of product
; m - middle byte of product
; h - high byte of product
; see #PPUMATH
MPYL = $002134
MPYM = $002135
MPYH = $002136
; SOFTWARE LATCH FOR h/V COUNTER
; $2137 r1 fvha
; ........
; Contains no data; just a latch to update OPHCT and OPVCT
SLVH = $002137
; OAM READ DATA
; $2138 r1 fv
; xxxxxxxx
; x - OAM data read
OAMDATAREAD = $002138
; VRAM READ DATA
; $2139 r1 fv
; $213A r1 fv
; VMDATALR VMDATAHR
; llllllll hhhhhhhh
; l - low byte of VRAM data read
; h - high byte of VRAM data read
VMDATALREAD = $002139
VMDATAHREAD = $00213A
; CHRAM READ DATA
; $213B r2 fv
; gggrrrrr .bbbbbgg
; r - red component of color
; g - green component of color
; b - blue component of color
CGDATAREAD = $00213B
; HORIZONTAL COUNTER FROM LAST LATCH
; $213C r2 fvha
; hhhhhhhh .......h
; h - horizontal dot position
; 0 to 339
OPHCT = $00213C
; VERTICAL COUNTER FROM LAST LATCH
; $213D r2 fvha
; vvvvvvvv .......v
; v - vertical scanline position
; 0 to 261
OPVCT = $00213D
; PPU STATUS AND PPU1 VERSION NUMBER
; $213E r1 fvha
; trm. vvvv
; t - OBJ time overflow (0: fine | 1: too many pixels on scanline - 8*34=292)
; r - OBJ range overflow (0: fine | 1: too many objects on scanline - 32)
; m - mode (0: master | 1: slave)
; v - PPU1 5C77 version
STAT77 = $00213E
; PPU STATUS AND PPU2 VERSION NUMBER
; $213F r1 fvha
; il.p vvvv
; i - current interlace field (0: odd | 1: even)
; l - external latch (0: no data | 1: new data)
; p - region (0: NTSC 60hz | 1: PAL 50hz)
; v - PPU2 5C78 version
STAT78 = $00213F
; AUDIO PROCESSING UNIT COMMUNICATION PORTS
; $2140 rw1 fvha
; $2141 rw1 fvha
; $2142 rw1 fvha
; $2143 rw1 fvha
; aaaaaaaa
; a - APU data
APUIO = $002140
APUIO0 = $002140
APUIO1 = $002141
APUIO2 = $002142
APUIO3 = $002143
; APUIO is mirrored up to $217F
; WRAM DATA READ/WRITE
; $2180 rw1 fvha
; xxxxxxxx
; x - WRAM data
WMDATA = $002180
; WRAM ADDRESS ACCESS
; $2181 rw1 fvha
; $2182 rw1 fvha
; $2183 rw1 fvha
; WMADDL WMADDH WMADDB
; llllllll hhhhhhhh .......b
; l - low byte of WRAM address
; h - high byte of WRAM address
; b - bank of WRAM address (0: bank7E | 1: bank7F)
WMADDR = $002181
WMADDL = $002181
WMADDH = $002182
WMADDB = $002183
;===================================================================================================
;===================================================================================================
; CPU REGISTERS
;===================================================================================================
;===================================================================================================
; JOYPAD STROBE AND COMMUNICATION PORT
; $4016 rw1 fvha
; write: .......s
; s - strobe joypads
;
; read: ......ca
; a - port 1 data 1
; c - port 1 data 2
JOYPAD = $004016
JOYPADA = $004016
; $4017 r1 fvha
; ......db
; d - port 2 data 1
; b - port 2 data 2
JOYPADB = $004017
;---------------------------------------------------------------------------------------------------
; INTERRUPT AND AUTO JOYPAD READ ENABLE
; $4200 w1 fvha
; n.vh ...j
; n - NMI enable (0: disabled | 1: enabled)
; vh - IRQ trigger time
; 00 - No IRQ
; 0h - IRQ triggers when HTIME is hit
; v0 - IRQ triggers when VTIME is hit
; vh - IRQ triggers when both HTIME and VTIME are hit
; j - auto joypad read (0: disabled | 1: enabled)
NMITIMEN = $004200
; PROGRAMMABLE I/O PORT (WRITE)
; $4201 w1 fvha
; ab.. ....
; a - controller port 2 pin 6 (0: no ppu latching | 1: ppu can be latched)
; b - controller port 1 pin 6
WRIO = $004201
; MULTIPLIER AND MULTIPLICAND
; $4202 w1 fvha
; $4203 w1 fvha
; WRMPYA WRMPYB
; aaaaaaaa bbbbbbbb
; a - unsigned 8-bit multiplicand A
; b - unsigned 8-bit multiplicand B
; need to wait 8 cycles before reading
; cycles taken to read the initial opcode count
WRMPYA = $004202
WRMPYB = $004203
; DIVISOR AND DIVIDEND
; $4204 w1 fvha
; $4205 w1 fvha
; $4206 w1 fvha
; WRDIVL WRDIVH
; WRDIV: llllllll hhhhhhhh
; l - low byte of unsigned 16-bit dividend
; h - high byte of unsigned 16-bit dividend
; WRDIVB: dddddddd
; d - unsigned 8-bit divisor
; need to wait 16 cycles before reading
; cycles taken to read initial opcode count
; fewer cycles needed if quotient is known to be small?
WRDIVL = $004204
WRDIVH = $004205
WRDIVB = $004206
; H-COUNT TIMER SETTINGS
; $4207 w1 fvha
; $4208 w1 fvha
; hhhhhhhh .......h
; h - IRQ horizontal trigger
HTIME = $004207
HTIMEL = $004207
HTIMEH = $004208
; V-COUNT TIMER SETTINGS
; $4209 w1 fvha
; $420A w1 fvha
; vvvvvvvv .......v
; v - IRQ vertical trigger
VTIME = $004209
VTIMEL = $004209
VTIMEH = $00420A
; DIRECT MEMORY ACCESS CHANNEL DESIGNATION
; $420B w1 fvha
; hgfedcba
; a - DMA channel 0 (0: disabled | 1: enabled)
; b - DMA channel 1 (0: disabled | 1: enabled)
; c - DMA channel 2 (0: disabled | 1: enabled)
; d - DMA channel 3 (0: disabled | 1: enabled)
; e - DMA channel 4 (0: disabled | 1: enabled)
; f - DMA channel 5 (0: disabled | 1: enabled)
; g - DMA channel 6 (0: disabled | 1: enabled)
; h - DMA channel 7 (0: disabled | 1: enabled)
MDMAEN = $00420B
; H-BLANK DIRECT MEMORY ACCESS CHANNEL DESIGNATION
; $420C w1 fvha
; hgfedcba
; a - HDMA channel 0 (0: disabled | 1: enabled)
; b - HDMA channel 1 (0: disabled | 1: enabled)
; c - HDMA channel 2 (0: disabled | 1: enabled)
; d - HDMA channel 3 (0: disabled | 1: enabled)
; e - HDMA channel 4 (0: disabled | 1: enabled)
; f - HDMA channel 5 (0: disabled | 1: enabled)
; g - HDMA channel 6 (0: disabled | 1: enabled)
; h - HDMA channel 7 (0: disabled | 1: enabled)
HDMAEN = $00420C
; ACCESS CYCLE DESIGNATION
; $420D w1 fvha
; .......f
; f - fast rom (0: disabled | 1: enabled)
; Works with SA1, but pauses the SA1.
MEMSEL = $00420D
; V-BLANK NMI FLAG AND SNES CPU VERSION NUMBER
; $4210 r1 fvha
; n... vvvv
; n - vblank NMI trigger (0: not in vblank | 1: in vblank)
; reading $4210 will clear this flag
; read this during NMI for safety
; messing with NMI enable may cause unwanted triggers
; v - Ricoh5A22 version
RDNMI = $004210
; H/V TIMER IRQ FLAG
; $4211 r1 fvha
; i... ....
; i - IRQ trigger (0: no request | 1: IRQ requested)
; reading $4211 will clear this flag
; read this during IRQ or else
; IRQ will trigger immediately when the current one ends
TIMEUP = $004211
; H/V BLANK FLAG AND AUTO JOYPAD READ STATUS
; $4212 r1 fvha
; vh.. ...j
; v - vertical blanking period (0: not vblank | 1: vblank)
; h - horizontal blanking period (0: not hblank | 1: hblank)
; blanking flags are toggled even during fblank
; and irrespective of interrupts
;
; j - auto joypad read flag (0: fine | 1: busy with ajpr)
HVBJOY = $004212
; PROGRAMMABLE I/O PORT (READ)
; $4213 r1 fvha
; ab......
; a - pin 6 of controller port 2
; b - pin 6 of controller port 1
RDIO = $004213
; QUOTIENT OF DIVISION
; $4214 r1 fvha
; $4215 r1 fvha
; RDDIVL RDDIVH
; llllllll hhhhhhhh
; l - low byte of quotient
; h - high byte of quotient
RDDIV = $004214
RDDIVL = $004214
RDDIVH = $004215
; PRODUCT OF MULTIPLICATION AND REMAINDER OF DIVISION
; $4216 r1 fvha
; $4217 r1 fvha
; RDMPYL RDMPYH
; llllllll hhhhhhhh
; l - low byte of result
; h - high byte of result
;
; for multiplication, this contains the product
; for division, this contains the remainder
RDMPY = $004216
RDMPYL = $004216
RDMPYH = $004217
; CONTROLLER DATA
; $4218 r1 fvha
; $4219 r1 fvha
; $421A r1 fvha
; $421B r1 fvha
; $421C r1 fvha
; $421D r1 fvha
; $421E r1 fvha
; $421F r1 fvha
;
; JOY1L JOY1H
; JOY1DATA1: AXLRvvvv BYsSudlr
;
; JOY2L JOY2H
; JOY2DATA1: AXLRvvvv BYsSudlr
;
; JOY3L JOY3H
; JOY1DATA2: AXLRvvvv BYsSudlr
;
; JOY4L JOY4H
; JOY2DATA2: AXLRvvvv BYsSudlr
;
; A - A face button (0: relaxed | 1: pressed)
; B - B face button (0: relaxed | 1: pressed)
; X - X face button (0: relaxed | 1: pressed)
; Y - Y face button (0: relaxed | 1: pressed)
; u - UP dpad button (0: relaxed | 1: pressed)
; d - DOWN dpad button (0: relaxed | 1: pressed)
; l - LEFT pad button (0: relaxed | 1: pressed)
; r - RIGHT dpad button (0: relaxed | 1: pressed)
; S - START button (0: relaxed | 1: pressed)
; s - SELECT button (0: relaxed | 1: pressed)
; L - LEFT SHOULDER button (0: relaxed | 1: pressed)
; R - RIGHT SHOULDER button (0: relaxed | 1: pressed)
;
; v - controller signature
; only v bits are put in data
; further data can be read for further controller information
;
; vvvv zzzzzzzz
; 0000 00000000 - No controller connected
; 0000 11111111 - Standard joypad
; 0001 ........ - SNES mouse
; 0011 ........ - SFC modem
; 0100 ........ - NTT data controller (has cool numpad)
; 1101 ........ - Voice-Kun
; 1110 xxxxxxxx - Third-party device
; 1111 ........ - Super Scope
JOY1L = $004218
JOY1H = $004219
JOY2L = $00421A
JOY2H = $00421B
JOY3L = $00421C
JOY3H = $00421D
JOY4L = $00421E
JOY4H = $00421F
;--------------------------------
JOY1DATA1L = $004218
JOY1DATA1H = $004219
JOY2DATA1L = $00421A
JOY2DATA1H = $00421B
JOY1DATA2L = $00421C
JOY1DATA2H = $00421D
JOY2DATA2L = $00421E
JOY2DATA2H = $00421F
;===================================================================================================
;===================================================================================================
; DMA REGISTERS
;===================================================================================================
;===================================================================================================
; DMA TRANSFER PARAMETERS
; $4300 rw1 fvha
; $4310 rw1 fvha
; $4320 rw1 fvha
; $4330 rw1 fvha
; $4340 rw1 fvha
; $4350 rw1 fvha
; $4360 rw1 fvha
; $4370 rw1 fvha
;
; dh.i fmmm
; d - transfer direction (0: A bus to B bus | 1: B bus to A bus)
; h - HDMA addressing (0: direct table | 1: indirect table)
; i - address direction (0: increment address | 1: decrement address)
; f - fixed transfer
; m - transfer mode
; 000 - 1 register, write once r+0
; 001 - 2 register, write once r+0, r+1
; 010 - 1 register, write twice r+0, r+0
; 011 - 2 registers, write twice r+0, r+0, r+1, r+1
; 100 - 4 registers, write once r+0, r+1, r+2, r+3
; 101 - 2 registers, write twice, alt r+0, r+1, r+0, r+1
; 110 - 1 register, write twice r+0, r+0
; 111 - 2 registers, write twice r+0, r+0, r+1, r+1
;
; for write twice modes, the address is still incremented
; assuming a non-fixed transfer
; for fixed transfers, the same address is always used
; even for write twice modes
DMAPX = $004300
DMAP0 = $004300
DMAP1 = $004310
DMAP2 = $004320
DMAP3 = $004330
DMAP4 = $004340
DMAP5 = $004350
DMAP6 = $004360
DMAP7 = $004370
;--------------------------------
DMAXMODE = $004300
DMA0MODE = $004300
DMA1MODE = $004310
DMA2MODE = $004320
DMA3MODE = $004330
DMA4MODE = $004340
DMA5MODE = $004350
DMA6MODE = $004360
DMA7MODE = $004370
;--------------------------------
HDMAXMODE = $004300
HDMA0MODE = $004300
HDMA1MODE = $004310
HDMA2MODE = $004320
HDMA3MODE = $004330
HDMA4MODE = $004340
HDMA5MODE = $004350
HDMA6MODE = $004360
HDMA7MODE = $004370
; DMA B-BUS ADDRESS ACCESS
; $4301 rw1 fvha
; $4311 rw1 fvha
; $4321 rw1 fvha
; $4331 rw1 fvha
; $4341 rw1 fvha
; $4351 rw1 fvha
; $4361 rw1 fvha
; $4371 rw1 fvha
;
; aaaaaaaa
; a - low byte of PPU port $21aa for B bus address
BBADX = $004301
BBAD0 = $004301
BBAD1 = $004311
BBAD2 = $004321
BBAD3 = $004331
BBAD4 = $004341
BBAD5 = $004351
BBAD6 = $004361
BBAD7 = $004371
;--------------------------------
DMAXPORT = $004301
DMA0PORT = $004301
DMA1PORT = $004311
DMA2PORT = $004321
DMA3PORT = $004331
DMA4PORT = $004341
DMA5PORT = $004351
DMA6PORT = $004361
DMA7PORT = $004371
; DMA A-BUS TABLE ADDRESS
; $4302 rw1 fvha
; $4303 rw1 fvha
; $4304 rw1 fvha
; $4312 rw1 fvha
; $4313 rw1 fvha
; $4314 rw1 fvha
; $4322 rw1 fvha
; $4323 rw1 fvha
; $4324 rw1 fvha
; $4332 rw1 fvha
; $4333 rw1 fvha
; $4334 rw1 fvha
; $4342 rw1 fvha
; $4343 rw1 fvha
; $4344 rw1 fvha
; $4352 rw1 fvha
; $4353 rw1 fvha
; $4354 rw1 fvha
; $4362 rw1 fvha
; $4363 rw1 fvha
; $4364 rw1 fvha
; $4372 rw1 fvha
; $4373 rw1 fvha
; $4374 rw1 fvha
;
; A1TxL A1TxH A1Bx
; llllllll hhhhhhhh bbbbbbbb
; l - low byte of A bus address
; h - high byte of A bus address
; b - bank of A bus address
;--------------------------------
A1TX = $004302
A1TXL = $004302
A1T0L = $004302
A1T1L = $004312
A1T2L = $004322
A1T3L = $004332
A1T4L = $004342
A1T5L = $004352
A1T6L = $004362
A1T7L = $004372
;--------------------------------
A1TXH = $004303
A1T0H = $004303
A1T1H = $004313
A1T2H = $004323
A1T3H = $004333
A1T4H = $004343
A1T5H = $004353
A1T6H = $004363
A1T7H = $004373
;--------------------------------
A1BX = $004304
A1B0 = $004304
A1B1 = $004314
A1B2 = $004324
A1B3 = $004334
A1B4 = $004344
A1B5 = $004354
A1B6 = $004364
A1B7 = $004374
;--------------------------------
DMAXADDR = $004302
DMA0ADDR = $004302
DMA1ADDR = $004312
DMA2ADDR = $004322
DMA3ADDR = $004332
DMA4ADDR = $004342
DMA5ADDR = $004352
DMA6ADDR = $004362
DMA7ADDR = $004372
;--------------------------------
DMAXADDRL = $004302
DMA0ADDRL = $004302
DMA1ADDRL = $004312
DMA2ADDRL = $004322
DMA3ADDRL = $004332
DMA4ADDRL = $004342
DMA5ADDRL = $004352
DMA6ADDRL = $004362
DMA7ADDRL = $004372
;--------------------------------
DMAXADDRH = $004303
DMA0ADDRH = $004303
DMA1ADDRH = $004313
DMA2ADDRH = $004323
DMA3ADDRH = $004333
DMA4ADDRH = $004343
DMA5ADDRH = $004353
DMA6ADDRH = $004363
DMA7ADDRH = $004373
;--------------------------------
DMAXADDRB = $004304
DMA0ADDRB = $004304
DMA1ADDRB = $004314
DMA2ADDRB = $004324
DMA3ADDRB = $004334
DMA4ADDRB = $004344
DMA5ADDRB = $004354
DMA6ADDRB = $004364
DMA7ADDRB = $004374
;--------------------------------
HDMAXADDR = $004302
HDMA0ADDR = $004302
HDMA1ADDR = $004312
HDMA2ADDR = $004322
HDMA3ADDR = $004332
HDMA4ADDR = $004342
HDMA5ADDR = $004352
HDMA6ADDR = $004362
HDMA7ADDR = $004372
;--------------------------------
HDMAXADDRL = $004302
HDMA0ADDRL = $004302
HDMA1ADDRL = $004312
HDMA2ADDRL = $004322
HDMA3ADDRL = $004332
HDMA4ADDRL = $004342
HDMA5ADDRL = $004352
HDMA6ADDRL = $004362
HDMA7ADDRL = $004372
;--------------------------------
HDMAXADDRH = $004303
HDMA0ADDRH = $004303
HDMA1ADDRH = $004313
HDMA2ADDRH = $004323
HDMA3ADDRH = $004333
HDMA4ADDRH = $004343
HDMA5ADDRH = $004353
HDMA6ADDRH = $004363
HDMA7ADDRH = $004373
;--------------------------------
HDMAXADDRB = $004304
HDMA0ADDRB = $004304
HDMA1ADDRB = $004314
HDMA2ADDRB = $004324
HDMA3ADDRB = $004334
HDMA4ADDRB = $004344
HDMA5ADDRB = $004354
HDMA6ADDRB = $004364
HDMA7ADDRB = $004374
; DMA SIZE, HDMA WORKING TABLE ADDRESS, AND HDMA INDIRECT TABLE BANK
; $4305 rw1 fvha
; $4306 rw1 fvha
; $4307 rw1 fvha
; $4315 rw1 fvha
; $4316 rw1 fvha
; $4317 rw1 fvha
; $4325 rw1 fvha
; $4326 rw1 fvha
; $4327 rw1 fvha
; $4335 rw1 fvha
; $4336 rw1 fvha
; $4337 rw1 fvha
; $4345 rw1 fvha
; $4346 rw1 fvha
; $4347 rw1 fvha