wok-tiny diff bootbricks/stuff/bricks.asm @ rev 182

Update bootpillman & bootsokoban
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Sep 24 17:53:05 2023 +0000 (8 months ago)
parents e05af9592e8b
children 5d44015ce878
line diff
     1.1 --- a/bootbricks/stuff/bricks.asm	Wed Sep 20 13:08:44 2023 +0000
     1.2 +++ b/bootbricks/stuff/bricks.asm	Sun Sep 24 17:53:05 2023 +0000
     1.3 @@ -28,17 +28,17 @@
     1.4  	; Start of the game
     1.5  	;
     1.6  start:
     1.7 -	mov ax,0x0002		; Text mode 80x25x16 colors
     1.8 -	int 0x10		; Setup
     1.9  	mov ax,0xb800		; Address of video screen
    1.10  	mov ds,ax		; Setup DS
    1.11  	mov es,ax		; Setup ES
    1.12  	sub sp,32
    1.13 -	xor ax,ax
    1.14 +	cbw
    1.15  	push ax			; Reset score
    1.16  	mov al,4		
    1.17  	push ax			; Balls remaining
    1.18  	mov bp,sp		; Setup stack frame for globals
    1.19 +	mov al,0x02		; Text mode 80x25x16 colors
    1.20 +	int 0x10		; Setup
    1.21  	;
    1.22  	; Start another level 
    1.23  	;
    1.24 @@ -93,10 +93,18 @@
    1.25  game_loop:
    1.26  	call wait_frame		; Wait 1/18.2 secs.
    1.27  
    1.28 -	mov word [si],0x0000	; Erase ball
    1.29 +	and word [si],0x0000	; Erase ball
    1.30  	
    1.31  	call update_score	; Update score
    1.32  	
    1.33 +	mov ah,0x01		; Check for keys
    1.34 +	int 0x16
    1.35 +	jz .0
    1.36 +	cbw			; Eat key
    1.37 +	int 0x16
    1.38 +	cmp al,27		; ESC key ?
    1.39 +	je exit
    1.40 +.0:	
    1.41  	mov ah,0x02		; Read modifier keys
    1.42  	int 0x16
    1.43  	test al,0x04		; Left ctrl
    1.44 @@ -226,20 +234,27 @@
    1.45  	mov cx,10846		; 1193180 / 110
    1.46  	call speaker		; Generate sound
    1.47  
    1.48 -	mov word [si],0		; Erase ball
    1.49 +	and word [si],0		; Erase ball
    1.50  	dec byte [bp+balls]	; One ball less
    1.51  	js .1			; All finished? Yes, jump
    1.52  	jmp another_ball	; Start another ball
    1.53  
    1.54  .1:	call wait_frame.2	; Turn off sound
    1.55 +	stc
    1.56  exit:
    1.57 +	pushf
    1.58  	mov ax,0x0003		; Text mode 80x25x16 colors
    1.59  	int 0x10		; Setup
    1.60  	int 0x20		; Exit to DOS / bootOS
    1.61 +	popf
    1.62 +	jc .1
    1.63 +	int 0x19
    1.64 +.1:
    1.65  	jmp start
    1.66  
    1.67  wait_frame:
    1.68  .0:
    1.69 +	hlt                     ; Wait for clock interrupt
    1.70  	mov ah,0x00		; Read ticks
    1.71  	int 0x1a		; Call BIOS
    1.72  	cmp dx,[bp+old_time]	; Wait for change