Skip to content

Instantly share code, notes, and snippets.

@WitherOrNot
Last active April 30, 2019 11:34
Show Gist options
  • Save WitherOrNot/3903e1458f81b4cbc2c6e8ae010886ef to your computer and use it in GitHub Desktop.
Save WitherOrNot/3903e1458f81b4cbc2c6e8ae010886ef to your computer and use it in GitHub Desktop.
Krusader ASM decompilation of the Woz Monitor interface from the Apple I
xaml .= $24
xamh .= $25
stl .= $26
sth .= $27
l .= $28
h .= $29
ysav .= $2a
mode .= $2b
in .= $0200
kbd .= $d010
kbdcr .= $d011
dsp .= $d012
dspcr .= $d013
reset cld
cli
ldy #$7f
sty dsp
lda #$a7
sta kbdcr
sta dspcr
notcr cmp #$df
beq bkspce
cmp #$9b
beq escape
iny
bpl nxtchr
escape lda #$dc
jsr echo
getlne lda #$8d
jsr echo
ldy #$01
bkspce dey
bmi getlne
nxtchr lda kbdcr
bpl nxtchr
lda kbd
sta in,y
jsr echo
cmp #$8d
bne notcr
ldy #$ff
lda #$00
tax
setstr asl
setmde sta mode
blskip iny
nxtitm lda in,y
cmp #$8d
beq getlne
cmp #$ae
bcc blskip
beq setmde
cmp #$ba
beq setstr
cmp #$d2
beq run
stx l
stx h
sty ysav
nxthex lda in,y
eor #$b0
cmp #$0a
bcc dig
adc #$88
cmp #$fa
bcc nothex
dig asl
asl
asl
asl
ldx #$04
hxshft asl
rol l
rol h
dex
bne hxshft
iny
bne nxthex
nothex cpy ysav
beq escape
bit mode
bvc notstr
lda l
sta (stl,x)
inc stl
bne nxtitm
inc sth
tnxitm jmp nxtitm
run jmp (xaml)
notstr bmi xamnxt
ldx #$02
setadr lda l-1,x
sta stl-1,x
sta xaml-1,x
dex
bne setadr
nxtpnt bne prdata
lda #$8d
jsr echo
lda xamh
jsr prbyte
lda #$ba
jsr echo
prdata lda #$a0
jsr echo
lda (xaml,x)
jsr prbyte
xamnxt stx mode
lda xaml
cmp l
lda xamh
sbc h
bcs tnxitm
inc xaml
bne modchk
inc xamh
modchk lda xaml
and #$07
bpl nxtpnt
prbyte pha
lsr
lsr
lsr
lsr
jsr prhex
pla
prhex and #$0f
ora #$b0
cmp #$ba
bcc echo
adc #$06
echo bit dsp
bmi echo
sta dsp
rts
brk
brk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment