floppyboot

bootsector Flappy Bird clone for x86
git clone git://squid-tech.com/floppyboot.git
Log | Files | Refs | README

commit 3c5ff1da1de88e12e5a90127b00bd608b1daa424
parent 9c4f47c593d56fdf3ae3a99d200c86507c205aca
Author: Josh Moore <jxm5210@rit.edu>
Date:   Sun, 12 Jan 2020 13:35:56 -0500

Add basic input handling

Diffstat:
Mfloppyboot.asm | 39+++++++++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)

diff --git a/floppyboot.asm b/floppyboot.asm @@ -4,6 +4,8 @@ org 0x7C00 %define BG_COLOR 0x01 ; blue %define PIPE_SPACING 0x0A ; distance between pipes +%define JUMP_KEY 0x48 ; up arrow + boot: ; set video mode to 40x25 16-color MOV AH, 0x00 @@ -21,8 +23,30 @@ boot: MOV CH, 0x3F INT 0x10 - ; move cursor to start position - CALL draw_bird +loop: + ; main game loop + +.input: + ; check input keystroke + MOV AH, 0x01 + INT 0x16 + JZ loop.process_game + + ; get the key + MOV AH, 0x00 + INT 0x16 + +.chkpress: + ; check whether the 'jump' key was pressed + CMP AH, JUMP_KEY + JNE loop.process_game + + CALL jump_bird + +.process_game: + ; update game state, draw graphics + + JMP loop.input halt: CLI @@ -51,6 +75,17 @@ draw_bird: POPA RET +jump_bird: + PUSHA + + MOV AL, [birdy] + SUB AL, 1 + MOV [birdy], AL + CALL draw_bird + + POPA + RET + ; game data ; bird position birdx: db 6