-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpatch64.s
150 lines (127 loc) · 3.34 KB
/
patch64.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
; Automated test for C64 autostart (use with VICE -debugcart and -limitcycles
; options).
.include "defs64.inc"
.include "macros.inc"
.forceimport __EXEHDR__
; test-result register exposed by VICE debugging 'cartridge'. Writing to this
; will cause VICE to exit, with the exit result set to the written value.
start:
LDY #MSG0-MSGBAS ; display
JSR SNDMSG
; copy
leaxy $A000 ; copy basic
stxy T1 ; set address
ldx #32 ; number of pages to copy
jsr copy
leaxy $E000 ; copy kernal
stxy T1 ; set address
ldx #32 ; number of pages to copy
jsr copy
lda 1 ; switch kernel and basic roms out
and #$FD
sta 1
; patches
; kernal patches
; change default memory configuraton in R6510 to use RAM
LDA #%11100101
STA $fdd5+1 ;
; patch ramtas to stop at $A000
ldx #6
@l2: lda ramtas2,X
sta $fd79,X
dex
bpl @l2
; set default colors and device number
lda #$16
sta $ecb9+24 ; lowercase
lda EXTCOL
sta $ecd9 ; border color
lda BGCOL0
sta $ecda ; background color
lda COLOR
sta $e534+1 ; foreground color
lda FA
sta $e1d9+1 ; default device number for BASIC LOAD
; set last char of the startup message
lda #'$'
sta $e4a9
; basic patches
; change basic ready prompt to something else
ldx #5
@l1: lda prompt,x
sta $a378,x
dex
bpl @l1
; finnish up
LDY #MSG1-MSGBAS ; display message
JSR SNDMSG
; do extra stuff specified on the command line
jsr main
rts
prompt:
.byte "RUN64."
ramtas2:
lda $c2
cmp #$a0
.byte $f0,$09 ; BEQ 9
nop
; .byte $a5,$c2,$c9,$a0,$f0,$09,$ea
; -----------------------------------------------------------------------------
; copy pages
copy:
ldy #0
@loop1:
LDA (T1),Y
STA (T1),Y
INY
BNE @loop1
dex
beq @end1
inc T2
bne @loop1
@end1:
RTS
; -----------------------------------------------------------------------------
; load extra patches specified on the command line
main:
lda BUF ; if run from shell or basic
bpl main1 ; check if basic token
rts ; we were run from BASIC with "run"
main1: lda COUNT
sta CHRPNT
tax
ldy #0
@l1: lda BUF,X
beq main2
sta VICSCN,y
iny
inx
cpx #80
bne @l1
main2:
rts
; -----------------------------------------------------------------------------
; print string A = len, XY = addr
strout:
sta COUNT
stxy R2D2
lda #'"'
jsr CHROUT
ldy #0
@lvl5:
lda (R2D2),y
jsr CHROUT
iny
cpy COUNT
bmi @lvl5
lda #'"'
jsr CHROUT
rts
.include "utils.s"
; -----------------------------------------------------------------------------
; message table; last character has high bit set
MSGBAS =*
MSG0: .BYTE 14
.BYTE "PATCH64",' '+$80
MSG1: .BYTE 14
.BYTE "COPYING ROM TO RAM",$0d+$80