mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:32:57 +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
|
mov ds, ax
|
||||||
|
|
||||||
test byte ptr ds:[HEX(501)], HEX(08) // High-resolution mode check
|
test byte ptr ds:[HEX(501)], HEX(08) // High-resolution mode check
|
||||||
jz VideoTestNormalMode
|
mov ax, HEX(0A000) // Suppose normal mode
|
||||||
mov ax, HEX(0E000)
|
jz short VideoTestDone
|
||||||
jmp short VideoTestDone
|
mov ah, HEX(E0) // Change 0xA000 to 0xE000, use hi-res mode
|
||||||
VideoTestNormalMode:
|
|
||||||
mov ax, HEX(0A000)
|
|
||||||
VideoTestDone:
|
VideoTestDone:
|
||||||
mov word ptr BP_REL(VramSegment), ax
|
mov word ptr BP_REL(VramSegment), ax
|
||||||
|
|
||||||
|
@ -360,14 +358,11 @@ PutChar:
|
||||||
push di
|
push di
|
||||||
push es
|
push es
|
||||||
|
|
||||||
push word ptr BP_REL(VramSegment)
|
les di, dword ptr BP_REL(VramSegOff) // Load the VRAM segment and offset (ES:DI)
|
||||||
pop es
|
|
||||||
mov di, word ptr BP_REL(VramOffset) // ES:DI = VramSegment:VramOffset
|
|
||||||
.PutCharWrite:
|
.PutCharWrite:
|
||||||
xor ah, ah
|
xor ah, ah // Write ASCII directly to the VRAM
|
||||||
stosw // Write ASCII directly to the VRAM
|
stosw // (two bytes per character)
|
||||||
|
mov word ptr BP_REL(VramOffset), di // Update the start position
|
||||||
mov word ptr BP_REL(VramOffset), di
|
|
||||||
pop es
|
pop es
|
||||||
pop di
|
pop di
|
||||||
|
|
||||||
|
@ -470,10 +465,12 @@ Reboot:
|
||||||
Halt:
|
Halt:
|
||||||
jmp short Halt // Spin
|
jmp short Halt // Spin
|
||||||
|
|
||||||
VramSegment:
|
VramSegOff:
|
||||||
.word 0
|
|
||||||
VramOffset:
|
VramOffset:
|
||||||
.word 0
|
.word 0
|
||||||
|
VramSegment:
|
||||||
|
.word 0
|
||||||
|
|
||||||
msgDiskError:
|
msgDiskError:
|
||||||
.ascii "ERR", CR, LF, NUL
|
.ascii "ERR", CR, LF, NUL
|
||||||
msgNotFoundError:
|
msgNotFoundError:
|
||||||
|
|
|
@ -56,12 +56,12 @@ writestr:
|
||||||
jmp short .writestr_loop
|
jmp short .writestr_loop
|
||||||
|
|
||||||
.writestr_cr:
|
.writestr_cr:
|
||||||
mov ax, word ptr VramOffset
|
mov ax, word ptr ds:[VramOffset]
|
||||||
mov dl, 80 * 2
|
mov dl, 80 * 2
|
||||||
div dl
|
div dl
|
||||||
inc ax
|
inc ax
|
||||||
mul dl
|
mul dl
|
||||||
mov word ptr VramOffset, ax
|
mov word ptr ds:[VramOffset], ax
|
||||||
|
|
||||||
/* Skip the next LF character */
|
/* Skip the next LF character */
|
||||||
inc si
|
inc si
|
||||||
|
@ -80,27 +80,39 @@ writechr:
|
||||||
pushf
|
pushf
|
||||||
pusha
|
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 */
|
/* High-resolution mode check */
|
||||||
test byte ptr ds:[HEX(501)], HEX(08)
|
test byte ptr ds:[HEX(501)], HEX(08)
|
||||||
jz .writechr_normal
|
mov dx, HEX(0A000) // Suppose normal mode
|
||||||
push HEX(0E000)
|
jz short .writechr_test_done
|
||||||
jmp short .writechr_test_done
|
mov dh, HEX(E0) // Change 0xA000 to 0xE000, use hi-res mode
|
||||||
.writechr_normal:
|
|
||||||
push HEX(0A000)
|
|
||||||
|
|
||||||
.writechr_test_done:
|
.writechr_test_done:
|
||||||
pop es
|
mov word ptr ds:[VramSegment], dx
|
||||||
mov di, word ptr VramOffset
|
|
||||||
|
.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
|
xor ah, ah
|
||||||
stosw
|
stosw
|
||||||
mov word ptr VramOffset, di
|
|
||||||
|
/* Update the start position */
|
||||||
|
mov word ptr ds:[VramOffset], di
|
||||||
|
|
||||||
popa
|
popa
|
||||||
popf
|
popf
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
VramSegOff:
|
||||||
VramOffset:
|
VramOffset:
|
||||||
.word 0
|
.word 0
|
||||||
|
VramSegment:
|
||||||
|
.word 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes a hex number in (AL, AX, EAX) to the console
|
* Writes a hex number in (AL, AX, EAX) to the console
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue