BASIC ROM ASCII

9 replies [Last post]
anarkavre's picture
Offline
Joined: Oct 18 2005
Posts: 59

I was searching the ROM of BASIC for the TOO LONG error message in a hex editor and noticed that the last byte in the string was 47 for the G. Also the SYNTAX error message the X was 58. Why are these two bytes 47 and 58 and not C7 and D8? Is this how Wozniak terminated a string by using the normal ASCII hex values used today? Why did the Apple work with the two different ASCII schemes?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Offline
Joined: Dec 20 2003
Posts: 249
The answer is right there. If

The answer is right there. If you look at the numbers in binary format you will see all but the last number is using the 8th bit. The apple 1 only used 7 bit ASCII so, yes, if the 8th bit is off, that is the last character. C7 is 11000111 and 47 in binary is 01000111. The far left bit is the 8th bit. Same ASCII scheme, Woz just strips off the 8th bit if it's set.

Vince

__________________

replica 1 The Apple 1 replica and the new Micro-KIM!
brielcomputers.com

anarkavre's picture
Offline
Joined: Oct 18 2005
Posts: 59
Few More Questions

Just a few more questions. Why is the backspace character DF? If you remove the 8th bit it becomes 5F, but 5F is the _ character. Shouldn't it be 88 in hex since taking off the 8th bit makes it 08? Also I saw in a screenshot the _ and ` are supported characters, but I don't know their hex values. Does the Apple support the {, |, }, and ~ characters?

iceandfire's picture
Offline
Joined: Dec 20 2003
Posts: 67
Apple Ascii set

Woz used the underline character (DF) for the backspace. The reasoning behind this is that the Apple I computer could not actually back-space, I guess. I don't think the Apple I supported the brace {}, bar (|) or ~ characters.

Larry

__________________

Larry Nelson

Offline
Joined: Dec 20 2003
Posts: 249
http://www.lookuptables.com/

http://www.lookuptables.com/

5F and 60 are _ and '

__________________

replica 1 The Apple 1 replica and the new Micro-KIM!
brielcomputers.com

anarkavre's picture
Offline
Joined: Oct 18 2005
Posts: 59
Sorry Vince

Sorry Vince if you misunderstood me. I'm just confused on the 7 bit and 8 bit conversions. I meant that for the backspace character the 8 bit value is DF and the 7 bit value would be 5F. But with 7 bit the _ character would also be 5F. Are 8 bit and 7 bit values only used for printable characters? Do control characters only use 8 bit values? Why don't the _ and ` characters have 8 bit values?

Offline
Joined: Dec 20 2003
Posts: 249
I'm sorry, I did misunderstan

I'm sorry, I did misunderstand. When you were looking at the statements in basic, the 8th bit is set in last character to indicate to basic that is the last character to print. The apple 1 and replica 1 have all keyboard data bit 8 tied high. So, anything coming in is >7F. If you check the apple 1 manual CPU section, look at note 10 (page 15) states that the 8th bit PA7 is tied to 5V. This makes all incoming keyboard data greater than 7F.

Ok, now, why is _ used for backspace? Because the video circuit Woz designed could not back up the cursor. So, the _ is a symbol just to help the user see a backspace has been pressed. Pressing the backspace key does nothing, you must press _ to make the system preform a backspace. But remember, you still see _ but the character behind the _ is gone.

Does this help?

Vince

__________________

replica 1 The Apple 1 replica and the new Micro-KIM!
brielcomputers.com

anarkavre's picture
Offline
Joined: Oct 18 2005
Posts: 59
Yes, this helps

Yes, this helps a lot. I'm trying to get things correct in my C conversion of Pom1. That's the reason for all the questions about ASCII. Pom1 doesn't have the _ or ` characters in the character ROM, but I saw a screenshot of an Apple 1 program that printed all the ASCII characters and the _ and ` characters were included. I guess I'll have to add those characters to the character ROM and maybe implement an option to either use the _ character or the backspace character to backspace. Thanks for your help.

Offline
Joined: Dec 20 2003
Posts: 249
Yeah, they were in the 2513 c

Yeah, they were in the 2513 character rom in the apple 1. If you do a search for this chip, actually the pdf doc sheet is on this site in the apple 1 owners club files. The doc sheet may show you all the characters in the set.

I'm not a programmer but I guess you can just OR the 8th bit in to all keyboard data?

__________________

replica 1 The Apple 1 replica and the new Micro-KIM!
brielcomputers.com

anarkavre's picture
Offline
Joined: Oct 18 2005
Posts: 59
If the backspace printed an _

If the backspace printed an _ did it not print the cursor block? Since I don't have an actual Apple 1 or Replica 1 it's hard for me to tell the details of it.