commit 3a5c7209e5fef1733e6df145ea53cce91f172d07 from: Benjamin Stürz date: Sat Oct 05 18:50:10 2024 UTC add puthex*() and print conv/xm memory commit - 6b04638f5bbbc03cf5848b9d69c8ffe6204048e0 commit + 3a5c7209e5fef1733e6df145ea53cce91f172d07 blob - e184e119eff712798b5cdba15c927da1884d518d blob + 7d9b82b4da198386e8c54996466ff4e065286273 --- sys/kernel.asm +++ sys/kernel.asm @@ -87,6 +87,21 @@ _entry: .reloadcs: lea bp, [hello] call puts + + lea bp, [convmsg] + call puts + mov ax, word [convmem] + call puthexw + lea bp, [kbmsg] + call puts + + lea bp, [xmmsg] + call puts + mov ax, word [highmem] + call puthexw + lea bp, [kbmsg] + call puts + jmp $ error: @@ -96,6 +111,34 @@ error: hlt jmp $ +; ax - value +puthexw: + push ax + mov al, ah + call puthexb + pop ax + jmp puthexb + +; al - value +puthexb: + push ax + shr al, 4 + call puthexch + pop ax + and al, 0xf + jmp puthexch + +; al - hex digit +puthexch: + cmp al, 10 + jae .hex + add al, '0' + jmp putchar + +.hex: + add al, 'a' - 10 + jmp putchar + ; al - char putchar: mov bx, 0x18 @@ -179,6 +222,12 @@ hello: db "Hello World", 10, 0 errstr: db "Error", 10, 0 +convmsg: + db "Conventional memory: 0x", 0 +xmmsg: + db "Extended memory: 0x", 0 +kbmsg: + db " KB", 10, 0 align 2 idtr: