marcie/examples/greet.mas

92 lines
1.2 KiB
Plaintext

org 100
// ask the user their name
askLoopStart, loadi questionCounter
skipcond 800
jump askLoopEnd
output
load questionCounter
add one
store questionCounter
jump askLoopStart
askLoopEnd, clear
// read in their response until newline
readLoopStart, input
storei responseCounter
subt newline
skipcond 800
jump readLoopEnd
load responseCounter
add one
store responseCounter
jump readLoopStart
readLoopEnd, clear
// greet the user
greetLoopStart, loadi greetingCounter
skipcond 800
jump greetLoopEnd
output
load greetingCounter
add one
store greetingCounter
jump greetLoopStart
greetLoopEnd, clear
// play back response
clear
store responseCounter
playbackLoopStart, loadi responseCounter
skipcond 800
jump playbackLoopEnd
output
load responseCounter
add one
store responseCounter
jump playbackLoopStart
playbackLoopEnd, clear
halt
one, hex 1
newline, hex 0A
exclamation, chr !
questionCounter, adr question
question, chr W
chr h
chr a
chr t
hex 20
chr i
chr s
hex 20
chr y
chr o
chr u
chr r
hex 20
chr n
chr a
chr m
chr e
chr ?
hex 0A
hex 00
greetingCounter, adr greeting
greeting, chr H
chr e
chr l
chr l
chr o
chr ,
hex 20
hex 00
responseCounter, hex 0