wok-tiny diff boot-man/stuff/boot-man.asm @ rev 184
boot-man: handle ESC key
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Sep 27 17:13:33 2023 +0000 (21 months ago) |
parents | 1e55ea7da8de |
children | 34a0a4406539 |
line diff
1.1 --- a/boot-man/stuff/boot-man.asm Tue Sep 26 17:09:38 2023 +0000 1.2 +++ b/boot-man/stuff/boot-man.asm Wed Sep 27 17:13:33 2023 +0000 1.3 @@ -64,7 +64,6 @@ 1.4 ; won't run on your machine. 1.5 1.6 start: 1.7 - sti ; Allow interrupts 1.8 call copy ; Can run as bootsector or DOS COM file 1.9 1.10 moved: 1.11 @@ -161,11 +160,19 @@ 1.12 je .no_key 1.13 int 0x16 1.14 mov al,ah 1.15 + dec ah ; Escape ? 1.16 + jne .convert_scancode 1.17 +.exit: 1.18 + mov al,3 1.19 + int 0x10 ; Reset screen 1.20 + int 0x20 ; Exit to DOS... 1.21 + int 0x19 ; ...or reboot 1.22 1.23 ; This code converts al from scancode to movement direction. 1.24 ; Input: 0x48 (up), 0x4b (right), 0x50 (down), 0x4d (left) 1.25 ; Output: 0xce (up), 0xca (right), 0xc6 (down), 0xc2 (left) 1.26 1.27 +.convert_scancode: 1.28 sub al, 0x47 ; 0x01 0x04 0x09 0x06 1.29 and al,0xfe ; 0x00 0x04 0x08 0x06 1.30 cmp al, 9 1.31 @@ -366,12 +373,8 @@ 1.32 cbw 1.33 int 0x16 ; Wait for any key 1.34 %endif 1.35 -.exit: 1.36 - mov ax,3 1.37 - int 0x10 ; Reset screen 1.38 - int 0x20 ; Exit to DOS... 1.39 jump_start equ $ + 1 1.40 - mov si,0xFFFC ; ...or restart boot sector 1.41 + mov si,0xFFFC ; restart boot sector 1.42 push si 1.43 ret 1.44 1.45 @@ -412,6 +415,7 @@ 1.46 mov di, moved ; Move self to a well known address 1.47 push di 1.48 mov cx, 512-3 1.49 + sti ; Allow interrupts 1.50 cld ; Clear the direction flag. We use string instructions a lot as they have one-byte codes 1.51 rep movsb 1.52 ret