From Newsgroup: comp.sys.cbm
Lyrical Nanoha wrote:
On Sat, 15 Oct 2005, Nick Bensema wrote:
I grew up initially with several computers in the Atari 8-bit series.
After my 130XE died, I got my grandfather's Commodore 64. They had
one thing in common: wacky dissociation between screen memory and
their OS's idea of ASCII.
With both computers, you could display letters on the screen with a
POKE to video memory. However, the number you POKEd was almost never
the same number you would put into a CHR$ function to print that
character.
For example, to get an uppercase A, you would:
(a) PRINT CHR$(65) (assuming uppercase mode if C64)
(b) POKE 1024,1 (Commodore 64)
(c) POKE 40000,33 (48k Atari 8-bit)
Is there any reason the screen memory was set up this way? Why wouldn't all three be 65?
Heh. Try the Apple ][ (where, thankfully, it's much simpler)...
]? chr$(65)
A
]poke 1024,193
]
At least it's as easy as adding a 128 on the Apple.
Also, what's the deal with the backspace? In PETSCII, it's CHR$(20),
even though CHR$(8) is right there doing nothing. In ATASCII, it's CHR$(126). I understand that ATASCII puts graphics tiles in its
first 27 characters, so it can't use CHR$(8) for backspace or
CHR$(13) for CR. But ASCII DEL, at CHR$(127), is RIGHT NEXT DOOR,
but ATASCII puts the tab there instead.
Thankfully on the Apple it's 127. (8 is Left Arrow, which made keyboard handling a nightmare in the original Dapple. 9 is of course Tab. Apple
used ASCII quite straightforwardly in their computers, thank God.)
On the TI-99/4A, you add 96 (>60). This is called the BASIC offset, and
is used to maximize VDP memory for your program. (The beginning of the character pattern table overlays another area).
So:
PRINT CHR$(65)
A
CALL POKEV(0,161) ! place A at screen location 0 (and POKEV requires E/A or Minimem or an enhanced XB)
As far as backspace, the "left arrow" key is 8, and you can hit FCTN-V
for 127. Or you can change the keyboard to PASCAL mode (mode 4) and
then Ctrl-H is 8, and 127 is still FCTN-V.
But as far as ASCII goes, outside of the BASIC offset, it is quite straightforward. Except that on the TI control characters don't get
translated (meaning control characters in files are read just as they
are, don't do strange things, control characters printed to the screen
don't cause screen clears, beeps, or anything else - they just show
whatever the character definition for that character).
--- Synchronet 3.18b-Win32 NewsLink 1.113