mirror of
https://github.com/KarolS/millfork.git
synced 2025-02-11 18:30:52 +00:00
New examples: echo.mfk and calculator.mfk
This commit is contained in:
parent
6f2a157de0
commit
c8c6ec83fc
31
examples/c64/calculator.mfk
Normal file
31
examples/c64/calculator.mfk
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import stdio
|
||||||
|
import c64_basic
|
||||||
|
|
||||||
|
array text1 = [ "enter first number:" petscii, 13, 0 ]
|
||||||
|
array text2 = [ "enter second number:" petscii, 13, 0 ]
|
||||||
|
array text3 = [ "the sum is:" petscii, 13, 0 ]
|
||||||
|
array texte = [ "that wasn't a number, try again:" petscii, 13, 0 ]
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
word a
|
||||||
|
word b
|
||||||
|
|
||||||
|
putstrz(text1)
|
||||||
|
a = readword()
|
||||||
|
while readword_err != 0 {
|
||||||
|
putstrz(texte)
|
||||||
|
a = readword()
|
||||||
|
}
|
||||||
|
|
||||||
|
putstrz(text2)
|
||||||
|
b = readword()
|
||||||
|
while readword_err != 0 {
|
||||||
|
putstrz(texte)
|
||||||
|
b = readword()
|
||||||
|
}
|
||||||
|
|
||||||
|
putstrz(text3)
|
||||||
|
a += b
|
||||||
|
putword(a)
|
||||||
|
putchar(13)
|
||||||
|
}
|
11
examples/c64/echo.mfk
Normal file
11
examples/c64/echo.mfk
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import c64_basic
|
||||||
|
import stdio
|
||||||
|
void main() {
|
||||||
|
while true {
|
||||||
|
readline()
|
||||||
|
// empty line is read as a single space
|
||||||
|
if readline_out[0] == 32 && readline_out[1] == 0 { return }
|
||||||
|
putstrz(readline_out)
|
||||||
|
putchar(13)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user