mirror of
https://github.com/KarolS/millfork.git
synced 2024-08-27 14:29:40 +00:00
62 lines
1.0 KiB
Plaintext
62 lines
1.0 KiB
Plaintext
// target-independent standard I/O routines
|
|
|
|
import string
|
|
#if ZX_SPECTRUM
|
|
import stdio_zxspectrum
|
|
#endif
|
|
|
|
|
|
#if not(ZX_SPECTRUM)
|
|
|
|
void putstr(pointer str, byte len) {
|
|
byte index
|
|
index = 0
|
|
while (index != len) {
|
|
putchar(str[index])
|
|
index += 1
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if NEC_PC_88
|
|
asm void putstrz(pointer hl) @$5550 extern
|
|
#endif
|
|
|
|
#if not(ZX_SPECTRUM) && not(NEC_PC_88)
|
|
void putstrz(pointer str) {
|
|
byte index
|
|
index = 0
|
|
while str[index] != 0 {
|
|
putchar(str[index])
|
|
index += 1
|
|
}
|
|
}
|
|
|
|
#endif
|
|
|
|
void putword(word w) {
|
|
byte digits
|
|
byte lastdigit
|
|
digits = 0
|
|
word mask
|
|
for mask:[40000,4000,400,40,4] {
|
|
lastdigit = 0
|
|
while w >= mask {
|
|
w -= mask
|
|
lastdigit += 4
|
|
}
|
|
mask >>= 2
|
|
while w >= mask {
|
|
w -= mask
|
|
lastdigit += 1
|
|
}
|
|
if digits != 0 || lastdigit != 0 {
|
|
putchar('0' + lastdigit)
|
|
digits += 1
|
|
}
|
|
}
|
|
if digits == 0 {
|
|
putchar('0')
|
|
}
|
|
}
|