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