Re: [cc65] Re: Questions for CBM guys

From: <silverdr1inet.com.pl>
Date: 2008-03-04 14:05:20
On 2008-03-04, at 11:53, Jonathan Graham Harston wrote:

> I checked the documentation before posting to check that
> the C64 was similar to the Acorn world:
>
> Commodore 64 Programmer's Reference Guide:
>
> "If no punctuation finishes the list, a carriage-return
> and a line- feed are printed at the end of the data. If
> a comma or semicolon terminates the output-list, the
> carriage-return and line-feed are suppressed."

This is the part which tells about PRINT# BASIC statement. What does  
it have to do with screen "driver"? Sure you can OPEN the screen  
device and PRINT# to it but why would you? OTOH similar description  
applies to PRINT statement - again: how does this refers to what byte  
is sent to screen driver?

> [...]
> That clearly indicates that line-feed and carriage-return
> are two seperate functions.

I wrote exactly this: "CR and LF are in fact separate functions and  
treating them as such does make a lot of sense". This doesn't mean  
that screen device driver in a C64 treats it as separate.

> Remember, I'm talking about /screen/ drivers here, not
> teletypes, printers, typing input, etc.

Those are very much similar but the situation at least in the cbm  
world is quite opposite than what you wrote. Printing to /screen/  
allows you to send $0d to achieve both CR and LF. <-- period. Printing  
to other devices can (and often is) different. Many printers included  
even a switch (either hardware DIP switch or software) to add LF after  
receiving CR from the computer. This just because sending the same  
data that would work on the /screen/ (just $0d) would make everything  
printed on one line when sent to printer.

>
> Character 13 - CR - repeatedly moves left until in the
>  lefthand column

on CBM it does also change the line

>
> Character 8 moves left one

On CBM it is either custom extension or NOP. To move left you send $9d

>
> Character 9 moves right one

On CBM it is either custom extension or NOP. To move right you send $1d

> Character 10 moves down one

On CBM $11

> Character 11 moves up one

On CBM $91

Ever tried those on a CBM, or Atari, or...?

> The only system I knew before this thread where this does
> not happen is the Sinclair computers, where CHR$13 moves
> down and left, the equivalent of CR/LF, so making it
> impossible to do a LF or a CR.

I don't know how Sinclair machines handle it but this is easily  
verifiable and quite probably it is also possible to do LF and other  
functions, just maybe not with stabdard LF ASCII code there.

>> MSDOS   : $0d$0a
>> CBM     : $0d
>> Amiga   : $0a
>> Atari   : $9b
>> Unix    : $0a
>> Mac[*]  : $0d
>
> Nope, I've used a Mac, and PRINT CHR$13; moves to the
> lefthand column without moving down, and PRINT CHR$10;

How did you check this on a classic Macos?

> moves down without changing the column, and the Unix
> systems I've used that have a screen driver (/not/ a
> teletype driver) do the same.

We might have a misunderstanding about what you call "screen driver"  
here. To me this is the subsystem, which interprets the stream of  
textual data in order to present it on the screen, in any size of  
window (small, big, fullscreen). One very common use of this is to  
present text files. Just send a text file to the raw screen driver and  
see how it interprets the line endings. Most "raw" screen editors use  
this subsystem as well. I guess you might be talking exactly about  
"teletype driver" or "terminal emulator", where adhering to standards  
is/was crucial. Internal "screen drivers" did how someone once created  
them, not necessarily adhering to ASCII or other standards but rather  
taking shortcuts or implementing own extensions. One of the most  
common shortcuts was to use CR as shortcut for CRLF and this is how  
the screen driver in C64 behaves. You send $0d to it and it does both  
CR and LF, whether you like it or not.

> If the others do perform as you say, then how on earth
> do you move the cursor down without changing the column?

On CBM you send $11

> And how on earth do you move to the lefthand column without
> moving down a line?

On Atari you send $9c

Now - having said that - I got interested and shall have to check how  
cc65's runtime lib achieves "\r" on the CBM. I don't remember a simple  
"one shot" way of doing it on a C64.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Mar 4 14:05:31 2008

This archive was generated by hypermail 2.1.8 : 2008-03-04 14:05:33 CET