-
Notifications
You must be signed in to change notification settings - Fork 1
/
helper.s
130 lines (115 loc) · 1.93 KB
/
helper.s
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
.export _loadzpage, _savezpage
_loadzpage:
ldx #2
@lp:
lda buffer,x
sta $0000,x
inx
bne @lp
rts
_savezpage:
ldx #2
@lp:
lda $0000,x
sta buffer,x
inx
bne @lp
rts
buffer:
.res $100
.export _zpcode
_zpcode:
.repeat 32, num
lda zpdata + num
sta $0002 + num
.endrepeat
jmp $0002
zpdata:
ldy #$14
@lp2:
ldx #$14
@lp1:
lda $02
iny
adc $03
iny
adc $04
dey
adc $05
dey
dex
bne @lp1
dey
bne @lp2
rts
zpdataend:
.export _dtvturboon
_dtvturboon:
lda #$01 ;enable extended features
sta $d03f
.byte $32,$99 ;sac $99 enable burstmode and skipcycles
lda #%00000011
.byte $32,$00 ;sac $00
; skip badlines
lda #$20
sta $d03c
rts
.export _dtvturbooff
_dtvturbooff:
.byte $32,$00 ;sac $00
lda #%00000000
.byte $32,$ee ;sac $ee
rts
ptr = $fc
.P02
.import _vic_pal
.export _set_vic_pal
_set_vic_pal:
sei
p1:
lda $d012
p2:
cmp $d012
beq p2
bmi p1
ldx #1 ; PAL
cmp #55
beq pal
dex ; NTSC
pal:
stx _vic_pal
cli
rts
.P816
.import _ram_banks
.export _set_ram_banks
_set_ram_banks:
; test all banks
stz ptr + 0
lda #$04
sta ptr + 1
stz ptr + 2
bank:
; write data
ldy #0
l0:
tya
sta [ptr],y
iny
bne l0
; compare
ldy #0
l1:
tya
cmp [ptr],y
bne error
iny
bne l1
; ok, next bank
inc ptr + 2
bne bank
error:
lda ptr + 2
sta _ram_banks
rts
.P02