Looking for Baum's tiny assembler on Apple-1

Programming the 6502 microprocessor and its relatives in assembly and other languages.
User avatar
cjs
Posts: 759
Joined: 01 Dec 2018
Location: Tokyo, Japan
Contact:

Re: Looking for Baum's tiny assembler on Apple-1

Post by cjs »

Chromatix wrote:
The [Apple 1] keyboard and display hardware are both interfaced to the CPU bus through a 6820 PIA...
The Apple 1 display is a little weird in that it is essentially a glass TTY; as far as I know it supports only a 6-bit version of ASCII plus carriage-return.
Right; the one control character is CR, which fills spaces to the end of the current line and, if that was the last line on the screen scrolls the screen up a line, filling new the line with spaces. The cursor is then left at the start of the new line.

I have a few more details in the Video section of my Apple 1 documentation, along with a link to a video of a real Apple 1 that confirms the behaviour, and links to a couple of emulators that are consistent with that (and one that is not). As documented there, the character output translation is:

Code: Select all

$00-$1F  Print nothing (excepting $0D)
    $0D  (CR) Moves to the beginning of the next line.
$20-$5F  (space through underbar) prints given char
$60-$7F  (lower-case etc.) prints same as $40-$5F
         ($7F is not treated as a control character)
I have also documented the character ROM details, with links to the data sheet and ROM dumps, and notes on how the dumps differ from the actual ROM contents.

I ended up documenting this carefully because tebl's RC6502-Apple-1-Replica, which uses an Arduino Nano to emulate the keyboard and display over a serial line, doesn't properly emulate the real behaviour.

________________________________
mvk wrote:
Atari 2600 programmers had it easy with their TIA chip. It took care of an entire scan line while their software could do something else.
Well, my understanding is that it's not quite that simple. You have to make sure you're ready to update the TIA registers during the horizontal retrace interval between the end of displaying the current scan line and the start of display of the next, which usually means you're going to trigger the "wait for end of scanline" function at some point before the end and can do nothing during that time. And many games (such as Space Invaders) spent their time during the scan line changing the TIA registers to get more "players" on the screen.

But sure, still easier and more flexible than having to program the CPU to clock the bits out yourself. I look forward to your redesign of the Gigatron to be as advanced as the Atari 2600, albeit more than 40 years late. :-)
Curt J. Sampson - github.com/0cjs
User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: Looking for Baum's tiny assembler on Apple-1

Post by mvk »

cjs wrote:
As documented there, the character output translation is:

Code: Select all

$00-$1F  Print nothing (excepting $0D)
    $0D  (CR) Moves to the beginning of the next line.
$20-$5F  (space through underbar) prints given char
$60-$7F  (lower-case etc.) prints same as $40-$5F
         ($7F is not treated as a control character)
I have also documented the character ROM details, with links to the data sheet and ROM dumps, and notes on how the dumps differ from the actual ROM contents.

I ended up documenting this carefully because tebl's RC6502-Apple-1-Replica, which uses an Arduino Nano to emulate the keyboard and display over a serial line, doesn't properly emulate the real behaviour.
I also want to get such details right. I found that this original machine seems to treat a range of chars (presumably 0..$1F) all as CR.

Video: https://youtu.be/4l8i_xOBTPg?t=105
Screenshot 2020-02-29 at 00.47.51.png
It is a bit hard to read, but they're showing a variation of the test program from the Apple-1 User manual (which was broken BTW).

Code: Select all

0000 LDA #0
     TAX
     JSR $FFEF
     INX
     TXA
     JMP $0002
User avatar
cjs
Posts: 759
Joined: 01 Dec 2018
Location: Tokyo, Japan
Contact:

Re: Looking for Baum's tiny assembler on Apple-1

Post by cjs »

mvk wrote:
I also want to get such details right. I found that this original machine seems to treat a range of chars (presumably 0..$1F) all as CR.
Fascinating! That's clearly different from the Apple 1 in the video I referenced in my notes: https://youtu.be/wTgyll6IqJY?t=33 .

Fortunately the Apple-1 Operation Manual includes schematics for the board. I won't claim to understand the video circuitry well (or much at all, really :-P) but I do notice that at the right-hand side there is pretty clearly a set of gates that detects a CR ($0D, 0001101) on the character input lines RD1 through RD7. The output of this goes into an OR gate the other input of which is the AND of a couple of flip-flop outputs that I would bet good money is the end-of-line detection.

So I think I'm going to (somewhat tentatively) assume that the Apple 1 in that video you found is broken. The way to confirm this would be to properly confirm the operation described by the schematic and, ideally, confirm that several other real Apple 1s have the "only CR generates a new line" behaviour.

Regarding that test program (which I use myself), what's broken about it? I see that it could certainly JMP $0003 instead of $0002, but that's an optimization that would make no difference in speed anyway, since the limit there is the wait for the video circuitry to be ready for a new character (done in the $FFEF ECHO routine).
Curt J. Sampson - github.com/0cjs
User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: Looking for Baum's tiny assembler on Apple-1

Post by mvk »

mvk wrote:
they're showing a variation of the test program from the Apple-1 User manual (which was broken BTW).
cjs wrote:
Regarding that test program (which I use myself), what's broken about it?
In the Apple-1 User Manual it jumps back to the clearing of A:
Screenshot 2020-02-29 at 08.51.56.png
Chromatix
Posts: 1462
Joined: 21 May 2018

Re: Looking for Baum's tiny assembler on Apple-1

Post by Chromatix »

Indeed, the penultimate byte should be 42 hex, thereby looping to the JSR.
User avatar
cjs
Posts: 759
Joined: 01 Dec 2018
Location: Tokyo, Japan
Contact:

Re: Looking for Baum's tiny assembler on Apple-1

Post by cjs »

mvk wrote:
cjs wrote:
Regarding that test program (which I use myself), what's broken about it?
In the Apple-1 User Manual it jumps back to the clearing of A....
Ah. That must be an older version of the manual. I use this one, which doesn't have that error.

Sheesh, get up to date! It's like you're living in the past or something. :-)
Curt J. Sampson - github.com/0cjs
User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: Looking for Baum's tiny assembler on Apple-1

Post by mvk »

cjs wrote:
I use this one, which doesn't have that error.
I don't spot any improvement from what I posted.
Screenshot 2020-02-29 at 08.51.56.png
User avatar
cjs
Posts: 759
Joined: 01 Dec 2018
Location: Tokyo, Japan
Contact:

Re: Looking for Baum's tiny assembler on Apple-1

Post by cjs »

mvk wrote:
I don't spot any improvement from what I posted.
Ah, we're looking at different programs. The one I was talking about, and the one that is used in both videos linked above, is two pages earlier in the section titled "TEST PROGRAM."
Apple 1 Test Program.png
Curt J. Sampson - github.com/0cjs
User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: Looking for Baum's tiny assembler on Apple-1

Post by mvk »

cjs wrote:
Ah, we're looking at different programs. The one I was talking about, and the one that is used in both videos linked above, is two pages earlier in the section titled "TEST PROGRAM."
Ah, I'm learning something new every day. I agree that the 2012 video must be an anomaly. Anyway, the lower case chars in the $60-$7F block are now properly squashed as well:
40R.png
May I soon graduate from this platform and qualify for the Apple ][, or VCS 2600.
User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: Looking for Baum's tiny assembler on Apple-1

Post by mvk »

I added a usage text when starting the mini-assembler with EEER. This makes the program a tiny bit larger than 1K, stretching from $BE5 to $FFF now.

But the good thing is that now there's a second entry point that skips the usage text. This extra help code and text runs from $BE5 to $CA7. The mini-assembler itself from $CA8 to $FFF. Not a single byte got wasted, and we have two really nice entry points: EEER and ... BEER!

Just perfect.
Usage.png
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: Looking for Baum's tiny assembler on Apple-1

Post by barrym95838 »

https://rosettacode.org/wiki/99_Bottles ... 2_Assembly

Code: Select all

0BEE
:A2 63 D0 05 A0 00 20 01 0C A0 21 20 01
:0C CA 10 F3 A2 63 98 48 20 3C 0C 8A F0
:16 A0 AF 38 E9 0A C8 B0 FB 69 3A C0 B0
:F0 06 48 98 20 40 0C 68 A0 29 20 40 0C
:E0 01 D0 01 C8 20 3C 0C 68 C9 20 F0 0B
:48 20 3C 0C 68 A0 20 C9 21 F0 C7 A0 45
:B9 4C 0C C8 48 09 80 29 FF 20 EF FF 68
:10 F1 60 54 41 4B 45 20 4F 4E 45 20 44
:4F 57 4E 20 41 4E 44 20 50 41 53 53 20
:49 54 20 41 52 4F 55 4E 44 2C 8D 4E 4F
:20 4D 4F 52 45 20 42 4F 54 54 4C C5 53
:20 4F 46 20 42 45 45 D2 20 4F 4E 20 54
:48 45 20 57 41 4C CC 2E 8D 47 4F 20 54
:4F 20 54 48 45 20 53 54 4F 52 45 20 41
:4E 44 20 42 55 59 20 53 4F 4D 45 20 4D
:4F 52 45 2C 8D
BEER
[... might not look very tidy in 26 columns though ...]
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: Looking for Baum's tiny assembler on Apple-1

Post by barrym95838 »

I was shocked and saddened to read this morning of Marcel's untimely passing. Our world just lost a darn good engineer. My condolences to his family and (I'm sure) many friends.
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)
User avatar
Dr Jefyll
Posts: 3526
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: Looking for Baum's tiny assembler on Apple-1

Post by Dr Jefyll »

Marcel van Kervinck, aka mvk, creator of the Gigatron, was a member of this forum its sibling on Anycpu.org. Forum member monsonite posted a thoughtful In Memorium here.

-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
Post Reply