[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2019-12-16T23:12:26-05:00 http://www.petesqbsite.com/phpBB3/app.php/feed/topic/14557 2019-12-16T23:12:26-05:00 2019-12-16T23:12:26-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=38902#p38902 <![CDATA[Re: Are arcade games possible in QB? [answered]]]> https://qbmikehawk.neocities.org/articl ... index.html

Long story short: keyboards have no on-board memory. What they do is send ONE byte of information via port 0x60 whenever there's a key status CHANGE (a key has been pressed or has been released,) thus the value found at port 0x60 will remain the same until another status change happens. The data sent contains two sets of information: a scan code (bits 0 to 6) and the status change of the specified key (bit 7 - if set, the key has been released, if not set, the key has been pressed.) Your program will never be able to stay up-to-date on current key status because releasing multiple keys at once may rapid-fire data to port 0x60 while your program is busy (and therefore, won't catch the changes.)

The proper way to do it is by replacing the ISR (Interrupt Service Register) for keyboard handling (register 9, interrupt 0x21) on the BIOS level, because that interrupt is called whenever there's a change to port 0x60 (that's how iD Software did with Wolfenstein 3D.) In QBASIC, it used to be done by reserving memory via an array, writing an ASM program that would modify the content of that array according to port 0x60, and hijacking ISR9 so the ASM code would be called right when a keyboard change occurs.

Hope that helps.

Statistics: Posted by MikeHawk — Mon Dec 16, 2019 11:12 pm


]]>
2019-11-06T15:52:56-05:00 2019-11-06T15:52:56-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=38884#p38884 <![CDATA[Re: Are arcade games possible in QB?]]> Statistics: Posted by Alex — Wed Nov 06, 2019 3:52 pm


]]>
2019-11-06T15:49:56-05:00 2019-11-06T15:49:56-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=38883#p38883 <![CDATA[Re: Are arcade games possible in QB?]]> Statistics: Posted by burger2227 — Wed Nov 06, 2019 3:49 pm


]]>
2019-11-05T13:05:50-05:00 2019-11-05T13:05:50-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=38881#p38881 <![CDATA[Re: Are arcade games possible in QB?]]>
I think properly done this routine should be split into two. One that updates the keyflags%() array and is called regularly like in every iteration of the main program loop, and one that checks the keyflags%() array to answer if the key the programmer is interested in is currently depressed. Function ScanKey%() seems to be doing exactly the same thing that QB64's _KEYDOWN() built-in function does but it works in QB/QBasic whereas _KEYDOWN is QB64-only.

Statistics: Posted by Alex — Tue Nov 05, 2019 1:05 pm


]]>
2019-11-05T11:47:01-05:00 2019-11-05T11:47:01-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=38880#p38880 <![CDATA[Re: Are arcade games possible in QB?]]>

Code:

FUNCTION ScanKey% (scancode%)STATIC Ready%, keyflags%() ' ready = 0 re dims the array IF NOT Ready% THEN REDIM keyflags%(0 TO 127): Ready% = -1 'set up arrayi% = INP(&H60) 'read keyboard statesIF (i% AND 128) THEN keyflags%(i% XOR 128) = 0 'key releasedIF (i% AND 128) = 0 THEN keyflags%(i%) = -1 'key pressedK$ = INKEY$ 'clears keboard buffer to prevent beepsScanKey% = keyflags%(scancode%) 'reads key code sent by program END FUNCTION  
Try Example 3 with key codes of keyboard listed: http://www.qb64.net/wiki/index-php/Scancodes/

Statistics: Posted by burger2227 — Tue Nov 05, 2019 11:47 am


]]>
2019-11-05T11:05:38-05:00 2019-11-05T11:05:38-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=38879#p38879 <![CDATA[Re: Are arcade games possible in QB?]]> Statistics: Posted by Alex — Tue Nov 05, 2019 11:05 am


]]>
2019-11-05T09:24:03-05:00 2019-11-05T09:24:03-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=38877#p38877 <![CDATA[Re: Are arcade games possible in QB?]]> http://www.qb64.net/wiki/index-php/INP/

Statistics: Posted by burger2227 — Tue Nov 05, 2019 9:24 am


]]>
2019-11-06T15:53:15-05:00 2019-11-03T15:46:06-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=38614#p38614 <![CDATA[Are arcade games possible in QB? [answered]]]>
So my question is how can one make arcade style games with real-time, fine-grained, player-controlled motion in QB? Is the mouse the ONLY option that everyone has or can we use the keyboard and if so how?

Statistics: Posted by Alex — Sun Nov 03, 2019 3:46 pm


]]>