X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libsrc%2Flynx%2Fread.s;h=d6341af89bc32d2e8284db2df42d175279c3eefb;hb=0eb1eb625fac71db5c0bfd79e6847a29be867d22;hp=c461e378fba6479891310b427abb313ca1927edc;hpb=d993b332a4391b13c987e97a2cef796a73f2a1c6;p=cc65 diff --git a/libsrc/lynx/read.s b/libsrc/lynx/read.s index c461e378f..d6341af89 100644 --- a/libsrc/lynx/read.s +++ b/libsrc/lynx/read.s @@ -8,43 +8,37 @@ ; reads bytes from a raw cart and does not understand the concept of files. ; So if you read over the end of file you get data from the next file. ; -; The count-parameter can be positive (Atari style) or negative (BLL style). -; In any case the read routine will work correctly. +; The count-parameter is positive (Atari style). ; ; int __fastcall__ read(int fd,void *buf,int count) ; - .importzp _FileDestPtr - .import lynxread0 - .import pushax,ldaxysp,ldax0sp,incsp6 - .export _read + .importzp _FileDestPtr + .import lynxread0 + .import pushax,ldaxysp,ldax0sp,incsp6 + .export _read -.segment "CODE" +.segment "CODE" -.proc _read: near +.proc _read: near -.segment "CODE" +.segment "CODE" - jsr pushax - ldy #$03 - jsr ldaxysp - sta _FileDestPtr - stx _FileDestPtr+1 - jsr ldax0sp - phx ; The BLL kit uses negative counts - plx ; while the basic Lynx uses positive - bmi @1 ; make all counts negative - eor #$FF - pha - txa - eor #$FF - bra @2 -@1: pha - txa -@2: tay - plx - jsr lynxread0 - jsr ldax0sp - jmp incsp6 + jsr pushax + ldy #$03 + jsr ldaxysp + sta _FileDestPtr + stx _FileDestPtr+1 + jsr ldax0sp + pha + txa + eor #$FF + tay + pla + eor #$FF + tax + jsr lynxread0 + jsr ldax0sp + jmp incsp6 .endproc