1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-11-05 00:05:44 +00:00
millfork/examples/c64/calculator.mfk
2018-01-20 22:10:04 +01:00

32 lines
600 B
Plaintext

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