1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00

Improvements with nasm preproc

This commit is contained in:
Adrien Bourmault 2019-01-17 14:09:08 +01:00
parent b7078be3af
commit fa0a8f6b4b
6 changed files with 34 additions and 22 deletions

View File

@ -34,7 +34,7 @@
;; GLOBAL DATA ;; GLOBAL DATA
Bootdrv db 0 Bootdrv db 0
end db "[End of Sector]", 0x0A, 0x0D, 0x0 ended db "[End of Sector]", 0x0A, 0x0A, 0x0D, 0x0
buffer: times 513 db "_" buffer: times 513 db "_"
;; TEXT ;; TEXT
@ -124,12 +124,19 @@ still_going:
mov dx, 0x1f0 ; Data port - data comes in and out of here. mov dx, 0x1f0 ; Data port - data comes in and out of here.
rep insw rep insw
pop rdi pop rdi
%ifdef DEBUG
mov bl, 0x0F mov bl, 0x0F
mov esi, buffer mov esi, buffer
call dump call dump
mov bl, 0x0A mov bl, 0x0A
mov esi, end mov esi, ended
call write call write
add qword [NextTRAM], 120 ; Cursor moving : 1120 = 80 * 2 * 7 lignes
%else
mov bl, 0x0A
mov esi, Pass
call write
%endif
pop rdx pop rdx
pop rcx pop rcx
pop rbx pop rbx

View File

@ -93,9 +93,9 @@ write:
dump: dump:
;-----------------------------------------------------------------------; ;-----------------------------------------------------------------------;
; x64/LM Dump Printing Functions ; ; x64/LM Dump 512 bytes of a buffer ;
; bl : color code ; ; bl : color code ;
; esi : string address ; ; esi : buffer address ;
;-----------------------------------------------------------------------; ;-----------------------------------------------------------------------;
mov edi, [NextTRAM] ; TRAM ADDRESS mov edi, [NextTRAM] ; TRAM ADDRESS
push rsi push rsi
@ -107,10 +107,9 @@ dump:
stosb ; text subpixel stosb ; text subpixel
mov al, bl mov al, bl
stosb ; color subpixel stosb ; color subpixel
add qword [NextTRAM], 0x2 ; Cursor moving
add qword [VGA_X], 0x2 ; coord + 2 because 2 subpixels
loop .pLoop loop .pLoop
pop rcx pop rcx
pop rdi pop rdi
pop rsi pop rsi
add qword [NextTRAM], 1000 ; Cursor moving : 1120 = 80 * 2 * 7 lignes
ret ret

View File

@ -8,6 +8,8 @@
; (x86_64 architecture only) ; ; (x86_64 architecture only) ;
;=----------------------------------------------------------------------------=; ;=----------------------------------------------------------------------------=;
%define DEBUG
[BITS 16] [BITS 16]
[ORG 0x1000] [ORG 0x1000]
@ -161,18 +163,23 @@ main32:
[BITS 64] [BITS 64]
;; DATA ;; DATA
Init db "Booting OS/K !", 0x0D, 0x0A, 0x0D, 0x0A, 0x09, " Checking CPUID...",0 Init db "Booting OS/K !", 0x0D, 0x0A, 0x0D, 0x0A, 0x09, " Checking CPUID...",0
CPUIDD db 0x09, " Checking CPUID...", 0 CPUIDD db 0x09, " Checking CPUID...", 0
EnA20 db 0x09, " Enabling A20 line...", 0 EnA20 db 0x09, " Enabling A20 line...", 0
ReadAttempt db 0x09, " Attempt to read a sector with ATA commands...", 0x0A, 0x0D, 0x0A, 0x0D,0 %ifdef DEBUG
txt db 0x09, " Switching to Long Mode... ", 0 ReadAttempt db 0x09, " Attempt to read a sector with ATA commands...", 0x0A, 0x0D, 0x0A, 0x0D, 0
Reinit db "Booting OS/K !", 0x0D, 0x0A, 0x0D, 0x0A, 0 %else
Pass db " OK", 0x0A, 0x0D, 0 ReadAttempt db 0x09, " Attempt to read a sector with ATA commands...", 0
Fail db " FAIL!", 0x0A, 0x0D, 0 %endif
msg db "The system is now in x64 mode. Is this not beautiful ?", 0x0A, 0x0D, 0 txt db 0x09, " Switching to Long Mode... ", 0
FileNotFound db "Second Stage Error : The Kernel was not found.", 0x0A, 0x0D, 0 EndOfLoader db "End of loader.bin. System will halt !", 0x0A, 0x0D, 0
DiskError db "Second Stage Error : The Disk has crashed.", 0x0A, 0x0D, 0 Reinit db "Booting OS/K !", 0x0D, 0x0A, 0x0D, 0x0A, 0
filename db "KERNEL BIN" Pass db " OK", 0x0A, 0x0D, 0
Fail db " FAIL!", 0x0A, 0x0D, 0
msg db "The system is now in x64 mode. Is this not beautiful ?", 0x0A, 0x0D, 0
FileNotFound db "Second Stage Error : The Kernel was not found.", 0x0A, 0x0D, 0
DiskError db "Second Stage Error : The Disk has crashed.", 0x0A, 0x0D, 0
filename db "KERNEL BIN"
%include "boot/loader/io/lmmem.asm" %include "boot/loader/io/lmmem.asm"
%include "boot/loader/io/lmterm.asm" %include "boot/loader/io/lmterm.asm"
@ -229,10 +236,9 @@ main64:
mov bh, 1 mov bh, 1
call ata_read call ata_read
call bitemporize ; Temporized because the ATA drive must be ready mov bl, 0x0D
mov esi, EndOfLoader
call write
jmp Die jmp Die
; times 1024 nop
; XXX ;
; It seems impossible to have an executable > 2.0 kB...

Binary file not shown.

Binary file not shown.

Binary file not shown.