On Mon, Jun 12, 2023 at 8:41 AM Rhialto <rhialto_at_falu.nl> wrote: > On Sun 11 Jun 2023 at 16:28:29 -0400, Ethan Dicks wrote: > > ...PRINT# is writing out CRLF, not CR, which is > > bunging up reading the data back in as numbers (not strings). > For BASIC 4.0, I think they changed this, and then offered a hack to > enable it back, if you used a logical file number of 128 or higher. Yes. I found that in the BASIC code. In fact. I went back and looked at the implementation of CRDO across 1977-1982 BASIC ROMs. There are 3 techniques: the original, Upgrade ROMs, and everything after Upgrade ROMs. Upgrade ROMs are the simplest implementation: 01379 C9E2 A9 0D CRDO LDA #13 01380 C9E4 20 45 CA JSR OUTDO 01381 C9E7 A9 0A LDA #$0A ;LINE FEED 01382 C9E9 20 45 CA JSR OUTDO 01383 C9EC 49 FF CRFIN EOR #255 01384 C9EE 60 PRTRTS RTS BASIC 4.0/VIC-20/C64 adds the check for LFN > 128 to skip LF... 01534 BADF A9 0D CRDO LDA #13 01535 BAE1 20 46 BB JSR OUTDO 01536 BAE4 A5 10 LDA CHANNL 01537 BAE6 10 05 BPL CRFIN 01538 BAE8 A9 0A LDA #$0A ;LINE FEED 01539 BAEA 20 46 BB JSR OUTDO 01540 BAED 49 FF CRFIN EOR #255 01541 BAEF 60 PRTRTS RTS Oddly, BASIC1 is the most complicated with some extra code to perhaps also send a NUL char after CRLF... 01368 C9D2 A5 03 CRDO LDA CHANNL 01369 C9D4 D0 02 BNE LC9D8 01370 C9D6 85 05 STA TRMPOS 01371 C9D8 A9 0D LC9D8 LDA #13 01372 C9DA 20 49 CA JSR OUTDO 01373 C9DD A9 0A LDA #$0A ;LINE FEED 01374 C9DF 20 49 CA JSR OUTDO 01375 C9E2 A5 03 CRFIN LDA CHANNL 01376 C9E4 D0 12 BNE PRTRTS 01377 C9E6 8A TXA 01378 C9E7 48 PHA 01379 C9E8 A6 04 LDX NULCNT 01380 C9EA F0 08 BEQ CLRPOS 01381 C9EC A9 00 LDA #0 01382 C9EE 20 49 CA PRTNUL JSR OUTDO 01383 C9F1 CA DEX 01384 C9F2 D0 FA BNE PRTNUL 01385 C9F4 86 05 CLRPOS STX TRMPOS 01386 C9F6 68 PLA 01387 C9F7 AA TAX 01388 C9F8 60 PRTRTS RTS > One would expect that for VIC-20 and C64 BASIC, Commodore had a chance > to fix it better, but I guess they didn't. Looks like the VIC-20 and C64 implementation of CRDO is exactly the same. > There are more things that are treated slightly differently between > normal screen I/O and files. I have been looking for those differences now, because of this experience. -ethanReceived on 2023-06-12 22:03:20
Archive generated by hypermail 2.3.0.