diff options
Diffstat (limited to 'libc/bios')
-rw-r--r-- | libc/bios/Makefile | 35 | ||||
-rw-r--r-- | libc/bios/bios.c | 12 | ||||
-rw-r--r-- | libc/bios/bios_vid.c | 24 |
3 files changed, 52 insertions, 19 deletions
diff --git a/libc/bios/Makefile b/libc/bios/Makefile index 934ec07..5fcc964 100644 --- a/libc/bios/Makefile +++ b/libc/bios/Makefile @@ -2,29 +2,34 @@ # This file is part of the Linux-8086 C library and is distributed # under the GNU Library General Public License. -TOP=.. -include $(TOP)/Make.defs - ifeq ($(LIB_OS),BIOS) ASRC=bios.c AOBJ=bios_start.o bios_isatty.o \ bios_open.o bios_read.o bios_write.o bios_lseek.o bios_close.o BSRC=bios_vid.c -BOBJ=bios_putc.o bios_getc.o bios_rdline.o -endif +BOBJ=bios_putc.o bios_getc.o bios_khit.o bios_rdline.o -all: $(AOBJ) $(BOBJ) +OBJ=$(AOBJ) $(BOBJ) -libc.a: $(AOBJ) $(BOBJ) - ar r ../$(LIBC) $(AOBJ) $(BOBJ) - @touch libc.a +CFLAGS=$(ARCH) $(CCFLAGS) $(DEFS) -clean: - rm -f *.o libc.a +all: $(LIBC)($(OBJ)) + @: -$(AOBJ): $(ASRC) - $(CC) $(CFLAGS) -c -DL_$* -o $@ $(ASRC) +$(LIBC)($(AOBJ)): $(ASRC) + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(AR) $(ARFLAGS) $@ $*.o + $(RM) $*.o -$(BOBJ): $(BSRC) - $(CC) $(CFLAGS) -c -DL_$* -o $@ $(BSRC) +$(LIBC)($(BOBJ)): $(BSRC) + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(AR) $(ARFLAGS) $@ $*.o + $(RM) $*.o +else +all: + @: +endif + +clean: + rm -f *.o libc.a diff --git a/libc/bios/bios.c b/libc/bios/bios.c index 3059fd9..a8d2079 100644 --- a/libc/bios/bios.c +++ b/libc/bios/bios.c @@ -26,6 +26,8 @@ defarg: .word boot_str, 0 boot_str: .asciz "boot" +loop_save: + .word 0 .text export ___cstartup ! Crt0 startup @@ -54,15 +56,17 @@ zap_bss: ! Clear the BSS mov ax,#1 push ax - mov si,#auto_start ! Pointer to first autostart function + mov bx,#auto_start ! Pointer to first autostart function auto_run: - mov bx,[si] + mov [loop_save],bx + mov bx,[bx] test bx,bx jz no_entry call bx ! Call the function no_entry: - inc si ! SI at next - inc si + mov bx,[loop_save] + inc bx ! next + inc bx jmp auto_run ! And round for the next. call_exit: ! Last item called by above. diff --git a/libc/bios/bios_vid.c b/libc/bios/bios_vid.c index 0d891a0..db2e91d 100644 --- a/libc/bios/bios_vid.c +++ b/libc/bios/bios_vid.c @@ -84,6 +84,9 @@ static int ctrl = 0; default: asm_putc(c); break; + case CTRL('I'): + asm_putc(' '); /* Only some BIOS's have this, so play safe */ + break; case CTRL('L'): asm_cpos(0,0); asm_cls(); @@ -424,6 +427,7 @@ int len; return 1; } ch &= 0x7F; + if( ch == '\033' ) ch=3; /* ESC= Interrupt too */ } if( ch == '\r' ) { @@ -460,6 +464,26 @@ bios_getc() /****************************************************************************/ +#ifdef L_bios_khit +bios_khit() +{ +#asm + mov ah,#1 + int $16 + jz nokey + cmp ax,#0 + jnz dort + mov ax,#3 +dort: + ret +nokey: + xor ax,ax +#endasm +} +#endif + +/****************************************************************************/ + #endif #endif #endif |