Qbasicnews.com
February 26, 2020, 02:19:29 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2] 3 4
  Print  
Author Topic: Need help with some stuff  (Read 9700 times)
dadsherm
Member
*
Posts: 75


« Reply #15 on: February 11, 2004, 10:18:36 PM »

Well, you would still have to leave in the "basics" (no pun intended), otherwise you would just end up with a computer that does nothing but use electricity!  :rotfl:
No, really, all seriousness aside, I really don't know. I would think so though. Any one else know?
Logged

adsherm
Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #16 on: February 11, 2004, 11:10:34 PM »

Because, come on...your mouse, keyboard, speakers, printer (if its on), scanner (ditto) all are waiting in the background...so wouldn't it be faster?
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #17 on: February 12, 2004, 08:14:52 AM »

Interrupts are asynchronous, that measn that hey are not checked in a regular basis. The CPU has some connections that are activated when one of those devices cause an interruption, and only then those devices are cared of. I mean, there is no overhead code to check them, this is performed by the hardware. When you press a key, a interrupt is generated, the computer then runs the interrupt handler (which usually captures the key and stuff). This happens with keyboard and mouse.

Speakers are passive devices, the soundcard just generates electricity that is sent to the speakers. The soundcard operates independently, so no overhead as well. No interrupts, no nothing.

The same thing with printers. When you want to print something, data is sent to the printer. No more interaction. As with the Scanner, when you need data from the Scanner a data path is opened, no polling interaction meanwhile. Those are actual slave devices.

I am speaking, of course, about MSDOS, which is the environment where QB lies. In windows many things happen in the background.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #18 on: February 12, 2004, 11:42:38 AM »

Okay, so you're saying when you press a key, the electric signal sent by it wakes up a little bit of code to deal with it?
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
dadsherm
Member
*
Posts: 75


« Reply #19 on: February 12, 2004, 01:11:29 PM »

What nathan wrote is partially true. I say partially because things like the sound card do more than just conduct an electric current to the speakers. To prove this point, try hooking up the speakers to any known source, (other than the sound cards), of electrical contact on the computer. I guarentee the only thing you will get, if anything, is a hum. (60 htz? maybe.) As for things like printers, yes they are only activated when"told" to, however, if you have something either waiting to be printed or being printed from the printer "spool", the program is being constantly monitored for the final ending signal.
Which I think is a "feed" signal of sorts. ( Some of my meds are kicking in right now, unfortunately?, and one of them affects my memory.)
So, except for the soundcard and barring anything being activated, and therefore monitored, I agree with what nat wrote.

I don't want anyone to take this personally, ( not that I think anyone would), but I have to take a break from doing any active responding for awhile.
I'll still read some things and if anyone would like to send me a p.m. or email, I'd be glad to respond, but I'm going thru a rough time right now with these goofy tremors and sometimes it takes awhile to "calm down".
I don't recall who it was that had the game "Line run?", but does anyone know how it turned out? I sent some suggestions to the programmer and I was just wondering if they helped any.
Logged

adsherm
Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #20 on: February 12, 2004, 01:14:17 PM »

Line Run was excellent. I'm really sorry to hear about your problem - you should try acupuncture, your problem sounds exactly like what it could help with. (lets not start an argument again)
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #21 on: February 12, 2004, 01:40:18 PM »

dadsherm, you are forgetting that we are talking about hardware. The spooler is a purely software program which is monitoring and queing print jobs. So basically nath was correct. Also, soundcard really doesnt do anything but send the electrical signals to the speakers after amplifying, filtering etc...
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #22 on: February 12, 2004, 07:54:22 PM »

I just phrased it bad Tongue

I meant that the speakers didn't need any overhead code to be controlled Cheesy
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #23 on: February 13, 2004, 04:17:59 AM »

'tis ok =). BTW you didnt mention about CD-ROMs and DVDs =P.
Logged
red_Marvin
Na_th_an
*****
Posts: 1509



WWW
« Reply #24 on: February 13, 2004, 06:00:24 AM »

Weasel88:: Your pseudocode looks good I think, but if
you redraw the character each loop cycle, it will flicker horribly
Instead do this: (inside loop)
Code:
check for key
if key is pressed
move character
endif


sorry running out of time...
Logged

/post]
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #25 on: February 13, 2004, 06:31:27 AM »

I almost forgot. Heres a working example of how to use arrow keys =).

Code:
CLS

DO
   KeyPress$ = INKEY$
   
   IF LEN(KeyPress$) = 2 THEN
      ScanCode% = ASC(RIGHT$(KeyPress$, 1))
   END IF

   IF KeyPress$ = CHR$(27) THEN LOCATE 1, 1: PRINT "You hit the ESC key!": END
   
   SELECT CASE ScanCode%
   CASE 72
      LOCATE 1, 1: PRINT "UP ARROW    "
   CASE 75
      LOCATE 1, 1: PRINT "LEFT ARROW  "
   CASE 77
      LOCATE 1, 1: PRINT "RIGHT ARROW "
   CASE 80
      LOCATE 1, 1: PRINT "DOWN ARROW  "
   CASE 59
      LOCATE 1, 1: PRINT "F1 Key      "
   END SELECT
   ScanCode% = 0
LOOP
Logged
KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #26 on: February 13, 2004, 07:47:59 AM »

yup, weasel. thats whats called a decent keyboard handler.
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #27 on: February 13, 2004, 07:49:24 AM »

Quote from: "dark_prevail"
yup, weasel. thats whats called a decent keyboard handler.


i dont get it!
Logged
KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #28 on: February 13, 2004, 08:00:26 AM »

sorry that came out wrong. I was just meaning that your example is much better than using the crappy old INKEY$.
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #29 on: February 13, 2004, 08:05:47 AM »

Quote from: "dark_prevail"
sorry that came out wrong. I was just meaning that your example is much better than using the crappy old INKEY$.

Ahem...cough...cough...my example uses Inkey$
Logged
Pages: 1 [2] 3 4
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!