-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathtms9918gfx2test.asm
112 lines (83 loc) · 1.63 KB
/
tms9918gfx2test.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
; Troy's HBC-56 - TMS9918 Graphics II mode test
;
; Copyright (c) 2021 Troy Schrapel
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;
!src "hbc56kernel.inc"
YPOS = $48
setupNameTable:
+tmsSetAddrNameTable
+tmsSendData TMS_NAME_DATA, $300
rts
setupColorTable:
+tmsSetAddrColorTable
+tmsSendData TMS_COLOR_DATA, $1800
rts
setupPatternTable:
+tmsSetAddrPattTable
+tmsSendData testImg, $1800
rts
hbc56Meta:
+setHbcMetaTitle "TMS GFXII MODE"
rts
hbc56Main:
sei
jsr tmsModeGraphicsII
+tmsDisableInterrupts
+tmsDisableOutput
+tmsColorFgBg TMS_WHITE, TMS_BLACK
jsr tmsSetBackground
jsr setupNameTable
jsr setupColorTable
jsr setupPatternTable
+tmsEnableOutput
cli
loop:
jsr doFrame
+hbc56CustomDelay 64
jmp loop
doFrame:
+tmsSetAddrColorTable
lda YPOS
clc
adc #1
sta YPOS
pha
ldy #24
nextRow
pla
clc
adc #1
and #$0f
pha
tax
lda .palette, x
ldx #0
nextCol
+tmsPut
dex
bne nextCol
dey
bne nextRow
pla
rts
.palette
!byte $80,$90,$a0,$20,$30,$70,$50,$40,$d0,$40,$50,$70,$30,$20,$a0,$90
TMS_NAME_DATA:
!for third, 0, 2 {
!for i, 0, 255 {
!byte i
}
}
TMS_COLOR_DATA:
!for .c, 0, 11 {
!for .r, 0, 511 {
!byte (.c + 2) << 4
}
}
testImg:
!bin "mode2test.bin"
;!bin "metallica.bin"