Skip to content

Commit fa79fc2

Browse files
authored
fixed loading of Basic programs
1 parent 4c092a1 commit fa79fc2

File tree

1 file changed

+40
-13
lines changed

1 file changed

+40
-13
lines changed

Source/Firmware/C16Side/cart264b.a

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
;
88
; cart264.a
99
;
10-
; RasPiC64 - A framework for interfacing the C64 (and C16/+4) and a Raspberry Pi 3B/3B+
11-
; - code of a cart to download and launch a .PRG from the RPi
12-
; - significant parts taken from http://www.cbmhardware.de/show.php?r=4&id=29 by CBMHARDWARE
13-
; Copyright (c) 2020 Carsten Dachsbacher <[email protected]>
10+
; Sidekick64 - A framework for interfacing the C64 and a Raspberry Pi Zero 2 or 3A+/3B+
11+
; - code of a cart to download and launch a .PRG from the RPi
12+
; - significant parts taken from http://www.cbmhardware.de/show.php?r=4&id=29 by CBMHARDWARE
13+
; Copyright (c) 2020-22 Carsten Dachsbacher <[email protected]>
1414
;
1515
; Logo created with http://patorjk.com/software/taag/
1616
;
@@ -30,7 +30,8 @@
3030
t_lo = $fe
3131
t_hi = $ff
3232
temp = $332
33-
trampoline = $333
33+
nofpages = $333
34+
trampoline = $334
3435

3536

3637
*=$8000
@@ -94,9 +95,6 @@ cpy2 lda $8100,x
9495
dex
9596
bpl cpy2
9697

97-
jmp trampoline
98-
99-
*=$8100 ; trampoline code
10098
sei
10199
lda #$00
102100
sta $02FE
@@ -105,24 +103,31 @@ cpy2 lda $8100,x
105103
sta $0314
106104
lda #$f2
107105
sta $0315
108-
lda #$00 ; basic , kernal
109-
sta $FDD0 ; function rom off
110-
sta $fb
111106

112-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
113-
; "download" .PRG
107+
; "download" .PRG (some preparations here)
114108
lda #03
115109
sta $fde5
116110

117111
; number of 256-byte pages to copy
118112
ldx $fde5
113+
stx nofpages
119114

120115
; get loading address
121116
lda $fde5
122117
sta t_lo
123118
lda $fde5
124119
sta t_hi
125120

121+
jmp trampoline
122+
123+
*=$8100 ; trampoline code
124+
lda #$00 ; basic , kernal
125+
sta $FDD0 ; function rom off
126+
sta $fb
127+
128+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
129+
; "download" .PRG
130+
126131
LOOPs0
127132
ldy #$00
128133
LOOPs1
@@ -138,6 +143,11 @@ cpy2 lda $8100,x
138143
bne LOOPs0
139144

140145
;; disable Sidekick64-transfer
146+
lda $fde5
147+
sta trampoline ; high byte
148+
lda $fde5
149+
sta trampoline+1 ; low byte
150+
141151
lda #123
142152
sta $fde5
143153
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -167,9 +177,26 @@ cpy2 lda $8100,x
167177
lda #8 ; last used device = 8
168178
sta $ba
169179

180+
ldx #$01 ; pointer to start addr of BASIC
181+
stx $2b
182+
183+
lda trampoline+1
184+
sta $2d ; ... and set BASIC program end and begin/end of BASIC variable addr
185+
sta $2f
186+
sta $31
187+
188+
lda #$10
189+
sta $2c
190+
191+
lda trampoline
192+
sta $2e
193+
sta $30
194+
sta $32
195+
170196
lda temp
171197
sta $ff13
172198

199+
173200
jsr $8bea ; start
174201
rts
175202

0 commit comments

Comments
 (0)