[metal] Mention magic key to switch video mode, at bootup

This commit is contained in:
tkchia 2022-10-04 15:37:50 +00:00
parent 02ecb1ecea
commit 077b608856

View file

@ -62,9 +62,13 @@ _rlinit_vesa:
testb $0b00000011,0x0417 # read keyboard shift state (as testb $0b00000011,0x0417 # read keyboard shift state (as
jnz .doit # given by BIOS's IRQ 1); if Shift jnz .doit # given by BIOS's IRQ 1); if Shift
# key pressed, activate code below # key pressed, activate code below
push %si # display brief message on magic key
mov $REAL(str.inform),%si
call .puts
pop %si
mov $0x8300,%ax # wait for the magic key for a short mov $0x8300,%ax # wait for the magic key for a short
mov $(250000>>16),%cx # period of time... mov $(1000000>>16),%cx # period of time...
mov $(250000&0xffff),%dx mov $(1000000&0xffff),%dx
push %ss push %ss
pop %es pop %es
mov %sp,%bx mov %sp,%bx
@ -75,12 +79,14 @@ _rlinit_vesa:
jnz .doit2 jnz .doit2
cmpb $0,%es:(%bx) cmpb $0,%es:(%bx)
jz .wait jz .wait
call .done_inform
stc stc
.done: pop %ax .done: pop %ax
pop %es pop %es
ret ret
.doit2: mov $0x8301,%ax # we got the magic key; cancel the .doit2: mov $0x8301,%ax # we got the magic key; cancel the
int $0x15 # wait timer int $0x15 # wait timer, & erase message
call .done_inform
.doit: pop %ax # we got the magic key; do stuff .doit: pop %ax # we got the magic key; do stuff
pop %es pop %es
// fall through // fall through
@ -139,6 +145,14 @@ _rlinit_vesa:
jmp 7b jmp 7b
.endfn .do_vesa_rlinit .endfn .do_vesa_rlinit
// Clear the informational message on the magic key.
.done_inform:
mov $0x0a00|' ',%ax
mov $7,%bx
mov $str.inform.end-str.inform-1,%cx
int $0x10
ret
// Preliminarily choose a "default" VESA screen mode from a list of // Preliminarily choose a "default" VESA screen mode from a list of
// gathered screen modes. // gathered screen modes.
// //
@ -570,6 +584,12 @@ _rlinit_vesa:
.endfn .putnl .endfn .putnl
.previous .previous
str.inform:
#define SHGLYPH "\x7f"
.ascii "\rinfo: press ",SHGLYPH,"Shift "
.asciz "to switch video mode\r"
str.inform.end:
.endobj str.inform
str.no_vesa: str.no_vesa:
.asciz "info: no VESA\r\n" .asciz "info: no VESA\r\n"
.endobj str.no_vesa .endobj str.no_vesa