Site Tools


This is an old revision of the document!



Warning: Declaration of syntax_plugin_miniblog_comment::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /homepages/45/d222496870/htdocs/apple2.guidero.us/lib/plugins/miniblog/syntax/comment.php on line 53

Warning: Declaration of syntax_plugin_miniblog_comment::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /homepages/45/d222496870/htdocs/apple2.guidero.us/lib/plugins/miniblog/syntax/comment.php on line 53

Warning: Declaration of syntax_plugin_miniblog_entry::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /homepages/45/d222496870/htdocs/apple2.guidero.us/lib/plugins/miniblog/syntax/entry.php on line 121

Warning: Declaration of syntax_plugin_miniblog_entry::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /homepages/45/d222496870/htdocs/apple2.guidero.us/lib/plugins/miniblog/syntax/entry.php on line 121

LC //e Card - Weird Stuff

Weird Beep

The //e Card is able to replace the standard Apple II beep with a Macintosh sound. The means by which this is accomplished is quite interesting.

The routine at $fbdd (BELL1) is

  .org $fbdd
  ; this code replaces the .1 second delay
  .byte $02  ; two byte NOP in 65C02
  .byte $01  ; should be ignored by CPU
  rts
  nop
  nop
  ; remaining code matches the original //e code and calling $fbe2
  ; will produce a beep, at the wrong pitch if the card is in fast mode.

$02 is a two-byte NOP on the 65C02. Interestingly enough, when the processor on the Card executes the sequence $02 $01, it produces the configured beep sound.

Try this in the monitor:

*300:02 01 02 01 02 01 60
*300G

Three beep sounds!

So this must be part of the magic that interfaces the card to the host Macintosh. How very very interesting.

Other Weird Instructions

The preceding find led me to search through the monitor ROM to look for other unusual instruction sequences.

Here is what I found:

In Routine Address Code Function
PWRUP $FAB4 $02 $02 ? (appears where standard //e has LDA #$C8 at beginning of boot slot search)
PWRUP $FAC0 $02 $03 ? (appears where standard //e has CMP #$C0 after decrmenting the slot pointer)
APPLEII $FB63 $02 $04 Display copyright message on screen, disappears if screen scrolls.
BELL1 $FBDD $02 $01 Play system bell sound.
GETLN1 $FD78 $02 $06 Key translation called right after rdchar. If A reg has DELETE, converts it to .
$02 $05 Not found in firmware, yet, but presumably this exists.

Hypothesis for $02 $02 and $02 $03:

$02 $02 loads the accumulator with $Cn+1 where n is the slot selected in the control panel, or $C8 for “Scan”.

$02 $03 checks the accumulator and depending on the control panel setting either allows the loop to continue (scan and A > $C0), drops to BASIC (scan and A = $C0), or prints the “unable to boot” message (specific slot and A != $Cn).

The Key Translation and the A register

Get to the monitor in your //e Card and try this:

*!
!300:jsr fd35
! nop
! nop
! jmp fdda
!
*300G

FD35 is the RDCHAR routine, FDDA is the print byte routine. This routine reads a keypress and outputs its hex code. Run it a few times to convince yourself there is no funny business. Run it a final time and press DELETE.

*300G
FF    (appears after pressing delete)
*

FF is exactly what we expect to see with the Apple II delete key.

Now want to see something interesting? Change the NOPs to $02 $06 and run it again. Try a few keys, then try it with DELETE.

*303:02 06
*300G
88    (appears after pressing delete)
*

88 is the code for the left arrow key. That's some serious magic, and in two bytes the Card converts DELETE to .

Try this sequence of instructions:

]HOME
]CALL -151
*300:02 04 60
*300G

Hit the left arrow a bunch of times until the display scrolls. POOF!