wok-tiny rev 189
bootpillman, bootinvaders: check video
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Aug 31 11:34:59 2024 +0000 (10 months ago) |
parents | 2330670eba8a |
children | a8312659f76d |
files | bootinvaders/stuff/invaders.asm bootpillman/stuff/pillman.asm |
line diff
1.1 --- a/bootinvaders/stuff/invaders.asm Thu Aug 29 17:33:52 2024 +0000 1.2 +++ b/bootinvaders/stuff/invaders.asm Sat Aug 31 11:34:59 2024 +0000 1.3 @@ -35,8 +35,8 @@ 1.4 ; press ESC. Position independant code. 1.5 ; 1.6 1.7 -;%define USE_ARROW_KEYS too slow 1.8 -;%define CHECK_VIDEO CGA and MDA cards are not supported 1.9 +;%define USE_ARROW_KEYS too slow 1.10 +%define CHECK_VIDEO CGA and MDA cards are not supported 1.11 1.12 cpu 8086 1.13 1.14 @@ -125,7 +125,7 @@ 1.15 add di,0x1e*2 1.16 loop in48 1.17 1.18 - ; CH is zero 1.19 + ; CL is zero 1.20 1.21 in14: 1.22 mov si,sprites+SPRITE_SIZE 1.23 @@ -137,14 +137,14 @@ 1.24 ; SI = Next invader to animate 1.25 ; DL = state (0=left, 1=right, >=2 down) 1.26 ; DH = nstate (next state) 1.27 - ; CH = dead invaders 1.28 + ; CL = dead invaders 1.29 ; BP = frame counter 1.30 ; 1.31 in46: 1.32 cmp byte [si+2],0x20 ; Current invader is cosmic debris? 1.33 jc in02 ; No, jump 1.34 - inc ch ; Count another dead invader 1.35 - cmp ch,55 ; All invaders defeated? 1.36 + inc cx ; Count another dead invader 1.37 + cmp cl,55 ; All invaders defeated? 1.38 je restart_game ; Yes, jump. 1.39 ; 1.40 ; Yes, invaders speed up 1.41 @@ -257,7 +257,9 @@ 1.42 js restart ; Exit if all used 1.43 in42: mov [si-2],ax ; Save new frame / color 1.44 mov di,[si] ; Load position 1.45 + pushf 1.46 call draw_sprite ; Draw sprite (spaceship) 1.47 + popf 1.48 jne in43 ; Jump if still explosion 1.49 1.50 %ifdef USE_ARROW_KEYS 1.51 @@ -274,12 +276,13 @@ 1.52 je quit ; Yes, jump 1.53 sub al,0x4b-1 1.54 test al,0xfd ; Left/Right arrow ? 1.55 - jnz in17 ; No, jump 1.56 + jnz in35 ; No, jump 1.57 dec ax 1.58 add di,ax ; Move 2 pixels Left/Right 1.59 add di,ax 1.60 in17: 1.61 %else 1.62 + mov bx,12 ; Ctrl/Alt key mask 1.63 mov ah,0x01 1.64 int 0x16 ; BIOS Got key 1.65 jz in17 ; No, jump 1.66 @@ -289,7 +292,6 @@ 1.67 je quit 1.68 in17: mov ah,0x02 ; BIOS Get Keyboard Flags 1.69 int 0x16 1.70 - mov bx,12 ; Ctrl/Alt key mask 1.71 and bl,al 1.72 jp in18 ; test Ctrl xor Alt 1.73 lea di,[bx+di-6] ; Move 2 pixels to left/right 1.74 @@ -339,16 +341,17 @@ 1.75 add ax,0x06*0x280+0x03*2 ; Offset for bullet 1.76 xchg ax,bx 1.77 1.78 - in al,(0x40) ; Read timer 1.79 - cmp al,0xfc ; Random event happening? 1.80 - jc in04 ; No, jump 1.81 + in al,(0x40) ; Read timer 1.82 + and al,0xfc ; Random event happening? 1.83 + jnz in04 ; No, jump 1.84 1.85 - mov di,shots 1.86 -in45: scasw ; Advance DI 1.87 - cmp [di],ch ; Search for free slot 1.88 - loopne in45 ; Until 3 slots searched 1.89 - mov [di],bx ; Start invader shot (or put in ignored slot) 1.90 + mov di,shots+2 1.91 + cbw 1.92 + repne ; Until 3 slots searched 1.93 + scasw ; Search for free slot 1.94 + mov [di-2],bx ; Start invader shot (or put in ignored slot) 1.95 in04: 1.96 + mov cl,0 1.97 jmp in06 1.98 1.99 ; 1.100 @@ -380,11 +383,11 @@ 1.101 1.102 ; ah = sprite color 1.103 ; al = sprite (x8) 1.104 + ; ch = 0 1.105 ; di = Target address 1.106 draw_sprite: 1.107 push cx 1.108 push di 1.109 - pushf 1.110 in03: push ax 1.111 call get_bitmaps 1.112 ; 1.113 @@ -401,7 +404,7 @@ 1.114 pop bx 1.115 cs xlat ; Extract one byte from bitmap 1.116 xchg ax,bx ; bl contains byte, bh contains color 1.117 - mov cx,10 ; Two extra zero pixels at left and right 1.118 + mov cl,10 ; Two extra zero pixels at left and right 1.119 clc ; Left pixel as zero (clean) 1.120 in0: mov al,bh ; Duplicate color in AX 1.121 call bit ; Draw pixel 1.122 @@ -412,7 +415,6 @@ 1.123 inc ax ; Next bitmap byte 1.124 test al,7 ; Sprite complete? 1.125 jne in03 ; No, jump 1.126 - popf 1.127 pop di 1.128 pop cx 1.129 in49: ret
2.1 --- a/bootpillman/stuff/pillman.asm Thu Aug 29 17:33:52 2024 +0000 2.2 +++ b/bootpillman/stuff/pillman.asm Sat Aug 31 11:34:59 2024 +0000 2.3 @@ -23,7 +23,7 @@ 2.4 ; position independant code, reset screen 2.5 ; at exit, slow down Pillman blink. 2.6 ; 2.7 -;%define CHECK_VIDEO CGA and MDA cards are not supported 2.8 +%define CHECK_VIDEO CGA and MDA cards are not supported 2.9 2.10 cpu 8086 2.11 2.12 @@ -229,7 +229,7 @@ 2.13 draw_maze_row: 2.14 cs lodsw ; Load one word of data from Code Segment 2.15 xchg ax,cx ; Put into AX 2.16 - mov bx,-30*8 ; Offset of mirror position 2.17 + mov bx,-31*8 ; Offset of mirror position 2.18 draw_maze_col: 2.19 add cx,cx ; Extract one tile of maze 2.20 mov ax,MAZE_COLOR*0x0100+0x18 ; Carry = 0 = Wall 2.21 @@ -237,14 +237,12 @@ 2.22 mov ax,PILL_COLOR*0x0100+0x38 ; Carry = 1 = Pill 2.23 dm1: call draw_sprite ; Draw tile 2.24 sub di,bx ; Go to mirror position 2.25 + call draw_sprite ; Draw tile 2.26 + lea di,[bx+di+8] ; Restore position and advance tile 2.27 add bx,16 ; Mirror finished? 2.28 - jg dm2 ; Yes, jump 2.29 - call draw_sprite ; Draw tile 2.30 - lea di,[bx+di-8] ; Restore position and advance tile 2.31 - jmp draw_maze_col ; Repeat until finished 2.32 + jle draw_maze_col ; Repeat until finished 2.33 2.34 -dm2: 2.35 - add di,X_OFFSET*8-15*8 ; Go to next row 2.36 + add di,X_OFFSET*8-16*8 ; Go to next row 2.37 lea ax,[bp+setup_data_] 2.38 sub ax,si ; Maze completed? (clear ax) 2.39 jne draw_maze_row ; No, jump