wok-tiny rev 184

boot-man: handle ESC key
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Sep 27 17:13:33 2023 +0000 (7 months ago)
parents 1e55ea7da8de
children 61c76233911e
files boot-man/stuff/boot-man.asm bootbricks/stuff/bricks.asm linux/stuff/bundle.S
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
     2.1 --- a/bootbricks/stuff/bricks.asm	Tue Sep 26 17:09:38 2023 +0000
     2.2 +++ b/bootbricks/stuff/bricks.asm	Wed Sep 27 17:13:33 2023 +0000
     2.3 @@ -28,6 +28,7 @@
     2.4  	; Start of the game
     2.5  	;
     2.6  start:
     2.7 +	sti			; Allow interrupts
     2.8  	mov ax,0xb800		; Address of video screen
     2.9  	mov ds,ax		; Setup DS
    2.10  	mov es,ax		; Setup ES
     3.1 --- a/linux/stuff/bundle.S	Tue Sep 26 17:09:38 2023 +0000
     3.2 +++ b/linux/stuff/bundle.S	Wed Sep 27 17:13:33 2023 +0000
     3.3 @@ -185,11 +185,9 @@
     3.4  	orb	%bl, %bl
     3.5  	jnz	scanboot
     3.6  	decb	%bh
     3.7 -	jmp	boot
     3.8  found:
     3.9  	cli
    3.10  	movb	0x1F1+BUFFER, %al	// setup size
    3.11 -boot:
    3.12  	pushw	%ds
    3.13  	pushw	%bx
    3.14  	pushw	%ss