diff --git a/plat/cpm/descr b/plat/cpm/descr index c023fc45c..1b2b43777 100644 --- a/plat/cpm/descr +++ b/plat/cpm/descr @@ -77,8 +77,8 @@ name led (.e:{TAIL}={PLATFORMDIR}/libem.a \ {PLATFORMDIR}/libsys.a \ {PLATFORMDIR}/libc.a \ - {PLATFORMDIR}/libsys.a \ {PLATFORMDIR}/libem.a \ + {PLATFORMDIR}/libsys.a \ {PLATFORMDIR}/libend.a) linker end diff --git a/plat/cpm/include/cpm.h b/plat/cpm/include/cpm.h index 3ad97b183..d9e370993 100644 --- a/plat/cpm/include/cpm.h +++ b/plat/cpm/include/cpm.h @@ -83,6 +83,9 @@ extern uint8_t cpm_read_random_safe(FCB* fcb); /* Extends cpm_ramtop over the CCP, for a little extra space. */ extern void cpm_overwrite_ccp(void); +/* Like cpm_printstring, but uses C-style strings terminated with a \0. */ +extern void cpm_printstring0(const char* s); + /* 0 */ extern void cpm_warmboot(void); /* 1 */ extern uint8_t cpm_conin(void); /* 2 */ extern void cpm_conout(uint8_t b); @@ -126,4 +129,8 @@ extern void cpm_overwrite_ccp(void); #define cpm_get_user() cpm_get_set_user(0xff) #define cpm_set_user(u) cpm_get_set_user(u) +extern uint8_t bios_conin(void); +extern uint8_t bios_const(void); +extern void bios_conout(uint8_t c); + #endif diff --git a/plat/cpm/libsys/bios_conin.s b/plat/cpm/libsys/bios_conin.s new file mode 100644 index 000000000..98ba4d67c --- /dev/null +++ b/plat/cpm/libsys/bios_conin.s @@ -0,0 +1,15 @@ +# +#include "asm.h" + +.define _bios_conin +_bios_conin: + lhld 1 + lxi d, 6 + dad d + push b + call .pchl + pop b + mov e, a + mvi d, 0 + ret + diff --git a/plat/cpm/libsys/bios_conout.s b/plat/cpm/libsys/bios_conout.s new file mode 100644 index 000000000..6562d3aa6 --- /dev/null +++ b/plat/cpm/libsys/bios_conout.s @@ -0,0 +1,21 @@ +# +#include "asm.h" + +.define _bios_conout +_bios_conout: + pop h ! pop return address + pop d ! pop parameter into DE + push d + push h + + push b + mov c, e + + lhld 1 + lxi d, 9 + dad d + call .pchl + + pop b + ret + diff --git a/plat/cpm/libsys/bios_const.s b/plat/cpm/libsys/bios_const.s new file mode 100644 index 000000000..c8036be33 --- /dev/null +++ b/plat/cpm/libsys/bios_const.s @@ -0,0 +1,16 @@ +# +#include "asm.h" + +.define _bios_const +_bios_const: + lhld 1 + lxi d, 3 + dad d + push b + call .pchl + pop b + mov e, a + mvi d, 0 + ret + + diff --git a/plat/cpm/libsys/close.c b/plat/cpm/libsys/close.c index be5ae0ec4..81d2d5135 100644 --- a/plat/cpm/libsys/close.c +++ b/plat/cpm/libsys/close.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "cpmsys.h" diff --git a/plat/cpm/libsys/cpm_printstring0.s b/plat/cpm/libsys/cpm_printstring0.s new file mode 100644 index 000000000..96d358123 --- /dev/null +++ b/plat/cpm/libsys/cpm_printstring0.s @@ -0,0 +1,27 @@ +# +#include "asm.h" + +! Prints a \0-terminated string. + +.define _cpm_printstring0 +_cpm_printstring0: + pop h ! pop return address + pop d ! pop parameter (possibly junk) + push d + push h + +.1: + ldax d ! fetch byte + ora a + rz ! exit if zero + inx d + + push b ! save FP as the BDOS will corrupt it + push d + mov e, a + mvi c, 2 ! conout + call 0x0005 + pop d + pop b + + jmp .1