progress on all fronts
[com32] / src / loader.asm
index d31c6a8..26a0743 100644 (file)
@@ -8,6 +8,7 @@
        extern boot_mem_map_size
 
 %include 'macros.inc'
+%define CON_SERIAL
 
        [bits 16]
        global _start
@@ -34,7 +35,9 @@ _start:
        jmp exit
 
 .notvm86:
+%ifdef CON_SERIAL
        call setup_serial
+%endif
        call enable_a20
        call detect_memory
 
@@ -213,6 +216,8 @@ kbc_wait_write:
 ; ---------------------- memory detection -----------------------
 
 detect_memory:
+       mov si, memdet_detram
+       call printstr
        mov si, memdet_e820_msg
        call printstr
        call detect_mem_e820
@@ -220,6 +225,8 @@ detect_memory:
        mov si, str_fail
        call printstr
 
+       mov si, memdet_detram
+       call printstr
        mov si, memdet_e801_msg
        call printstr
        call detect_mem_e801
@@ -227,6 +234,8 @@ detect_memory:
        mov si, str_fail
        call printstr
 
+       mov si, memdet_detram
+       call printstr
        mov esi, memdet_88_msg
        call printstr
        call detect_mem_88
@@ -234,6 +243,8 @@ detect_memory:
        mov esi, str_fail
        call printstr
 
+       mov si, memdet_detram
+       call printstr
        mov esi, memdet_cmos_msg
        call printstr
        call detect_mem_cmos
@@ -252,10 +263,11 @@ detect_memory:
 str_ok db 'OK',10,0
 str_fail db 'failed',10,0
 memdet_fail_msg db 'Failed to detect available memory!',10,0
-memdet_e820_msg db 'Detecting RAM (BIOS 15h/0xe820)... ',0
-memdet_e801_msg db 'Detecting RAM (BIOS 15h/0xe801)... ',0
-memdet_88_msg  db 'Detecting RAM (BIOS 15h/0x88, max 64mb)... ',0
-memdet_cmos_msg db 'Detecting RAM (CMOS)...',0
+memdet_detram  db 'Detecting RAM '
+memdet_e820_msg db '(BIOS 15h/0xe820)... ',0
+memdet_e801_msg db '(BIOS 15h/0xe801)... ',0
+memdet_88_msg  db '(BIOS 15h/0x88, max 64mb)... ',0
+memdet_cmos_msg db '(CMOS)...',0
 
        ; detect extended memory using BIOS call 15h/e820
 detect_mem_e820:
@@ -424,6 +436,7 @@ mem_map times 128 db 0
 
 ; ----------------------- serial console ------------------------
 
+%ifdef CON_SERIAL
 setup_serial:
        ; set clock divisor
        mov dx, UART_BASE + 3   ; LCTL
@@ -461,6 +474,9 @@ ser_printstr:
        jmp ser_printstr
 .end:  ret
 
+%endif ; def CON_SERIAL
+
+
 printstr:
        lodsb
        test al, al
@@ -468,38 +484,24 @@ printstr:
        cmp al, 10      ; check for line-feed and insert CR before it
        jnz .nolf
        push ax
+%ifdef CON_SERIAL
        mov al, 13
        call ser_putchar
+%endif
        mov dl, 13
        mov ah, 2
        int 21h
        pop ax
-.nolf: call ser_putchar
+.nolf:
+%ifdef CON_SERIAL
+       call ser_putchar
+%endif
        mov ah, 2
        mov dl, al
        int 21h
        jmp printstr
 .end:  ret
 
-       [bits 32]
-ser_putchar_pmode:
-       SER_PUTCHAR
-       ret
-
-ser_putstr_pmode:
-       lodsb
-       test al, al
-       jz .end
-       cmp al, 10
-       jnz .nolf
-       push ax
-       mov al, 13
-       call ser_putchar_pmode
-       pop ax
-.nolf: call ser_putchar_pmode
-       jmp ser_putstr_pmode
-.end:  ret
-       
 
        align 4
 enterpm dd 0xbad00d    ; space for linear address for far jump to pmode