Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Apple /// monitorisms

6 views
Skip to first unread message

schmidtd

unread,
May 30, 2008, 2:30:48 PM5/30/08
to
One of the toughest things in moving from an Apple II development
environment to an Apple /// for me was the lack of a way to break into
a running program, debug it via the monitor, and re-start it. I found
buried in the very short-lived "/// Cheers!" disk-magazine (http://
www.callapple.org/magazines/cheers/summer_1985.html) the answer to all
my monitor questions. Excerpted from an article by Brian Matthews,
for your consideration:

First, here is a little routine that you want to run either as part of
your assembler code or execute from BASIC. It essentially fixes up
the equivalent of the reset vector to jump into the monitor, while
preserving the way back to where you were...

; Points SOS’ NMI vector at the debug routine in SOS. It normally
; points at an RTS so that hitting RESET doesn’t do anything. This
; changes it so when you hit RESET, SOS enters a routine that saves
all the
; important stuff, and jumps into the built in monitor. To reenter
SOS, do
; a 198CG from the monitor. Known to work through SOS 1.3.
lda $1904 ; Grab low byte of NMI vector
sec ; Make sure that carry is set.
sbc #$07 ; Fall back 7 bytes from the
sta $1911 ; byte currently pointed to
lda $1905 ; (an RTS), and store this in
sbc #$00 ; the NMI JMP instruction.
sta $1912 ; Unwrap the high byte.
rts ; All done!

After running this little routine (once), you can hit the reset key
(not ctrl-reset!) to break into the monitor. You can hit Escape-S to
clear the screen, hit space bar to get out of escape mode, then do
whatever you want to in the monitor. Then, a 198CG command will send
you right back to the place you were when you hit reset! Voila,
almost as good as an Apple II.

Now, the monitor commands themselves...
Command:
Meaning:

ADDR1
Dump the byte at ADDR1.

ADDR1.ADDR2
Dump the bytes between ADDR1 and ADDR2.

Return
Dump the next line of bytes.

ADDR1<ADDR2.ADDR3M
Move the bytes at ADDR2 through ADDR3 into ADDR1

ADDR1<ADDR2.ADDR3V
Verify that the bytes between ADDR2 and ADDR3 are the same as those at
ADDR1.

BYTE1<ADDR2.ADDR3S
Search for BYTE1 between ADDR2 and ADDR3.

BLOCK<ADDR2.ADDR3R
Read the blocks starting at BLOCK into ADDR2 through ADDR3.

BLOCK<ADDR2.ADDR3W
Write to the blocks starting at BLOCK from ADDR2 through ADDR3.

ADDR1:BYTE1 BYTE2...
Store BYTE1 at location ADDR1, BYTE2 at location ADDR1 + 1, etc.

ADDR1:’Text’
Store the Text into memory starting at ADDR1 with the high bit of each
byte clear.

ADDR1:”Text”
Store the Text into memory starting at ADDR1with the high bit if each
byte set.

U
JSR to location $3F8.

Happy ///ing!

David Schmenk

unread,
May 31, 2008, 10:16:28 AM5/31/08
to

Dave-

Thanks for keeping us updated (and also be able to search on this
later). I'm making pretty good progress on my Java VM, with the
eventual goal of getting it on the ///. Having you pave the way sure
makes it easier! I'm looking at all that memory with anticip-p-p-p-ation.

Dave...

0 new messages