-
Notifications
You must be signed in to change notification settings - Fork 3
/
vdc_scroll.asm
142 lines (114 loc) · 2.56 KB
/
vdc_scroll.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
// kick assembler, c128 tests
#import "c128system.asm"
#import "c128macros.asm"
:BasicUpstart128(MAIN)
MAIN:
:SetBankConfiguration(15) // set bank 15
// place the screen ram area at $4000
ldx #12
lda #$40
jsr WRITE_VDC
inx
lda #$00
jsr WRITE_VDC
// fill the screen ram with data
:SetVDCUpdateAddress($4000)
lda #$40 // page to start writing to
sta $ff
ldy #0 // page counter and char code
ldx #31 // internal data register of the VCD.
!:
tya
jsr WRITE_VDC
iny
bne !-
inc $ff
lda $ff
cmp #$49 // done $2000 - $28ff?
bne !-
// add some attributes
:SetVDCUpdateAddress($0800)
ldy #0
lda #%01110101
ldx #31
!:
jsr WRITE_VDC
ror // crazy stuff
dey
bne !-
ldx #25 // write to this VDC register
jsr READ_VDC
ora #%01000000 // enable attributes
jsr WRITE_VDC
// setup done. lets scroll
// set display start address $4000
// we use big endian, as used by the vdc
lda #$40
sta $fe
lda #$00
sta $ff
// reset y-fine value
lda #0
sta $fd
// do y-fine adjustment. register 24 is for this
// the lower 4 bits (values 0-9)
yfine:
inc $fd
lda $fd
cmp #8 // character is 8 pixels hi (by default)
bne cont
// reset the y-fine register
lda #0
sta $fd // clear local value
ldx #24
jsr READ_VDC
and #%11100000 // reset bits 4-0
jsr WRITE_VDC
// go to next row
// ....
lda $ff
clc
adc #80
sta $ff
bcc !+
inc $fe
lda $fe
cmp #$48 // scrolled to $4800?
beq done
!:
// update VDC display start address
ldx #12
lda $fe
jsr WRITE_VDC
inx
lda $ff
jsr WRITE_VDC
jmp yfine
done:
rts
// increment y-fine value
cont:
ldx #24
jsr READ_VDC
and #%11100000
adc $fd
jsr WRITE_VDC
jsr delay
jmp yfine
// delay loop
delay:
ldx #$40
ldy #0
!:
dey
bne !-
dex
bne !-
rts
// assemble sub routines.
WRITE_VDC:
:WriteVDC()
rts
READ_VDC:
:ReadVDC()
rts