From dd49c6d79ba7633ee2cd551d54fbee2c17391f1a Mon Sep 17 00:00:00 2001 From: sparky4 Date: Thu, 26 Jan 2017 12:09:59 -0600 Subject: [PATCH] showing row and colum drawing i optimized it to only draw at the end of walk. this explains why it is much slower than it was before --- src/lib/16_tail.c | 38 ++++++++++++++++++++++++++++++++++++++ src/lib/16_tail.h | 2 ++ 2 files changed, 40 insertions(+) diff --git a/src/lib/16_tail.c b/src/lib/16_tail.c index 6ebe442d..41379e32 100755 --- a/src/lib/16_tail.c +++ b/src/lib/16_tail.c @@ -388,6 +388,44 @@ void walktypeinfo(player_t *player, word pn) } } +void turboXT(byte bakapee) +{ + //byte bakapee = 12; + __asm { + push ax + push bx + push cx + in al, 61h ; Read equipment flags + xor al, bakapee ; toggle speed + out 61h, al ; Write new flags back + + mov bx, 0F89h ; low pitch blip + and al, 4 ; Is turbo mode set? + jz @@do_beep + mov bx, 52Eh ; high pitch blip + +@@do_beep: + mov al, 10110110b ; Timer IC 8253 square waves + out 43h, al ; channel 2, speaker + mov ax, bx + out 42h, al ; send low order + mov al, ah ; load high order + out 42h, al ; send high order + in al, 61h ; Read IC 8255 machine status + push ax + or al, 00000011b + out 61h, al ; Turn speaker on + mov cx, 2000h +@@delay: + loop @@delay + pop ax + out 61h, al ; Turn speaker off + pop cx + pop bx + pop ax + } +} + const char *nibble_to_binary(nibble x) { static char b[9]; diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index 932d557f..8d7082a3 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -39,6 +39,7 @@ FUNCTIONKEYFUNCTIONS0EXE #define FUNCTIONKEYFUNCTIONS0EXE \ + if(IN_KeyDown(sc_F4)){ turboXT(12); IN_UserInput(1,1); } \ if(IN_KeyDown(87/*sc_F11*/)){ pageflipflop=!pageflipflop; IN_UserInput(1,1); } \ if(IN_KeyDown(68/*sc_F10*/)){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap; IN_UserInput(1,1); } \ if(IN_KeyDown(sc_F9)){ pagenorendermap=!pagenorendermap; IN_UserInput(1,1); } \ @@ -77,6 +78,7 @@ void Shutdown16(global_game_variables_t *gvar); void Startup16(global_game_variables_t *gvar); void ClearMemory (global_game_variables_t *gvar); void Quit (global_game_variables_t *gvar, char *error); +void turboXT(byte bakapee); void walktypeinfo(player_t *player, word pn); void nibbletest(); void booleantest(); -- 2.39.5