mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 08:00:24 +00:00
[FREELDR:PC98] Don't do the HighRes check everytime a character is written with writechr (#4359)
And bring similar simplifications to the PC98 FAT12 bootsector. Co-authored-by: Dmitry Borisov <di.sean@protonmail.com>
This commit is contained in:
parent
94a650cdf7
commit
a3899d8151
2 changed files with 34 additions and 25 deletions
|
@ -145,11 +145,9 @@ relocated:
|
|||
mov ds, ax
|
||||
|
||||
test byte ptr ds:[HEX(501)], HEX(08) // High-resolution mode check
|
||||
jz VideoTestNormalMode
|
||||
mov ax, HEX(0E000)
|
||||
jmp short VideoTestDone
|
||||
VideoTestNormalMode:
|
||||
mov ax, HEX(0A000)
|
||||
mov ax, HEX(0A000) // Suppose normal mode
|
||||
jz short VideoTestDone
|
||||
mov ah, HEX(E0) // Change 0xA000 to 0xE000, use hi-res mode
|
||||
VideoTestDone:
|
||||
mov word ptr BP_REL(VramSegment), ax
|
||||
|
||||
|
@ -360,14 +358,11 @@ PutChar:
|
|||
push di
|
||||
push es
|
||||
|
||||
push word ptr BP_REL(VramSegment)
|
||||
pop es
|
||||
mov di, word ptr BP_REL(VramOffset) // ES:DI = VramSegment:VramOffset
|
||||
les di, dword ptr BP_REL(VramSegOff) // Load the VRAM segment and offset (ES:DI)
|
||||
.PutCharWrite:
|
||||
xor ah, ah
|
||||
stosw // Write ASCII directly to the VRAM
|
||||
|
||||
mov word ptr BP_REL(VramOffset), di
|
||||
xor ah, ah // Write ASCII directly to the VRAM
|
||||
stosw // (two bytes per character)
|
||||
mov word ptr BP_REL(VramOffset), di // Update the start position
|
||||
pop es
|
||||
pop di
|
||||
|
||||
|
@ -470,10 +465,12 @@ Reboot:
|
|||
Halt:
|
||||
jmp short Halt // Spin
|
||||
|
||||
VramSegment:
|
||||
.word 0
|
||||
VramSegOff:
|
||||
VramOffset:
|
||||
.word 0
|
||||
VramSegment:
|
||||
.word 0
|
||||
|
||||
msgDiskError:
|
||||
.ascii "ERR", CR, LF, NUL
|
||||
msgNotFoundError:
|
||||
|
|
|
@ -56,12 +56,12 @@ writestr:
|
|||
jmp short .writestr_loop
|
||||
|
||||
.writestr_cr:
|
||||
mov ax, word ptr VramOffset
|
||||
mov ax, word ptr ds:[VramOffset]
|
||||
mov dl, 80 * 2
|
||||
div dl
|
||||
inc ax
|
||||
mul dl
|
||||
mov word ptr VramOffset, ax
|
||||
mov word ptr ds:[VramOffset], ax
|
||||
|
||||
/* Skip the next LF character */
|
||||
inc si
|
||||
|
@ -80,27 +80,39 @@ writechr:
|
|||
pushf
|
||||
pusha
|
||||
|
||||
/* Check if the VRAM segment was initialized */
|
||||
mov dx, word ptr ds:[VramSegment]
|
||||
test dx, dx
|
||||
jnz short .writechr_write
|
||||
|
||||
/* High-resolution mode check */
|
||||
test byte ptr ds:[HEX(501)], HEX(08)
|
||||
jz .writechr_normal
|
||||
push HEX(0E000)
|
||||
jmp short .writechr_test_done
|
||||
.writechr_normal:
|
||||
push HEX(0A000)
|
||||
|
||||
mov dx, HEX(0A000) // Suppose normal mode
|
||||
jz short .writechr_test_done
|
||||
mov dh, HEX(E0) // Change 0xA000 to 0xE000, use hi-res mode
|
||||
.writechr_test_done:
|
||||
pop es
|
||||
mov di, word ptr VramOffset
|
||||
mov word ptr ds:[VramSegment], dx
|
||||
|
||||
.writechr_write:
|
||||
/* Load the VRAM segment and offset (ES:DI) */
|
||||
les di, dword ptr ds:[VramSegOff]
|
||||
|
||||
/* Write ASCII directly to the VRAM (two bytes per character) */
|
||||
xor ah, ah
|
||||
stosw
|
||||
mov word ptr VramOffset, di
|
||||
|
||||
/* Update the start position */
|
||||
mov word ptr ds:[VramOffset], di
|
||||
|
||||
popa
|
||||
popf
|
||||
ret
|
||||
|
||||
VramSegOff:
|
||||
VramOffset:
|
||||
.word 0
|
||||
VramSegment:
|
||||
.word 0
|
||||
|
||||
/*
|
||||
* Writes a hex number in (AL, AX, EAX) to the console
|
||||
|
|
Loading…
Reference in a new issue