-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest1.asm
More file actions
138 lines (110 loc) · 2.47 KB
/
test1.asm
File metadata and controls
138 lines (110 loc) · 2.47 KB
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
.function VDC_RowColToAddress(x, y) {
/* Function returns a VDC memory address for a given row and column */
.var addr = y * 80 + x;
.if (addr > -1 && addr < 2000)
.return addr
else
.return -1;
}
c128lib_BasicUpstart128($1c10)
* = $1c10
Entry: {
.label x = 2;
.label y = 2;
.label width = 40;
.label height = 10
// $1c10-$2cba = $10aa = 4266
// $1c10-$2303 (with jsr) = $06f3 = 1779
// $1c10-$2141 (with some opt) = $0531 = 1329
// $1c10-$1d14 (with loops) = $0104 = 260
// $1c10-$1cfb (with loops opt) = $00eb = 235
// $1c10-$1cd8 (with loops opt2) = $00c8 = 200
/* Top left corner */
lda #85
sta VDC_Poke.value
lda #<(VDC_RowColToAddress(x, y))
sta VDC_Poke.address
lda #>(VDC_RowColToAddress(x, y))
sta VDC_Poke.address + 1
jsr VDC_Poke
/* Left border */
lda #66
sta VDC_Poke.value
ldy #height - 2
!:
c128lib_add16(80, VDC_Poke.address)
jsr VDC_Poke
dey
bne !-
/* Bottom left corner */
lda #74
sta VDC_Poke.value
jsr VDC_Poke
/* Bottom border */
lda #67
sta VDC_Poke.value
ldy #width-2
!:
c128lib_inc16(VDC_Poke.address)
jsr VDC_Poke
dey
bne !-
/* Bottom right corner */
lda #75
sta VDC_Poke.value
jsr VDC_Poke
/* Right border */
lda #66
sta VDC_Poke.value
ldy #height - 2
!:
c128lib_sub16(80, VDC_Poke.address)
jsr VDC_Poke
dey
bne !-
/* Top right corner */
lda #73
sta VDC_Poke.value
jsr VDC_Poke
/* Top border */
lda #67
sta VDC_Poke.value
ldy #width-3
!:
c128lib_dec16(VDC_Poke.address)
jsr VDC_Poke
dey
bne !-
rts
}
VDC_Poke: {
ldx #c128lib.Vdc.CURRENT_MEMORY_HIGH_ADDRESS
lda address + 1
c128lib_WriteVdc()
// ldx #c128lib.Vdc.CURRENT_MEMORY_LOW_ADDRESS
inx
lda address
c128lib_WriteVdc()
ldx #c128lib.Vdc.MEMORY_READ_WRITE
lda value
c128lib_WriteVdc()
rts
address: .word $0000
value: .byte $00
}
.macro VDC_Poke(address, value) {
ldx #c128lib.Vdc.CURRENT_MEMORY_HIGH_ADDRESS
lda #>address
c128lib_WriteVdc()
// ldx #c128lib.Vdc.CURRENT_MEMORY_LOW_ADDRESS
inx
lda #<address
c128lib_WriteVdc()
ldx #c128lib.Vdc.MEMORY_READ_WRITE
lda #value
c128lib_WriteVdc()
}
#import "common/lib/common-global.asm"
#import "common/lib/math-global.asm"
#import "chipset/lib/vdc.asm"
#import "chipset/lib/vdc-global.asm"