ONT_GOSUBAll screen pokes have to be changed to reflect the change of the start value for the MC-10 screen (16384) and the Coco screen (1024). The MC-10 does not have an ELSE command, so all cases of the use of this must be modified. If the last command of an IF preceding an ELSE statement is a GOTO, than all one must do is move the subsequent commands to the next line. If not, then a GOTO will have to be added to jump over this new line.
FORT=D_TO
IFA>B_THEN
A_AND_B
A_OR_B
FORA=1TOB_STEP
I add a routine (10000-10004) to handle the high speed poke of the Coco. The MC-10 runs its basic programs about 10% faster than a Coco in regular speed, so some of the basic programs I have written really require the use of high speed. But in other instances, high speed makes them a little too fast. For the latter instances, I make using high speed optional so that people can use the lower speed as a difficulty level option, or learning mode. Otherwise, the routine (which someone on the Dragon Archive forums kindly gave me--Zephyr?) automatically pokes high speed for the Coco 3, but always prompts for Coco1 and 2s (and Dragons) just in case one's Coco 1 or 2 can't handle high speed.
Any orange text screen use must be switched from the MC-10's POKE49151,64 to the Coco's SCREEN 0,1. Also, all the peeks to sense the keyboard rollover tables must be changed, because these are handled very differently between the two machines. Here's the difference between how I continuously sense for key input on the MC-10
20 ONK(PEEK(17023)ANDPEEK(2))GOSUB1,2,3,4,5These two peeks will return the value of whatever key is currently being pressed on an MC-10 keyboard and then consult array K to branch to the appropriate subroutine for that key. K is a 255 unit numeric array in which the elements represent the ASCII values and what is stored in those values represent which subroutine to jump to. Typically the arrow keys get assigned 1,2,3,4 and the space bar gets 5. On the coco you must consult a sequence of peek locations to check if keys are being pressed and then consult a peek location for the ASCII value of the key being pressed. For example the following will accomplish the same as the MC-10 code above:
19 ONK(PEEK(135)) GOSUB8,9,10,11,12:RETURNIn most of my programs the main loop (along with input like that above) is usually located in the 20-25 line range. So I just have to go and change the MC-10 code for the above. This is not usually a problem as the Coco allows 256 long character lines (versus the MC-10s 128 character limit) and with the speedup poke's slightly higher speed, no appreciable loss of speed occurs. I have discovered that Coco 2s with Extended Basic versions 1.2 and above need to have the peek addresses (345-341) in the rollover table poked with 255 before consulting them, as they are not reset when the key stops being pressed. Even with this large number of pokes, the speed typically only drops back to the level of the MC-10, which was as I said, about 10% faster than an un-double-speed-poked Coco. I learned about this problem from Zephyr on the Dragon forums and from Arthur Flexser. Zephyr noted:
20 ON1-((PEEK(345)ANDPEEK(344)ANDPEEK(343)ANDPEEK(342)ANDPEEK(341))=255) GOSUB19
The truth is that Tandy modified the keyboard routine slightly for v1.2, and added the following extra code at the start. This was done in an attempt to speed-up BASIC when no keyboard input was required. They quickly realised that this caused problems for existing BASIC software that read the keyboard by peeking the rollover table. The extra code was then removed for the CoCo 3.Other than such changes, the machines are pretty much the same if one is not using high res graphics or any other Extended Basic commands not available in the MC-10 such as PRINT USING, ATAN, STRING, etc. But most of these functions can be recreated in Basic. The old Coco manual "Getting Started With Color Basic" provides some useful subroutines, such as one for ATAN, which I needed when I ported the classic 8-bit astronomy program SKYSCAPE:
Available at:
https://github.com/jggames
No comments:
Post a Comment