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
Bootdrv db 0
end db "[End of Sector]", 0x0A, 0x0D, 0x0
ended db "[End of Sector]", 0x0A, 0x0A, 0x0D, 0x0
buffer: times 513 db "_"
;; TEXT
@ -124,12 +124,19 @@ still_going:
mov dx, 0x1f0 ; Data port - data comes in and out of here.
rep insw
pop rdi
%ifdef DEBUG
mov bl, 0x0F
mov esi, buffer
call dump
mov bl, 0x0A
mov esi, end
mov esi, ended
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 rcx
pop rbx

View File

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

View File

@ -8,6 +8,8 @@
; (x86_64 architecture only) ;
;=----------------------------------------------------------------------------=;
%define DEBUG
[BITS 16]
[ORG 0x1000]
@ -164,8 +166,13 @@ main32:
Init db "Booting OS/K !", 0x0D, 0x0A, 0x0D, 0x0A, 0x09, " Checking CPUID...",0
CPUIDD db 0x09, " Checking CPUID...", 0
EnA20 db 0x09, " Enabling A20 line...", 0
%ifdef DEBUG
ReadAttempt db 0x09, " Attempt to read a sector with ATA commands...", 0x0A, 0x0D, 0x0A, 0x0D, 0
%else
ReadAttempt db 0x09, " Attempt to read a sector with ATA commands...", 0
%endif
txt db 0x09, " Switching to Long Mode... ", 0
EndOfLoader db "End of loader.bin. System will halt !", 0x0A, 0x0D, 0
Reinit db "Booting OS/K !", 0x0D, 0x0A, 0x0D, 0x0A, 0
Pass db " OK", 0x0A, 0x0D, 0
Fail db " FAIL!", 0x0A, 0x0D, 0
@ -229,10 +236,9 @@ main64:
mov bh, 1
call ata_read
call bitemporize ; Temporized because the ATA drive must be ready
mov bl, 0x0D
mov esi, EndOfLoader
call write
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.