Skip to content

Commit c03c530

Browse files
committed
The fastloader works, read-only! It's much, much faster than without one
(still not great).
1 parent 3e3e7e5 commit c03c530

File tree

4 files changed

+46
-45
lines changed

4 files changed

+46
-45
lines changed

src/arch/commodore/c64.S

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -581,52 +581,34 @@ zendproc
581581
; Reads a 256-byte sector whose LBA index is in XA.
582582

583583
zproc read_sector
584-
jsr convert_to_ts
584+
tay
585+
txa
585586
pha
586587
tya
587588
pha
588589

589-
lda #8
590-
jsr LISTEN
591-
lda #$6f
592-
jsr SECOND
593-
594-
lda #'U'
595-
jsr CIOUT
596-
lda #'1'
597-
jsr CIOUT
598-
lda #2
599-
jsr decimal_out
600-
lda #0
601-
jsr decimal_out
602-
pla ; get sector
603-
jsr decimal_out
604-
pla ; get track
605-
jsr decimal_out
606-
607-
jsr UNLSN
608-
609-
;jsr get_status
610-
611-
lda #8
612-
jsr TALK
613-
lda #$62
614-
jsr TALKSA
590+
lda #'R'
591+
jsr uload3_send
592+
pla
593+
jsr uload3_send
594+
pla
595+
jsr uload3_send
615596

616597
ldy #0
617598
zrepeat
618-
jsr ACPTR
599+
jsr uload3_recv
619600
sta disk_buffer, y
620601
iny
621602
zuntil eq
622603

623-
jsr UNTALK
604+
clc
624605
rts
625606
zendproc
626607

627608
; Writes a 256-byte sector whose LBA index is in XA.
628609

629610
zproc write_sector
611+
.if 0
630612
jsr convert_to_ts
631613
pha
632614
tya
@@ -692,6 +674,9 @@ zproc write_sector
692674
reset_buffer_pointer_command:
693675
.ascii "B-P 2 0"
694676
.byte 13, 0
677+
.endif
678+
sec
679+
rts
695680
zendproc
696681

697682
; Prints an 8-bit hex number in A.
@@ -944,12 +929,6 @@ ddEnd:
944929
rts
945930
zendproc
946931

947-
948-
loading_msg:
949-
.byte 147, 14, 5
950-
.ascii "cp/m-65 FOR THE cOMMODORE 64"
951-
.byte 13, 0
952-
953932
.data
954933

955934
zp_base: .byte __USERZEROPAGE_START__

src/arch/commodore/c64.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ SECTIONS {
2525
} >ram AT>bootstrap
2626

2727
.data : {
28+
. = ALIGN(16);
29+
*(.aligned.16)
2830
*(.data .data.* .rodata .rodata.*)
2931
bios_end_addr = .;
3032
} >ram AT>bootstrap

src/arch/commodore/uload3/client.S

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,7 @@ zendproc
170170
zproc uload3_recv_file
171171
zrepeat
172172
jsr uload3_recv
173-
zif eq
174-
clc
175-
rts
176-
zendif
173+
zbreakif eq
177174
cmp #0xff
178175
zif eq
179176
; Error!
@@ -197,5 +194,9 @@ zproc uload3_recv_file
197194
zif cs
198195
inc ptr+1
199196
zendif
200-
zendloop
197+
198+
lda uloadtmp
199+
cmp #0xfe
200+
zuntil ne
201+
rts
201202
zendproc

src/arch/commodore/uload3/drive1541.S

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,15 @@ zproc drv_recvstring, .drive
218218
rts
219219
zendproc
220220

221-
; Converts an LBA sector number in XA to a track/sector.
221+
; Reads an LBA sector number and converts it to (track, sector).
222+
223+
zproc read_lba, .drive
224+
jsr drv_recv
225+
pha
226+
jsr drv_recv
227+
tax
228+
pla
222229

223-
zproc convert_to_ts, .drive
224230
ldy #0
225231
zloop
226232
cpx #0
@@ -255,16 +261,30 @@ zproc drv_start, .drive
255261
; fall through
256262
zlproc drv_main, .drive
257263
zloop
264+
main_done:
258265
jsr drv_recv ; get command byte, exit if ATN goes low
259266

267+
cmp #'R' ; read a sector
268+
beq read_sector
260269
cmp #'F' ; load a file
261270
beq load_file
262271

263272
lda #$ff ; unknown command
264-
main_done:
265273
jsr drv_send
266274
zendloop
267275

276+
read_sector:
277+
jsr read_lba
278+
jsr drv_readsector
279+
280+
ldx #0
281+
zrepeat
282+
lda DRIVEBUFFER, x
283+
jsr drv_send
284+
inx
285+
zuntil eq
286+
jmp main_done
287+
268288
load_file:
269289
jsr drv_recvstring
270290

@@ -349,7 +369,6 @@ dirent_found:
349369
lda DRIVEBUFFER+0
350370
zuntil eq
351371

352-
lda #0 ; end of data
353-
jsr drv_send
372+
label:
354373
jmp main_done
355374
zendproc

0 commit comments

Comments
 (0)