mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-23 00:14:25 +00:00
42 lines
809 B
C
42 lines
809 B
C
|
|
#include "portab.h"
|
|
#include "osif.h"
|
|
|
|
|
|
BYTE *__prtshort(pobj, pbuf, base, signed, digs)
|
|
WORD *pobj;
|
|
BYTE **pbuf;
|
|
WORD base;
|
|
WORD signed;
|
|
|
|
BYTE *digs;
|
|
{
|
|
/* 05/27/83 - changed to do divide in short (HY) */
|
|
/* 08/11/83 - changed to handle 68K arg passing (as longs) (WHF) */
|
|
|
|
REG UWORD n;
|
|
REG BYTE *p;
|
|
REG WORD b;
|
|
#if HILO /*--------------------------*/
|
|
LONG ln; /* declare a placeholder */
|
|
/* */
|
|
ln = *pobj; /* assign arg to long */
|
|
n = ln & 0xFFFFL; /* then to WORD */
|
|
#else /*--------------------------*/
|
|
n = *pobj; /* assign arg to WORD */
|
|
#endif /*--------------------------*/
|
|
p = digs;
|
|
b = base;
|
|
if (signed)
|
|
if ((int)n < 0) {
|
|
n = -n;
|
|
*(*pbuf)++ = '-';
|
|
}
|
|
while (n != 0)
|
|
{
|
|
*p++ = n % b;
|
|
n = n / b;
|
|
}
|
|
return (p);
|
|
}
|