9boot: fix 9bootiso

rearrange sub.c for putc(), readn(), memcmp(), memmove(), strchr() and strlen()
and uart to fit into the first 2K of the image.
This commit is contained in:
cinap_lenrek 2013-02-18 04:16:33 +01:00
parent c9c06dd8ba
commit 2fc31e9a70
3 changed files with 36 additions and 34 deletions

View file

@ -1,5 +1,6 @@
/* handy strings in l.s */
extern char origin[];
extern char uart;
extern char hex[];
extern char bootname[];

View file

@ -289,6 +289,9 @@ TEXT bootname(SB), $0
#endif
TEXT uart(SB), $0
BYTE $0xff
TEXT hex(SB), $0
BYTE $'0'; BYTE $'1'; BYTE $'2'; BYTE $'3';
BYTE $'4'; BYTE $'5'; BYTE $'6'; BYTE $'7';

View file

@ -3,8 +3,6 @@
#include "fns.h"
#include "mem.h"
int uart = -1;
void
putc(int c)
{
@ -24,25 +22,25 @@ print(char *s)
}
int
getc(void)
readn(void *f, void *data, int len)
{
int c;
uchar *p, *e;
c = kbdgetc();
if(c == 0 && uart != -1)
c = uartgetc(uart);
return c & 0x7f;
}
void
memset(void *dst, int v, int n)
{
uchar *d = dst;
while(n > 0){
*d++ = v;
n--;
putc(' ');
p = data;
e = p + len;
while(p < e){
if(((ulong)p & 0xF000) == 0){
putc('\b');
putc(hex[((ulong)p>>16)&0xF]);
}
if((len = read(f, p, e - p)) <= 0)
break;
p += len;
}
putc('\b');
return p - (uchar*)data;
}
void
@ -99,26 +97,26 @@ strchr(char *s, int c)
return nil;
}
int
readn(void *f, void *data, int len)
void
memset(void *dst, int v, int n)
{
uchar *p, *e;
uchar *d = dst;
putc(' ');
p = data;
e = p + len;
while(p < e){
if(((ulong)p & 0xF000) == 0){
putc('\b');
putc(hex[((ulong)p>>16)&0xF]);
}
if((len = read(f, p, e - p)) <= 0)
break;
p += len;
while(n > 0){
*d++ = v;
n--;
}
putc('\b');
}
return p - (uchar*)data;
int
getc(void)
{
int c;
c = kbdgetc();
if(c == 0 && uart != -1)
c = uartgetc(uart);
return c;
}
static int