Skip to content

Commit

Permalink
[KERNAL] handle two LOAD edge cases (X16Community#378)
Browse files Browse the repository at this point in the history
* [KERNAL] handle two LOAD edge cases

* add check for large load starting after $9D00

* add minor opt suggestion from Fulgen301 on PR#378
  • Loading branch information
mooinglemur authored Jan 21, 2025
1 parent 88fd522 commit bd9aa45
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions kernal/cbm/channel/load.s
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ ld27 jsr acptr ;get first byte
ld30 jsr loding ;tell user loading
;
ldy verck ;load/verify/vram?
beq ld40 ;verify
bpl ld35 ;loading into vram
bne :+
jmp ld40 ;verify
: bpl ld35 ;loading into vram

;
;block-wise load into RAM
Expand All @@ -110,17 +111,26 @@ bld10
jsr stop ;stop key?
beq break2
lda verck
clc
bmi bld11 ; check load into RAM/VRAM
sec ; RAM
bmi bld11 ; check load into RAM/VRAM
sec ; VRAM
ldx #<VERA_DATA0 ; use data0 for call to MACPTR instead of VRAM address
ldy eah ; store VRAM address as EAH instead of data0 address.
ldy eah ; store VRAM address as EAH instead of data0 address.
phy
ldy #>VERA_DATA0
bra bld12
break2
jmp break
bld11:
ldx eal
ldy eah
cpy #$9d
bcc @cont2
cpy #$a0
bcs @cont
jmp ld40
@cont
clc
@cont2
phy ;save address hi
bld12:
lda #0 ;load as many bytes as device wants
Expand Down Expand Up @@ -155,11 +165,14 @@ bld12:
sta eah
bit status ;eoi?
bvc bld10 ;no...continue load
ld32
lda tmp2 ;first block of headerless load?
bpl ld70 ;no, regular eoi
bpl ld33 ;no, regular eoi
lsr a
lsr a
bcc ld70 ;no timeout/fnf so just eoi
bcs ld34
ld33
jmp ld70 ;no timeout/fnf so just eoi
ld34 jmp ld15 ;file not found when on first attempt

;
Expand All @@ -178,14 +191,16 @@ ld35
bra bld10 ; attempt block read using macptr
;
ld39 sta eah
bit status ;eoi?
bvs ld32 ;yes...go back to blockwise eoi check logic
ld40 lda #$fd ;mask off timeout
and status
sta status
;
jsr stop ;stop key?
bne ld45 ;no...
;
break2 jmp break ;stop key pressed
jmp break ;stop key pressed
;
ld45 jsr acptr ;get byte off ieee
tax
Expand Down Expand Up @@ -254,7 +269,7 @@ ld80 ldx eal
rts
ld81 lda verck
dec
beq ld64 ; loading to VRAM
bpl ld64 ; loading to VRAM
bit status ; eoi?
bvs ld70 ; yes...exit normally
jsr untlk ; close channel
Expand Down

0 comments on commit bd9aa45

Please sign in to comment.