1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-06-01 09:41:36 +00:00
millfork/examples/crossplatform/calculator.mfk

39 lines
713 B
Plaintext
Raw Permalink Normal View History

import stdio
2018-12-19 21:32:55 +00:00
#if CBM_64
import c64_basic
#elseif CBM_264
import c264_basic
#elseif ZX_SPECTRUM || NEC_PC_88 || TRS80 || CBM_VIC
2018-12-19 21:32:55 +00:00
// no imports needed
#else
#error Unsupported platform
#endif
void main() {
word a
word b
2018-12-19 18:01:53 +00:00
putstrz("enter first number:"z)
new_line()
a = readword()
2018-12-19 18:01:53 +00:00
while errno != err_ok {
putstrz("that wasn't a number, try again:"z)
new_line()
a = readword()
}
putstrz("enter second number:{n}"z)
b = readword()
2018-12-19 18:01:53 +00:00
while errno != err_ok {
putstrz("that wasn't a number, try again:"z)
new_line()
b = readword()
}
2018-12-19 18:01:53 +00:00
putstrz("the sum is:"z)
new_line()
putword(a + b)
new_line()
}