-
Notifications
You must be signed in to change notification settings - Fork 1
/
m65macros.s
113 lines (99 loc) · 1.91 KB
/
m65macros.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
.macro BasicUpstart65(addr) {
* = $2001
.var addrStr = toIntString(addr)
.byte $09,$20 //End of command marker (first byte after the 00 terminator)
.byte $0a,$00 //10
.byte $fe,$02,$30,$00 //BANK 0
.byte <end, >end //End of command marker (first byte after the 00 terminator)
.byte $14,$00 //20
.byte $9e //SYS
.text addrStr
.byte $00
end:
.byte $00,$00 //End of basic terminators
}
.macro enable40Mhz() {
lda #$41
sta $00 //40 Mhz mode
}
.macro enableVIC3Registers () {
lda #$00
tax
tay
taz
map
eom
lda #$A5 //Enable VIC III
sta $d02f
lda #$96
sta $d02f
}
.macro enableVIC4Registers () {
lda #$00
tax
tay
taz
map
eom
lda #$47 //Enable VIC IV
sta $d02f
lda #$53
sta $d02f
}
.macro disableC65ROM() {
lda #$70
sta $d640
eom
}
.macro mapMemory(source, target) {
.var sourceMB = (source & $ff00000) >> 20
.var sourceOffset = ((source & $00fff00) - target)
.var sourceOffHi = sourceOffset >> 16
.var sourceOffLo = (sourceOffset & $0ff00 ) >> 8
.var bitLo = pow(2, (((target) & $ff00) >> 12) / 2) << 4
.var bitHi = pow(2, (((target-$8000) & $ff00) >> 12) / 2) << 4
.if(target<$8000) {
lda #sourceMB
ldx #$0f
ldy #$00
ldz #$00
} else {
lda #$00
ldx #$00
ldy #sourceMB
ldz #$0f
}
map
//Set offset map
.if(target<$8000) {
lda #sourceOffLo
ldx #[sourceOffHi + bitLo]
ldy #$00
ldz #$00
} else {
lda #$00
ldx #$00
ldy #sourceOffLo
ldz #[sourceOffHi + bitHi]
}
map
eom
}
.macro VIC4_SetCharLocation(addr) {
lda #[addr & $ff]
sta $d068
lda #[[addr & $ff00]>>8]
sta $d069
lda #[[addr & $ff0000]>>16]
sta $d06a
}
.macro VIC4_SetScreenLocation(addr) {
lda #[addr & $ff]
sta $d060
lda #[[addr & $ff00]>>8]
sta $d061
lda #[[addr & $ff0000]>>16]
sta $d062
lda #[[[addr & $ff0000]>>24] & $0f]
sta $d063
}