1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-06-10 08:29:37 +00:00

New examples: echo.mfk and calculator.mfk

This commit is contained in:
Karol Stasiak 2018-01-20 22:10:04 +01:00
parent 6f2a157de0
commit c8c6ec83fc
2 changed files with 42 additions and 0 deletions

View 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
View 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)
}
}