Woz Monitor ported

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice.
Post Reply
User avatar
marcelk
Posts: 98
Joined: 13 May 2018, 08:26

Woz Monitor ported

Post by marcelk » 12 Jun 2018, 18:09

I've ported the Apple-1 built-in monitor program: WozMon.gcl

The original is 254 bytes, my version is $254 bytes :lol:. About half of that is for terminal output (character printing). The Apple-1 had dedicated hardware for that...

IMG_3712.jpg
IMG_3712.jpg (223.41 KiB) Viewed 363 times

This is an extension of the earlier Terminal.gcl program that just echoed typed characters to the screen. Now you can inspect memory locations, write to them and execute code. Original WozMon tutorials should be valid as I tried to deviate as little as possible from the original: the differences are essentially cosmetic or slightly improved usability. You will need such tutorial to understand what is going on, because the command interface is VERY TERSE. I could't figure it out by myself in the Apple-1 emulators. Once you "get" it, it is pretty easy.

I'm not aware of an emulator that can simulate an ASCII keyboard yet, so try it on hardware.

Update: I have integrated it also as the terminal application in the Arduino interface sketch. With that a hooked-up keyboard can inject WozMon at a single keystroke. The sketch is renamed as "BabelFish" because that better conveys what it does: translating all kinds of signals. And "LoaderTest" was a boring name to begin with...

monsonite
Posts: 7
Joined: 17 May 2018, 07:17

Re: Woz Monitor ported

Post by monsonite » 13 Jun 2018, 06:56

Excellent work Marcel,

I'm looking forward to trying this.

User avatar
marcelk
Posts: 98
Joined: 13 May 2018, 08:26

Re: Woz Monitor ported

Post by marcelk » 15 Jun 2018, 06:59

Some magic spells...

Double the LED sequence speed:

Code: Select all

2f:5
Very slow LED sequence speed:

Code: Select all

2f:ff
Momentarily switch off the LEDs (until the sequencer makes its next step):

Code: Select all

14:0
Replay the startup sound for 2 seconds (120 frames):

Code: Select all

2c:78
Shift screen 8 pixels to the right:

Code: Select all

101:f8
Shift bottom half of screen 8 pixels to the right:

Code: Select all

177:f8
Restart Woz monitor:

Code: Select all

200R
Continuously blink a pixel:

Code: Select all

500
:11 0 8 
:2b 50 f0 50 e3 1 90 3R
blinker.png
blinker.png (108.34 KiB) Viewed 288 times

User avatar
marcelk
Posts: 98
Joined: 13 May 2018, 08:26

Re: Woz Monitor ported

Post by marcelk » 28 Sep 2018, 12:33

Someone inquired about built-in routines you can call from the WozMon. I figure I should share my reply here:

Like the Apple-1, the Gigatron’s RAM is in a virgin state after starting WozMon. However, typical tutorials refer to routines present in the monitor itself, and there some similar ones in our version:

0216 PrintChar — prints character in vAC
0266 CNewLine — conditional newline (newline if not already at start of line)
026b NewLine — unconditional newline (simply skips the test)
02b3 PrintByte — print hex value of byte in vAC

Unlike the original WozMon, you can actually call these safely directly with the 'R' command. But although you can call them like that, it isn’t of much use it self. You can better use them from a vCPU assembly program you toggle in first.

The CALL instruction is 0xCF, and it reads the address from a zero page variable.
PrintChar is in 0x38/39
CNewline is in 0x3a/3b
Newline doesn’t have an variable set by WozMon
PrintByte is in 0x3c/3d

You can check that as follows:

PastedGraphic-2.png
PastedGraphic-2.png (16.82 KiB) Viewed 111 times

Example program I just made up:

Code: Select all

0500 75       // PUSH
 0501 CF 3A    // CALL CNewLine
 0503 59 61    // LDI  0x61 (‘a')
 0505 2B 50    // STW  0x50
 0507 21 50    // LDW  0x50
 0509 CF 38    // CALL PrintChar
 050B 93 50    // INC  0x50
 050D 21 50    // LDW  0x50
 050F 8c 7b    // XORI 0x7b (‘z’+1)
 0511 35 72 05 // BNE  0x0507
 0514 63       // POP
 0515 FF       // RET
To key this in and run it, you do:

PastedGraphic-1.png
PastedGraphic-1.png (38.58 KiB) Viewed 111 times

This stuff is really going back to 1976..

Post Reply