All of my Basic games in one zip

Use this forum to submit new files for the download section of the archive. I will check each submission and upload it to the archive on a regular basis.
User avatar
jgerrie
Posts: 146
Joined: Thu Jun 28, 2012 3:01 pm
Location: Cape Breton, Nova Scotia, Canada
Contact:

Re: All of my Basic games in one zip

Post by jgerrie »

jedie wrote:What's about to put all .bas listing on a github account?
Good idea. I'll see about getting an account. Got my son to install DragonPy on his Linux PC (PyPy ver). Little harder to get it up on my Windows PC (old and slow). Have tried tinkering with the editor. Nice colourization. Been having trouble "injecting" the source into the Coco2b. Errors out with:
"OverflowError: unsigned 1-byte integer is greater than maximum"
Probably because I'm still running XP or something. Like the colors though.

I have updated the following Coco versions of my games in my JGGAMES.zip compilation:
BERZERK DSK 2
RAIDER DSK 1
SCRAMBLE DSK 3
DODGE DSK 3
Dragon specific updates will follow eventually.
Attachments
JGGAMES.zip
(582.75 KiB) Downloaded 431 times
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: All of my Basic games in one zip

Post by jedie »

jgerrie wrote:Have tried tinkering with the editor. Nice colourization.
There are a few things to improve in the editor, see also: viewtopic.php?f=8&t=4439&p=11699#p9569

jgerrie wrote:Been having trouble "injecting" the source into the Coco2b. Errors out with:
"OverflowError: unsigned 1-byte integer is greater than maximum"
Found the bug -> viewtopic.php?f=5&t=4308&p=11890#p11890

One questions to your BASIC code:
In INVADERS.bas i found many of this:

Code: Select all

ONK GOSUB2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
ON M GOSUB21,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,20,20,20
ON K GOTO1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
Why not a IF statements here? Performance?
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: All of my Basic games in one zip

Post by jedie »

I have made some change to the origin INVADER.bas:

https://github.com/jedie/DragonPy/commi ... NVADER.bas

e.g.:
* renum
* add some alive "loading..." information

Seems that the program PEEK the keyboard matrix directly in these lines:

Code: Select all

...
330 ON1-((PEEK(343)ANDPEEK(344)ANDPEEK(345))=255)GOSUB380
...
380 ONK(PEEK(135))GOSUB350,360,390:RETURN
...
Because of this, it's not platform independent between Dragon/CoCo/MC-10...

What platform independent can be done here? INKEY$ to slow? (The resulting charcodes are also different, isn't it?)

btw. the MC-10 keyboard map would be also interesting here: http://archive.worldofdragon.org/index. ... e=Keyboard
btw2: In DragonPy the keyboard matrix implementation is good for normal typing, but not for gameplay ;( I add this on my ToDo: https://github.com/jedie/DragonPy/issues/3
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
User avatar
jgerrie
Posts: 146
Joined: Thu Jun 28, 2012 3:01 pm
Location: Cape Breton, Nova Scotia, Canada
Contact:

Re: All of my Basic games in one zip

Post by jgerrie »

jedie wrote: One questions to your BASIC code:
In INVADERS.bas i found many of this:

Code: Select all

ONK GOSUB2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
ON M GOSUB21,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,20,20,20
ON K GOTO1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
Why not a IF statements here? Performance?
The changes I posted in my last message to the Coco versions of BERZERK, RAIDER, SCRAMBLE, TOMB, etc. (and soon the Dragon versions of these) involve removing such constructions where possible. These constructions were/are motivated by the benefits that packing lines as tightly as possible in the main loop can provide. But you are right to point out that a simple IF is very fast (someone else on the Yahoo MC10 group also brought this to my attention recently), so I have been converting some lines back to such in my older programs where I used the ON approach excessively/inappropriately. However, the middle line above could not be replaced by a simple IF, so I would likely keep it. I'll add INVADER to my list for retrofitting. Thanks for bringing it to my attention. All my programs are works in progress and input from people like yourself have been critical in making them tighter and faster...

I've got a GitHub site now. I have posted and will post my updates to my distros there.
https://github.com/jggames

As far as I am aware the key polling routine works for Coco and for the Dragon, except I have to remove pokes in the Dragon version which reset the values to 255 in the peek locations (something that doesn't bother the Coco1 or Coco3 and is necessary for Coco2B). Also, the speed key routine in lines 100000 on provided by Zephyr are need for smooth key sensing on the Dragon. I've tested most of the programs using XROAR and I recall that they work...
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: All of my Basic games in one zip

Post by jedie »

Currently i'm writing a BASIC code reformat tool. Current state:
before:

Code: Select all

10 ONPOINT(Y,K)GOTO250,250
20 FORT=479TO 542:T(T)=0:Y(T)=28:NEXT
730 CLS:PRINT"FIXME: PLEASE WAIT [           ]";
after reformat:

Code: Select all

10 ON POINT(Y,K) GOTO 250,250
20 FOR T=479 TO 542:T(T)=0:Y(T)=28:NEXT 
730 CLS:PRINT "FIXME:PLEASE WAIT [           ]";
This is nonsense code, but i think you get the idea.

Then i have the idea to create also a "compressor" script....
Maybe it's possible to do mutch more reformat/compress. e.g.: split code on ":" while reformat and merge code with ":" while compress...
Theoretical it's possible to merge all code, that's not a Jump destination and the code line must be smaller than 255 (?) chars...

Another feature for my BASIC editor is to semi-auto-move lines: Maybe only "move current line to X" and update all Jump Addresses. So it's easy to move all frequently jump destinations to the top. This brings speed, isn't it?

btw. we should start a Wiki page with some "best practise" BASIC tips and insert a list of performance tips? Or does it exist somewhere?
jgerrie wrote:I've got a GitHub site now. I have posted and will post my updates to my distros there.
https://github.com/jggames
Good idea. I'm watching... ;)
jgerrie wrote:As far as I am aware the key polling routine works for Coco and for the Dragon, except I have to remove pokes in the Dragon version which reset the values to 255 in the peek locations (something that doesn't bother the Coco1 or Coco3 and is necessary for Coco2B). Also, the speed key routine in lines 100000 on provided by Zephyr are need for smooth key sensing on the Dragon. I've tested most of the programs using XROAR and I recall that they work...
IMHO INVADER.bas reads the keyboard matrix directly, so it didn't use the BASIC scan routine, isn't it?
And IMHO the keyboard matrix is different and the BASIC scan routine returns different values, too. So it's impossible to skop some translations... isn't it?
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
User avatar
jgerrie
Posts: 146
Joined: Thu Jun 28, 2012 3:01 pm
Location: Cape Breton, Nova Scotia, Canada
Contact:

Re: All of my Basic games in one zip

Post by jgerrie »

jedie wrote:Currently i'm writing a BASIC code reformat tool. Current state:
before:
IMHO INVADER.bas reads the keyboard matrix directly, so it didn't use the BASIC scan routine, isn't it?
And IMHO the keyboard matrix is different and the BASIC scan routine returns different values, too. So it's impossible to skop some translations... isn't it?
Part of the difficulty I have in porting programs from the MC-10 to Coco and Dragon is that Coco and Dragon Basic needs spaces in certain places that the slightly later rendition of Microsoft Basic used on the MC-10 does not require. Specifically:
ONNGOTO100 must be ONN GOTO100
FORA=BTOCSTEPD must be FORC=A TOB STEPC
IFA=BTHEN must be IFA=B THEN
IFA=BANDC=DTHEN must be IFA=B ANDC=DTHEN
IFA=BORC=DTHEN must be IFA=B ORC=DTHEN

An important programming technique for getting speed in my games for the MC-10 is to remove ALL spaces and to stick to single letter variables. This is fine on the MC-10. It requires absolutely no spaces anywhere. Every space just wastes tiny increments of time. I have some macros in MSWord now that help me with some of these replacements, but not all. I also have macros for changing the directly entered graphic strings to CHR$ equivalents, but there is always cleanup and unforeseen complications...

In terms of the key polling routine I have to change this for the MC-10:
20 ONK(PEEK(2)ANDPEEK(17023))GOSUB2,3,4,7

to this for the COCO:
14 ONK(PEEK(135))GOSUB2,3,4,7:RETURN
20 POKE345,255:POKE344,255:POKE343,255:POKE342,255:POKE341,255:POKE340,255:IF(PEEK(345)ANDPEEK(344)ANDPEEK(343)ANDPEEK(342)ANDPEEK(341)ANDPEEK(340))<>255THENGOSUB14

and this for the DRAGON:
14 ONK(PEEK(135))GOSUB2,3,4,7:RETURN
20 IF(PEEK(345)ANDPEEK(344)ANDPEEK(343)ANDPEEK(342)ANDPEEK(341)ANDPEEK(340))<>255THENGOSUB14

The poke in the Coco ones are for the benefit of CocoBs, which have a slightly different way of handling the rollover table, which does not reset it. The Coco1 and Coco3 don't need such pokes, but it too difficult to be bothered having multiple versions and they're not bothered by the pokes. The Dragon, however, is bothered, so I have to take the out for it. I also have to change the values of the K array to those of the arrow keys on the COCO/DRAGON rather than the codes for ASWZ.

Any special peeks or pokes must also be converted. Such as those which provide the current cursor location, which I use quite a bit. Also POKE49151 (MC-10) must be switched for SCREEN0,1. Finally the MC-10 uses a special CLOAD*A,"FILENAME" command to store numeric arrays to tape (in this case array A). This has to be replaced with this for a Coco with a disk drive:

6800 GOSUB10003:PRINT"SAVING":OPEN "O", #1,"DATA/DAT":FORC1=0TO150:WRITE #1,A(C1):NEXT:CLOSE#1:GOSUB1001
6840 GOSUB10003:PRINT"LOADING":OPEN "I", #1, "DATA/DAT":FORC1=0TO150:INPUT#1,A(C1):NEXT:CLOSE#1:GOSUB10001

or this for the DRAGON using tape:

6800 GOSUB10003:PRINT"SAVING":OPEN "O", #-1,"DATA":FORC1=0TO171:PRINT #-1,A(C1):NEXT:CLOSE#-1:GOSUB10001
6840 GOSUB10003:PRINT"LOADING":OPEN "I", #-1, "DATA":FORC1=0TO171:INPUT #-1,A(C1):NEXT:CLOSE#-1:GOSUB10001

Finally, I usually include Zephr's nifty speedkey and speedup sensing subroutine for the DRAGON and Coco
10000 IF PEEK(65535)=27 THEN POKE65497,0:GOTO10002 ELSE CLS:INPUT"CAN YOUR COMPUTER HANDLE DOUBLE SPEED (Y/N)";DS$
10001 IF DS$="Y" THEN POKE65495,0 ELSE IF DS$<>"N" THEN10000
10002 RETURN
10003 IF PEEK(65535)=27 THEN POKE65496,0 ELSE POKE65494,0
10004 RETURN
10005 ' ENABLE DRAGON SPEEDKEY
10006 IF PEEK(65535)<>180 THEN 10008
10007 IF PEEK(269)+PEEK(270)<>1 THEN POKE65283,52:POKE256,116:POKE257,1:POKE258,81:POKE259,126:POKE260,PEEK(269):POKE 261,PEEK(270):POKE269,1:POKE270,0:POKE65283,53
10008 RETURN
10009 ' DISABLE DRAGON SPEEDKEY
10010 IF PEEK(65535)<>180 THEN 10012
10011 IF PEEK(269)+PEEK(270)=1 THEN POKE65283,52:POKE269,PEEK(260):POKE270,PEEK(261):POKE65283,53
10012 RETURN

Anyway I am currently working on porting a dozen or so of my latest MC-10 programs to Coco and Dragon, but it is a lot of fiddly tiring work (not as fun as the original programming challenges). so my progress is slow. I've done BIGRED, SWELFOOP, and DICEWARS for the Coco. I'm working on Temple of Apshai. Here's what I plan to do:
DSK10:
BIGRED
SWELFOOP
DICEWARS
SEAWAR
DIGGER
CRAZY8S
CASTADV1
SHUFFLE
GOFISH
HEXAGON
DOTS

DSK11:
APSHAI

DSK12:
JOURNEY
MORLOCKS
SORCERY
ORIENT
ADVENT1
DRWHO1
PTREAS
ORAN
CHATEAU1
NINJA
PIRATE1
MANTICOR
User avatar
jgerrie
Posts: 146
Joined: Thu Jun 28, 2012 3:01 pm
Location: Cape Breton, Nova Scotia, Canada
Contact:

Re: All of my Basic games in one zip

Post by jgerrie »

Here's a new game I've made on the MC-10 and converted to Dragon. It's called DiceWars and its a rendition of a popular Java game that can be found on the net. Hope my AI is reasonably challenging. Any feedback would be much appreciated. More conversions on the way...
Attachments
DICEWARS.CAS
(6.53 KiB) Downloaded 435 times
User avatar
jgerrie
Posts: 146
Joined: Thu Jun 28, 2012 3:01 pm
Location: Cape Breton, Nova Scotia, Canada
Contact:

Re: All of my Basic games in one zip

Post by jgerrie »

Here's the latest version of of BERZERK containing a few refined techniques for squeezing just a few more ticks of speed out of the code...
Attachments
BERZERK.CAS
(10.01 KiB) Downloaded 427 times
User avatar
jgerrie
Posts: 146
Joined: Thu Jun 28, 2012 3:01 pm
Location: Cape Breton, Nova Scotia, Canada
Contact:

Re: All of my Basic games in one zip

Post by jgerrie »

Here are few other updated games...
Attachments
DODGE.CAS
(6.08 KiB) Downloaded 452 times
SCRAMBLE.CAS
(5.59 KiB) Downloaded 437 times
RAIDER.CAS
(5.49 KiB) Downloaded 427 times
Alastair
Posts: 669
Joined: Fri Jul 18, 2008 11:33 pm

Re: All of my Basic games in one zip

Post by Alastair »

Re. DiceWars.
I think the control keys need changing because I keep pressing the Q key when moving the cursor. Indeed, until I made the quick fix below (which makes the zero key the quit game key) I never finished a game!

Code: Select all

180 IFK<>48 THEN 120
Post Reply