Jump to content

Critique my first basic program on my 800XL

Recommended Posts

The minimal "smarter" technique which C= Basic employs is to simply compare the destination to current line, then just scan forward if > or start from beginning of program if <


Though the C= Basic only gets it partially right, it only checks if the high byte of the destination is greater but you can force proper search by creative usage of line numbering.

  • Like 1
Link to comment
Share on other sites

On 2/28/2024 at 9:36 PM, phaeron said:

Yes, it's a known bug/limitation in the OS:


GET/PUT wouldn't be any better, unless you buffer enough data to ensure that the first cassette record is written before DOS fetches another sector.


I see. Here is another copy Disk to CAS with a 1K buffer. Again this is reading at the byte level, so it shouldn't matter what kind of file it's copying. This program reuses the buffer over and over so size shouldn't matter. (That's what she said...😆)


10 OPEN #1,4,0,"D2:TEMP.LG"

20 FR=1:REM First Run Flag Set -- OPEN 'C:' only once

30 CLR: DIM BUF$(1024):REM CLeaR DIMmed strings so we don't end up with extra data after the EOF occurs

40 TRAP 95:FOR I=1 TO 1024

50 GET #1,A: BUF$(I,I)=CHR$(A)

60 NEXT I:IF FR THEN OPEN #2,8,0,"C:":FR=0:REM OPEN 'C:' right before output to compensate for OS bug

70 ? #2,BUF$;

80 GOTO 30

90 REM Trapped EOF brings us here

95 IF FR THEN OPEN #2,8,0,"C:":REM If file is less than 1K TRAP and subsequent write will occur before OPEN 'C:'. Must check for it again before write.

100 ? #2,BUF$;:CLOSE #1:CLOSE #2:REM Output remaining string contents and CLOSE all IOCBs

110 END




Edited by Houdini
Fixed file less than 1K bug.
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...