dptr = (uint16_t)udata.u_dptr;
while (ct < udata.u_nblock) {
+ uint16_t len;
/* Pass the page to map for the data */
map = p[(dptr >> 14)];
- rd_memcpy(is_read, map, dptr, udata.u_block);
+ len = 0x4000 - (dptr & 0x3FFF);
+ if (len >= BLKSIZE)
+ rd_memcpy(is_read, map, dptr, udata.u_block, BLKSIZE, 0, 0);
+ else
+ rd_memcpy(is_read, map, dptr, udata.u_block, len,
+ p[(dptr >> 14) + 1], BLKSIZE - len);
udata.u_block++;
ct++;
dptr += BLKSIZE;
int rd_open(uint8_t minor, uint16_t flag);
/* asm banking helper */
-void rd_memcpy(uint8_t isread, uint8_t map, uint16_t dptr, uint16_t block);
+void rd_memcpy(uint8_t isread, uint8_t map, uint16_t dptr, uint16_t block,
+ uint16_t len, uint8_t map2, uint16_t len2);
#endif /* __DEVRD_DOT_H__ */
ret
;
-; Disk helper - FIXME should be IRQ safe nowdays
+; Disk helper - FIXME - do we need the di/ei still
;
_rd_memcpy: push ix
ld ix, #0
add ix, sp
; 4(ix) = is_read, 5(ix) = dptr page 6-7(ix) = dptr, 8-9(ix) = block
+ ; 10-11(ix) = len, 12(ix) = map2, 13-14(ix) = len2
ld l, 6(ix)
ld h, 7(ix)
ld c, 5(ix)
;
; All mapped, and then its simple
;
-rd_write: ld bc, #512
+rd_write: ld c, 10(ix)
+ ld b, 11(ix)
ldir
+
+ ld a, 12(ix) ; second page map or 0 = none
+ or a
+ jr z, rd_done ; usual case
+ out (0x12) ,a
+ ld c, 13(ix)
+ ld b, 14(ix)
+ ld a, 4(ix)
+ or a
+ jr z, rd_part2
+ ld hl, #0x8000
+ jr copy_part2
+rd_part2: ld de, #0x8000
+copy_part2: ldir
+rd_done:
call map_kernel ; map the kernel and return
ei
pop ix