How to write games in BASIC

Tutorials and help articles.

Articles will be approved by our staff before posting. This is to ensure that the community gets the highest quality possible content.
User avatar
DragonGaulois
Posts: 16
Joined: Mon Jan 31, 2022 4:13 pm

How to write games in BASIC

Post by DragonGaulois »


thank you for these tutorials ?

i like the graphics of the games, especially crazy boulders

User avatar
DusanStrakl
Posts: 127
Joined: Sun Apr 26, 2020 9:15 pm
Location: Bay Area, California
Contact:

How to write games in BASIC

Post by DusanStrakl »



On 11/13/2022 at 2:38 AM, DragonGaulois said:




thank you for these tutorials ?



i like the graphics of the games, especially crazy boulders



Thank you, I appreciate that. I draw all the graphics myself and typically it takes more time to design the game, make all the graphics than to write the code.

4094
Posts: 4
Joined: Mon Jan 02, 2023 6:54 am

How to write games in BASIC

Post by 4094 »


Hello.

From someone who tries to come back to 8 bit programming more than 30 years after his first lines of code : a great thank you !

PS : your ZX and Oric story reminds me of someone :);

Fred.

4094
Posts: 4
Joined: Mon Jan 02, 2023 6:54 am

How to write games in BASIC

Post by 4094 »


Hi ! 

As an X16 newbie, I tried to make  your BASIC examples work for the r41.

Layer map now starts at: $1B000, so I found :

veradirect.bas :

10 POKE $9F25,0

20 POKE $9F20,0:POKE $9F21,$B0:POKE $9F22,$21

30 FOR N=1 TO 80:POKE $9F23,N:NEXT N


veraddirect2.bas :

10 POKE $9F25,0

20 POKE $9F20,0:POKE $9F21,$B0:POKE $9F22,$91

30 FOR N=1 TO 80:POKE $9F23,N:NEXT N


Hope it'll be useful for someone.

Thanks again !

Fred.

TomXP411
Posts: 1761
Joined: Tue May 19, 2020 8:49 pm

How to write games in BASIC

Post by TomXP411 »


It looks like this program still has a bug: the second layr gets turned on, which causes some other problems. 


On 1/3/2023 at 6:01 AM, 4094 said:




30 FOR N=1 TO 80:POKE $9F23,N:NEXT N



This is actually a problem... you have your auto-increment set for 256, so the program is writing a character on each line. The problem is that the frame buffer only has 60 lines, and you're writing 80 lines. This writes past the frame buffer into space that holds other data. 

Here is a version that doesn't hammer VRAM past the frame buffer. It also shows 3 different ways of talking to VERA: the direct method, the VPOKE method, and the hybrid method. 

The hybrid method takes advantage of VPOKE to set up the address registers, and then you can simply write to them directly with POKE after that to send more data to VERA. Of course, you still need to set the increment register, but this is a little more readable. 

10 CLS:REM "DIRECT" POKE

20 POKE $9F25,0

30 POKE $9F20,0:POKE $9F21,$B0:POKE$9F22,$91

40 FOR N=1 TO 60:POKE $9F23,N:NEXT N

100 REM VPOKE EXAMPLE

110 P=$B010

120 VPOKE $1,P,0

130 FOR N=1 TO 60

140 VPOKE 1,P,N

150 P=P+$100

160 NEXT

210 REM HYBRID

220 VPOKE 1,$B020,0

230 POKE $9F22,$91 : REM SET AUTO-INCREMENT

240 FOR N=1 TO 60:POKE $9F23,N:NEXT N

 

4094
Posts: 4
Joined: Mon Jan 02, 2023 6:54 am

How to write games in BASIC

Post by 4094 »


Hi.

Stupid me probably copied the horizontal loop to build the vertical one ?.

Thx !

neutrino
Posts: 182
Joined: Wed Oct 19, 2022 5:26 pm

How to write games in BASIC

Post by neutrino »


Just an idea. Maybe it would be possible to make multiple Basic interpretators run in parallel such that one program can handle game play, another graphics and a third sound etc? Separate variables etc and then exploit interrupts for pre-emptive multitasking?

 

kelli217
Posts: 522
Joined: Sun Jul 05, 2020 11:27 pm

How to write games in BASIC

Post by kelli217 »


When the CPU is running one process, it isn't running any of the others. Multitasking isn't really going to speed anything up. In fact, the contact switching is going to add overhead. And there will be contention for zero page and the stack, both of which are very limited resources.

Uhfgood
Posts: 1
Joined: Sun Feb 19, 2023 10:30 pm

Re: How to write games in BASIC

Post by Uhfgood »

Am I missing something? I have no idea how to access any tutorials. Actually looks like the html is borked for some reason. Is it just me?
TomXP411
Posts: 1761
Joined: Tue May 19, 2020 8:49 pm

Re: How to write games in BASIC

Post by TomXP411 »

Uhfgood wrote: Tue Feb 21, 2023 7:16 pm Am I missing something? I have no idea how to access any tutorials. Actually looks like the html is borked for some reason. Is it just me?
Stuff written before Jan 10, 2023 is going to have some problems. We aren't able to fully convert HTML from the old forum software, because phpBB doesn't support arbitrary HTML in forum posts. Some things could be converted to BBCode tags, but things like YouTube embeds have to be re-done by hand.

If you see missing content, I encourage you to reach out to the original poster of the content, via the DM system, and ask if they can edit their posts and update links and/or embeds to work with BBCode.
Post Reply