Posts: 2,180
Threads: 222
Joined: Apr 2022
Reputation:
104
It was a fractional delay used for smoother animation. Back in the day, we didn't have tools like frames limit (_LIMIT) or fractional delays like _delay .05. SLEEP 1 was a full second and got messed up if the user sat on the keyboard (the second timer quits when a key is pressed and the sleep terminates). The other trick, but not available in QB64 was to use SOUND 0, .1, which would produce a slight silent delay.
Pete
PS Bob was happy to hear you found the programs a useful source of information. I sure wish we could drag him out of retirement someday. Recently he did state if he found the right project to inspire him, he might get back to coding. Maybe next year we can run a think up a program for TheBOB contest. I mean for some reason, lost on me, all the SCREEN zero stuff I still post of The QBasic Forum hasn't brought him back!
Pete
Shoot first and shoot people who ask questions, later.
Posts: 229
Threads: 25
Joined: Aug 2022
Reputation:
23
(12-06-2022, 02:10 AM)Pete Wrote: It was a fractional delay used for smoother animation. Back in the day, we didn't have tools like frames limit (_LIMIT) or fractional delays like _delay .05. SLEEP 1 was a full second and got messed up if the user sat on the keyboard (the second timer quits when a key is pressed and the sleep terminates). The other trick, but not available in QB64 was to use SOUND 0, .1, which would produce a slight silent delay.
Pete
PS Bob was happy to hear you found the programs a useful source of information. I sure wish we could drag him out of retirement someday. Recently he did state if he found the right project to inspire him, he might get back to coding. Maybe next year we can run a think up a program for TheBOB contest. I mean for some reason, lost on me, all the SCREEN zero stuff I still post of The QBasic Forum hasn't brought him back!
Pete
Thanks for the interesting explanation. Nice to know those tricks that were used for optimization.
I'm enjoying Bob's programming. A couple other interesting commands that I've noticed...
Code: (Select All) Out &H3C8, 0
Code: (Select All) Swap ActivePAGE, VisualPAGE 'SWAP values of page variables...
Screen 9, , ActivePAGE, VisualPAGE 'which toggles active/visual page
Definitely a great resource. I hope he finds a new project to work on! Meanwhile I'm going through those programs and I'll have questions I'm sure.
Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
(12-06-2022, 03:49 AM)james2464 Wrote: Code: (Select All) Swap ActivePAGE, VisualPAGE 'SWAP values of page variables...
Screen 9, , ActivePAGE, VisualPAGE 'which toggles active/visual page
Had to be done in Q(uick)BASIC. Be happy and use QB64(PE), using "_LOADIMAGE" or "_NEWIMAGE" to have a "page" and then using "_PUTIMAGE" at least to display it into the "current" screen. Way back then while EGA (LOL) was the best that could be done with graphics there wasn't a lot of memory and the programmer had to fumble with those bit planes to get color, which explains those cumbersome "OUT" statements.
There isn't even a need to "flip buffers" like had to be done so often for WindowsXP DirectX programming. At least two buffers were required which was the size of the screen, and the program had to go back and forth between them, showing one while drawing on the other one.
Posts: 2,180
Threads: 222
Joined: Apr 2022
Reputation:
104
Indeed. QBasic needed tricks to make up for lack of speed. Page flipping allowed the next animation to be built in the background, and then flipped to the visual page. The effect avoided flickering. QB64 is so much faster the flipping, although still available, is not often needed. In QBasic, I even used page flipping on SCREEN 0. Without it, even simple menus had some noticeable flickering.
Pete
Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
12-06-2022, 06:15 AM
(This post was last modified: 12-06-2022, 06:21 AM by mnrvovrfc.
Edit Reason: Discovered a new forum trick!
)
(12-06-2022, 03:49 AM)james2464 Wrote: Definitely a great resource. I hope he finds a new project to work on! Meanwhile I'm going through those programs and I'll have questions I'm sure. Many of TheBob's programs are also going to use "CALL INTERRUPT" to deal with the mouse, which could cause problems. The best case "problem" was the mouse not responding at all; one of the worst cases was QB64 refusing to compile the program. Now I don't remember which program it was but I had to go back to QB64 v0.90 or earlier on Windows to compile that program successfully. I think it was the page animation program. But the mouse cursor was difficult to move around. I didn't notice if the program was taking a lot of CPU or if the routine was inefficient.
Rewriting that program to use "_MOUSEINPUT" and related routines was going to be an effort I was unwilling to take up.
Also keep in mind that in a few of his games, there are two programs per game. One has to be compiled and run to produce the graphics for the other program file which is actually the game.
LOL I might write in this font from this point forward. It's not listed in the font pull-down menu (only the ones acquired by "winetricks corefonts" it seems). Discovered it in Steve's thread about the changelogs.
Posts: 2,180
Threads: 222
Joined: Apr 2022
Reputation:
104
12-06-2022, 06:49 AM
(This post was last modified: 12-06-2022, 06:51 AM by Pete.)
Actually most all of TheBOB programs I posted here I converted over for Bob, to QB64 mouse routines, and packaged the needed graphics files in the accompanying zips, so there is no need for the creation routines. The original ones posted at The QBasic Forum almost all use CALL ABSOLUTE for the mouse routines, which do not work in QB64. Also, as you stated, those files required you run a program to create the needed graphics files.
Pete
Posts: 2,180
Threads: 222
Joined: Apr 2022
Reputation:
104
12-06-2022, 11:44 AM
(This post was last modified: 12-06-2022, 05:11 PM by Pete.)
CRIKEY! The Starship Enterprise sighted under Australia!!!
|