wok-tiny diff bootris/stuff/tetranglix.asm @ rev 182

Update bootpillman & bootsokoban
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Sep 24 17:53:05 2023 +0000 (9 months ago)
parents e05af9592e8b
children 1e55ea7da8de
line diff
     1.1 --- a/bootris/stuff/tetranglix.asm	Wed Sep 20 13:08:44 2023 +0000
     1.2 +++ b/bootris/stuff/tetranglix.asm	Sun Sep 24 17:53:05 2023 +0000
     1.3 @@ -59,7 +59,7 @@
     1.4      ; White spaces on black background.
     1.5      xor di, di
     1.6      mov ax, 0x0F00
     1.7 -    mov cx, ax                   ; At least 80x25x2.
     1.8 +    mov ch, 8                    ; At least 80x25x2.
     1.9      rep stosw
    1.10      call pop_check
    1.11  
    1.12 @@ -89,7 +89,10 @@
    1.13      ; Calculate first index into screen.
    1.14      lodsw
    1.15      aad 0x10
    1.16 -    cmp byte [si-1], 0x10
    1.17 +
    1.18 +    mov cl, 0x10
    1.19 +
    1.20 +    cmp [si-1], cl
    1.21      sbb ah, ah
    1.22      xchg bx, ax
    1.23      lea di, [si + (STACK - OFFSET) + 0xFE + bx]
    1.24 @@ -97,8 +100,6 @@
    1.25  
    1.26      mov si, CUR_TETRAMINO
    1.27  
    1.28 -    mov cl, 0x10
    1.29 -
    1.30      .loop:
    1.31          test cl, 0x13;0b1011
    1.32          jnz .load_loop
    1.33 @@ -148,6 +149,14 @@
    1.34      or [di], al
    1.35      ret
    1.36  
    1.37 +exit_game_over:
    1.38 +    je start
    1.39 +exit_dos:
    1.40 +    mov al,0x03           ; Clear screen
    1.41 +    int 0x10
    1.42 +    int 0x20              ; Return to bootOS
    1.43 +    int 0x19
    1.44 +
    1.45  ; All tetraminos in bitmap format.
    1.46  tetraminos:
    1.47      db 0xF0;0b11110000   ; I
    1.48 @@ -196,6 +205,7 @@
    1.49  .busy_loop2:
    1.50          pushf
    1.51  .busy_loop1:
    1.52 +        hlt                 ; Wait for clock interrupt
    1.53          mov ah,0x00
    1.54          int 0x1a
    1.55          cmp [bx],dx
    1.56 @@ -205,7 +215,7 @@
    1.57          cmc
    1.58          jc .busy_loop2
    1.59          pop dx
    1.60 -        xor cx,cx       ; Or rotation doesn't work
    1.61 +        xor cx,cx           ; Or rotation doesn't work
    1.62      %endif
    1.63          ; If we don't need to load a new tetramino, yayy!
    1.64          test dl, dl
    1.65 @@ -267,37 +277,30 @@
    1.66  
    1.67          .exit:
    1.68              dec ah
    1.69 -            jne .left
    1.70 -
    1.71 -        .exit_dos:
    1.72 -            mov al,0x03           ; Clear screen
    1.73 -            int 0x10
    1.74 -            int 0x20              ; Return to bootOS
    1.75 -            jmp start
    1.76 +            je exit_dos
    1.77 +            mov al, ah
    1.78  
    1.79          ; Go left.
    1.80          .left:
    1.81 -            cmp ah, LEFT_SCANCODE-1
    1.82 -            jne .right
    1.83 -
    1.84 -            dec byte [si]
    1.85 -            jmp .call_bp
    1.86 +            cmp al, LEFT_SCANCODE-1
    1.87 +            je .call_bp
    1.88  
    1.89          ; Go right.
    1.90          .right:
    1.91 -            cmp ah, RIGHT_SCANCODE-1
    1.92 +            cmp al, RIGHT_SCANCODE-1
    1.93              jne .rotate
    1.94  
    1.95 -            inc byte [si]
    1.96 +            add byte [si],2
    1.97  
    1.98          .call_bp:
    1.99 -            xor ah, (LEFT_SCANCODE-1) ^ (RIGHT_SCANCODE-1)
   1.100 +            dec byte [si]
   1.101 +            xor al, (LEFT_SCANCODE-1) ^ (RIGHT_SCANCODE-1)
   1.102              call bp
   1.103              jc .left
   1.104  
   1.105          ; Rotate it.
   1.106          .rotate:
   1.107 -            cmp ah, UP_SCANCODE-1
   1.108 +            cmp al, UP_SCANCODE-1
   1.109              jne .vertical_increment
   1.110  
   1.111              inc cx
   1.112 @@ -408,8 +411,9 @@
   1.113          .game_over:             ; Game Over
   1.114              xor ax, ax
   1.115              int 0x16            ; wait for and key
   1.116 -            jmp .exit_dos
   1.117 -            
   1.118 +            dec ah
   1.119 +            jmp exit_game_over
   1.120 +           
   1.121          .next_iter:             
   1.122              ; Display the stack.
   1.123              push si