22 lines
902 B
NASM
22 lines
902 B
NASM
; CHOICE.ASM -- Press 1 for E (Earth) or 2 for M (Mars).
|
|
POLCAT equ $a000 ; Keyboard polling vector. Returns a key in A.
|
|
CHROUT equ $a002 ; Character-output vector.
|
|
CR equ 13
|
|
|
|
org $3f00
|
|
start lda #'? ; Show that the program is waiting for a key.
|
|
jsr [CHROUT]
|
|
choose jsr [POLCAT] ; Check the keyboard without waiting for Enter.
|
|
cmpa #'1
|
|
beq earth ; A matching comparison sets the Z flag.
|
|
cmpa #'2
|
|
bne choose ; No key or an unexpected key: try again.
|
|
mars lda #'M
|
|
bra printit ; Skip the Earth path.
|
|
earth lda #'E
|
|
printit jsr [CHROUT] ; Both paths meet here with one letter in A.
|
|
lda #CR
|
|
jsr [CHROUT]
|
|
rts
|
|
end start
|