File tree Expand file tree Collapse file tree 1 file changed +17
-16
lines changed Expand file tree Collapse file tree 1 file changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -566,34 +566,34 @@ ti_Read:
566
566
ld c , (iy + 12 )
567
567
call util_is_slot_open
568
568
jr z , .ret0
569
- ld bc , (iy + 6 )
570
- ld hl , (iy + 9 )
571
- call __smulu
572
- add hl , de
573
- xor a , a
574
- sbc hl , de
575
- jr z , .ret0
576
- push hl ; hl = total size to read
577
569
call util_get_slot_size
578
570
push bc
579
571
call util_get_offset
580
572
pop hl
581
573
or a , a
582
574
sbc hl , bc ; size - offset = bytes left to read
583
- pop de ; if no bytes left, return
584
575
jr z , .ret0
585
576
jr c , .ret0
577
+ ld bc , (iy + 6 )
578
+ call __sdivu ; (size - offset) / chunk_size
579
+ ld de , (iy + 9 ) ; number of chunks to read, hl = number of chunks left
586
580
or a , a
587
581
sbc hl , de
588
- add hl , de ; check if left size <= read size
582
+ add hl , de ; check if left <= read
589
583
jr nc , .copy
590
- jr .ret0 ; otherwise just return if not enough read space
584
+ ex de , hl
591
585
.copy:
592
- push de
593
- call util_get_data_offset
586
+ ex de , hl
587
+ ld bc , (iy + 6 )
588
+ push hl
589
+ call __smulu
590
+ add hl , de
591
+ or a , a
592
+ sbc hl , de
593
+ jr z , .ret0. pop
594
+ push hl
594
595
ld de , (iy + 3 )
595
596
pop bc
596
- push bc
597
597
ldir
598
598
call util_get_offset
599
599
pop hl
@@ -603,8 +603,9 @@ ti_Read:
603
603
call util_get_offset_ptr
604
604
ld (hl) , de
605
605
pop hl
606
- ld bc , (iy + 6 )
607
- jp __sdivu ; return actual chunks read
606
+ ret ; return actual chunks read
607
+ .ret0. pop :
608
+ pop hl
608
609
.ret0:
609
610
xor a , a
610
611
sbc hl , hl
You can’t perform that action at this time.
0 commit comments