https://worldofdragon.org/api.php?action=feedcontributions&user=Tormod&feedformat=atomThe Dragon Archive - User contributions [en]2024-03-29T15:10:52ZUser contributionsMediaWiki 1.31.15https://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9121Dragon Notebook2017-07-09T15:54:24Z<p>Tormod: /* ERROR MESSAGES AND CODES */ pre</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith, THE EDITOR<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<pre><br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
</pre><br />
<br />
== Sound and graphics ==<br />
<pre><br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
</pre><br />
<br />
== Other ==<br />
<pre><br />
CONTINUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
</pre><br />
<br />
=== Addresses of the READ/WRITE routines in ROM. ===<br />
<pre><br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
</pre><br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
=== RIGHT JUSTIFICATION ROUTINE ===<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<pre><br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
</pre><br />
AND ANOTHER EXAMPLE<br />
<pre><br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
</pre><br />
<br />
=== DISK DRIVE NUMBERS IN PROGRAMS ===<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
<pre><br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
</pre><br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
=== SELECTING MENU OPTIONS ===<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
<pre><br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
</pre><br />
<br />
=== INVERSE VIDEO ===<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<pre><br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
</pre><br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
<pre><br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
</pre><br />
<br />
=== AUTO REPEAT ON THE D32 ===<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
<pre><br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
</pre><br />
<br />
=== DREAM ===<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
<pre><br />
POKE 29788,215:POKE 29789,145<br />
</pre><br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
<pre><br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
</pre><br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
<pre><br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
</pre><br />
<br />
=== STRINGS ===<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
=== FILEMASTER ===<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
<pre><br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
</pre><br />
By adding the following line, the number of each record can be<br />
printed:<br />
<pre><br />
5587 PRINT#DV,R(LN)+1<br />
</pre><br />
<br />
=== LLISTINGS ===<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
=== BASIC ADDRESSES ===<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
=== DISK FILES ===<br />
<pre><br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header, otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
</pre><br />
<br />
=== TO SAVE GRAPHICS TO TAPE OR DISK ===<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<pre><br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
</pre><br />
<br />
=== AUTOREPEATING KEYS FOR THE D32 ===<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
=== COLD START ===<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
=== PAUSE ===<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
=== INVERTING GRAPHICS PAGES ===<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
<pre><br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
</pre><br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
=== RESCUE OPERATION ===<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
=== THREE COLOUR PMODE4 ===<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
=== DISABLE BREAK KEY ===<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
=== SLOW DOWN LIST ===<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
=== EASY MOVING GRAPHICS ===<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
<pre><br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
</pre><br />
<br />
=== CLEAR SCREEN IN M/CODE ===<br />
<pre><br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
</pre><br />
<br />
=== PRINTER LINE FEED ===<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
=== PRINTER FIELD WIDTH ===<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
=== GRAPHICS - HIDING SCREENS ===<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
<pre><br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
</pre><br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
=== TEXT IN M/CODE PROGRAMS ===<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
=== INCREASE MEMORY AVAILABLE ===<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
=== GRAPHICS PAGES - ADDRESSES ===<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
<pre><br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
</pre><br />
<br />
=== PRINTER - TO AVOID HANG UPS ===<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
=== PRINTER - PARAMETER SETTING ===<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
=== DRIVE NUMBER ===<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
=== BAUD RATE CODE ===<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
<pre><br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
</pre><br />
<br />
=== DATA TROUBLE ===<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
=== AWAIT KEYPRESS ===<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
=== KEYBOARD DISABLE ===<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
=== GRAPHICS (Colour) ===<br />
<pre><br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
</pre><br />
<br />
=== TEXT SCREEN ===<br />
<pre><br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
</pre><br />
<br />
=== CURSOR - TO REDEFINE ===<br />
<pre><br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
</pre><br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
=== CASSETTE - HIGH SPEED MODE RESCUE ===<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
=== BREAK - TO DISABLE ===<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
<pre><br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
</pre><br />
OR AN EVEN SHORTER ROUTINE:<br />
<pre><br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
</pre><br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
=== BREAK - TO DISABLE INCLUDING INPUT LINES ===<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
<pre><br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
</pre><br />
<br />
=== TELEWRITER ===<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
=== PRINT - VARY OUTPUT TO SCREEN OR PRINTER ===<br />
<pre><br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
</pre><br />
<br />
=== CONVERT HEX/DECIMAL/HEX ===<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
=== DISPLAY ===<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
=== LOOPS ===<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
=== CENTERING A TITLE ===<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
=== CASSETTES ===<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
=== WAIT FOR KEYPRESS ===<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
=== CASSETTE LOADING ===<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
=== FC (Function Call) errors ===<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
=== OD (Out of data) errors ===<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
=== PAINT errors ===<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
=== USR Routines ===<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<pre><br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
</pre><br />
where 30000 can be any address......<br />
and then later in the program...<br />
<pre><br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
</pre><br />
<br />
=== BS Bad Subscript errors ===<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
=== DD Attempt to redimension an array. ===<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
=== DS Direct statement ===<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
=== FM Bad file mode ===<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
=== NE File non-existent ===<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
=== NF NEXT without FOR ===<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
=== TF Too many open ===<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
=== UL Undefined line ===<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
=== DATA ===<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<pre><br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
</pre><br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
<pre><br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
</pre><br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<pre><br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
</pre><br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<pre><br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
</pre><br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<pre><br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
</pre><br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<pre><br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
</pre><br />
<br />
== BASIC INTERPRETER CODES ==<br />
<pre><br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
</pre><br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<pre><br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
</pre><br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<pre><br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
</pre><br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
These refer to DRAGONDOS.<br />
<pre><br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
</pre><br />
<br />
== SAM CONTROL BITS ==<br />
<pre><br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
</pre><br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<pre><br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
</pre><br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9120Dragon Notebook2017-07-09T15:53:24Z<p>Tormod: /* BAUD RATE CODE */ fixup</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith, THE EDITOR<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<pre><br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
</pre><br />
<br />
== Sound and graphics ==<br />
<pre><br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
</pre><br />
<br />
== Other ==<br />
<pre><br />
CONTINUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
</pre><br />
<br />
=== Addresses of the READ/WRITE routines in ROM. ===<br />
<pre><br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
</pre><br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
=== RIGHT JUSTIFICATION ROUTINE ===<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<pre><br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
</pre><br />
AND ANOTHER EXAMPLE<br />
<pre><br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
</pre><br />
<br />
=== DISK DRIVE NUMBERS IN PROGRAMS ===<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
<pre><br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
</pre><br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
=== SELECTING MENU OPTIONS ===<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
<pre><br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
</pre><br />
<br />
=== INVERSE VIDEO ===<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<pre><br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
</pre><br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
<pre><br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
</pre><br />
<br />
=== AUTO REPEAT ON THE D32 ===<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
<pre><br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
</pre><br />
<br />
=== DREAM ===<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
<pre><br />
POKE 29788,215:POKE 29789,145<br />
</pre><br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
<pre><br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
</pre><br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
<pre><br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
</pre><br />
<br />
=== STRINGS ===<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
=== FILEMASTER ===<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
<pre><br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
</pre><br />
By adding the following line, the number of each record can be<br />
printed:<br />
<pre><br />
5587 PRINT#DV,R(LN)+1<br />
</pre><br />
<br />
=== LLISTINGS ===<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
=== BASIC ADDRESSES ===<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
=== DISK FILES ===<br />
<pre><br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header, otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
</pre><br />
<br />
=== TO SAVE GRAPHICS TO TAPE OR DISK ===<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<pre><br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
</pre><br />
<br />
=== AUTOREPEATING KEYS FOR THE D32 ===<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
=== COLD START ===<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
=== PAUSE ===<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
=== INVERTING GRAPHICS PAGES ===<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
<pre><br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
</pre><br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
=== RESCUE OPERATION ===<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
=== THREE COLOUR PMODE4 ===<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
=== DISABLE BREAK KEY ===<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
=== SLOW DOWN LIST ===<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
=== EASY MOVING GRAPHICS ===<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
<pre><br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
</pre><br />
<br />
=== CLEAR SCREEN IN M/CODE ===<br />
<pre><br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
</pre><br />
<br />
=== PRINTER LINE FEED ===<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
=== PRINTER FIELD WIDTH ===<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
=== GRAPHICS - HIDING SCREENS ===<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
<pre><br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
</pre><br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
=== TEXT IN M/CODE PROGRAMS ===<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
=== INCREASE MEMORY AVAILABLE ===<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
=== GRAPHICS PAGES - ADDRESSES ===<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
<pre><br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
</pre><br />
<br />
=== PRINTER - TO AVOID HANG UPS ===<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
=== PRINTER - PARAMETER SETTING ===<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
=== DRIVE NUMBER ===<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
=== BAUD RATE CODE ===<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
<pre><br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
</pre><br />
<br />
=== DATA TROUBLE ===<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
=== AWAIT KEYPRESS ===<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
=== KEYBOARD DISABLE ===<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
=== GRAPHICS (Colour) ===<br />
<pre><br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
</pre><br />
<br />
=== TEXT SCREEN ===<br />
<pre><br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
</pre><br />
<br />
=== CURSOR - TO REDEFINE ===<br />
<pre><br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
</pre><br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
=== CASSETTE - HIGH SPEED MODE RESCUE ===<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
=== BREAK - TO DISABLE ===<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
<pre><br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
</pre><br />
OR AN EVEN SHORTER ROUTINE:<br />
<pre><br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
</pre><br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
=== BREAK - TO DISABLE INCLUDING INPUT LINES ===<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
<pre><br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
</pre><br />
<br />
=== TELEWRITER ===<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
=== PRINT - VARY OUTPUT TO SCREEN OR PRINTER ===<br />
<pre><br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
</pre><br />
<br />
=== CONVERT HEX/DECIMAL/HEX ===<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
=== DISPLAY ===<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
=== LOOPS ===<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
=== CENTERING A TITLE ===<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
=== CASSETTES ===<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
=== WAIT FOR KEYPRESS ===<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
=== CASSETTE LOADING ===<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
=== FC (Function Call) errors ===<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
=== OD (Out of data) errors ===<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
=== PAINT errors ===<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
=== USR Routines ===<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<pre><br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
</pre><br />
where 30000 can be any address......<br />
and then later in the program...<br />
<pre><br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
</pre><br />
<br />
=== BS Bad Subscript errors ===<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
=== DD Attempt to redimension an array. ===<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
=== DS Direct statement ===<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
=== FM Bad file mode ===<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
=== NE File non-existent ===<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
=== NF NEXT without FOR ===<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
=== TF Too many open ===<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
=== UL Undefined line ===<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
=== DATA ===<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<pre><br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
</pre><br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
<pre><br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
</pre><br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<pre><br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
</pre><br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<pre><br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
</pre><br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<pre><br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
</pre><br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<pre><br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
</pre><br />
<br />
== BASIC INTERPRETER CODES ==<br />
<pre><br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
</pre><br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<pre><br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
</pre><br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<pre><br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
</pre><br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
These refer to DRAGONDOS.<br />
<pre><br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
</pre><br />
<br />
== SAM CONTROL BITS ==<br />
<pre><br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
</pre><br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9119Dragon Notebook2017-07-09T15:51:42Z<p>Tormod: /* HELPFUL ROUTINES */ pre and headers</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith, THE EDITOR<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<pre><br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
</pre><br />
<br />
== Sound and graphics ==<br />
<pre><br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
</pre><br />
<br />
== Other ==<br />
<pre><br />
CONTINUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
</pre><br />
<br />
=== Addresses of the READ/WRITE routines in ROM. ===<br />
<pre><br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
</pre><br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
=== RIGHT JUSTIFICATION ROUTINE ===<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<pre><br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
</pre><br />
AND ANOTHER EXAMPLE<br />
<pre><br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
</pre><br />
<br />
=== DISK DRIVE NUMBERS IN PROGRAMS ===<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
<pre><br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
</pre><br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
=== SELECTING MENU OPTIONS ===<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
<pre><br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
</pre><br />
<br />
=== INVERSE VIDEO ===<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<pre><br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
</pre><br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
<pre><br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
</pre><br />
<br />
=== AUTO REPEAT ON THE D32 ===<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
<pre><br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
</pre><br />
<br />
=== DREAM ===<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
<pre><br />
POKE 29788,215:POKE 29789,145<br />
</pre><br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
<pre><br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
</pre><br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
<pre><br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
</pre><br />
<br />
=== STRINGS ===<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
=== FILEMASTER ===<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
<pre><br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
</pre><br />
By adding the following line, the number of each record can be<br />
printed:<br />
<pre><br />
5587 PRINT#DV,R(LN)+1<br />
</pre><br />
<br />
=== LLISTINGS ===<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
=== BASIC ADDRESSES ===<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
=== DISK FILES ===<br />
<pre><br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header, otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
</pre><br />
<br />
=== TO SAVE GRAPHICS TO TAPE OR DISK ===<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<pre><br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
</pre><br />
<br />
=== AUTOREPEATING KEYS FOR THE D32 ===<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
=== COLD START ===<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
=== PAUSE ===<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
=== INVERTING GRAPHICS PAGES ===<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
<pre><br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
</pre><br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
=== RESCUE OPERATION ===<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
=== THREE COLOUR PMODE4 ===<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
=== DISABLE BREAK KEY ===<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
=== SLOW DOWN LIST ===<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
=== EASY MOVING GRAPHICS ===<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
<pre><br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
</pre><br />
<br />
=== CLEAR SCREEN IN M/CODE ===<br />
<pre><br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
</pre><br />
<br />
=== PRINTER LINE FEED ===<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
=== PRINTER FIELD WIDTH ===<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
=== GRAPHICS - HIDING SCREENS ===<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
<pre><br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
</pre><br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
=== TEXT IN M/CODE PROGRAMS ===<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
=== INCREASE MEMORY AVAILABLE ===<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
=== GRAPHICS PAGES - ADDRESSES ===<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
<pre><br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
</pre><br />
<br />
=== PRINTER - TO AVOID HANG UPS ===<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
=== PRINTER - PARAMETER SETTING ===<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
=== DRIVE NUMBER ===<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
=== BAUD RATE CODE ===<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
<pre><br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
<pre><br />
<br />
=== DATA TROUBLE ===<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
=== AWAIT KEYPRESS ===<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
=== KEYBOARD DISABLE ===<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
=== GRAPHICS (Colour) ===<br />
<pre><br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
</pre><br />
<br />
=== TEXT SCREEN ===<br />
<pre><br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
</pre><br />
<br />
=== CURSOR - TO REDEFINE ===<br />
<pre><br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
</pre><br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
=== CASSETTE - HIGH SPEED MODE RESCUE ===<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
=== BREAK - TO DISABLE ===<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
<pre><br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
</pre><br />
OR AN EVEN SHORTER ROUTINE:<br />
<pre><br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
</pre><br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
=== BREAK - TO DISABLE INCLUDING INPUT LINES ===<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
<pre><br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
</pre><br />
<br />
=== TELEWRITER ===<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
=== PRINT - VARY OUTPUT TO SCREEN OR PRINTER ===<br />
<pre><br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
</pre><br />
<br />
=== CONVERT HEX/DECIMAL/HEX ===<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
=== DISPLAY ===<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
=== LOOPS ===<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
=== CENTERING A TITLE ===<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
=== CASSETTES ===<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
=== WAIT FOR KEYPRESS ===<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
=== CASSETTE LOADING ===<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
=== FC (Function Call) errors ===<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
=== OD (Out of data) errors ===<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
=== PAINT errors ===<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
=== USR Routines ===<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<pre><br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
</pre><br />
where 30000 can be any address......<br />
and then later in the program...<br />
<pre><br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
</pre><br />
<br />
=== BS Bad Subscript errors ===<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
=== DD Attempt to redimension an array. ===<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
=== DS Direct statement ===<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
=== FM Bad file mode ===<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
=== NE File non-existent ===<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
=== NF NEXT without FOR ===<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
=== TF Too many open ===<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
=== UL Undefined line ===<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
=== DATA ===<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<pre><br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
</pre><br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
<pre><br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
</pre><br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<pre><br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
</pre><br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<pre><br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
</pre><br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<pre><br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
</pre><br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<pre><br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
</pre><br />
<br />
== BASIC INTERPRETER CODES ==<br />
<pre><br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
</pre><br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<pre><br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
</pre><br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<pre><br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
</pre><br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
These refer to DRAGONDOS.<br />
<pre><br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
</pre><br />
<br />
== SAM CONTROL BITS ==<br />
<pre><br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
</pre><br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9118Dragon Notebook2017-07-09T15:38:53Z<p>Tormod: /* PEEKs, POKES and EXECs */ pre</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith, THE EDITOR<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<pre><br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
</pre><br />
<br />
== Sound and graphics ==<br />
<pre><br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
</pre><br />
<br />
== Other ==<br />
<pre><br />
CONTINUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
</pre><br />
<br />
=== Addresses of the READ/WRITE routines in ROM. ===<br />
<pre><br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
</pre><br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
<br />
<br />
RIGHT JUSTIFICATION ROUTINE<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
<br />
AND ANOTHER EXAMPLE<br />
<br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
<br />
DISK DRIVE NUMBERS IN PROGRAMS<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
SELECTING MENU OPTIONS<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
<br />
INVERSE VIDEO<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
<br />
AUTO REPEAT ON THE D32<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
<br />
DREAM<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
POKE 29788,215:POKE 29789,145<br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
<br />
STRINGS<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
FILEMASTER<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
By adding the following line, the number of each record can be<br />
printed:-<br />
5587 PRINT#DV,R(LN)+1<br />
<br />
LLISTINGS<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
BASIC ADDRESSES<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
DISK FILES<br />
<br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header<br />
bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic<br />
where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header,<br />
otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in<br />
program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
<br />
TO SAVE GRAPHICS TO TAPE OR DISK<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
<br />
AUTOREPEATING KEYS FOR THE D32<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
COLD START<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
<br />
PAUSE<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
INVERTING GRAPHICS PAGES<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
RESCUE OPERATION<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
THREE COLOUR PMODE4<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
DISABLE BREAK KEY<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
SLOW DOWN LIST<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
EASY MOVING GRAPHICS<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
<br />
CLEAR SCREEN IN M/CODE<br />
<br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
<br />
PRINTER LINE FEED<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
PRINTER FIELD WIDTH<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
GRAPHICS - HIDING SCREENS<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
TEXT IN M/CODE PROGRAMS<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
INCREASE MEMORY AVAILABLE<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
GRAPHICS PAGES - ADDRESSES<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
<br />
PRINTER - TO AVOID HANG UPS<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
PRINTER - PARAMETER SETTING<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
DRIVE NUMBER<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
BAUD RATE CODE<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
<br />
DATA TROUBLE<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
AWAIT KEYPRESS<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
KEYBOARD DISABLE<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
GRAPHICS (Colour)<br />
<br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
<br />
TEXT SCREEN<br />
<br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
<br />
CURSOR - TO REDEFINE<br />
<br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
CASSETTE - HIGH SPEED MODE RESCUE<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
BREAK - TO DISABLE<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
<br />
OR AN EVEN SHORTER ROUTINE:<br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
<br />
BREAK - TO DISABLE INCLUDING INPUT LINES<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
<br />
TELEWRITER<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
PRINT - VARY OUTPUT TO SCREEN OR PRINTER<br />
<br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
<br />
CONVERT HEX/DECIMAL/HEX<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
DISPLAY<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
LOOPS<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
CENTERING A TITLE<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
CASSETTES<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
WAIT FOR KEYPRESS<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
CASSETTE LOADING<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
=== FC (Function Call) errors ===<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
=== OD (Out of data) errors ===<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
=== PAINT errors ===<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
=== USR Routines ===<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<pre><br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
</pre><br />
where 30000 can be any address......<br />
and then later in the program...<br />
<pre><br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
</pre><br />
<br />
=== BS Bad Subscript errors ===<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
=== DD Attempt to redimension an array. ===<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
=== DS Direct statement ===<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
=== FM Bad file mode ===<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
=== NE File non-existent ===<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
=== NF NEXT without FOR ===<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
=== TF Too many open ===<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
=== UL Undefined line ===<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
=== DATA ===<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<pre><br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
</pre><br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
<pre><br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
</pre><br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<pre><br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
</pre><br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<pre><br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
</pre><br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<pre><br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
</pre><br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<pre><br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
</pre><br />
<br />
== BASIC INTERPRETER CODES ==<br />
<pre><br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
</pre><br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<pre><br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
</pre><br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<pre><br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
</pre><br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
These refer to DRAGONDOS.<br />
<pre><br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
</pre><br />
<br />
== SAM CONTROL BITS ==<br />
<pre><br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
</pre><br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9117Dragon Notebook2017-07-09T15:33:36Z<p>Tormod: /* INTRODUCTION */</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith, THE EDITOR<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
<br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
<br />
CONTNUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
<br />
Addresses of the READ/WRITE routines in ROM.<br />
<br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
<br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
<br />
<br />
RIGHT JUSTIFICATION ROUTINE<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
<br />
AND ANOTHER EXAMPLE<br />
<br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
<br />
DISK DRIVE NUMBERS IN PROGRAMS<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
SELECTING MENU OPTIONS<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
<br />
INVERSE VIDEO<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
<br />
AUTO REPEAT ON THE D32<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
<br />
DREAM<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
POKE 29788,215:POKE 29789,145<br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
<br />
STRINGS<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
FILEMASTER<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
By adding the following line, the number of each record can be<br />
printed:-<br />
5587 PRINT#DV,R(LN)+1<br />
<br />
LLISTINGS<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
BASIC ADDRESSES<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
DISK FILES<br />
<br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header<br />
bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic<br />
where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header,<br />
otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in<br />
program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
<br />
TO SAVE GRAPHICS TO TAPE OR DISK<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
<br />
AUTOREPEATING KEYS FOR THE D32<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
COLD START<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
<br />
PAUSE<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
INVERTING GRAPHICS PAGES<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
RESCUE OPERATION<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
THREE COLOUR PMODE4<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
DISABLE BREAK KEY<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
SLOW DOWN LIST<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
EASY MOVING GRAPHICS<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
<br />
CLEAR SCREEN IN M/CODE<br />
<br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
<br />
PRINTER LINE FEED<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
PRINTER FIELD WIDTH<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
GRAPHICS - HIDING SCREENS<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
TEXT IN M/CODE PROGRAMS<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
INCREASE MEMORY AVAILABLE<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
GRAPHICS PAGES - ADDRESSES<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
<br />
PRINTER - TO AVOID HANG UPS<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
PRINTER - PARAMETER SETTING<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
DRIVE NUMBER<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
BAUD RATE CODE<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
<br />
DATA TROUBLE<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
AWAIT KEYPRESS<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
KEYBOARD DISABLE<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
GRAPHICS (Colour)<br />
<br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
<br />
TEXT SCREEN<br />
<br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
<br />
CURSOR - TO REDEFINE<br />
<br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
CASSETTE - HIGH SPEED MODE RESCUE<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
BREAK - TO DISABLE<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
<br />
OR AN EVEN SHORTER ROUTINE:<br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
<br />
BREAK - TO DISABLE INCLUDING INPUT LINES<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
<br />
TELEWRITER<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
PRINT - VARY OUTPUT TO SCREEN OR PRINTER<br />
<br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
<br />
CONVERT HEX/DECIMAL/HEX<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
DISPLAY<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
LOOPS<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
CENTERING A TITLE<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
CASSETTES<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
WAIT FOR KEYPRESS<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
CASSETTE LOADING<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
=== FC (Function Call) errors ===<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
=== OD (Out of data) errors ===<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
=== PAINT errors ===<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
=== USR Routines ===<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<pre><br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
</pre><br />
where 30000 can be any address......<br />
and then later in the program...<br />
<pre><br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
</pre><br />
<br />
=== BS Bad Subscript errors ===<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
=== DD Attempt to redimension an array. ===<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
=== DS Direct statement ===<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
=== FM Bad file mode ===<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
=== NE File non-existent ===<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
=== NF NEXT without FOR ===<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
=== TF Too many open ===<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
=== UL Undefined line ===<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
=== DATA ===<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<pre><br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
</pre><br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
<pre><br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
</pre><br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<pre><br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
</pre><br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<pre><br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
</pre><br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<pre><br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
</pre><br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<pre><br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
</pre><br />
<br />
== BASIC INTERPRETER CODES ==<br />
<pre><br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
</pre><br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<pre><br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
</pre><br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<pre><br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
</pre><br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
These refer to DRAGONDOS.<br />
<pre><br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
</pre><br />
<br />
== SAM CONTROL BITS ==<br />
<pre><br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
</pre><br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9116Dragon Notebook2017-07-09T15:32:02Z<p>Tormod: /* DEBUGGING HINTS */ make headers</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith,<br />
THE EDITOR<br />
<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
<br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
<br />
CONTNUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
<br />
Addresses of the READ/WRITE routines in ROM.<br />
<br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
<br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
<br />
<br />
RIGHT JUSTIFICATION ROUTINE<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
<br />
AND ANOTHER EXAMPLE<br />
<br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
<br />
DISK DRIVE NUMBERS IN PROGRAMS<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
SELECTING MENU OPTIONS<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
<br />
INVERSE VIDEO<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
<br />
AUTO REPEAT ON THE D32<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
<br />
DREAM<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
POKE 29788,215:POKE 29789,145<br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
<br />
STRINGS<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
FILEMASTER<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
By adding the following line, the number of each record can be<br />
printed:-<br />
5587 PRINT#DV,R(LN)+1<br />
<br />
LLISTINGS<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
BASIC ADDRESSES<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
DISK FILES<br />
<br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header<br />
bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic<br />
where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header,<br />
otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in<br />
program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
<br />
TO SAVE GRAPHICS TO TAPE OR DISK<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
<br />
AUTOREPEATING KEYS FOR THE D32<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
COLD START<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
<br />
PAUSE<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
INVERTING GRAPHICS PAGES<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
RESCUE OPERATION<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
THREE COLOUR PMODE4<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
DISABLE BREAK KEY<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
SLOW DOWN LIST<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
EASY MOVING GRAPHICS<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
<br />
CLEAR SCREEN IN M/CODE<br />
<br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
<br />
PRINTER LINE FEED<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
PRINTER FIELD WIDTH<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
GRAPHICS - HIDING SCREENS<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
TEXT IN M/CODE PROGRAMS<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
INCREASE MEMORY AVAILABLE<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
GRAPHICS PAGES - ADDRESSES<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
<br />
PRINTER - TO AVOID HANG UPS<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
PRINTER - PARAMETER SETTING<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
DRIVE NUMBER<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
BAUD RATE CODE<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
<br />
DATA TROUBLE<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
AWAIT KEYPRESS<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
KEYBOARD DISABLE<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
GRAPHICS (Colour)<br />
<br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
<br />
TEXT SCREEN<br />
<br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
<br />
CURSOR - TO REDEFINE<br />
<br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
CASSETTE - HIGH SPEED MODE RESCUE<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
BREAK - TO DISABLE<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
<br />
OR AN EVEN SHORTER ROUTINE:<br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
<br />
BREAK - TO DISABLE INCLUDING INPUT LINES<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
<br />
TELEWRITER<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
PRINT - VARY OUTPUT TO SCREEN OR PRINTER<br />
<br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
<br />
CONVERT HEX/DECIMAL/HEX<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
DISPLAY<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
LOOPS<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
CENTERING A TITLE<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
CASSETTES<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
WAIT FOR KEYPRESS<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
CASSETTE LOADING<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
=== FC (Function Call) errors ===<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
=== OD (Out of data) errors ===<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
=== PAINT errors ===<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
=== USR Routines ===<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<pre><br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
</pre><br />
where 30000 can be any address......<br />
and then later in the program...<br />
<pre><br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
</pre><br />
<br />
=== BS Bad Subscript errors ===<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
=== DD Attempt to redimension an array. ===<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
=== DS Direct statement ===<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
=== FM Bad file mode ===<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
=== NE File non-existent ===<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
=== NF NEXT without FOR ===<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
=== TF Too many open ===<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
=== UL Undefined line ===<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
=== DATA ===<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<pre><br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
</pre><br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
<pre><br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
</pre><br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<pre><br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
</pre><br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<pre><br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
</pre><br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<pre><br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
</pre><br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<pre><br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
</pre><br />
<br />
== BASIC INTERPRETER CODES ==<br />
<pre><br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
</pre><br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<pre><br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
</pre><br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<pre><br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
</pre><br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
These refer to DRAGONDOS.<br />
<pre><br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
</pre><br />
<br />
== SAM CONTROL BITS ==<br />
<pre><br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
</pre><br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9115Dragon Notebook2017-07-09T15:28:49Z<p>Tormod: /* GRAPHIC MODES of the DRAGON and COCO */ pre</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith,<br />
THE EDITOR<br />
<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
<br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
<br />
CONTNUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
<br />
Addresses of the READ/WRITE routines in ROM.<br />
<br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
<br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
<br />
<br />
RIGHT JUSTIFICATION ROUTINE<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
<br />
AND ANOTHER EXAMPLE<br />
<br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
<br />
DISK DRIVE NUMBERS IN PROGRAMS<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
SELECTING MENU OPTIONS<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
<br />
INVERSE VIDEO<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
<br />
AUTO REPEAT ON THE D32<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
<br />
DREAM<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
POKE 29788,215:POKE 29789,145<br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
<br />
STRINGS<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
FILEMASTER<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
By adding the following line, the number of each record can be<br />
printed:-<br />
5587 PRINT#DV,R(LN)+1<br />
<br />
LLISTINGS<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
BASIC ADDRESSES<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
DISK FILES<br />
<br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header<br />
bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic<br />
where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header,<br />
otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in<br />
program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
<br />
TO SAVE GRAPHICS TO TAPE OR DISK<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
<br />
AUTOREPEATING KEYS FOR THE D32<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
COLD START<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
<br />
PAUSE<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
INVERTING GRAPHICS PAGES<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
RESCUE OPERATION<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
THREE COLOUR PMODE4<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
DISABLE BREAK KEY<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
SLOW DOWN LIST<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
EASY MOVING GRAPHICS<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
<br />
CLEAR SCREEN IN M/CODE<br />
<br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
<br />
PRINTER LINE FEED<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
PRINTER FIELD WIDTH<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
GRAPHICS - HIDING SCREENS<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
TEXT IN M/CODE PROGRAMS<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
INCREASE MEMORY AVAILABLE<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
GRAPHICS PAGES - ADDRESSES<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
<br />
PRINTER - TO AVOID HANG UPS<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
PRINTER - PARAMETER SETTING<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
DRIVE NUMBER<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
BAUD RATE CODE<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
<br />
DATA TROUBLE<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
AWAIT KEYPRESS<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
KEYBOARD DISABLE<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
GRAPHICS (Colour)<br />
<br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
<br />
TEXT SCREEN<br />
<br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
<br />
CURSOR - TO REDEFINE<br />
<br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
CASSETTE - HIGH SPEED MODE RESCUE<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
BREAK - TO DISABLE<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
<br />
OR AN EVEN SHORTER ROUTINE:<br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
<br />
BREAK - TO DISABLE INCLUDING INPUT LINES<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
<br />
TELEWRITER<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
PRINT - VARY OUTPUT TO SCREEN OR PRINTER<br />
<br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
<br />
CONVERT HEX/DECIMAL/HEX<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
DISPLAY<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
LOOPS<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
CENTERING A TITLE<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
CASSETTES<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
WAIT FOR KEYPRESS<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
CASSETTE LOADING<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
<br />
FC (Function Call) errors<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
OD (Out of data) errors<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
PAINT errors<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
USR Routines<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
where 30000 can be any address......<br />
and then later in the program...<br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
<br />
BS Bad Subscript errors<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
DD Attempt to redimension an array.<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
DS Direct statement<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
FM Bad file mode<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
NE File non-existent<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
NF NEXT without FOR<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
TF Too many open<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
UL Undefined line<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
DATA<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<pre><br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
</pre><br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
<pre><br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
</pre><br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<pre><br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
</pre><br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<pre><br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
</pre><br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<pre><br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
</pre><br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<pre><br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
</pre><br />
<br />
== BASIC INTERPRETER CODES ==<br />
<pre><br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
</pre><br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<pre><br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
</pre><br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<pre><br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
</pre><br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
These refer to DRAGONDOS.<br />
<pre><br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
</pre><br />
<br />
== SAM CONTROL BITS ==<br />
<pre><br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
</pre><br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9114Dragon Notebook2017-07-09T15:26:56Z<p>Tormod: /* SAM CONTROL BITS */</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith,<br />
THE EDITOR<br />
<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
<br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
<br />
CONTNUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
<br />
Addresses of the READ/WRITE routines in ROM.<br />
<br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
<br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
<br />
<br />
RIGHT JUSTIFICATION ROUTINE<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
<br />
AND ANOTHER EXAMPLE<br />
<br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
<br />
DISK DRIVE NUMBERS IN PROGRAMS<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
SELECTING MENU OPTIONS<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
<br />
INVERSE VIDEO<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
<br />
AUTO REPEAT ON THE D32<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
<br />
DREAM<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
POKE 29788,215:POKE 29789,145<br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
<br />
STRINGS<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
FILEMASTER<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
By adding the following line, the number of each record can be<br />
printed:-<br />
5587 PRINT#DV,R(LN)+1<br />
<br />
LLISTINGS<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
BASIC ADDRESSES<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
DISK FILES<br />
<br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header<br />
bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic<br />
where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header,<br />
otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in<br />
program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
<br />
TO SAVE GRAPHICS TO TAPE OR DISK<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
<br />
AUTOREPEATING KEYS FOR THE D32<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
COLD START<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
<br />
PAUSE<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
INVERTING GRAPHICS PAGES<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
RESCUE OPERATION<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
THREE COLOUR PMODE4<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
DISABLE BREAK KEY<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
SLOW DOWN LIST<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
EASY MOVING GRAPHICS<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
<br />
CLEAR SCREEN IN M/CODE<br />
<br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
<br />
PRINTER LINE FEED<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
PRINTER FIELD WIDTH<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
GRAPHICS - HIDING SCREENS<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
TEXT IN M/CODE PROGRAMS<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
INCREASE MEMORY AVAILABLE<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
GRAPHICS PAGES - ADDRESSES<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
<br />
PRINTER - TO AVOID HANG UPS<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
PRINTER - PARAMETER SETTING<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
DRIVE NUMBER<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
BAUD RATE CODE<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
<br />
DATA TROUBLE<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
AWAIT KEYPRESS<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
KEYBOARD DISABLE<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
GRAPHICS (Colour)<br />
<br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
<br />
TEXT SCREEN<br />
<br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
<br />
CURSOR - TO REDEFINE<br />
<br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
CASSETTE - HIGH SPEED MODE RESCUE<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
BREAK - TO DISABLE<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
<br />
OR AN EVEN SHORTER ROUTINE:<br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
<br />
BREAK - TO DISABLE INCLUDING INPUT LINES<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
<br />
TELEWRITER<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
PRINT - VARY OUTPUT TO SCREEN OR PRINTER<br />
<br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
<br />
CONVERT HEX/DECIMAL/HEX<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
DISPLAY<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
LOOPS<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
CENTERING A TITLE<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
CASSETTES<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
WAIT FOR KEYPRESS<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
CASSETTE LOADING<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
<br />
FC (Function Call) errors<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
OD (Out of data) errors<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
PAINT errors<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
USR Routines<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
where 30000 can be any address......<br />
and then later in the program...<br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
<br />
BS Bad Subscript errors<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
DD Attempt to redimension an array.<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
DS Direct statement<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
FM Bad file mode<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
NE File non-existent<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
NF NEXT without FOR<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
TF Too many open<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
UL Undefined line<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
DATA<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
<br />
<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
<br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
<br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<pre><br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
</pre><br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<pre><br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
</pre><br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<pre><br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
</pre><br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<pre><br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
</pre><br />
<br />
== BASIC INTERPRETER CODES ==<br />
<pre><br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
</pre><br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<pre><br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
</pre><br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<pre><br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
</pre><br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
These refer to DRAGONDOS.<br />
<pre><br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
</pre><br />
<br />
== SAM CONTROL BITS ==<br />
<pre><br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
</pre><br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9113Dragon Notebook2017-07-09T15:26:41Z<p>Tormod: /* INPUT/OUTPUT ROUTINES */</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith,<br />
THE EDITOR<br />
<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
<br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
<br />
CONTNUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
<br />
Addresses of the READ/WRITE routines in ROM.<br />
<br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
<br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
<br />
<br />
RIGHT JUSTIFICATION ROUTINE<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
<br />
AND ANOTHER EXAMPLE<br />
<br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
<br />
DISK DRIVE NUMBERS IN PROGRAMS<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
SELECTING MENU OPTIONS<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
<br />
INVERSE VIDEO<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
<br />
AUTO REPEAT ON THE D32<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
<br />
DREAM<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
POKE 29788,215:POKE 29789,145<br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
<br />
STRINGS<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
FILEMASTER<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
By adding the following line, the number of each record can be<br />
printed:-<br />
5587 PRINT#DV,R(LN)+1<br />
<br />
LLISTINGS<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
BASIC ADDRESSES<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
DISK FILES<br />
<br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header<br />
bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic<br />
where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header,<br />
otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in<br />
program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
<br />
TO SAVE GRAPHICS TO TAPE OR DISK<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
<br />
AUTOREPEATING KEYS FOR THE D32<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
COLD START<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
<br />
PAUSE<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
INVERTING GRAPHICS PAGES<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
RESCUE OPERATION<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
THREE COLOUR PMODE4<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
DISABLE BREAK KEY<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
SLOW DOWN LIST<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
EASY MOVING GRAPHICS<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
<br />
CLEAR SCREEN IN M/CODE<br />
<br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
<br />
PRINTER LINE FEED<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
PRINTER FIELD WIDTH<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
GRAPHICS - HIDING SCREENS<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
TEXT IN M/CODE PROGRAMS<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
INCREASE MEMORY AVAILABLE<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
GRAPHICS PAGES - ADDRESSES<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
<br />
PRINTER - TO AVOID HANG UPS<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
PRINTER - PARAMETER SETTING<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
DRIVE NUMBER<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
BAUD RATE CODE<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
<br />
DATA TROUBLE<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
AWAIT KEYPRESS<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
KEYBOARD DISABLE<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
GRAPHICS (Colour)<br />
<br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
<br />
TEXT SCREEN<br />
<br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
<br />
CURSOR - TO REDEFINE<br />
<br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
CASSETTE - HIGH SPEED MODE RESCUE<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
BREAK - TO DISABLE<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
<br />
OR AN EVEN SHORTER ROUTINE:<br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
<br />
BREAK - TO DISABLE INCLUDING INPUT LINES<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
<br />
TELEWRITER<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
PRINT - VARY OUTPUT TO SCREEN OR PRINTER<br />
<br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
<br />
CONVERT HEX/DECIMAL/HEX<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
DISPLAY<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
LOOPS<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
CENTERING A TITLE<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
CASSETTES<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
WAIT FOR KEYPRESS<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
CASSETTE LOADING<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
<br />
FC (Function Call) errors<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
OD (Out of data) errors<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
PAINT errors<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
USR Routines<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
where 30000 can be any address......<br />
and then later in the program...<br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
<br />
BS Bad Subscript errors<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
DD Attempt to redimension an array.<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
DS Direct statement<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
FM Bad file mode<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
NE File non-existent<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
NF NEXT without FOR<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
TF Too many open<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
UL Undefined line<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
DATA<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
<br />
<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
<br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
<br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<pre><br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
</pre><br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<pre><br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
</pre><br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<pre><br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
</pre><br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<pre><br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
</pre><br />
<br />
== BASIC INTERPRETER CODES ==<br />
<pre><br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
</pre><br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<pre><br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
</pre><br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<pre><br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
</pre><br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
These refer to DRAGONDOS.<br />
<pre><br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
</pre><br />
<br />
== SAM CONTROL BITS ==<br />
<br />
<br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
<br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9112Dragon Notebook2017-07-09T15:26:06Z<p>Tormod: /* BASIC INTERPRETER CODES */ pre</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith,<br />
THE EDITOR<br />
<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
<br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
<br />
CONTNUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
<br />
Addresses of the READ/WRITE routines in ROM.<br />
<br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
<br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
<br />
<br />
RIGHT JUSTIFICATION ROUTINE<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
<br />
AND ANOTHER EXAMPLE<br />
<br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
<br />
DISK DRIVE NUMBERS IN PROGRAMS<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
SELECTING MENU OPTIONS<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
<br />
INVERSE VIDEO<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
<br />
AUTO REPEAT ON THE D32<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
<br />
DREAM<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
POKE 29788,215:POKE 29789,145<br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
<br />
STRINGS<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
FILEMASTER<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
By adding the following line, the number of each record can be<br />
printed:-<br />
5587 PRINT#DV,R(LN)+1<br />
<br />
LLISTINGS<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
BASIC ADDRESSES<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
DISK FILES<br />
<br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header<br />
bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic<br />
where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header,<br />
otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in<br />
program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
<br />
TO SAVE GRAPHICS TO TAPE OR DISK<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
<br />
AUTOREPEATING KEYS FOR THE D32<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
COLD START<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
<br />
PAUSE<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
INVERTING GRAPHICS PAGES<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
RESCUE OPERATION<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
THREE COLOUR PMODE4<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
DISABLE BREAK KEY<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
SLOW DOWN LIST<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
EASY MOVING GRAPHICS<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
<br />
CLEAR SCREEN IN M/CODE<br />
<br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
<br />
PRINTER LINE FEED<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
PRINTER FIELD WIDTH<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
GRAPHICS - HIDING SCREENS<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
TEXT IN M/CODE PROGRAMS<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
INCREASE MEMORY AVAILABLE<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
GRAPHICS PAGES - ADDRESSES<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
<br />
PRINTER - TO AVOID HANG UPS<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
PRINTER - PARAMETER SETTING<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
DRIVE NUMBER<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
BAUD RATE CODE<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
<br />
DATA TROUBLE<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
AWAIT KEYPRESS<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
KEYBOARD DISABLE<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
GRAPHICS (Colour)<br />
<br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
<br />
TEXT SCREEN<br />
<br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
<br />
CURSOR - TO REDEFINE<br />
<br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
CASSETTE - HIGH SPEED MODE RESCUE<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
BREAK - TO DISABLE<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
<br />
OR AN EVEN SHORTER ROUTINE:<br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
<br />
BREAK - TO DISABLE INCLUDING INPUT LINES<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
<br />
TELEWRITER<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
PRINT - VARY OUTPUT TO SCREEN OR PRINTER<br />
<br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
<br />
CONVERT HEX/DECIMAL/HEX<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
DISPLAY<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
LOOPS<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
CENTERING A TITLE<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
CASSETTES<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
WAIT FOR KEYPRESS<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
CASSETTE LOADING<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
<br />
FC (Function Call) errors<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
OD (Out of data) errors<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
PAINT errors<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
USR Routines<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
where 30000 can be any address......<br />
and then later in the program...<br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
<br />
BS Bad Subscript errors<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
DD Attempt to redimension an array.<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
DS Direct statement<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
FM Bad file mode<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
NE File non-existent<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
NF NEXT without FOR<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
TF Too many open<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
UL Undefined line<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
DATA<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
<br />
<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
<br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
<br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<pre><br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
</pre><br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<pre><br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
</pre><br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<pre><br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
</pre><br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<pre><br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
</pre><br />
<br />
== BASIC INTERPRETER CODES ==<br />
<pre><br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
</pre><br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<pre><br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
</pre><br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<pre><br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
</pre><br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
<br />
<br />
These refer to DRAGONDOS.<br />
<br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
<br />
<br />
== SAM CONTROL BITS ==<br />
<br />
<br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
<br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9111Dragon Notebook2017-07-09T15:24:51Z<p>Tormod: /* DRAGONDOS WORK SPACE */ pre</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith,<br />
THE EDITOR<br />
<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
<br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
<br />
CONTNUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
<br />
Addresses of the READ/WRITE routines in ROM.<br />
<br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
<br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
<br />
<br />
RIGHT JUSTIFICATION ROUTINE<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
<br />
AND ANOTHER EXAMPLE<br />
<br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
<br />
DISK DRIVE NUMBERS IN PROGRAMS<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
SELECTING MENU OPTIONS<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
<br />
INVERSE VIDEO<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
<br />
AUTO REPEAT ON THE D32<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
<br />
DREAM<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
POKE 29788,215:POKE 29789,145<br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
<br />
STRINGS<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
FILEMASTER<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
By adding the following line, the number of each record can be<br />
printed:-<br />
5587 PRINT#DV,R(LN)+1<br />
<br />
LLISTINGS<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
BASIC ADDRESSES<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
DISK FILES<br />
<br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header<br />
bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic<br />
where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header,<br />
otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in<br />
program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
<br />
TO SAVE GRAPHICS TO TAPE OR DISK<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
<br />
AUTOREPEATING KEYS FOR THE D32<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
COLD START<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
<br />
PAUSE<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
INVERTING GRAPHICS PAGES<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
RESCUE OPERATION<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
THREE COLOUR PMODE4<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
DISABLE BREAK KEY<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
SLOW DOWN LIST<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
EASY MOVING GRAPHICS<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
<br />
CLEAR SCREEN IN M/CODE<br />
<br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
<br />
PRINTER LINE FEED<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
PRINTER FIELD WIDTH<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
GRAPHICS - HIDING SCREENS<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
TEXT IN M/CODE PROGRAMS<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
INCREASE MEMORY AVAILABLE<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
GRAPHICS PAGES - ADDRESSES<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
<br />
PRINTER - TO AVOID HANG UPS<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
PRINTER - PARAMETER SETTING<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
DRIVE NUMBER<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
BAUD RATE CODE<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
<br />
DATA TROUBLE<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
AWAIT KEYPRESS<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
KEYBOARD DISABLE<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
GRAPHICS (Colour)<br />
<br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
<br />
TEXT SCREEN<br />
<br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
<br />
CURSOR - TO REDEFINE<br />
<br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
CASSETTE - HIGH SPEED MODE RESCUE<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
BREAK - TO DISABLE<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
<br />
OR AN EVEN SHORTER ROUTINE:<br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
<br />
BREAK - TO DISABLE INCLUDING INPUT LINES<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
<br />
TELEWRITER<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
PRINT - VARY OUTPUT TO SCREEN OR PRINTER<br />
<br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
<br />
CONVERT HEX/DECIMAL/HEX<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
DISPLAY<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
LOOPS<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
CENTERING A TITLE<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
CASSETTES<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
WAIT FOR KEYPRESS<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
CASSETTE LOADING<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
<br />
FC (Function Call) errors<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
OD (Out of data) errors<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
PAINT errors<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
USR Routines<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
where 30000 can be any address......<br />
and then later in the program...<br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
<br />
BS Bad Subscript errors<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
DD Attempt to redimension an array.<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
DS Direct statement<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
FM Bad file mode<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
NE File non-existent<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
NF NEXT without FOR<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
TF Too many open<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
UL Undefined line<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
DATA<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
<br />
<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
<br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
<br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<pre><br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
</pre><br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<pre><br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
</pre><br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<pre><br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
</pre><br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<pre><br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
</pre><br />
<br />
== BASIC INTERPRETER CODES ==<br />
<br />
<br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
<br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
Page 34<br />
<br />
<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
Page 35<br />
<br />
<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
<br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
<br />
<br />
These refer to DRAGONDOS.<br />
<br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
<br />
<br />
== SAM CONTROL BITS ==<br />
<br />
<br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
<br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9110Dragon Notebook2017-07-09T15:24:09Z<p>Tormod: /* MEMORY MAP DETAILS */ pre</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith,<br />
THE EDITOR<br />
<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
<br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
<br />
CONTNUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
<br />
Addresses of the READ/WRITE routines in ROM.<br />
<br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
<br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
<br />
<br />
RIGHT JUSTIFICATION ROUTINE<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
<br />
AND ANOTHER EXAMPLE<br />
<br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
<br />
DISK DRIVE NUMBERS IN PROGRAMS<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
SELECTING MENU OPTIONS<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
<br />
INVERSE VIDEO<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
<br />
AUTO REPEAT ON THE D32<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
<br />
DREAM<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
POKE 29788,215:POKE 29789,145<br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
<br />
STRINGS<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
FILEMASTER<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
By adding the following line, the number of each record can be<br />
printed:-<br />
5587 PRINT#DV,R(LN)+1<br />
<br />
LLISTINGS<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
BASIC ADDRESSES<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
DISK FILES<br />
<br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header<br />
bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic<br />
where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header,<br />
otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in<br />
program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
<br />
TO SAVE GRAPHICS TO TAPE OR DISK<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
<br />
AUTOREPEATING KEYS FOR THE D32<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
COLD START<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
<br />
PAUSE<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
INVERTING GRAPHICS PAGES<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
RESCUE OPERATION<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
THREE COLOUR PMODE4<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
DISABLE BREAK KEY<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
SLOW DOWN LIST<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
EASY MOVING GRAPHICS<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
<br />
CLEAR SCREEN IN M/CODE<br />
<br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
<br />
PRINTER LINE FEED<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
PRINTER FIELD WIDTH<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
GRAPHICS - HIDING SCREENS<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
TEXT IN M/CODE PROGRAMS<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
INCREASE MEMORY AVAILABLE<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
GRAPHICS PAGES - ADDRESSES<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
<br />
PRINTER - TO AVOID HANG UPS<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
PRINTER - PARAMETER SETTING<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
DRIVE NUMBER<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
BAUD RATE CODE<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
<br />
DATA TROUBLE<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
AWAIT KEYPRESS<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
KEYBOARD DISABLE<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
GRAPHICS (Colour)<br />
<br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
<br />
TEXT SCREEN<br />
<br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
<br />
CURSOR - TO REDEFINE<br />
<br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
CASSETTE - HIGH SPEED MODE RESCUE<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
BREAK - TO DISABLE<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
<br />
OR AN EVEN SHORTER ROUTINE:<br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
<br />
BREAK - TO DISABLE INCLUDING INPUT LINES<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
<br />
TELEWRITER<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
PRINT - VARY OUTPUT TO SCREEN OR PRINTER<br />
<br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
<br />
CONVERT HEX/DECIMAL/HEX<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
DISPLAY<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
LOOPS<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
CENTERING A TITLE<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
CASSETTES<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
WAIT FOR KEYPRESS<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
CASSETTE LOADING<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
<br />
FC (Function Call) errors<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
OD (Out of data) errors<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
PAINT errors<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
USR Routines<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
where 30000 can be any address......<br />
and then later in the program...<br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
<br />
BS Bad Subscript errors<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
DD Attempt to redimension an array.<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
DS Direct statement<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
FM Bad file mode<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
NE File non-existent<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
NF NEXT without FOR<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
TF Too many open<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
UL Undefined line<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
DATA<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
<br />
<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
<br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
<br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<pre><br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
</pre><br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<pre><br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
</pre><br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<pre><br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
</pre><br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<br />
<br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
<br />
== BASIC INTERPRETER CODES ==<br />
<br />
<br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
<br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
Page 34<br />
<br />
<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
Page 35<br />
<br />
<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
<br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
<br />
<br />
These refer to DRAGONDOS.<br />
<br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
<br />
<br />
== SAM CONTROL BITS ==<br />
<br />
<br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
<br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9109Dragon Notebook2017-07-09T15:21:26Z<p>Tormod: /* BIBLIOGRAPHY */ break up a bit</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith,<br />
THE EDITOR<br />
<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
<br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
<br />
CONTNUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
<br />
Addresses of the READ/WRITE routines in ROM.<br />
<br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
<br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
<br />
<br />
RIGHT JUSTIFICATION ROUTINE<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
<br />
AND ANOTHER EXAMPLE<br />
<br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
<br />
DISK DRIVE NUMBERS IN PROGRAMS<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
SELECTING MENU OPTIONS<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
<br />
INVERSE VIDEO<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
<br />
AUTO REPEAT ON THE D32<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
<br />
DREAM<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
POKE 29788,215:POKE 29789,145<br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
<br />
STRINGS<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
FILEMASTER<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
By adding the following line, the number of each record can be<br />
printed:-<br />
5587 PRINT#DV,R(LN)+1<br />
<br />
LLISTINGS<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
BASIC ADDRESSES<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
DISK FILES<br />
<br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header<br />
bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic<br />
where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header,<br />
otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in<br />
program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
<br />
TO SAVE GRAPHICS TO TAPE OR DISK<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
<br />
AUTOREPEATING KEYS FOR THE D32<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
COLD START<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
<br />
PAUSE<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
INVERTING GRAPHICS PAGES<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
RESCUE OPERATION<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
THREE COLOUR PMODE4<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
DISABLE BREAK KEY<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
SLOW DOWN LIST<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
EASY MOVING GRAPHICS<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
<br />
CLEAR SCREEN IN M/CODE<br />
<br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
<br />
PRINTER LINE FEED<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
PRINTER FIELD WIDTH<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
GRAPHICS - HIDING SCREENS<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
TEXT IN M/CODE PROGRAMS<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
INCREASE MEMORY AVAILABLE<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
GRAPHICS PAGES - ADDRESSES<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
<br />
PRINTER - TO AVOID HANG UPS<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
PRINTER - PARAMETER SETTING<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
DRIVE NUMBER<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
BAUD RATE CODE<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
<br />
DATA TROUBLE<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
AWAIT KEYPRESS<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
KEYBOARD DISABLE<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
GRAPHICS (Colour)<br />
<br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
<br />
TEXT SCREEN<br />
<br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
<br />
CURSOR - TO REDEFINE<br />
<br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
CASSETTE - HIGH SPEED MODE RESCUE<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
BREAK - TO DISABLE<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
<br />
OR AN EVEN SHORTER ROUTINE:<br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
<br />
BREAK - TO DISABLE INCLUDING INPUT LINES<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
<br />
TELEWRITER<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
PRINT - VARY OUTPUT TO SCREEN OR PRINTER<br />
<br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
<br />
CONVERT HEX/DECIMAL/HEX<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
DISPLAY<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
LOOPS<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
CENTERING A TITLE<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
CASSETTES<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
WAIT FOR KEYPRESS<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
CASSETTE LOADING<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
<br />
FC (Function Call) errors<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
OD (Out of data) errors<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
PAINT errors<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
USR Routines<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
where 30000 can be any address......<br />
and then later in the program...<br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
<br />
BS Bad Subscript errors<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
DD Attempt to redimension an array.<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
DS Direct statement<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
FM Bad file mode<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
NE File non-existent<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
NF NEXT without FOR<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
TF Too many open<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
UL Undefined line<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
DATA<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
<br />
<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
<br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
<br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
<br />
Other books, if you can find them, are:<br />
<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<br />
<br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
<br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
<br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<br />
<br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
<br />
== BASIC INTERPRETER CODES ==<br />
<br />
<br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
<br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
Page 34<br />
<br />
<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
Page 35<br />
<br />
<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
<br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
<br />
<br />
These refer to DRAGONDOS.<br />
<br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
<br />
<br />
== SAM CONTROL BITS ==<br />
<br />
<br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
<br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_Notebook&diff=9108Dragon Notebook2017-07-09T15:19:37Z<p>Tormod: /* DISKS AND THE DRAGON 64 */ add headers and preformated tags</p>
<hr />
<div>== INTRODUCTION ==<br />
<br />
<br />
This Notebook is dedicated to 6809 programmers past, present<br />
and future and in particular to those whose work has<br />
contributed so much to unravelling the secrets of the<br />
DRAGON'S ROM.<br />
<br />
The contents have been gleaned from many different sources<br />
over the years and to all contributors, known and unknown,<br />
we offer out heartfelt thanks.<br />
<br />
The Editor's gnarled fingers were responsible for the typing<br />
of all the pages in this book using what he considers to be<br />
the best word processor for the 6809 computers, namely<br />
'STYLOGRAPH' operating under OS9. The major drawback to<br />
using this method is that it is not possible to test any of<br />
the routines after they have been typed. Consequently,<br />
although dozens of mistakes have been spotted and corrected,<br />
it is inevitable that a goodly number will have been<br />
overlooked.<br />
<br />
While every effort has been made to check the routines<br />
contained in the Notebook it has not been possible in every<br />
case. Should you become aware of mistakes in any of these<br />
subroutines, please write and let the Editor know,<br />
especially if you are able to put matters right. By the same<br />
token, if you know of any subroutine which would be of<br />
interest to your fellow members, please drop the Editor a<br />
line, and he will include it in any future edition. Of<br />
special interest would be short source code routines from<br />
DREAM or other assembler, because nothing teaches you better<br />
to program in machine code than examining experts routines.<br />
<br />
The intention of this small publication was to give all our<br />
members as much information as possible about the Dragon and<br />
to a lesser extent the Tandy Coco. There are many members,<br />
new to computing, who have recently acquired a Dragon who<br />
are struggling to find information with which to augment the<br />
Basic Manual. We hope this Notebook will help them produce<br />
worthwhile programs, which they can share with us all<br />
through the pages of DRAGON UPDATE & UP2DATE.<br />
<br />
<br />
Ray Smith,<br />
THE EDITOR<br />
<br />
<br />
== PEEKs, POKES and EXECs ==<br />
<br />
WAIT for Keyboard input<br />
DRAGON EXEC 34091 (COCO EXEC 44539)<br />
Same as Q$=INKEY$:IF Q$="" THEN 10<br />
<br />
HIGH SPEED POKE<br />
POKE 65495,0<br />
Doubles the processing speed from .89mhz to 1.7mhz - useful<br />
for data processing and arithmetical functions, but<br />
POTENTIALLY can be dangerous for your computer as it can<br />
shorten the life of the chips.<br />
<br />
POKE 65494,0<br />
Returns computer to normal speed.<br />
Use this poke before inputting or outputting any information<br />
to tape or disk, if you are using the high speed poke.<br />
<br />
POKE 65497,0<br />
An even faster speed. Screen image is lost and should be<br />
used with extreme caution with involved arithmetic<br />
calculations only.<br />
<br />
POKE 65496,0<br />
Turns off above speed poke.<br />
<br />
COLD START<br />
POKE113,0<br />
Produces a cold start whenever the RESET button is pressed.<br />
<br />
WARM START<br />
EXEC 40999 (COCO 46004)<br />
Produces a warm start, but if used after the above poke,<br />
will then produce an immediate cold start.<br />
<br />
DISABLE LIST COMMAND<br />
POKE 383,158<br />
List command will produce garbage.<br />
Also disables DIR command for disk<br />
POKE&H180,PEEK(114):POKE&H180, PEEK(115)<br />
Disables the List command when using disks only.<br />
<br />
TRON/TROFF<br />
POKE175,79<br />
Turns on Trace flag - same as TRON<br />
POKE175,0<br />
Turns it off again - same as TROFF<br />
<br />
GRAPHICS MODE<br />
PEEK(182)<br />
Returns present PMODE number.<br />
Returns 0 if graphics not in use.<br />
<br />
LOWER CASE CHARACTERS<br />
Coco POKE 282,0. Dragon POKE 329,0<br />
Text will be printed to screen in inverse video and to<br />
printer in lower case.<br />
<br />
UPPER CASE CHARACTERS<br />
DRAGON POKE 329,255 (COCO POKE 282,255)<br />
Turns off lower case flag and all text will be in Capitals.<br />
<br />
PRINT DISK DIRECTORY<br />
POKE 111,254:DIR<br />
DEVN routine. Decides which device the text output is<br />
directed to.<br />
0=Screen. 255=tape. 254=printer.<br />
<br />
TIMER VALUE<br />
PEEK(274)*256+PEEK(275)<br />
Gives the value of the timer.<br />
POKE274,0 and POKE275,0 to return value of Timer to 0.<br />
<br />
LAST KEY PRESSED<br />
PEEK(135)<br />
Gives the ASCII code of last key pressed in program.<br />
<br />
LAST VARIABLE USED<br />
PEEK(55) + PEEK(56)<br />
Gives ASCII code of last variable used. Print CHR$ in front<br />
of the command to get the STRING value of last variable<br />
used.<br />
<br />
PCLEAR0 for DISK<br />
POKE25,PEEK(188):NEW<br />
Will give you an SN error, but PCLEAR0 will have been<br />
accomplished. Or alternatively:-<br />
POWER UP:POKE25,14:POKE26,0:NEW<br />
for the same thing.<br />
<br />
PCLEAR0 for TAPE systems<br />
POKE 25,6:NEW<br />
<br />
MOTOR ON / MOTOR OFF<br />
POKE 65313,4 for motor on.<br />
POKE 65313,52 for motor off.<br />
<br />
MACHINE CODE PROGRAM ADDRESSES<br />
(a) For tape:<br />
START: PEEK(487) * 256 + PEEK(488)<br />
END: PEEK(126) * 256 + PEEK(127)-1<br />
EXEC: PEEK(157) * 256 + PEEK(158)<br />
(b) For disk: (Dragon only)<br />
FOR X=1618 TO 1623 STEP 2: PRINT<br />
PEEK(X) * 256 + PEEK(X+1);:NEXT<br />
The resulting numbers will be:<br />
START, LENGTH and EXEC.<br />
To find END address, add START and LENGTH together and<br />
deduct 1.<br />
<br />
BASIC PROGRAM ADDRESSES<br />
PEEK(25)*256+PEEK(26) - START<br />
PEEK(31)*256+PEEK(32) - END<br />
<br />
TEXT SCREEN - CURSOR POSITION<br />
PEEK(136)*256+PEEK(137)<br />
Shows a position somewhere between 1024(Start of screen) &<br />
1535(end)<br />
<br />
MAXIMUM MEMORY POINTER<br />
PEEK(116)*256+PEEK(117)<br />
Shows end of RAM<br />
<br />
HIMEM<br />
PEEK(39)*256+PEEK(40)<br />
Shows place of protected memory, and is highest address for<br />
basic.<br />
<br />
CHARACTER TO TEXT SCREEN<br />
POKE (1024-1535),(33-255)<br />
Pokes a character or graphics block to the text screen.<br />
<br />
CHARACTER/COLOR BLOCK to GRAPHIC<br />
Applies to PMODE 1 and 2 only.<br />
POKE (1536-4607),(33-255) for tape or POKE<br />
(3072-6143),(33-255) disk.<br />
<br />
DISKS<br />
PEEK(235) for DRIVE number.<br />
PEEK(236) for TRACK number.<br />
PEEK(237) for SECTOR number.<br />
<br />
TAPE FILENAME of file last loaded<br />
<br />
FORX=474TO481:PRINTCHR$(PEEK(X));: NEXT<br />
Prints filename of the last tape file loaded in string form.<br />
<br />
TEXT TO SCREEN DISABLE<br />
<br />
POKE359,255<br />
After you use this Poke, nothing you type on the keyboard<br />
appears on the screen. Whatever statement you type will be<br />
executed, provided it does not require any text to be<br />
printed on screen. In consequence you can type for example<br />
SCREEN1,1 or PCLS or SOUND100,1 and these will be executed.<br />
The DIR command will not work however, as it requires the<br />
list of files to be printed on the screen. The LIST command<br />
is also disabled.<br />
Do not use this poke in your program if you require<br />
statements to be printed on the screen.<br />
POKE359,126 <br />
Although this will not itself appear on the screen, it will<br />
restore the text etc on screen to normal.<br />
<br />
ORANGE TEXT SCREEN<br />
<br />
POKE359,57<br />
Lets you use any graphic screen or the text screen<br />
(SCREEN0,1) without alternating back to the default text<br />
screen. Consequently SCREEN0,1 will give you an orange<br />
screen without switching back to the normal green screen.<br />
Using SCREEN0,1 after this POKE will make your title screens<br />
have more impact.<br />
POKE359,126 to recover from above.<br />
<br />
DRIVE NUMBER FOR DRAGONDOS<br />
<br />
Although you can use the command DRIVE 1 (or 2,3 or 4) in<br />
your program. You cannot use a variable (in Dragondos) and<br />
so DRIVE X will produce an error.<br />
You can however use POKE1546,DR where DR is the variable for<br />
any Drive number in the range 1 to 4.<br />
<br />
CURRENT LINE NUMBER<br />
<br />
PEEK(104)*256+PEEK(105)<br />
<br />
CURRENT DATA LINE NUMBER<br />
<br />
PEEK(49)*256+PEEK(50)<br />
<br />
DISK/TAPE CHECK<br />
<br />
PEEK(188)<br />
This returns a 6 if no disk drive is installed for both Dragon<br />
& the Coco. If a disk drive is installed then a 14 is returned<br />
for the Coco and a 12 for the Dragon.<br />
<br />
SOUND - OCTAVE<br />
<br />
PEEK(222)+1<br />
Returns the current Octave in use.<br />
<br />
SOUND - NOTE LENGTH<br />
<br />
PEEK(225)<br />
Notes can be any length from 1 to 255.<br />
<br />
SOUND - CURRENT TEMPO<br />
<br />
PEEK(226)<br />
Tempo can be from 1 to 255.<br />
<br />
GRAPHICS - COLORSET<br />
<br />
PEEK(193)<br />
Returns 8 if using Colorset 1 or 0 if using Colorset 0.<br />
<br />
GRAPHICS - START BYTE<br />
<br />
PEEK(186)*256+PEEK(187)<br />
Returns start address at top of current Hi-res screen.<br />
<br />
GRAPHICS - END BYTE<br />
<br />
PEEK(183)*256+PEEK(184)<br />
Returns end address at the bottom right of current hi-res<br />
screen.<br />
<br />
GRAPHICS - CIRCLE RADIUS<br />
<br />
PEEK(207)*256+PEEK(208)<br />
Returns the radius of a circle if drawn in PMODE4. Multiply the<br />
number by 2 to get the radius of a circle in PMODE1 and 3.<br />
<br />
GRAPHICS - CIRCLE CENTRE<br />
<br />
(a) PEEK(203)*256+PEEK(204)<br />
Returns the centre X co-ordinate of a circle in PMODE4,<br />
Multiply by 2 for PMODES1 and 3.<br />
(continued over)<br />
<br />
(b) PEEK(205)*256+PEEK(206)<br />
Returns the centre Y (vertical) co-ordinate of a circle in<br />
PMODE4, multiply by 2 for PMODES 1 and 3.<br />
<br />
GRAPHICS - DRAW<br />
<br />
(a) ANGLE PEEK(232)<br />
Returns Draw angle from 0 to3.<br />
(b) SCALE PEEK(233)<br />
Returns scale number from 1 to 62<br />
<br />
CONTNUE after BREAK<br />
<br />
PEEK(41)*256+PEEK(42)<br />
Gives the line number at which continuation should begin after<br />
Break.<br />
<br />
DISK DIRECTORY<br />
<br />
COCO EXEC 52175<br />
DRAGON EXEC 55868<br />
Prints disk directory on screen, same as command DIR.<br />
<br />
JOYSTICK - FIRE BUTTON<br />
<br />
PEEK(65280)<br />
COCO: Returns 253 or 125 for LEFT joystick fire button and<br />
254/126 if RIGHT joystick button pressed. 255 if no button<br />
pressed and 257 if BOTH are pressed.<br />
DRAGON: returns 253/125 for LEFT joystick,254/126 Right<br />
joystick, 255/127 if no button pressed and 252 for both.<br />
<br />
TAPE: LOADING A HEADERLESS PROGRAM<br />
<br />
MOTORON: EXEC &HB714<br />
This should load in a program which has been saved, for<br />
example, when the motor did not get up to speed in time and so<br />
you've got a program saved without a header.<br />
<br />
TAPE: SLOW STARTING AUTOMATICS<br />
<br />
If your tape recorder is slow to start when it receives the<br />
signal, remove the remote jack and switch the motor on from the<br />
program, or in direct mode with MOTORON:SOUND1,20:<br />
CSAVE"PROGRAM". This is the method used by Harvey Grey, and as<br />
he says it never fails.<br />
<br />
TAPE: MERGING TWO PROGRAMS<br />
<br />
Have the two programs ready, by renumbering Program B so that<br />
its line numbers start after those of Program A.<br />
CLOAD"PROGRAMA":POKE25,PEEK(27):POKE26,PEEK(28)-2:<br />
CLOAD"PROGRAMB":POKE25,30:POKE26,1<br />
They should then have merged.<br />
<br />
ERASE - ANY PROGRAM IN MEMORY<br />
<br />
DRAGON EXEC 33815 COCO EXEC 44313<br />
Erases any program - same as the NEW command<br />
<br />
CUMANA DOS POKES<br />
<br />
Addresses of the READ/WRITE routines in ROM.<br />
<br />
00EB Number of the active drive<br />
00EE/F Buffer address (for sector read/write)<br />
00F6 If non-zero decrement 0605 in each IRQ<br />
0605 When reaches zero turns off disk motor<br />
0609 Verify flag: 0=Off else is On<br />
060A Drive number<br />
0697/8 Auto current line number<br />
0699/A Auto increment<br />
069B Auto flag: 0=Off else is on<br />
069C/D Error GOTO - line number<br />
069E Error GOTO flag: 0=off else is on<br />
069F/A0 ERL<br />
06A1 ERR<br />
E56D Sector READ routine<br />
E643 Sector WRITE routine<br />
<br />
<br />
== HELPFUL ROUTINES ==<br />
<br />
<br />
<br />
RIGHT JUSTIFICATION ROUTINE<br />
<br />
Where LL is the line length, and string to be justified is A$.<br />
<br />
10 LL=51:P=51<br />
20 DF=LL-LEN(A$):IF INSTR(A$,"")=0 THEN80<br />
30 IF DF=0 THEN80<br />
40 FOR J=P TO1STEP-1:IF MID$(A$,J,1)="" THEN A$=LEFT$(A$,J)+<br />
MID$(A$,J):DF=DF-1:GOTO60<br />
50 NEXT<br />
60 P=J-1:IF P<1 THEN P=LEN(A$)<br />
70 GOTO30<br />
80 RETURN<br />
<br />
AND ANOTHER EXAMPLE<br />
<br />
10 A$="This is just an example of a string"<br />
20 A$=A$+""<br />
30 LL=32:F=0:S=0:N=0:P=1:L=LEN(A$):B$=""<br />
40 GOSUB180:GOSUB190:IF F=0 THEN70<br />
50 S=S-P+F:P=F<br />
60 IF P>=L THEN N=N+1:GOTO40<br />
70 IF N=1 THEN210<br />
80 P=1:GOSUB180<br />
90 SP=LL-S-P-N+2<br />
100 B$=B$+STRING$(P-1,32)<br />
110 DS=INT(SP/(N-1)):MS=SP-(N-1)*DS:PA=1<br />
120 GOSUB190:IF F=0 THEN200<br />
130 B$=B$+MID$(A$,P,F-P):P=F<br />
140 GOSUB180<br />
150 IF SP=0 THEN B$=B$+" ":GOTO120<br />
160 IF PA>=MS THEN B$=B$-STRING$(DS+2,32):SP=SP-DS-1:PA=PA+1:<br />
GOTO120<br />
170 B$=B$+STRING$(DS+1,32):SP=SP-DS:GOTO200<br />
180 IF MID$(A$,P,1)=" " THEN P=P+1:GOTO180:ELSE<br />
RETURN<br />
190 F=INSTR(P,A$," "):RETURN<br />
200 B$=LEFT$(B$,LL)<br />
210 A$=B$:PRINT A$<br />
<br />
DISK DRIVE NUMBERS IN PROGRAMS<br />
<br />
You can use specified drive numbers in programs, using the<br />
command DRIVE n, where n is a number from 1 to 4; but you<br />
cannot specify a variable with this command.<br />
You can input a variable and use it as part of the READ/WRITE<br />
commands, as follows:<br />
100 INPUT"drive number";D<br />
110 FWRITE CHR$(48+D)+":FILENAME.DAT";variable list<br />
Alternatively you can set the default drive to whatever number<br />
from 1 to 4 you specify, with a<br />
poke: eg POKE 235,D or POKE1546,D personally I always use the<br />
latter.<br />
<br />
SELECTING MENU OPTIONS<br />
<br />
Suppose the option required is in A$ and they are sequential,<br />
A, B, C etc, then:- ON ASC(A$-64) GOTO 100,200,300,etc.<br />
If they are NOT sequentioal, ie A,L,M,S,X etc<br />
10 A$=INKEY$:IF A$="" THEN 10<br />
20 ON INSTR(A$,"ALMSX etc")GOTO100,200,300 etc<br />
30 PRINT"INVALID OPTION":GOTO10<br />
<br />
INVERSE VIDEO<br />
<br />
(A) Changing text screen to green on black. (D32 AND D64)<br />
<br />
10 CLEAR200,32539<br />
20 FORX=32540 TO 32635:READ A$<br />
30 POKEX,VAL("&H"+A$):NEXT<br />
40 FOR X=0TO127:PRINT@0,CHR$(X):POKEX+32627,PEEK(1024):NEXT<br />
50<br />
POKE359,126:POKE360,127:POKE361,28:POKE416,126:POKE417,127:POKE<br />
418,109:CLS<br />
60 DATA32,62,34,36,9E,88,81,8,26,D,8C,4,0,27,35,86,20,A7,84,A7,<br />
82,26,15,81,D,26,4,8D,29,20,D,4D,2B,8,10,8E,7F,7D,A6,A6,88,40,<br />
A7,80,9F,88,8C,5<br />
70 DATA FF,23,11,8E,4,0,EC,88,20,ED,81,8C,5,E0,25,F6,9F,88,8D,<br />
2,35,B6,86,20,A7,80,1F,10,C4,1F,26,F6,39,2F,1,39,35,10,8C,BA,62<br />
,26,F8,C6,20,7E,BA,79<br />
CLS WILL WORK OKAY, BUT CLEAR OR RESET WILL RESULT IN THE<br />
SCREEN REVERTING TO BLACK ON GREEN<br />
<br />
(B) Green or orange on black for D64 only.<br />
<br />
Enter 64 mode & run following basic program: This caters for<br />
CLS and RESET and sets to an orange screen if you enter SCREEN<br />
0,1<br />
10 POKE 59735,15<br />
20 POKE 62659,32<br />
30 POKE 63992,32<br />
40 POKE 64423,32<br />
50 POKE 64447,32<br />
60 POKE 64470,8<br />
70 POKE 64474,2<br />
80 POKE 64475,128<br />
90 POKE 64476,96<br />
100 POKE 283,105<br />
110 POKE 284,253<br />
<br />
AUTO REPEAT ON THE D32<br />
<br />
Although the D64 has autorepeat in the 64 mode, the D32<br />
keyboard will auto repeat with the following subroutine:<br />
10 POKE &HFF04,(PEEK(&HFF03)AND &HFE)<br />
20 POKE &H10D,&HBF:POKE &H10E,&H20<br />
30 POKE &HFF03,(PEEK(&HFF03)OR 1)<br />
<br />
DREAM<br />
<br />
To make it easier to save source code to tape, as the header<br />
used in Dream is too short for some recorders which have<br />
trouble getting up to speed in time.<br />
POKE 29788,215:POKE 29789,145<br />
This lengthens the header tone, but slows up the recording<br />
slightly.<br />
<br />
IF THIS STILL DOES NOT WORK, TRY THE FOLLOWING:<br />
EXIT from Dream with BREAK/Q and when in Basic type the<br />
following:<br />
CSAVEM"FILENAME",PEEK(&H5F8A)*256+PEEK(&H5F8B),&H6000,&H6080<br />
Press PLAY & RECORD on Cassette recorder and then PRESS ENTER.<br />
To RELOAD into Dream:<br />
a) Load Dream but don't EXEC.<br />
b) CLOAD"FILENAME"<br />
c) EXEC<br />
d) Reply 'Y' to 'Old text?' prompt.<br />
<br />
STRINGS<br />
<br />
When you use temporary variables in programs, such as<br />
X$=INKEY$, use the same variables over and over again,<br />
otherwise you can get an OS (out of string space error).<br />
You can force a Garbage collection by using EXEC36055. This<br />
makes the computer sort out the string space.<br />
<br />
FILEMASTER<br />
<br />
When you wish to update a file and save it with the same name,<br />
the program justs tags the updated file on the end of the old<br />
file, rather than killing the old file first. You can get over<br />
this problem by changing the following lines in OLDFILE.<br />
3640 MN$+NM$+"DAT":KILL MN$:FWRITE NM$;RL<br />
8005 GOTO 3640<br />
By adding the following line, the number of each record can be<br />
printed:-<br />
5587 PRINT#DV,R(LN)+1<br />
<br />
LLISTINGS<br />
<br />
To printout listings in the same width as the Dragon screen (ie<br />
32 characters per line) - POKE &H148,0:POKE &H9B,32:LLIST<br />
<br />
BASIC ADDRESSES<br />
<br />
START ADDRESS: STADR=PEEK(25)*256+PEEK(26)<br />
END ADDRESS: ENADR=PEEK(27)*256+PEEK(28)-1<br />
<br />
,CE 1<br />
DISK FILES<br />
<br />
ASCII TEXT FILES<br />
Last byte is always "1A".<br />
<br />
BASIC FILES<br />
DRAGON - Start with a 9 byte header<br />
1) 55(hex)<br />
2) File type 01 Basic etc, 02 M/code<br />
3/4) Load Address<br />
5/6)Length of program ie length of file less 9 header<br />
bytes.<br />
7/8) Exec address -put into &H9D/9E to tell basic<br />
where to start execution<br />
9) AA(hex)<br />
Bytes 1 & 9 are used by Basic to identify the header,<br />
otherwise the DOS assumes its a DATA file.<br />
End with 3 NULL bytes - 00,00,00<br />
<br />
NON-SEGMENTED M/L FILES<br />
DRAGON - as for basic above.<br />
COCO - Start with a 5 byte header.<br />
a) Null byte 00<br />
b) 2 bytes which specify number of data bytes in<br />
program -ie length in Hex<br />
c) 2 bytes which specify start (LOAD) address<br />
- End with a 5 byte tail sequence.<br />
a) FF byte<br />
b) 2 null bytes 00,00<br />
c) 2 bytes which specify EXEC address<br />
- Note - the End address is not stored, but is calculated<br />
from LOAD address plus file length minus 1.<br />
<br />
SEGMENTED M/L FILES<br />
COCO - Same as for non-segmented files, but at the end of<br />
every segment they have ANOTHER header and so on. They only<br />
have one END sequence and ONE EXEC address.<br />
<br />
TO SAVE GRAPHICS TO TAPE OR DISK<br />
<br />
If you do not know the address of the page in<br />
use you can save the currently displayed graphic<br />
page in any PMODE with the following:-<br />
<br />
(C)SAVE(M)"FILENAME",PEEK(186) *<br />
256+PEEK(187),PEEK(183) * 256 + PEEK(184),33649<br />
<br />
AUTOREPEATING KEYS FOR THE D32<br />
<br />
FOR X=337 TO 345: POKE X,255: NEXT: X$=INKEY$<br />
<br />
COLD START<br />
<br />
A Cold Start can be forced by POKE 113,0 and pressing RESET<br />
<br />
<br />
PAUSE<br />
<br />
EXEC 41194 can be used on the D32 and the D64 in 32 mode to<br />
pause a program, eg following a page of instructions.<br />
Pressing any key restarts the program.<br />
<br />
INVERTING GRAPHICS PAGES<br />
<br />
This short machine code subroutine will invert the first four<br />
pages of the graphic screens. That is change the foreground<br />
colour to the background colour and vice versa.<br />
To operate EXEC&H6000 or EXEC 24576.<br />
110 FOR X=24576 to 24595<br />
120 READ A$:POKE X,VAL("&H"+A$): NEXT X<br />
130 DATA 8E, 06,00,A6,84,88,FF,A7,84,30,01,8C,1E,00,27,03,7E,<br />
60,03,39<br />
The Data underlined refer to the addresses of the start and<br />
end of the first four graphic pages, when using cassette. If<br />
you are using DISKS then replace with 0C,00 and 24,00.<br />
<br />
RESCUE OPERATION<br />
<br />
Sometimes when using a mixture of BASIC and M/code routines<br />
you can cause a crash when the Dragon freezes. The only<br />
option being to press RESET. On occasions after pressing<br />
RESET and typing LIST, all you get are the first few lines of<br />
the BASIC program followed by garbled lines.<br />
To get your program back simply type RENUM.<br />
You will be unable to RUN it, but you can SAVE it and reload<br />
after a COLD START.<br />
<br />
THREE COLOUR PMODE4<br />
<br />
10 PMODE3,1:SCREEN1,1:POKE 65314,248<br />
This line tells BASIC that the four colour mode is required,<br />
but the POKE tells the VIDEO chip that 2 colour high<br />
resolution is wanted.<br />
The new colour set has 0 = WHITE, 1 = BLACK and 2 = LIGHT<br />
PURPLE<br />
<br />
DISABLE BREAK KEY<br />
<br />
Enter the following Pokes in DIRECT mode:<br />
POKE 411,228: POKE412,203: POKE 413,4: POKE 414,237: POKE<br />
415,228<br />
THEN to DISABLE POKE 410,236<br />
And to ENABLE POKE 410,57<br />
<br />
SLOW DOWN LIST<br />
<br />
POKE 359,60 - This effects everything that is OUTPUT<br />
including PRINTING. POKE 359,57 for NORMAL SPEED.<br />
<br />
EASY MOVING GRAPHICS<br />
<br />
First DRAW the shape you want and put it in a STRING<br />
variable, eg C$. Then assign a couple of variables re the<br />
LOCATION and DRAW your shape at the desired location.<br />
10 PMODE4,1:SCREEN1,1:PCLS<br />
20 C$="D6F4H4G4E4U3R3L6R3U3R1D1L2U1R1"<br />
30 X=128:Y=96<br />
40 DRAW"BM"+STR$(X)+","+STR$(Y)+C$<br />
and to move the man, change line 30 as follows<br />
30 FOR X=10 TO 250 STEP 4: Y=96<br />
50 PCLS:NEXT X<br />
60 EXEC34091 (to hold graphics in view)<br />
<br />
CLEAR SCREEN IN M/CODE<br />
<br />
(A) by using existing ROM routine:<br />
LDB #$60<br />
JSR 47737<br />
RTS<br />
(b) this is the faster way:<br />
LDX #$0400<br />
LDU #$0600<br />
LOOP STU ,X++<br />
BNE LOOP<br />
RTS<br />
<br />
PRINTER LINE FEED<br />
<br />
If your Printer does not give an automatic line feed, or if<br />
its been turned off for OS9, STYLO etc. POKE330,2 and POKE<br />
330,1 to turn it off again.<br />
<br />
PRINTER FIELD WIDTH<br />
<br />
To alter the comma field width (default 16), POKE 153, with<br />
the new field and POKE 154 with the last field.<br />
Eg: For 6 fields of length 10, POKE 153,10: POKE154,50<br />
Useful for printing columns, but dont use the value 0,which<br />
makes the Printer hang!<br />
<br />
GRAPHICS - HIDING SCREENS<br />
<br />
You can hide Graphics Screens behind Loading Screens,<br />
providing you DIM correctly.<br />
PMODE 0 DIM 307 per screen<br />
PMODE 1 & 2 DIM 614 per screen<br />
PMODE 3 & 4 DIM 1228 per screen<br />
GET(0,0)-(255,191),A,B,C etc and PUT back when required.<br />
<br />
TEXT IN M/CODE PROGRAMS<br />
<br />
To check for text in long machine code programs, eg<br />
Adventures etc, to look for clues?<br />
FOR X=0 TO &H7FFF:PRINT CHR$(PEEK(X));: NEXT<br />
<br />
INCREASE MEMORY AVAILABLE<br />
<br />
To increase memory available to the maximum when using DISKS,<br />
ie to perform a PCLEAR 0 - No graphic pages.<br />
COCO: POKE 25,14: POKE 3584,0: NEW<br />
DRAGON: POKE 25,12:POKE3072,0: NEW<br />
This gives 28967 available bytes of memory<br />
<br />
To increase memory when not using disks - POKE 25,6: NEW<br />
before loading cassette<br />
<br />
GRAPHICS PAGES - ADDRESSES<br />
<br />
To find START and END addresses of Graphic Pages in use:-<br />
PRINT PEEK(186)*256+PEEK(187) - for the START<br />
PRINT PEEK(183)*256+PEEK(184) - for the END<br />
<br />
PRINTER - TO AVOID HANG UPS<br />
<br />
Insert the following line in your program to ensure that your<br />
printer is on line, so that the program will not 'hang'.<br />
P=PEEK(65314) AND 1: IF P=1 THEN PRINT"PRINTER NOT ON LINE"<br />
<br />
PRINTER - PARAMETER SETTING<br />
<br />
Characters per line PEEK(155) - Default 132<br />
To alter to 80 or even 40 etc POKE 328,0: POKE 155,80 or<br />
whatever.<br />
<br />
DRIVE NUMBER<br />
<br />
Some Dragons will allow you to use DRIVE and the number in<br />
programs, but if you get an error, use POKE&H60,2 or number.<br />
<br />
BAUD RATE CODE<br />
<br />
This short subroutine will fill in the array with the baud<br />
rate associated with the array index:<br />
DIM BD(15)<br />
FOR X=1 to 15: READ BD(X):NEXT<br />
DATA<br />
50,75,110,135,150,300,600,1200,1800,2400,3600,4800,7200,9600<br />
<br />
DATA TROUBLE<br />
<br />
When using HEX loaders etc, to find the line number of the<br />
last DATA statement loaded:<br />
PRINT PEEK(49)*256+PEEK(50)<br />
<br />
AWAIT KEYPRESS<br />
<br />
If two keypresses are required then EXEC41184 (otherwise<br />
EXEC34091)<br />
<br />
KEYBOARD DISABLE<br />
<br />
(A) POKE 65281,50 (B) POKE 65301,0<br />
AND POKE 65301,20 TO ENABLE AGAIN (from the program!)<br />
<br />
RESET - TO DISABLE - POKE 113,85<br />
<br />
GRAPHICS (Colour)<br />
<br />
(a) Striped effects -<br />
Poke 178,N:LINE(X,Y)-(X1,Y1),PSET,BF<br />
(b) Foreground colour - PEEK (178)<br />
(c) Background colour - PEEK (179)<br />
(d) Active colour - PEEK (180)<br />
(e) Graphic Mode - PEEK (181/2)<br />
<br />
TEXT SCREEN<br />
<br />
(a) Move to lower half of screen - POKE 136,5<br />
(b) Move to upper half of screen - POKE 136,4<br />
(c) Cursor position in Low-res - PEEK (136/7)<br />
(d) ASCII code of last keypress - PEEK (135)<br />
<br />
CURSOR - TO REDEFINE<br />
<br />
POKE 363,(ASCII code of required character):<br />
POKE 364,167:<br />
POKE 365,159: POKE 366,0: POKE 367,136<br />
To ACTIVATE above - POKE 362,134 and to DEACTIVATE<br />
POKE362,57<br />
<br />
CASSETTE - HIGH SPEED MODE RESCUE<br />
<br />
If you accidentally CSAVE a program while in the High Speed<br />
mode then load it back at normal speed then:<br />
POKE 146,8: POKE 147,4: POKE 148,8<br />
<br />
BREAK - TO DISABLE<br />
<br />
To turn the BREAK key on and off within a program, use this<br />
subroutine:<br />
10 CLEAR 300, 32735<br />
20 FOR X = 32736 TO 32756<br />
30 READ A$: A=VAL("&H"+A$)<br />
40 POKE X,A: NEXT<br />
50 POKE 411,127: POKE 412,224<br />
60 PRINT"BREAK DISABLED": POKE 410,126<br />
70 FOR DL=1 TO 2500:NEXT<br />
80 CLS: PRINT "BREAK ENABLED": POKE 410,57<br />
90 FOR DL=1 TO 2500: NEXT: GOTO60<br />
100 DATA<br />
32,62,1C,AF,BD,80,06,26,07,81,13,26,03,7E,85,2B,<br />
97,87,7E,84,A6<br />
<br />
OR AN EVEN SHORTER ROUTINE:<br />
10 FOR X=&HF8 TO &HFE: READ A: POKE X,A:NEXT<br />
20 FOR X=&H19A TO &H19C: READ A: POKE X,A: NEXT<br />
30 DATA 50,98,28,175,126,173,165<br />
40 DATA 126,0,248<br />
NOTE: These routines do not work during INPUT lines.<br />
<br />
<br />
BREAK - TO DISABLE INCLUDING INPUT LINES<br />
<br />
This short M/code subroutine will disable the BREAK key,<br />
including during INPUT lines.<br />
10 CLEAR 200, 32550<br />
20 FOR X-0 TO 55: READ A$: POKE32551+X,VAL("&H"+A$): NEXT<br />
30 DATA 8E,7F,3C,BF,01,6B,8E,7F,54,BF,01,9B,86,7E,B7,01<br />
6A,B7,01,9A,39,0D,6F,27,01,39,32,62,34,14,BD,80<br />
09,BD,80,06,27,F8,81,03,27,F4,7E,B5,42,9F,DF,35<br />
10,30,04,34,10,9E,DF,39<br />
40 EXEC 32551<br />
<br />
TELEWRITER<br />
<br />
For those who have the Cassette version, you can change the<br />
colour set and have a green on black screen by POKE<br />
&H2FDF,240 before loading.<br />
<br />
PRINT - VARY OUTPUT TO SCREEN OR PRINTER<br />
<br />
100 INPUT"OUTPUT TO GO TO SCREEN OR PRINTER"; A$<br />
110 A$=LEFT$(A$,1)<br />
120 IF A$="S" THEN P=0:GOTO(Screen Print routine at 150 etc<br />
using PRINT#P)<br />
130 IF A$="P" THEN P= -2 ELSE GOTO100<br />
140 PRINT#P,(Your Printer routine)<br />
<br />
CONVERT HEX/DECIMAL/HEX<br />
<br />
Let the DRAGON (a) work it out: DECIMAL/HEX ? HEX$(n)<br />
HEX/DECIMAL ? VAL(&Hetc)<br />
(b) add them for you ? HEX$(&H0A+&HFF)<br />
<br />
DISPLAY<br />
<br />
To change the TEXT screen from GREEN to ORANGE, in order to<br />
highlight instructions etc - POKE 65314,13<br />
<br />
LOOPS<br />
<br />
Use FOR/NEXT loops in preference to GOTO for Speed and<br />
Efficiency.<br />
<br />
CENTERING A TITLE<br />
<br />
CLS: PRINT TAB((X-LEN(A$))/2)A$<br />
Where A$ is the Title and X is the number of characters per<br />
screen line/printer line.<br />
<br />
CASSETTES<br />
<br />
To load a headerless program - MOTORON: EXEC 46868<br />
<br />
WAIT FOR KEYPRESS<br />
<br />
If you use EXEC 34091, The Key pressed can be read from the<br />
A Register.<br />
EXEC 34091: X$= INKEY$: PRINT X$<br />
or get value of X$ with Y=ASC(X$)-48 (for numbers 1 to 9)<br />
<br />
CASSETTE LOADING<br />
<br />
To resurrect programs accidentally saved at the faster speed<br />
(POKE 65495,0).<br />
Load the program back using the double speed poke.<br />
AUDIO ON: POKE65497,0: CLOAD<br />
You lose video at this speed and so the Audio is on to tell<br />
you when the tape has finished loading. Press RESET and try<br />
listing program. If the DRAGON does not return to normal mode<br />
POKE 65495,126 and then list. The program sometimes<br />
unfortunately is not recoverable.<br />
<br />
<br />
== DISKS AND THE DRAGON 64 ==<br />
<br />
=== (A) DETACH DOS ===<br />
<br />
Unplug your DOS using Software instead of manually unplugging<br />
the cartridge and risking damaging the connections.<br />
<pre><br />
1 CLS7:PCLEAR4<br />
2 POKE1541,2<br />
3 FOR X=0 TO 146:POKE3073+X,PEEK(46010+X):NEXT<br />
4 POKE 3072,18:POKE3197,0<br />
5 FOR X=1 TO 3: READ S,F: FOR J=S TO F: READ A$<br />
6 POKE 3072+J,VAL("&H"+A$)<br />
7 NEXT J,X<br />
8 DATA 148,156,8E,0C,9C,BD,90,E5,7E,83,71,157,188<br />
9 DATA 44,4F,53,20,44,45,54,41,43,48,20,28,43,29,20,31,<br />
39,38,35,20,44,52,41,47,4F,4E,20,55,53,45,52,00<br />
10 DATA 13,17,8E,7F,FE,20,0E<br />
11 POKE 114,12:POKE 115,0<br />
12 PRINT@224,STRING$(32,236);<br />
13 PRINT@256," PRESS RESET TO DETACH DOS "<br />
14 PRINT@288,STRING$(32,227);<br />
15 SCREEN 0,1<br />
16 GOTO16<br />
</pre><br />
TO 'UNPLUG' DOS, RUN PROGRAM and press RESET on cue.<br />
TO REGAIN DOS, POKE 113,0 and press RESET.<br />
<br />
=== (B) MOVING BASIC AND DOS TO HIGH MEMORY ===<br />
<br />
Enabling DISKS to be used in the D64 mode and giving a<br />
further 8k available for program storage from 57344 onwards.<br />
M/code source - assemble in DREAM etc.<br />
<pre><br />
ORCC #255 Disable IRQ's<br />
LDX #32768 Start of Basic<br />
LOOP STA $FFDE ROM mode<br />
LDA ,X Get byte from ROM<br />
STA $FFDF RAM mode<br />
STA ,X+ Store in RAM<br />
CMPX #57344 All copied<br />
BLO LOOP No Branch again<br />
ANDCC #255-16 Enable IRQ's<br />
RTS Return to Basic in 64k mode<br />
</pre><br />
This produces through DREAM the following Data:<br />
<pre><br />
1 CLEAR 600<br />
2 FOR A=1 to 18<br />
3 SREAD 1,16,A,A$,B$<br />
4 SWRITE 1,20,A,A$,B$<br />
5 NEXT<br />
</pre><br />
If that doesn't accomplish it, which means that Track 16<br />
was also corrupted, then hard luck! You'll either have to<br />
reformat the disk or rebuild the Directory Track, using a<br />
DISK FIXIT type program. Try Pam D'Arcy's program 'DISKFIX'<br />
from the NDUG.<br />
<br />
=== (D) CARTRIDGE INTERFACE ===<br />
<br />
ODD number lines are on the UPPER side and are all GROUND.<br />
EVEN numbered lines are on the LOWER side.<br />
Looking down on the Cartridge Edge connector the pins run<br />
from 2 to 34, from right to left.<br />
<pre><br />
2<br />
4<br />
6<br />
8 INDEX<br />
10 DRIVE 0<br />
12 DRIVE 1<br />
14<br />
16 MOTOR<br />
18 DIRECTION<br />
20 STEP<br />
22 WRITE DATA<br />
24 WRITE GATE<br />
26 TRACK 0<br />
28 WRITE PROTECT<br />
30 READ DATA<br />
32 SIDE 1<br />
34 READY - Not connected in Dragondos<br />
</pre><br />
<br />
=== (E) DISK - TO PRINT DIRECTORY ===<br />
<br />
POKE 111,254:DIR<br />
<br />
=== (F) DISK - DELTADOS ===<br />
<br />
This POKE allows long BASIC programs to be run without OM<br />
errors.<br />
LOAD program and if it does not contain a CLEAR statement,<br />
insert at the beginning of the program:-<br />
POKE 377,57: CLEAR 200, &H7FFF<br />
Otherwise just insert the POKE on its own.<br />
NOW SAVE TO DISK and then RUN. If the DOS space was not<br />
overwritten when the program was run, then the DOS can be<br />
RE-ENABLED with POKE 377,126:CLEAR 200,&H78FF.<br />
<br />
== GRAPHICS - FINDING CO-ORDINATES ==<br />
<br />
To convert PMODE4 co-ordinates (X,Y) to PRINT ` positions on<br />
the TEXT screen:<br />
P=INT(X/8)+32*INT(Y/12): PRINT P: PRINT@P,"*";<br />
<br />
== LIST ==<br />
<br />
=== (A) TO SLOW DOWN ===<br />
The more common method but NOT TO BE USED WITH DOS OR ANY<br />
CARTRIDGE in place.<br />
POKE 359,19 and if still too fast POKE 360,19 also.<br />
RESET by poking a value of 57 to both locations.<br />
<br />
=== (B) TO DISABLE ===<br />
POKE 383,157: POKE 383,158<br />
To re-enable POKE 383,126<br />
<br />
== Program loading tricks ==<br />
<br />
=== FINDING ADDRESS OF M/CODE PROGRAM ===<br />
<pre><br />
PRINT PEEK(487)*256+PEEK(458) ......(A)<br />
PRINT PEEK(126)*256+PEEK(127)-1 .....(B)<br />
PRINT PEEK(157)*256+PEEK(158) ......(C)<br />
SAVE OR CSAVEM"PROGRAM", A, B, C<br />
</pre><br />
<br />
=== TO DISABLE AUTORUN PROGRAMS ===<br />
<br />
CLOADM"PROGRAM", 1298<br />
CSAVEM"PROGRAM", A+1298, B+1298, C+1298<br />
<br />
=== TO RELOCATE MACHINE CODE PROGRAMS ===<br />
<br />
(A) ON DISK - LOAD "PROGRAM.BIN", n<br />
(B) ON TAPE - CLOADM"PROGRAM", n<br />
Where 'n' is the offset, found by subtracting the old address<br />
from the new address, providing the new address is higher<br />
than the original address.<br />
If the new address is below the original address than the<br />
value of 'n' = 65536 plus new address less original address.<br />
<br />
=== TAPE LOADING DIFFICULTIES ===<br />
Before saving to cassette:<br />
<pre><br />
POKE &H745B,255: POKE144,1 To raise output signal level<br />
POKE144,3: POKE 144,0 to return to default setting.<br />
POKE &H746b,128 for a longer header.<br />
(or try values between 1 & 255)<br />
POKE 65313,8 Motor on<br />
POKE 65313,247 Motor off<br />
EXEC &H8015 Turns on Cassette relay<br />
EXEC &H8018 Turns it off<br />
</pre><br />
<br />
=== ARROW KEYS ===<br />
Checking that one of the four arrow keys has been used:<br />
<pre><br />
10 IF INKEY$=CHR$(8) OR CHR$(21) THEN GOTO...(LEFT ARROW)<br />
20 IF INKEY$=CHR$(9) OR CHR$(93) THEN GOTO...(RIGHT ARROW)<br />
30 IF INKEY$=CHR$(10)OR CHR$(91) THEN GOTO...(DOWN ARROW)<br />
40 IF INKEY$=CHR$(94)OR CHR$(95) THEN GOTO...(UP ARROW)<br />
</pre><br />
The second CHR$ character is SHIFT plus the ARROW key.<br />
<br />
== GRAPHICS - HINTS and ROUTINES ==<br />
<br />
<br />
OVERLAYING ONE SCREEN ON ANOTHER<br />
<br />
The basic method is to PCLEAR8 and load one screen into Page<br />
1 and the other into Page 5 (using Hi-res screens, then GET<br />
the picture and PUT it over the Page 1 screen.<br />
<br />
10 PCLEAR8<br />
20 PMODE4,1:SCREEN1,1:PCLS<br />
30 LOAD "PICTURE1.EXT" 'for disk<br />
35 CLOADM"PICTURE1" 'for tape<br />
40 PMODE4,5:SCREEN1,1:PCLS<br />
50 LOAD"PICTURE2.EXT",9216 'or<br />
55 CLOADM"PICTURE2",6144 'tape<br />
60 DIM A(160):GET(0,0) - (255,191),A,G<br />
70 PMODE4,1:PUT(0,0)-(255,191),A,AND<br />
80 GOTO80<br />
<br />
(FOR PMODE3 SCREENS USE 'OR' IN LINE 70 INSTEAD OF 'AND'.)<br />
<br />
<br />
EXTRA PAGES ON DRAGON 32<br />
<br />
These extra pages are Pages 17 to 20 and work on the D32,<br />
but not apparently on the D64. On the latter machine pages<br />
can be stored in high memory.<br />
PCLEAR8<br />
PMODE4,1:SCREEn1,1<br />
(C)LOAD(M)"PICTURE1"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+4:NEXT<br />
(I.E.) Put it into Page 5 on.<br />
(C)LOAD(M)"PICTURE2"(.EXT")<br />
FORX=1TO4:PCOPY X TO X+16:NEXT<br />
(C)LOAD(M)"PICTURE3"(.EXT")<br />
You should now have 3 pictures in memory and to see them<br />
....<br />
EXEC41194 'Picture 3 visible<br />
FORX=1TO4:PCOPY X+16 TO X:NEXT<br />
EXEC41194 'Picture 2 on screen<br />
FORX=1TO4:PCOPY X+4 TO X:NEXT<br />
EXEC41194 'Picture 1 is back!<br />
<br />
DRAW COMMAND<br />
<br />
The Draw command always starts by fixing a point on screen<br />
from which to draw and this point can be defined by<br />
variables.<br />
This command usually reads:<br />
DRAW"BM"+STR$(X)+","+STR$(Y) etc<br />
and most people tend to leave out that comma.<br />
The DRAGON will perform the same function using the simpler:<br />
DRAW"BM=X;=Y;" etc<br />
Where X is the horizontal and Y is the vertical co-ordinate<br />
in pixels.<br />
<br />
You can MOVE your graphic by simply putting the co-ordinates<br />
in a loop.<br />
<br />
HI-RES SCREEN FLIPPER<br />
<br />
This Basic sub-routine will flip the screen upside down.<br />
10 DIM A(10),B(10)<br />
20 PMODE4,1:SCREEN1,1<br />
30 FORX=0TO95:GET(0,X)-(255,X),A<br />
,G:GET(0,191-X)-(255,191-X),B,G<br />
40 PUT(0,X)-(255,X),B,PSET: PUT (0,191-X)-(255,191-X),A,PSET<br />
50 NEXT<br />
60 EXEC41194<br />
<br />
GET/PUT: SIZE OF DIM REQUIRED<br />
<br />
Count the number of bytes used in your graphics. There are<br />
1536 per graphics page, or 6144 in a PMODE3 or PMODE4 4<br />
page screen, but only 3072 in PMODEs 1 and 2.<br />
So take this number and divide by 20 for the odd PMODEs (1 &<br />
3) and divide by 40 for the even modes (2 & 4) then<br />
subtract one.<br />
The result is the length of the one dimensional array<br />
required to store the picture. The same applies to portions<br />
of a screen.<br />
For example half the entire PMODE4 screen (3072 pixels)<br />
would require a DIM of :<br />
(3072/40)-1 or 76<br />
<br />
<br />
== SCREEN ADDRESSES (GRAPHICS) ==<br />
<br />
<br />
These depend whether you are using a disk operating system,<br />
as most DOS use the first page of graphics and so with DOS<br />
in place graphics start one page higher.<br />
<br />
Page Tape Disk<br />
1 &H0600-&H0BFF &H0C00-&H11FF<br />
2 &H0C00-&H11FF &H1200-&H17FF<br />
3 &H1200-&H17FF &H1800-&H1DFF<br />
4 &H1800-&H1DFF &H1E00-&H23FF<br />
5 &H1E00-&H23FF &H2400-&H29FF<br />
6 &H2300-&H29FF &H2A00-&H2FFF<br />
7 &H2A00-&H2FFF &H3000-&H35FF<br />
8 &H3000-&H35FF &H3600-&H3BFF<br />
<br />
To save and load screens to tape use the above scale as<br />
follows for PMODE4 for example:<br />
CSAVEM"FILE",&H600,&H1DFF,&H0600<br />
or in decimal this would be:<br />
CSAVEM"FILE",1536,7679,1536<br />
CLOADM"PIX"<br />
<br />
But to save screens to disk you need to save one more byte,<br />
else the byte in the bottom right hand cormer of the screen<br />
will not be saved. Eg:-<br />
SAVE"FILE",&HC00,&H2400,&HC00<br />
which will save it to the default extension ".BIN", but if<br />
you wish to distinguish your graphic screens from machine<br />
code programs save them with an extension such as ".PIX".<br />
In decimal this would be:<br />
SAVE"FILE.PIX",3072,9216,3072. (Superdos 9215)<br />
<br />
== DEBUGGING HINTS ==<br />
<br />
<br />
FC (Function Call) errors<br />
<br />
These usually occur in the GET, PUT, DRAW, PLAY and LINE<br />
commands.<br />
An FC error usually means that you are asking one of these<br />
commands to do something they cannot do, and the most likely<br />
causes are:<br />
(a) Co-ordinates out of range. For example horizontal and<br />
vertical must be positive with horizontal less than 256 and<br />
vertical less than 192.<br />
(b) Dimensions of PUT command may be more than the GET<br />
statement.<br />
(c) Execution of a string with an illegal character in it.<br />
For example DRAW"BM100,100;XL$(2);" - where there is nothing<br />
wrong with the DRAW command as such - but on looking back at<br />
XL$(2) you find this = "D2L2P2" - in other words it contains<br />
an illegal character in it, ie "P2".<br />
(d) The most common causes of this error are not necessarily<br />
found in the line in question, but you should look back at<br />
the definition of the individual components.<br />
<br />
OD (Out of data) errors<br />
<br />
These occur as a rule when you:-<br />
(a) repeat or omit data statements<br />
(b) or you write or copy hexloader addresses wrongly.<br />
<br />
PRINT PEEK(49)*256+PEEK(50) will give you the line number of<br />
the current DATA statement.<br />
PRINT PEEK(51)*256+PEEK(52) will give you the address of the<br />
next item in the current Data statement.<br />
<br />
PAINT errors<br />
<br />
Paint errors can be catastrophic in graphics, when the paint<br />
spreads everywhere and while an error is NOT reported, it<br />
figures that you will not be too happy with the mess it<br />
causes!<br />
If you don't know which particular PAINT command is the<br />
trouble, find where the previous SCREEN command is situated<br />
(say line 100) and put a GOTO100 before each PAINT command<br />
until you locate the one at fault.<br />
Then check the co-ordinates and colour codes for validity,<br />
the co-ordinates must be INSIDE the area you wish to paint.<br />
If this should fail then check the lines where that<br />
particular graphic shape was formulated and ensure that the<br />
outline is completely closed off. Check for a one pixel gap<br />
in the outline somewhere.<br />
<br />
USR Routines<br />
<br />
A well known bug in the ROM of the Dragon 32 means that the<br />
USR command must contain a zero before each numbered USR<br />
function, but this was corrected in the Dragon 64 and the<br />
zero in that machine causes an error.<br />
No zero in the 32, or a zero in the 64, both show an error.<br />
The following routine inserted in your programs will<br />
circumvent this and will ensure the program should run on<br />
both machines.<br />
<br />
5 VS$=CHR$(PEEK(49052) + PEEK(49053)) 'TO TEST WHETHER<br />
DRAGON 32 OR 64<br />
6 IF VS$="64" THEN DEF USR1=30000 ELSE DEF USR01=30000<br />
where 30000 can be any address......<br />
and then later in the program...<br />
IF VS$="64" THEN X=USR1(A) ELSE X=USR01(A)<br />
<br />
BS Bad Subscript errors<br />
<br />
These usually occur when the subscripts in an array are out<br />
of range. Use a DIM statement to dimension the array. For<br />
example, if you have X$(12) in your program but you have not<br />
informed the computer of the 12 elements by the use of the<br />
DIM command. Remember you are not required to use the DIM<br />
command UNLESS you plan to use more than 10 subscripts.<br />
When you use DIM(11) you are planning on using 12 subscripts<br />
as the DIM count starts with zero.<br />
<br />
DD Attempt to redimension an array.<br />
<br />
Be careful where you put the DIM statement in your program,<br />
because if the program returns to the line in which you have<br />
placed the DIM statement, you will get this error. Make sure<br />
in planning your program that the initialisation process, of<br />
which the DIM statement may be an essential part, occurs at<br />
the beginning and the program does not regress.<br />
<br />
DS Direct statement<br />
<br />
Can occur because there is a direct statement in a data file,<br />
perhaps by loading an ASCII file which has 'lost' a line<br />
number. Files loaded off Bulletin Boards were prone to this<br />
error.<br />
<br />
FM Bad file mode<br />
<br />
If you have both double and single drives you may be prone to<br />
this error, or use a mix of single and double sided disks on<br />
your drives. The reason is that if you use a single sided<br />
disk in a double sided drive, the DOS reads the disk on<br />
startup or reset and expects the same type of disk in that<br />
drive, so when you put a double sided disk in the drive it is<br />
reading from Sector 18 to Sector 1 and doesn't recognise that<br />
the program continues on Sector 19 etc.<br />
The solution is to press the RESET button.<br />
Of course if you've got single sided drives and you're<br />
attempting to read a double sided disk, you'll get this error<br />
and there's nothing you can do about it!<br />
<br />
NE File non-existent<br />
<br />
The Computer can't find the file you want. If you've got more<br />
than one drive you may have omitted to prefix the filename<br />
with the drive number and a colon. or in the case of the Coco<br />
placed these AFTER the filename.<br />
e.g. Dragon - LOAD"2:FILENAME<br />
Coco - LOAD"FILENAME:1<br />
Although the numbers are different, in both cases you are<br />
loading the file from Drive 2.<br />
This error also occurs if you are using the COPY, KILL or<br />
RENAME commands and omit the extension.<br />
<br />
NF NEXT without FOR<br />
<br />
This occurs when the command NEXT is used without a matching<br />
FOR. Sometimes occurs through bad programming practice such<br />
as jumping into loops. Often occurs when the NEXT commands<br />
are reversed in nested loops.<br />
As programs are increased in speed by NOT using the variable<br />
with NEXT (ie NEXT X), the variable is unnecessary; the<br />
computer knows which variable to use, even if you've<br />
forgotten!<br />
<br />
TF Too many open<br />
<br />
Files that is. One of the easiest errors to fall into, when<br />
you go from using Coco disk drives to the Dragon. The Coco<br />
keeps track of its files differently to the Dragon reserving<br />
buffer space etc. You dont have to keep closing Coco files,<br />
but it is good practice to do so on the Dragon.<br />
There are 19 fonts in the DESKTOP program and in order to<br />
copy these to another disk, I often wrote a short little<br />
program to copy from 1 to 19 fonts. This would grind to a<br />
halt with this error after copying 10 fonts, if a CLOSE<br />
command was not included.<br />
<br />
UL Undefined line<br />
<br />
Occurs when a GOTO or a GOSUB is used with a line number<br />
that is not in the program.<br />
When you are using hybrid programs which are a mix of Basic<br />
and machine code routines, this error may be the first<br />
indication that your program has crashed. The program is<br />
possibly trying to jump to a line near the end of the<br />
program, but when you list it you find you've lost the end<br />
of your program. You can sometimes RESCUE it by using the<br />
RENUM command and although it won't Run, you can save it and<br />
when reloaded it will probably run.<br />
<br />
DATA<br />
<br />
Most mistakes occur when you type in programs from magazines<br />
etc, through the misreading of 8 and B in machine code, or<br />
by using an O in Hex notation instead of an 0. An the<br />
reverse is the case in music notation using an 0 in mistake<br />
for the O for the octave.<br />
Programmers who use an I or an O for a variable are asking<br />
you to fall in the trap and type a 1 or an 0. They are so<br />
difficult to spot if you go wrong. Especially if you get an<br />
FC error which refers to a string some lines back.<br />
<br />
Remember Murphy's Law, "If you don't want it to happen it<br />
probably will". I remember one program of Pam D'Arcy's that<br />
I had on tape in the days when I first purchased a disk<br />
drive. It was called TAPESCAN or SCANTAPE and as its name<br />
implies, used to scan through a tape and tell you what was<br />
on the tape and if the program was in machine code, what the<br />
relevent addresses were. In those days, I was always<br />
leaving a disk in the drive (a bad practice which I don't<br />
recommend to anyone). Anyway, every time I used TAPESCAN it<br />
did a grand job on my tape, but it wiped the disk directory<br />
and replaced it with gobbledegook. It used to drive me mad,<br />
but it taught me to never leave disks in the drive.<br />
<br />
<br />
== GRAPHIC MODES of the DRAGON and COCO ==<br />
<br />
<br />
NOTE - Modes 3 to 9 are not supported by Basic, but can be<br />
poked and used in your programs. One such program was called<br />
'Semigraphics 24' and was written by A C Daniel, it appeared<br />
in Dragon User magazine August 1985.<br />
<br />
MODE 1 Standard text screen 32 x 16 bytes (512)<br />
<br />
MODE 2 Semigraphic 4 SET/RESET as above screen.<br />
Same as Alphanumeric screen above and is<br />
supported by basic. Element size 64 x 32.<br />
<br />
MODE 3 (not supported by Basic)<br />
<br />
Semigraphic 6 Element size 64 x 48<br />
512 bytes - 4 colours per colour set.<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,AAND7+16+C<br />
Where C=0 or C=8 for Colorset 0 or 1.<br />
POKE65476,0:POKE65474,0:POKE65472,0<br />
<br />
MODE 4 (not supported by Basic<br />
<br />
Semigraphics 8 - Element size 64 X 64<br />
2048 bytes - 8 colours - Border black<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65475,0:POKE65475,1:POKE65472,0<br />
<br />
MODE 5 (not supported by Basic)<br />
<br />
Semigraphics 12 - Element size 64 x 96<br />
3072 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK(65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65474,0:POKE65472,0<br />
<br />
MODE 6 not supported by Basic)<br />
<br />
Semigraphics 24 - Element size 64 x 192<br />
6144 bytes - 8 colours - Black border<br />
SELECT with the following:-<br />
A=PEEK65314):POKE65314,(A AND 7)<br />
POKE65477,1:POKE65475,1:POKE65472,0<br />
<br />
NOTE - In the Semigraphic 8 colour modes, the colours are<br />
set with the MSB which ALWAYS has bit 7 set (1) and the rest<br />
of the MSB (ie bits 6,5 &4) are set for the colours as<br />
follows:<br />
000 GREEN 001 YELLOW<br />
010 BLUE 011 RED<br />
100 BUFF 101 CYAN<br />
110 MAGENTA 111 RED<br />
<br />
MODE 7 (not supported by Basic)<br />
<br />
64 X 64 GRAPHICS - FOUR COLOUR<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+C<br />
Where C=0 for Colour set 0<br />
c=8 for Colour set 1<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
Uses 1024 bytes. To START see end of section.<br />
<br />
MODE 8 (not supported by Basic)<br />
<br />
128 x 64 TWO COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+16+C<br />
WHERE C=0 OR C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65473,1:POKE65474,0:POKE65476,0<br />
AGAIN USES 1024 BYTES. TO START SEE END.<br />
<br />
MODE 9 (AGAIN NOT SUPPORTED)<br />
<br />
128 X 64 FOUR COLOURS<br />
Select with -<br />
A=PEEK(65314):POKE65314,(AAND7)+128+32+C<br />
WHERE C=0 OF C=8 FOR COLOUR SETS 0 OR 1.<br />
POKE65472,0:POKE65475,0:POKE65476,1<br />
Uses 2048 bytes.<br />
<br />
MODE10 is PMODE0 - 1536 bytes - 2 colour<br />
<br />
MODE11 is PMODE1 - 3072 bytes - 4 colour<br />
<br />
MODE12 is PMODE2 - 3072 bytes - 2 colour<br />
<br />
MODE13 is PMODE3 - 6144 bytes - 4 colour<br />
<br />
MODE14 is PMODE4 - 6144 bytes - 2 colour<br />
<br />
<br />
== BIBLIOGRAPHY ==<br />
<br />
The Major work regarding Graphics is William Barden's COLOR<br />
COMPUTER GRAPHICS published by TANDY (now out of print in<br />
this country). He describes bit mapping for all the non<br />
supported modes. Although intended for the TANDY COCO, it<br />
also applies to the Dragon, which uses the same SAM chip.<br />
Other books, if you can find them, are:-<br />
ADVANCED SOUND AND GRAPHICS by Keith and Steven Brain -<br />
published by SUNSHINE Books.<br />
PROGRAMMING THE DRAGON for GAMES & GRAPHICS by Geoff<br />
Phillips - published by McGRAW-HILL<br />
INSIDE THE DRAGON by Duncan Smeed & Ian Sommerville -<br />
published by ADDISON-WESLEY.<br />
Chapter 7 applies.<br />
DRAGON 32 PROGRAMMER'S REFERENCE GUIDE by John Vander Reydon<br />
- published by MELBOURNE HOUSE.<br />
<br />
<br />
== MEMORY MAP ==<br />
<br />
<br />
DRAGON 32 and 64 in 32 mode<br />
<br />
<pre> 0 - 1023 0000 - 03FF SYSTEM USE<br />
1024 - 1535 0400 - 05FF TEXT SCREEN<br />
1536 - 3071 0600 - 0BFF GRAPHICS: PAGE 1<br />
3072 - 4607 0C00 - 11FF PAGE 2<br />
4608 - 6143 1200 - 17FF PAGE 3<br />
6144 - 7679 1800 - 1DFF PAGE 4<br />
7680 - 9215 1E00 - 23FF PAGE 5<br />
9216 - 10751 2400 - 29FF PAGE 6<br />
10752 - 12287 2A00 - 2FFF PAGE 7<br />
12288 - 13823 3000 - 35FF PAGE 8<br />
13824 - 32767 3600 - 7FFF PROGRAM USE<br />
32768 - 49151 8000 - BFFF BASIC ROM<br />
49152 - 65279 C000 - FEFF CARTRIDGE USE<br />
65280 - 65535 FF00 - FFFF INPUT/OUTPUT<br />
</pre><br />
<br />
PLEASE NOTE:<br />
With disks in use, the Disk work space occupies the first<br />
page of graphics (1536 to 3071) and in consequence Graphics<br />
screens are moved up one page, starting at 3072 (&H0C00) and<br />
ending at 15359 (&H3BFF).<br />
On start up the Dragon does a PCLEAR4 and in consequence the<br />
memory available for program use starts at 7680, or 9216<br />
with the DOS Controller in place.<br />
<br />
DRAGON 64 in 64 MODE.<br />
<br />
Same as above, except the BASIC ROM is moved from 32768<br />
(&H8000) to 49152 (&HC000), which gives a substantial<br />
increase in memory available for program use, but means that<br />
disks cannot be used as the ROM overlays the Cartridge area.<br />
Programs exist to overcome this problem however.<br />
<br />
<pre>13824 - 49151 3600 - BFFF PROGRAM USE<br />
49152 - 65279 C000 - FEFF BASIC ROM<br />
65280 - 65375 FF00 - FF5F INPUT/OUTPUT<br />
65376 - 65503 FF60 - FFDF SAM CONTROL BITS<br />
65504 - 65535 FFE0 - FFFF MPU VECTORS</pre><br />
<br />
<br />
NOTE<br />
<br />
The following pages contain details of the Dragon's memory,<br />
both the Basic work pages and the Basic ROM. While every<br />
effort has been made to ensure the accuracy of these<br />
details, the Editor has had to rely on a number of sources<br />
and it has not been possible to check them all.<br />
Where possible details have also been given of the Tandy<br />
Coco2 equivalent, making it possible for the conversion of<br />
programs from American sources. In so doing you are reminded<br />
that the Coco disk system differs greatly from Dragondos and<br />
is closer to the cassette system in the way that it handles<br />
data files.<br />
One other major difference is the way that graphic binary<br />
files are stored, they are usually 512 bytes higher in<br />
memory than Dragon graphics.<br />
<br />
== MEMORY MAP DETAILS ==<br />
<br />
<br />
0 0 BREAK message flag<br />
1 1 STRING delimiting character<br />
2 2 Another delimiting character<br />
3 3 General counter<br />
4 4 Count of IF's seen looking for ELSE<br />
5 5 DIM flag<br />
6 6 VARIABLE type flag 0=numeric 255=string<br />
7 7 Garbage collection flag<br />
8 8 Subscript allowed flag<br />
9 9 INPUT/READ flag<br />
10 A Arithmetic use<br />
11) B) String pointer - first free temporary<br />
12) C)<br />
13) D) String pointer - last used temporory<br />
15-24 E-18 Temporary results<br />
25/26 19/1A Start address of Basic program<br />
27/28 1B/1C Start address of simple variables table<br />
see D User 1/86 p38 for details of<br />
variables.<br />
29/30 1D/1E Start address of ARRAY table<br />
31/32 1F/20 End of storage (last byte used by Basic)<br />
33/34 21/22 Top of Stack. ((Stack grows down)<br />
35/36 23/24 Top of free STRING space. By subtracting the<br />
contents of 33/34 you get free string space<br />
37/38 25/26 Pointer to STRING in string space<br />
39/40 27/28 Top of RAM available to Basic<br />
41/42 29/2A Line number used in 'CONT' command<br />
43/44 2B/2C Temp G.P. line number store<br />
45/46 2D/2E Pointer to statement to be executed<br />
47/48 2F/30 Direct mode command text pointer<br />
49/50 31/32 Current DATA statement line number<br />
51/52 33/34 Address of next item in current data sta'nt<br />
53/54 35/36 Address of keyboard input buffer<br />
55/56 37/38 Pointer to VARIABLE last in use<br />
57/58 39/3A VARPTR address of variable last in use<br />
59/78 3B/4E Evaluation variables<br />
65/66 41/42 High end destination address for block move<br />
67/68 43/44 High end origin address<br />
69/70 45/46 Low end destination address<br />
71/72 47/48 Low end origin address<br />
79/84 4F/54 Floating Point Accumulator: No 1<br />
79 4F Exponent )<br />
80/83 50/53 Mantissa ) Details of FPA<br />
84 54 Sign )<br />
85 55 Temporary sign of FAC<br />
86 56 String variable length<br />
92/97 5C/61 Floating Pt Acc No 2: details as before<br />
98 62 Sign comparison<br />
99 63 Extended precision byte-Coco<br />
104/105 68/69 Current line number (65535 in direct mode)<br />
106 6A VDU Comma field width (default 16)<br />
107 6B VDU Last Comma field (screen width - above)<br />
108 6C VDU Current column number (0 - 31)<br />
109 6D VDU Line width. No of characters per line<br />
110 6E Cassette I/O flag. Set FF on input incurring<br />
111 6F DEVN: re text output: 0=VDU 255=tape 254=prt<br />
112 70 Cassette EOF flag: EOF reached if non zero<br />
113 71 Restart flag. If<>$55 - cold start on reset<br />
114/115 72/73 Restart vector. If flag=$55 & vector points<br />
points to a NOP then warm start else<br />
a cold start.<br />
116/117 74/75 Physical end of RAM<br />
120 78 Cassette status:0=closed 1=input 2=output<br />
121 79 I/O buffer size<br />
122/3 7A/B Header buffer address:where f'name block is<br />
124 7C Cassette block type:<br />
0=f'name block 1=data block 255=EOF marker b<br />
125 7D BLKLEN:Cass Block length:Bytes to read/write<br />
126/7 7E/F Cassette I/O buffer address<br />
128 80 Used internally to calculate the checksum<br />
129 81 I/O error code 1=CRC 2=attempt load into RAM<br />
130/2 82/4 Temp store used by COS<br />
133 85 Last sine value<br />
134 86 Data for Lo-res SET/RESET routine<br />
135 87 ASCII code of last key pressed<br />
136/7 88/89 Current VDU cursor address (ie screen pos)<br />
138/9 8A/B G.P. (16 bit) scratch pad<br />
140 8C Sound pitch value (frequency)<br />
141/2 8D/E GP Countdown facility (?duration of sound)<br />
143 8F Cursor Flash Counter<br />
144/5 90/1 Cassette leader byte count (number of &H55s)<br />
146 92 Min Cycle width of 1200HZ - Init=12<br />
147 93 Min Pulse width of 1200HZ - Init=0A<br />
148 94 Max pulse width of 1200HZ - Init=12<br />
149/50 95/6 Dragon - Motor on delay<br />
Coco - Serial printer Baud rate constant<br />
HEX Msb Lsb (decimal) Baud<br />
149 150<br />
02EB 2 235 75<br />
01CA 1 202 120<br />
0173 1 115 150<br />
00BE 0 180 300<br />
0057 0 87 600 (default)<br />
0028 0 41 1200<br />
0012 0 18 2400<br />
0006 0 6 4800<br />
0001 0 1 9600<br />
151/2 97/8 Keyboard Scan Delay constant: Init=&H045E<br />
153 99 Printer Comma Field Width: Default 16<br />
154 9A Printer Last Comma Field<br />
155 9B Printer Line Width: Set this to width 80?<br />
156 9C Printer Head Column:same as POS(-2) in basic<br />
157/8 9D/E Exec Entry address<br />
159/170 9F/AA Self modifying routine which reads next char<br />
166/7 A6/7 Address of current sig byte - next char pntr<br />
171/4 AB/E Used by RND command<br />
175 AF TRON/TROFF flag: Non zero - trace on<br />
176/7 B0/1 Address os start of USR address table<br />
178 B2 Current foreground colour<br />
179 B3 Current Background colour<br />
180 B4 Temp colour in use<br />
181 B5 Byte value for current colour: ie bits set<br />
182 B6 Graphics PMODE number in use.<br />
183/4 B7/8 Address of LAST byte of current graphics<br />
185 B9 Number of bytes per line in current PMODE<br />
186/7 BA/B Address of FIRST byte: current graphics disp<br />
188 BC Start of graphics pages (MSB) defaults to 06<br />
Changed to 0C by Dragondos<br />
189/90 BD/E Current X Cursor position (not available<br />
191/2 BF/C0 Current Y Cursor position (n.a.)<br />
193 C1 Colour Set currently in use<br />
194 C2 Plot/Unplot flag:0=Reset, Non-zero=Set<br />
195/96 C3/4 Current Horizontal Pixel number<br />
197/8 C5/6 Current Vertical Pixel number<br />
199/200 C7/C8 Current X cursor co-ordinate<br />
201/2 C9/CA Current Y cursor co-ordinate<br />
203/4 CB/CC Circle command X co-ordinate<br />
205/6 CD/CE Circle command Y co-ordinate<br />
207/8 CF/D0 RENUMber increment value<br />
209/10 D1/2 RENUMber Start line (original number)<br />
211/2 D3/4 CLOADM: 2's complement load offset value<br />
213/4 D5/6 RENUMber New Start line (new number)<br />
215 D7 Editor line length - not user available<br />
216/221 D8/DD Graphics use<br />
222 DE Current octave in use (0 - 4)<br />
223/4 DF/E0 Volume data for volume setting in PLAY<br />
225 E1 Current note length in PLAY<br />
226 E2 Current TEMPO for PLAY command<br />
227/8 E3/4 Music duration count<br />
229 E5 Music dotted note flag<br />
230 E6 Coco - Baud rate constant<br />
231 E7 Coco - Input timeout constant<br />
232 E8 Current ANGLE used in DRAW routine<br />
233 E9 Current SCALE used in DRAW routine<br />
234 EA Disk operation code-what operation specified<br />
235 EB Disk Drive number(1 - 4) Coco(1 - 3)<br />
236 EC Disk read/write TRACK number<br />
237 ED Disk read/write SECTOR number<br />
238/9 EE/F Disk read/write Sector Buffer address<br />
240 F0 Disk Error Status byte (Convt to DDOS code)<br />
241 F1 Disk File Control Block number (1 - 10)<br />
242 F2 Number of bytes in Disk buffer area<br />
243 F3 No of bytes to transfer to/from buffer<br />
244 F4 Number of SIDES/TRACKS for current drive<br />
00=1 side 40 tracks 01=2 sides 40 tracks<br />
FF=1 side 80 tracks FE=2 sides 80 tracks<br />
The FORMAT of a disk is taken from the last<br />
few bytes of Sector 1 of Track 20 in Drogon<br />
DOS, on first access of disk after switch on<br />
or RESET.<br />
245 F5 File Read/write flag<br />
0=read, 1=write & FF=verify<br />
246 F6 Disk I/O in progress flag<br />
256/8 100/2 SWI3 JUMP VECTOR - called from &HFFF2<br />
Execution of a SWI3 instruction of &H113F<br />
will stack Registers and jump here<br />
259/61 103/5 SWI2 JUMP VECTOR - called from &HFFF4<br />
Execution of a SWI2 instruction of &H103F<br />
will stack registers and jump here<br />
262/4 106/8 SWI1 JUMP VECTOR - called from &HFFFA -&H3F<br />
will stack registers and jump here<br />
265/7 109/B NMI JUMP VECTOR -non-maskable interrupt<br />
called from &HFFFC, set to &H7ED7AE JUMPD7AE<br />
by initialisation of disk operating system<br />
in the Coco. Okay for Dragon?<br />
268/70 10C/E IRQ JUMP SECTOR - Interrupt request called<br />
from &HFFF8. Set to &H7EA9B3 to initialise<br />
Basic, Set to &H7E894C for initialisation of<br />
extended Basic or set to &H7ED7BC for the<br />
initialisation of DOS in the Coco.<br />
271/3 10F/111 FIRQ JUMP VECTOR - Fast interrupt request<br />
called from &HFFF6, set to &H7EA0F6 by the<br />
initialisation of Basic and causes a jump to<br />
the Cartridge Port in the Coco.<br />
274/6 112/4 In Coco this is EXEC of USR basic function<br />
274/5 112/3 Timer - current value of system timer<br />
In both Dragon and Coco (double function)<br />
277/81 115/9 Random number seeds used in RND function<br />
282/7 11A/F Unused in Dragon<br />
282 11A Coco - Caps lock 1=lock 0=unlock (lower case<br />
283/4 11B/C Coco - keyboard delay constant<br />
285/7 11D/F Coco - Vector to 45509 (JUMP $8489)<br />
288 120 Number of Basic commands (reserved words)<br />
289/90 121/2 Address of list of Basic commands<br />
291/2 123/4 Address of Command Despatch Table<br />
293 125 Number of Basic functions<br />
294/5 126/7 Address of list of Basic functions<br />
296/7 128/9 Address of Function Despatch Table<br />
298/307 12A/133 As for 288 to 297, but in Dragon refers to<br />
Disk commands and functions, but in the Coco<br />
to Extended Basic commands and functions.<br />
308/317 134/13D These addresses as above re COCO disks.<br />
308/327 134/147 DRAGON - USR Table (20 bytes 2 each USR)<br />
This USR table is switched to 1667 to 1686,<br />
or Hex 683 to 696 when DOS is connected and<br />
is replaced with Disk Stub3 which acts as a<br />
terminator.<br />
328 148 PRINTER AUTO LF/CR Flag<br />
329 149 Dragon - Caps Lock flag:non zero=upper case<br />
330 14A Number of chars in end of line sequence(1-4)<br />
331/4 14B/E End of Line Characters: Set to CR/LF/NUL/NUL<br />
This sequence is sent to printer when a<br />
carriage return is output.<br />
336/45 150/9 Dragon Keyboard 'Roll-over' table<br />
338/45 152/9 Coco Keyboard 'Roll-over' table<br />
<br />
DRAGON/COCO KEYBOARD ROLLOVER TABLE<br />
<br />
Response:<br />
Address 191 223 239 247 251 253 254<br />
Dec Hex D C D C D C D C D C D C D C<br />
338 152 ENT ENT X 8 P 0 H X @ P 8 H 0 @<br />
339 153 CLR CLR Y 9 Q 1 I Y A Q 8 I 1 A<br />
340 154 BRK BRK Z : R 2 J Z B R : J 2 B<br />
341 155 ; S 3 K C S ; K 3 C<br />
342 156 , T 4 L D T , L 4 D<br />
343 157 - U 5 M E U - M 5 E<br />
344 158 . V 6 N F V . N 6 F<br />
345 159 SPC / W 7 O SPC G W / O 7 G<br />
<br />
RESPONSE IS 255 OR &HFF IF NO KEY IS PRESSED<br />
<br />
346 15A Right Joystick(0) - X value<br />
347 15B Right Joystick(1) - Y value<br />
348 15C Left Joystick (2) - X value<br />
349 15D Left Joystick (3) - Y value<br />
<br />
350 to 424 15E to 1A8 RAM HOOKS (each 3 bytes)<br />
350/2 15E/160 Device Open- called just before OPEN command<br />
353/5 161/3 Device Number-called when a DEVN is verified<br />
356/8 164/6 Device Initialisation- called before setting<br />
up the Device parameters in Loctn 106 to 109<br />
359/61 167/9 OUTPUT CHAR TO DEVN:called just before out-<br />
putting char in A Reg to DEVN<br />
362/4 16A/C INPUT CHAR FROM DEVN: called just before<br />
inputting a char from DEVN into A Register<br />
365/7 16D/F INPUT FILE: called just before inputting a<br />
file using INPUT<br />
368/70 170/2 OUTPUT FILE: called just before outputting<br />
to a file using PRINT<br />
371/3 173/5 CLOSE ALL FILES: called before all files are<br />
closed, action only taken if Cassette open<br />
374/6 176/8 CLOSE FILE: called before device is CLOSED<br />
action only taken if DEVN is -1 (tape)<br />
377/9 179/B COMMAND INTERPRETER: called before interpret<br />
of token in A Reg as command, used by Delta<br />
380/2 17C/E RE-REQUEST INPUT. Called before requesting<br />
more data from keyboard- ie before ?? prompt<br />
383/5 17F/181 CHECK KEYS. Called before keyboard scanned<br />
for BREAK and SHIFT/@. Keyboard not scanned<br />
if DEVN is -1.<br />
386/8 182/4 LINE INPUT FILE. Called before Line Input is<br />
executed on current DEVN<br />
389/91 185/7 CLOSE FILE & COMMAND. Called before closing<br />
an ASCII file just read in as a Basic prog'm<br />
by CLOAD & returning to COMMAND mode.<br />
392/4 188/A CHECK EOF. Called before checking for EOF<br />
for current DEVN<br />
395/7 18B/D EVALUATE EXPRESSION. (obvious)<br />
398/400 18E/190 USER ERROR TRAP. Can be patched by the user,<br />
that is in Basic, to trap error messages.<br />
401/3 191/3 SYSTEM ERROR TRAP. Can be patched by the<br />
'system', ie Basic extension ROMs to trap<br />
errors (used by Dragondos)<br />
404/6 194/6 RUN LINK. Called when RUN command is about<br />
to be executed. Patched by DDOS to allow a<br />
disk filename to be specified.<br />
407/9 197/9 RESET BASIC MEMORY. Called from two routines<br />
in ROM before Basic Memory vectors are<br />
changed, ie by entering or editing lines,<br />
running programs etc.<br />
410/2 19A/C GET NEXT COMMAND. Called before reading in<br />
the next Basic command to be executed while<br />
program is running.<br />
413/5 19D/F ASSIGN STRING VARIABLE. (obvious)<br />
416/8 1A0/2 SCREEN ACCESS. Called before the CLS,GET and<br />
PUT commands are executed.<br />
419/21 1A3/5 TOKENISE LINE. Called before an ASCII line<br />
is tokenised in internal Basic format<br />
422/4 1A6/8 DETOKENISE LINE. Called before a Tokenised<br />
line is converted to ASCII characters<br />
425/464 or 1A9/1D0 STRING BUFFER AREA<br />
465 1D1 Cassette filename length<br />
466/73 1D2/9 Cassette filename to search for/or write out<br />
474/728 or 1DA/2D8 CASSETTE FILE DATA BUFFER<br />
Area of memory used to load filename block &<br />
ASCII data blocks - if this contains a file-<br />
name block then this can be peeked (474-488)<br />
474/81 1DA/1E1 Cassette filename (in buffer)<br />
482 1E2 File type: 0=token basic 1=ASCII 2=binary<br />
483 1E3 ASCII flag: 0=binary, non-zero=ASCII files.<br />
484 1E4 Gap flag: 1=continuous, 255(FF)=gapped files<br />
485/6 1E5/6 Execution address of machine code file<br />
487/8 1E7/8 Load address of ungapped machine code file<br />
729/33 2D9/C Basic line input buffer preamble<br />
734/984 2DD/3D8 Basic line input buffer<br />
985/1002 3D9/EA BUFFER space<br />
1003/20 3EB/3FC Unused<br />
1021/2 3FD/E End of line delay - RS 232 port on D64<br />
1023 3FF D64 RS 232 port Baud rate controller port<br />
1024) 400) TEXT SCREEN<br />
1535) 5FF) Default area.<br />
<br />
The Coco Buffer areas are slightly different:<br />
733/988 2DD/3DC 255 byte Keyboard buffer<br />
737/827 2E1/33B 90 byte Screen buffer<br />
<br />
The Disk Work area is from 1536 to 3071, or &H0600 to &H0BFF<br />
Otherwise if disks are not installed these addresses are in<br />
respect of the first of the Graphic pages, but with the DOS<br />
installed the Graphics page 1 starts at 3072 (&H0C00).<br />
<br />
<br />
== DRAGONDOS WORK SPACE ==<br />
<br />
<br />
1536 0600 Start of Disk work space or Graphics Page 1<br />
when Disk cartridge not installed<br />
1541 0605 Countdown to Disk motor off: Off when zero<br />
1544 0608 Auto Verify ON/OFF: 0=off else checks sector<br />
1546 060A Current Default drive No. Used when no Drive<br />
number is specified in the command<br />
1549/50 060D/E Auto command line number in use<br />
1551/2 060F/10 Auto command increment value<br />
1553 0611 Program LOAD/RUN flag: 0=Load else Load/RUN<br />
1555 0613 Auto command ON/OFF flag: 0=off else Auto on<br />
1556 0614 Error command ON/OFF flag: 0=off else ERR on<br />
1557/8 0615/6 ERROR trap line number: Basic line error rtn<br />
1559/60 0617/8 ERL: line number of last error<br />
1561 0619 ERR: Error code of last basic error<br />
1562/3 061A/B Address of start of statement in error<br />
1564/9 061C/21 Drive 1 details<br />
1570/5 0622/7 Drive 2 details<br />
1576/81 0628/D Drive 3 details<br />
1582/7 062E/33 Drive 4 details<br />
1588) 0634) Disk Buffers 1 to 4 details, 7 bytes each<br />
1615) 064F)<br />
1616/66 0650/82 Current Drive information<br />
1618/9 0652/3 Start address of program loaded<br />
1620/1 1654/5 Length of program loaded<br />
1622/3 1656/7 Entry (EXEC) address of M/code program<br />
1667/86 1683/96 USR Vector table: relocated from 308-327(dec<br />
1687 to 1706) Disk Drive Parameter table<br />
0697 to 06AA) 4 bytes per parameter - 1 for each drive<br />
1687/90 0697/A On Line Flag: Non zero means dive on line<br />
1691/4 069B/E Current Track, if Drive on line<br />
1695/8 069F/A2 Head Stepping rate: This should only be<br />
changed if slower drives are used.<br />
1699/702<br />
06A3/6 Disk Tracks on each drive<br />
1703/6 06A7/A Disk Sectors per track on each drive<br />
1707/24 06AB/BC Directory Sector status<br />
1725/2034 File Control Blocks: 10 in all: One for each<br />
6BD/7F2 open file: Each FCB 32 bytes long<br />
2035/47 7F3/F Temporary variables<br />
2048/3071 )Disk Buffers: 4 in all, each 256 bytes long<br />
800/BFF)<br />
<br />
3072 0C00 Start of Graphic Page 1 when disks in place<br />
otherwise start of Graphic Page 2 for tapes.<br />
<br />
== BASIC INTERPRETER CODES ==<br />
<br />
<br />
32768 8000 Hardware initialisation<br />
32771 8003 Software initialisation<br />
32774 8006 POLCAT:Keyboard input:put into Register A<br />
32777 8009 Cursor Blink<br />
32780 800C CHROUT:Write character in Reg A to screen<br />
32783 800F Writes out character in Reg A to printer<br />
32786 8012 Joystick input:stored in addresses 346/9 dec<br />
32789 8015 Cassette on<br />
32792 8018 Cassette off<br />
32795 801B Write leader to cassette (or A00C)<br />
32798 801E Output byte from Reg A to cassette<br />
32801 8021 CSRDON:Cassette on, prepare for reading<br />
32804 8024 Input one byte from cassette to Register A<br />
32807 8027 Gets one bit in from cassette into carry<br />
32810 802A Reads in a byte from another computer<br />
32813 802D Sends a byte to another computer<br />
32816 8030 Select Baud rate of communications line<br />
<br />
From here on the Coco equivalents are given in brackets and<br />
only a few Hex addresses will be given<br />
<br />
33604 (44102) SYSERR: Generates appropriate action for<br />
Error code in B Reg<br />
33649 (44147) CMDMODE: prints OK prompt & returns to the<br />
command mode<br />
33773 (44271) BASVECT2: complete initialisation process<br />
after Basic program loaded<br />
33815 (44313) NEW Basic:removes current Basic program from<br />
memory, resets stack & clears variables<br />
33823 (44321) BASVECT1: Sets up various necessary vectors,<br />
once a Basic program has been loaded<br />
33844 (44339) RESETS STACK: Resets stack to initial pos'tn<br />
all entries are lost<br />
33951 (44446) RUN BASIC: runs a basic program in memory,<br />
used to AUTORUN programs<br />
34091 851B (44539) WAIT KEY: waits for a key press, and<br />
when key pressed puts it in A Register<br />
34935 (45382) GET EXPR: routine will evaluate & put VARPTR<br />
address of following expression into 82/83<br />
34951 (45398) GET STRG: compiles a string and puts it into<br />
free string space<br />
35236 (45671) CKCLBRAK: as for CKCOMA, but checks for a<br />
closed bracket<br />
35239 (45674) CKOPBRAK: as for above, but checks for an<br />
open bracket<br />
35242 (45677) CKCOMA: Checks to see next significant char<br />
in command line is a comma, and if not it<br />
produces a SYNTAX error<br />
35244 (45679) CKCHAR: as for CKCOMA, but checks for char<br />
in B Register<br />
35476 (45911) GETVAR: Get VARPTR address of the follwing<br />
variable's name<br />
35625 (46057) GETUSR: Returns value of the argument in the<br />
USR function as 16 bit number in D register<br />
35632 INTCNV: pass parameters to M/code routine<br />
35641 GIVABF:used to pass values from M/C to Basic<br />
35893 (46322) ASSIGN-16-BIT:assigns value in D Register to<br />
a numeric variable<br />
35894 (46323) ASSIGN-8-BIT:assigns value in B register to<br />
a numeric variable<br />
Page 34<br />
<br />
<br />
36055 (46481) GARBAGE COLLECT: forces a controlled garbage<br />
collection of string space<br />
36255 (46681) DELVAR: frees space taken by a variable<br />
36433 (46859) GET-8-BIT: returns value of the following<br />
number in B Register<br />
36483 (46909) GET-16-BIT: returns value of the following<br />
number in X register<br />
36522 (46948) LIST BASIC: lists basic program in memory to<br />
to DEVN (device specified)<br />
37025 90A1 (47448) PRINT CR/LE: moves cursor position<br />
to start of a new line<br />
37093 90E5 (47516) OUT STRING:Outputs a text string to<br />
device number in DEVN<br />
38266 957A (48588) PRINT NUMBER:outputs 16 bit number<br />
in D Reg to DEVN<br />
38798 978E RANDOM NUMBER: Generates an 8 bit random<br />
number and puts it in location 278<br />
39998 (34830) ASSIGN-16-BITB:alternative to 35893, assigns<br />
value in Locs 82/83 to a variable<br />
41194 A0EA (36038) WAIT WITH CURSOR:scans keyboard for<br />
a keypress, flashing cursor at print pos.<br />
43207 (38201) CLEAR GRAPHICS:clears current graphics<br />
screen to data in B Register on entry<br />
43304 (38298) SET COLOURS: sets up locations 180 & 181<br />
43320 (38314) SELECT DISPLAY: Selects text or graphics<br />
depending on Z condition code, if Z=1 text<br />
43322 95AC (38316) RESET VDU: resets default VDU mode<br />
43401 (38395) SET VDG MODE:sets VDG in mode given in A Reg<br />
43421 (38415) SET VDG OFFSET: sets display offset for the<br />
graphics mode<br />
43428 (38422) SELECT VDG COL: selects required VDG colour<br />
set from the data in location 193<br />
43489 (38483) SELECT PAGE: on entry B reg contains page no<br />
43536 (38530) SELECT COL SET: selects colour set 0 or 1,<br />
according to data in B reg<br />
43555 (38549) RESERVE HRG RAM: reserves RAM for graphics<br />
and moves basic if necessary<br />
44698 (39639) PLAY NOTE: A Reg contains ASC code of note,<br />
other parameters should be set up<br />
45137 (40118) DRAW:allows access to all facilities of DRAW<br />
46004 (40999) RESET:resets whole works, as if reset button<br />
has been pressed<br />
46080 (41142) BOOT BASIC: restarts the Basic interpreter<br />
as if on power up or reset<br />
46410 B54A (41602) OUTCHAR:outputs character in A Reg<br />
to device number in DEVN (location 111)<br />
46687 (42029) CLOSE FILES: closes any open tape stream and<br />
flushes buffer<br />
46757 (42089) WRITE BASIC: writes current basic program to<br />
cassette<br />
46920 (42257) READ BINARY: reads in BIN file from tape<br />
47283 (42625) FIND FILE: searches tape for matching f'name<br />
47411 (42753) READ 1ST BLOCK:gets filename block into tape<br />
buffer<br />
47422 B93E (42763) BLKIN: reads a block of data into<br />
cassette buffer<br />
47505 (42981) WRITE 1ST BLOCK: (obvious)<br />
47513 B999 (42996) BLKOUT: write block of data to tape<br />
47583 (43149) SET LRG LEVEL:on entry the X Reg contains<br />
Lo-res screen address, B Reg colour & loc184<br />
the OR data<br />
47623 (43189) RESET LRG PIXEL:as above but B Reg ignored,<br />
Pixel reset to Black<br />
Page 35<br />
<br />
<br />
47656 (43225) CALC PIXEL POS:on entry the top of stack<br />
must contain Lo-res vertical co-ordinate,<br />
preceded by horizontal co-ordinate<br />
47735 BA77 (43304) CLEAR SCREEN: clears screen to space<br />
and 'homes' cursor<br />
47737 BA79 (43306) CLEAR SCREEN to CHR: clears screen<br />
to character in B Reg<br />
47776 (43345) BEEP:sound Beep for length held in B Reg and<br />
pitch set by location 140<br />
47811 (43380) AUDIO OFF: disables sound:clears bit 3 65315<br />
47813 (43382) ENABLE SOUND: enables 6 bit sound by setting<br />
Bit 3 of 65315<br />
47828 (43397) RESET D/A: Puts value $7E into D/A converter<br />
address<br />
47830 (43399) WRITE D/A: puts contents of A Reg into D/A C<br />
47852 (43421) AUDIO ON:on entry the B Reg must be zero<br />
48000 BB80 BOOT BASIC64K: Boots 64 mode<br />
48053 BBB5 (41369) UPDATE CURSOR: flashes cursor<br />
48101 BBE5 (41409) POLCAT: scans keyboard and puts the<br />
character in A Register<br />
48288 BCA0 (41763) CLEAR VDU LINE: clears current VDU<br />
line from the cursor position<br />
48299 BCAB (41738) VDU OUT: prints char in A Reg to VDU<br />
48373 BCF5 PRINTER DIR OUT: char in A Reg sent printer<br />
48394 BD0A PCRLF:moves print head to start of next line<br />
48410 BD1A (41663) PRINTER OUT:Char in Reg A to printer<br />
48449 (43426) SELECT JSK:selects joystick sources (ports -<br />
0 - 3) from A Register<br />
48466 BD52 (43486) READ JSKS: Updates all joystick data<br />
locations (346/9)<br />
48549 BDA5 (42837) BIT IN:reads a single bit(see below)<br />
48557 BDAD (42825) BYTE IN:reads a byte into A Reg(tape<br />
48591 (42954) MOTOR ON: tape - sets bit 3 of $FF21<br />
48604 (42987) MOTOR OFF: tape - clears bit 3 of $FF21<br />
48615 (42876) READ LEADER: motor on & prepares COS to read<br />
48658 (43050) BYTE OUT: writes byte in A Reg to tape<br />
48746 BE6A WRTLDR:turns cassette on and writes a leader<br />
<br />
THE FOLLOWING ARE DRAGONDOS ROUTINES<br />
<br />
49166 C00E LENFIL: Report file length<br />
49168 C010 CLOSAL: Close all files<br />
49176 C018 GETFRE: Get free space<br />
49178 C01A DELETE: Delete a file<br />
49180 C01C PROTECT/UNPROTECT a file<br />
49182 C01E RENAME a file<br />
49184 C020 GETDIR: Get directory entry<br />
49406 C0FC WRITE SECTOR: Writes 256 bytes to disk<br />
49412 C104 READ SECTOR: reads 256 bytes from disk<br />
49509 C165 DRIVE INIT: initialises DOS hardware<br />
49513 C169 HARDWARE I/O: low level command to hardware<br />
50108 C3BC FORMAT DISK: in the DEFD drive<br />
53581 D14D GET FREE SPACE: free bytes on current drive<br />
54033 D311 CONVERT SECTOR:converts LSN(Logical sect no)<br />
in Y Reg to Track/Sector<br />
55868 DA3C DIR DSK: directory of disk in DEFD drive to<br />
DEVN<br />
56229 DBA5 BEEP: on entry B Reg should contain number<br />
of beeps<br />
56267 DBCB WAIT TIME:on entry X Reg should contain the<br />
number of milliseconds to wait<br />
56330 DC0A BOOT DSK: boots an OS off disk in DEFD drive<br />
<br />
== INPUT/OUTPUT ROUTINES ==<br />
<br />
<br />
These refer to DRAGONDOS.<br />
<br />
65280 FF00 Bits 0 to 6 Keyboard row input<br />
Bit 7 koystick comparator input<br />
Decimal value 255/127 if no fire but pressed<br />
Dec value 254 or 126 if right joystick<br />
button pressed<br />
Dec value 253 or 125 if left joystick fire<br />
button pressed<br />
65282 FF02 Bits 0 to 7 keyboard column output<br />
65312 FF20 Bit 0 - cassette data input<br />
1 - RS232 data output<br />
2/7 - 6 bit D/A(.25 to 4.75 volts out)<br />
65313 FF21 Bit 0 - control of CD<br />
0=FIRQ to CPU disabled, 1=enabled<br />
Bit 1 - RS 232 status input<br />
0=set flag falling edge CD, 1=rising edge<br />
Bit 2 - normal Data Direction Register addsd<br />
0=change FF20 to DDR<br />
Bit 3 - Cass Motor control, 0=off, 1=on<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - CD interrupt flag<br />
65314 FF22 Bit 0 - RS 232 data input<br />
1 - single bit cound output<br />
2 - RAM size input<br />
3 - VDG Control Output CSS(color set ct)<br />
4 - VDG Control Output GM0&NOT(INT)/EXT<br />
5 - VDG Cont Output GM1<br />
6 - VDG Cont Output GM2<br />
7 - VDG Cont Output NOT(A)/G<br />
65315 FF23 (Coco) POKE 54 to disable auto exec of cartr<br />
POKE 55 to enable auto execute of cartridge<br />
Not certain re above for Dragon<br />
Bit 0 - control of cartridge<br />
0=FIRQ to CPU disabled, 1= enabled<br />
Bit 1 - Interrupt input<br />
0=sets flag on falling edge of cartridge<br />
1=sets flag on rising edge of cartridge<br />
Bit 2 - Normally 1, 0=changes FF22 to DDReg<br />
3 - 6 bit sound enable<br />
4 - always 1<br />
5 - always 1<br />
6 - not used<br />
7 - Cartridge Interrupt Flag<br />
<br />
<br />
== SAM CONTROL BITS ==<br />
<br />
<br />
65472/7 FFC0/5 VDG Control Registers for 6883 SAM<br />
Contains 3 pairs of addresses (V0-V2), and<br />
poking any value to EVEN addresses sets Bit<br />
Off(0) in VDG circuitry. Poking value to ODD<br />
addresses set Bit ON(1) in 6847 VDG circuit<br />
65472/3 FFC0/1 Control of Bit 0 (V0)<br />
65474/5 FFC2/3 1 (V1)<br />
65476/7 FFC4/5 2 (V2)<br />
65478/91 Page Select Register contains 7 pairs of<br />
FFC6/D3 (F0-F6) control Display Start address (Bin)<br />
Address os upper left most display element=<br />
0000+1/2*OFFSET. Poking any value to even<br />
addresses sets Bit OFF (0) in Page select.<br />
Poking any value to ODD addresses sets Bit<br />
ON(1) in Page Select Circuitry.<br />
Also BASEPAGE is set by converting binary<br />
value of F (Bits F0 to F6) to decimal and<br />
multiplying this decimal number by 512.<br />
65478/9 FFC6/7 Control of Bit 0 (F0)<br />
65480/1 FFC8/9 1 (F1)<br />
65482/3 FFCA/B 2 (F2)<br />
65484/5 FFCC/D 3 (F3)<br />
65486/7 FFCE/F 4 (F4)<br />
65488/9 FFD0/1 5 (F5)<br />
65490/1 FFD2/3 6 (F6)<br />
<br />
65492/3 FFD4/5 Page #1 P1 control of Bit 7: (F7) 0=Normal<br />
65494/7 FFD6/9 Clock Speed (R0-R1) Poking any value to even<br />
addresses sets Bit OFF (0). Poking any value<br />
to ODD addresses sets bit ON (1).<br />
65494/5 FFD6/7 Control of Bit R0<br />
65496/7 FFD8/9 Control of Bit R1<br />
R0=0, R1=0 (slow mode defa<br />
<br />
<br />
== MPU VECTORS ==<br />
<br />
<pre><br />
65522/3 FFF2/3 SWI 3 Vector mapped to 49138/9 BFF2/3<br />
65524/5 FFF4/5 SWI 2 vector 49140/1 BFF4/5<br />
65526/7 FFF6/7 FIRQ vector 49142/3 BFF6/7<br />
65528/9 FFF8/9 IRQ vector 49144/5 BFF8/9<br />
65530/1 FFFA/B SWI 1 vector 49146/7 BFFA/B<br />
65532/3 FFFC/D NMI vector 49148/9 BFFC/D<br />
65534/5 FFFE/F RESET vector 49150/1 BFFE/F<br />
</pre><br />
<br />
== ERROR MESSAGES AND CODES ==<br />
<br />
<br />
0 NF NEXT without FOR<br />
2 SN Syntax error<br />
4 RG RETURN without GOSUB<br />
6 OD Out of Data in READ<br />
8 FC Illegal Function call<br />
10 OV Overflow<br />
12 OM Out of Memory<br />
14 UL Undefined Line<br />
16 BS Bad subscript<br />
18 DD Redimension array<br />
20 /0 Division by Zero<br />
22 ID Illegal Direct Statement<br />
24 TM Type mismatch<br />
26 OS Out of String space<br />
28 LS String too long<br />
30 ST String too complex<br />
32 CN Can't continue<br />
34 UF<br />
36 FD Faulty data<br />
38 AO File already open<br />
40 DN Drive number<br />
42 IO Input/Output error<br />
44 FM Wrong file mode<br />
46 NO File not open<br />
48 IE Input past EOF (ER on the Coco)<br />
50 DS Direct statement<br />
128 * NR Not ready<br />
130 * SK Seek<br />
132 WP Write protect<br />
134 * RT Record Type<br />
136 * RF Record not found<br />
138 * CC Cyclic redundancy<br />
140 * LD Lost data<br />
142 * BT Boot error<br />
144 * IV Invalid Directory<br />
146 * FD Directory full<br />
148 DF Disk full<br />
150 FS File Spec<br />
152 * PT Protection on<br />
154 * PE READ past EOF<br />
156 * FF File not found<br />
158 * FE File exists (AE on the Coco)<br />
160 NE Non-existent<br />
162 * TF Too many open<br />
164 * PR Parameter error<br />
* * These error messages are not on the Coco,<br />
but the following are and are not on the Dragon.<br />
BR Bad record number (in data)<br />
FN Bad file name<br />
FO Field overflow re data files<br />
OB Out of Buffer space<br />
SE Set to non-fielded string (data)<br />
VF Verification error<br />
<br />
<br />
<br />
[[Category:Documentation]] [[Category:Software]] [[Category:Development]]</div>Tormodhttps://worldofdragon.org/index.php?title=System_Software&diff=8294System Software2016-05-07T20:50:40Z<p>Tormod: links to OS-9_System</p>
<hr />
<div>== Dragon Data ==<br />
<br />
[[Dragon DOS]]<br />
<br />
[[OS-9_System|OS-9 Level 1]]<br />
<br />
[[OS-9_System|OS-9 Level 2]]<br />
<br />
== Compusense ==<br />
<br />
[[FLEX]]<br />
<br />
== Premier Micro Systems ==<br />
<br />
[[Delta DOS]]<br />
<br />
== Eurohard ==<br />
<br />
[[OS-9_System|OS-9 Level 1 V2.0]]<br />
<br />
[[Category:Software]]<br />
<br />
== The NitrOS-9 project ==<br />
<br />
[[NitrOS-9]] Level 1</div>Tormodhttps://worldofdragon.org/index.php?title=NitrOS-9&diff=8293NitrOS-92016-05-07T20:47:33Z<p>Tormod: </p>
<hr />
<div>NitrOS-9 is a multi-task operating system for the Dragon and CoCo computers. It was originally based on OS-9 from Microware as an optimized version for the 6309 microprocessor. Over time it turned into a open-source project and is still under development. NitrOS-9 Level 1 is similar to OS-9 Level 1 and can run on the Dragon 64. It can actually boot on a Dragon 32 as well, but with very little RAM left to do anything useful. NitrOS-9 Level 2 is similar to OS-9 Level 2 and requires the GIME memory management unit (MMU) and extra memory of the CoCo3.<br />
<br />
NitrOS-9 has support for the Dragon Data disk controller (thanks to Phill) and for [[DriveWire]].<br />
<br />
Visit the [http://www.nitros9.org NitrOS-9 project] for more information.<br />
<br />
<br />
[[Category:Software]][[Category:System Software]][[Category:OS-9]]</div>Tormodhttps://worldofdragon.org/index.php?title=Programador_de_EPROM_(Resistor_magazine)&diff=8292Programador de EPROM (Resistor magazine)2016-05-07T20:45:24Z<p>Tormod: missing gallery end tag</p>
<hr />
<div>An EPROM programmer cartridge sold as kit through the Spanish electronics magazine ''Resistor''.<br />
<br />
== Pictures ==<br />
<br />
<gallery><br />
Image:Resistor_EPROM_Programmer_PCB_Top.jpg|PCB Top<br />
Image:Resistor_EPROM_Programmer_PCB_Bottom.jpg|PCB Bottom<br />
</gallery><br />
<br />
[[Category:Documentation]] [[Category:Hardware]] [[Category:DIY_Projects]]</div>Tormodhttps://worldofdragon.org/index.php?title=UDW_SD-card_DriveWire_microserver&diff=8291UDW SD-card DriveWire microserver2016-05-07T20:39:23Z<p>Tormod: /* uDW (by Tormod) */ linkify</p>
<hr />
<div>= uDW (by Tormod) =<br />
<br />
The ''uDW DriveWire microserver'' is a standalone, SD card based mass-storage solution for the Dragon. It plugs into the printer port (instead of a [[Dragon_32/64_Drivewire_Adapter|DriveWire adapter]]) and contains an embedded [[DriveWire]] server. Programs and files are stored on a micro SD card and are accessed the same way as if they were on a PC-based DriveWire server.<br />
<br />
* Dimensions 10 x 5 x 3 cm<br />
* Compatible with all DriveWire software ([[DWLOAD]], HDB-DOS, [[NitrOS-9]], ...)<br />
* Connects to printer port via IDC flat cable<br />
* Powered by the Dragon<br />
* Uses standard micro-SD cards (FAT formatted)<br />
* Built-in real time clock<br />
* Firmware upgradeable over USB<br />
<br />
[[File:udw.jpg]]<br />
<br />
http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=6&t=4981<br />
<br />
[[Category:Hardware]] [[Category:DIY_Projects]] [[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dweebs&diff=8290Dweebs2016-05-07T20:33:44Z<p>Tormod: /* DOS */ linkify NitrOS-9</p>
<hr />
<div>== What are dweebs? ==<br />
<br />
They're '[[DWLOAD]] Extensible Execution Blocks', a method for extending the functionality of [[DWLOAD]], a tool used to access [[DriveWire]].<br />
<br />
== How do they work? ==<br />
<br />
The DWLOAD client is relatively simple, due to the space constraints in the ROM. The dweeb is a mechanism to dynamically extend the functionality of DWLOAD. The dweeb is loaded from the server like any other program, but accesses the I/O routines of DWLOAD. It also reads its command parameters from the DWLOAD command line.<br />
<br />
The best example is the "SAVE" dweeb. There is not enough room in the ROM to include support for saving files over DriveWire. However, this functionality can be loaded on demand. DLOAD"SAVE""MYFILE.BAS" saves a BASIC program to the DriveWire server. The SAVE functionality is only temporarily loaded into RAM and used during this invocation.<br />
<br />
Since a dweeb uses the I/O routines of the calling DWLOAD, it is independent of the real transport being used, which makes development with for instance the Becker interface in XRoar very convenient.<br />
<br />
Examples:<br />
<br />
DLOAD"VLOAD""MYIMAGE.VDK""MYFILE.BAS"<br />
DLOAD"DOS"<br />
DLOAD"LROM""GAME.ROM"<br />
<br />
== How do you install them? ==<br />
<br />
Normally, dweebs live in the top directory of your Drivewire server - simply unzip the archive and put the files in there. However, you can create subdirectories in your Drivewire directory, for example:<br />
<br />
DLOAD"DWEEB/DATE"<br />
DLOAD"VDK/VDIR""DISK.VDK"<br />
<br />
You can also use variables with your dweebs, for example:<br />
<br />
D$="DWEEB/DATE"<br />
DLOADD$<br />
<br />
== The Dweeb Directory ==<br />
<br />
This is a list of the known Dweebs, extracted from posts on the forum. Please feel free to add any others to this list. <br />
''Note:'' CocoSDC users will use DWLOAD instead of DLOAD for all these examples.<br />
<br />
=== File Manipulation Dweebs ===<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&p=12300&hilit=LDAF#p12300 LDAF] ====<br />
Allows the user to load an ASCII basic file.<br />
DLOAD"LDAF""HELLO.BAS"<br />
''Note:'' See [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=LDAF&start=50#p14791 this post]] for the latest version. Also note that LDA (and the original version of LDAF) '''only''' work with DOS files.<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968#p12106 LROM] ====<br />
Allows the user to load (and run) any ROM file.<br />
DLOAD"LROM""ROMName (no need to put the .ROM extension)<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=CAS&start=50#p13706 CAS] ====<br />
A simple CAS parser to load CAS files directly from the DriveWire server.<br />
DLOAD"CAS""MYFILE.CAS"<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 SAVE/RESAVE] ====<br />
Save a basic program to the DriveWire server. ''Note:'' The commonly used Java based DW4 server currently doesn't support saving to a new file. In this case, use RESAVE to save over the top of an existing, possibly empty, file.<br />
DLOAD"SAVE""MYFILE.BAS"<br />
DLOAD"RESAVE""MYFILE.BAS"<br />
<br />
=== Disk Manipulation Dweebs ===<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=FLO2V#p12107 FLO2V] ====<br />
Allows copying a floppy from the default Dragon drive to a new VDK file in the PC Windows file system so you can save a backup of the disk and use it on XRoar as well.<br />
DLOAD"FLO2V""VDKName.VDK"<br />
''Note:'' See [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=VLOAD&start=40#p13154 this post]] for the latest version<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=V2FLO#p12107 V2FLO] ====<br />
Allows copying an VDK to a floppy on the default Dragon drive to restore a previous backup or simply to transfer a XRoar disk to the real Dragon drives.<br />
DLOAD"V2FLO""VDKName.VDK"<br />
''Note:'' See [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=VLOAD&start=40#p13154 this post]] for the latest version<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=VDIR#p12108 VDIR] ====<br />
Produces a directory list of the disk image.<br />
DLOAD"VDIR""DiskName"<br />
''Note:'' See [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=VDIR&start=30#p13033 this post] for the latest version<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=VLOAD#p12110 VLOAD] ====<br />
Allows the user to load and run/execute any program contained in any VDK image<br />
DLOAD"VLOAD""DiskName""FileName.Ext"<br />
''Note:'' Also see [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=VLOAD&start=30#p13037 this post] for the latest version.<br />
<br />
=== Drivewire and other Dweebs ===<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 DATE] ====<br />
Displays date and time from the DW4 server<br />
DLOAD"DATE"<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=DW&start=10#p12164 DW] ====<br />
Sends requests to the DriveWire server.<br />
DLOAD"DW""DW SERVER STATUS"<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 DOS] ====<br />
Boot from disk 0 on DW4 server (for launching [[NitrOS-9]])<br />
DLOAD"DOS"</div>Tormodhttps://worldofdragon.org/index.php?title=DriveWire&diff=8289DriveWire2016-05-07T20:33:00Z<p>Tormod: /* DriveWire software */ linkify NitrOS-9</p>
<hr />
<div>== Overview ==<br />
<br />
DriveWire is a way to connect your Dragon to a PC. It allows you to transfer files from the PC to your Dragon, or to use the PC as a virtual disk for the Dragon. A server program runs on the PC and services requests from the Dragon. Instead of a PC, a stand-alone DriveWire server like the [[uDW SD-card DriveWire microserver|uDW]] can be used.<br />
<br />
== DriveWire software ==<br />
<br />
DriveWire on the Dragon uses the printer port. On the Dragon, software is needed that can "talk" to the DriveWire server through the printer port. Operating systems like HDB-DOS and [[NitrOS-9]] have support for DriveWire, and can use the DriveWire server as a full replacement for a normal floppy or hard disk drive. See [[Drivewire for dummies]] for how to use HDB-DOS and DriveWire.<br />
<br />
For Dragon there is also [[DWLOAD]] - a small program that can be used to load programs from the DriveWire server without needing a disk operating system. DWLOAD can be embedded in a modified BASIC ROM, replacing the "DLOAD" command.<br />
<br />
== DriveWire adapters ==<br />
<br />
On the Dragon you will need an adapter to convert the printer port signals to a compatible serial port (or USB virtual serial port).<br />
<br />
See [[Dragon_32/64_Drivewire_Adapter]].<br />
<br />
== DriveWire server software ==<br />
<br />
The Drivewire4 (DW4) server is a Java application and can be downloaded here: https://sites.google.com/site/drivewire4/download<br />
<br />
A lightweight alternative is "DriveWire Lite": A reimplementation in C of the server side of the DriveWire 3 protocol: http://sourceforge.net/projects/dwlite/<br />
<br />
There is also an open-source DriveWire server written in Python: https://github.com/6809/DwLoadServer<br />
<br />
== Drivewire4 (DW4) server usage ==<br />
<br />
Just choose CoCo2 in the DriveWire4 server "Simple Config Wizard".<br />
Keep all the default selections.<br />
<br />
If you would like to use the server under Windows without installing the JRE, use this batch file for startup:<br />
<pre><br />
SET JDK=%~dp0\jre<br />
SET JAVA_EXE=%JDK%\bin\java.exe<br />
"%JAVA_EXE%" -XX:+UseConcMarkSweepGC -jar DW4UI.jar --backup &<br />
pause<br />
</pre><br />
Download a JRE and put it into DriveWire directory together with this batch file.<br />
<br />
== Links ==<br />
<br />
* [https://sourceforge.net/p/drivewireserver/wiki/DriveWire_Specification/ DriveWire specification]<br />
<br />
[[Category:Documentation]] [[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=Repository&diff=8288Repository2016-05-07T20:32:15Z<p>Tormod: /* linkify NitrOS-9 */</p>
<hr />
<div>There are many Software projects around 6809, Dragon and CoCo ...<br />
<br />
Here a link collection of theses:<br />
<br />
=== ToolShed ===<br />
<br />
ToolShed is a package of utilities to perform cross-development from Windows, Linux or Mac OS X computers to the Tandy Color Computer and Dragon microcomputers. Tools are included to read/write both OS-9 RBF disk images and CoCo Disk BASIC disk images, generate cassette WAV files and more.<br />
<br />
* Webpage: http://toolshed.sourceforge.net/<br />
* Project page: http://sourceforge.net/projects/toolshed/<br />
* Sourcecode repo: http://sourceforge.net/p/toolshed/code/<br />
<br />
<br />
=== LWTOOLS ===<br />
<br />
LWTOOLS is a set of cross-development tools for the Motorola 6809 and Hitachi 6309 microprocessors. It supports assembling to raw binaries, CoCo LOADM binaries, and a proprietary object file format for later linking. It also supports macros and file inclusion among other things.<br />
<br />
* Project page / Sourcecode: http://lwtools.projects.l-w.ca/<br />
<br />
=== M6809 computer tools ===<br />
<br />
Stuff for the M6809-based Dragon and similar computers.<br />
<br />
* https://gitorious.org/m6809-computer-tools<br />
<br />
==== conv-tools ====<br />
Various conversion tools for e.g. cassette and disk binary formats.<br />
* https://gitorious.org/m6809-computer-tools/conv-tools<br />
<br />
==== dload-dragon ====<br />
Patched DLOAD command for Dragon 32. Uses HDB-DOS DriveWire routines to talk serial on the Dragon printer port.<br />
* https://gitorious.org/m6809-computer-tools/dload-dragon<br />
<br />
==== dload-server ====<br />
A server for the DLOAD protocol, to be run on the host computer. Originally written by Burt Mitchell and ported to UNIX by Bryan Clingman.<br />
* https://gitorious.org/m6809-computer-tools/dload-server<br />
<br />
=== m6809 ===<br />
Motorola 6809 dev tools: Linux packages '''xroar''', '''lwtools''', '''toolshed'''<br />
* https://launchpad.net/~tormodvolden/+archive/ubuntu/m6809<br />
<br />
<br />
=== '6809' GitHub organization ===<br />
Stuff around 6809 CPU and homecomputers like Dragon 32/64, CoCo...<br />
* https://github.com/6809/<br />
<br />
==== DwLoadServer ====<br />
DWLOAD server implemented in Python <br />
* https://github.com/6809/DwLoadServer<br />
<br />
==== dragonlib ====<br />
Python library around 6809 computers like Dragon 32/64, CoCo... <br />
* https://github.com/6809/dragonlib<br />
<br />
==== sbc09 ====<br />
sbc09 stands for Lennart Benschop 6809 Single Board Computer.<br />
It contains a assembler and simulator for the Motorola M6809 processor.<br />
* https://github.com/6809/sbc09<br />
<br />
==== rom-info ====<br />
Collected Informations/Comments for 6809 ROM Images like Dragon 32 / 64 etc... <br />
* https://github.com/6809/rom-info<br />
<br />
<br />
=== NitrOS-9 ===<br />
[[NitrOS-9]] is an open-source OS-9 variant for Dragon and Tandy CoCo<br />
* Webpage: http://www.nitros9.org/<br />
* Project page: http://sourceforge.net/projects/nitros9/<br />
* Sourcecode repo: http://sourceforge.net/p/nitros9/code/<br />
<br />
=== FUZIX ===<br />
A new UNIX-like operating system for 8-bit computers, including Dragon and Tandy CoCo <br />
* https://github.com/EtchedPixels/FUZIX<br />
<br />
<br />
Missing links? Just edit this page and insert it ;)<br />
<br />
[[Category:Software]] [[Category:6809]]</div>Tormodhttps://worldofdragon.org/index.php?title=DWLOAD&diff=8287DWLOAD2016-05-07T20:31:21Z<p>Tormod: linkify NitrOS-9</p>
<hr />
<div>== DriveWire overview ==<br />
<br />
[[DriveWire]] is a way to connect your Dragon to a PC. It allows you to transfer files from the PC to your Dragon, or to use the PC as a virtual disk for the Dragon. A server program runs on the PC and services requests from the Dragon. Instead of a PC, a stand-alone DriveWire server like the [[uDW SD-card DriveWire microserver|uDW microserver]] can be used.<br />
<br />
DriveWire on the Dragon uses the printer port. On the Dragon, software is needed that can "talk" to the DriveWire server through the printer port. Operating systems like HDB-DOS and [[NitrOS-9]] have support for DriveWire, and can use the DriveWire server as a full replacement for a normal floppy or hard disk drive.<br />
<br />
For Dragon there is also DWLOAD - a small program that can be used to load programs from the DriveWire server without needing a disk operating system. DWLOAD can be embedded in a modified BASIC ROM, replacing the "DLOAD" command.<br />
<br />
== DWLOAD concept ==<br />
<br />
DWLOAD is designed to be so small that it fits into unused parts of the Dragon BASIC ROM. Nonetheless, it allows you to simply download and run files from the DriveWire server from within BASIC without any resident use of memory. DWLOAD can be enhanced by "DriveWire Executable Extension Blocks" (dweebs) which are small program loaded from the server to provide further DriveWire capabilities on demand. Some examples are "VLOAD" to load files from VDK images residing on the DriveWire server, "LROM" to load a ROM image into high RAM, and "DOS" to boot NitrOS-9 over DriveWire.<br />
<br />
DWLOAD can also be used together with HDB-DOS or Dragon DOS. You can for instance load files from the PC (plain files or from inside VDK images) and save them on your Dragon DOS floppy drive. Or load files from your Dragon DOS floppy drive and save them on the PC (currently only BASIC files supported via the "SAVE" dweeb).<br />
<br />
== Requirements ==<br />
<br />
In addition to your Dragon 32 or Dragon 64 or compatible home computer you will need either<br />
<br />
DriveWire adapter + PC running DriveWire server (DW4) <br />
<br />
or<br />
<br />
uDW microserver <br />
<br />
Of course, on the Dragon you will need DriveWire software. If you have the DWLOAD EPROM you are all set and can load everything (also HDB-DOS or NitrOS-9) via DriveWire. Otherwise, software (including a DWLOAD program) can be loaded from disk or cassette tape to get started. <br />
<br />
== Using DWLOAD ==<br />
<br />
DWLOAD is a small DriveWire client for BASIC which works without needing a DOS. It loads files as-is from the DriveWire server, that is, not using disk images like HDB-DOS or NitrOS-9 does.<br />
<br />
Simply put: Just drop the files in your DriveWire4 server folder, and access them from the Dragon using DWLOAD.<br />
<br />
The files can be Dragon DOS binary or BASIC files, or DECB binaries.<br />
<br />
The DWLOAD client can be loaded from tape or disk or, most conveniently, embedded into the BASIC ROM, like the DWLOAD EPROM.<br />
<br />
If you have the DWLOAD EPROM, use the "DLOAD" command to load files. Examples:<br />
<br />
DLOAD"MYFILE.BAS"<br />
to load and run the file "MYFILE.BAS" from the DriveWire server. To only load the program, use "DLOADN":<br />
DLOADN"BROKEN.BAS"<br />
<br />
Note that the filename ending is not significant, since the DWLOAD deduces the file type from its content.<br />
<br />
<br />
== DWLOAD Extensible Execution Blocks (dweeb) ==<br />
<br />
The DWLOAD client is relatively simple, due to the space constraints in the ROM. The dweeb is a mechanism to dynamically extend the functionality of DWLOAD. The dweeb is loaded from the server like any other program, but accesses the I/O routines of DWLOAD. It also reads its command parameters from the DWLOAD command line.<br />
<br />
More information, including a directory of available dweebs, can be found on the [[Dweebs]] wiki page.<br />
<br />
== Links ==<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 DWLOAD forum thread]<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968 dweebs forum thread]<br />
<br />
[[Category:Documentation]] [[Category:Hardware]] [[Category:DIY_Projects]] [[Category:Software]][[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=System_Software&diff=8286System Software2016-05-07T20:28:55Z<p>Tormod: add NitrOS-9</p>
<hr />
<div>== Dragon Data ==<br />
<br />
[[Dragon DOS]]<br />
<br />
[[OS-9 Level 1]]<br />
<br />
[[OS-9 Level 2]]<br />
<br />
== Compusense ==<br />
<br />
[[FLEX]]<br />
<br />
== Premier Micro Systems ==<br />
<br />
[[Delta DOS]]<br />
<br />
== Eurohard ==<br />
<br />
[[OS-9 Level 1 V2.0]]<br />
<br />
[[Category:Software]]<br />
<br />
== The NitrOS-9 project ==<br />
<br />
[[NitrOS-9]] Level 1</div>Tormodhttps://worldofdragon.org/index.php?title=NitrOS-9&diff=8285NitrOS-92016-05-07T20:27:04Z<p>Tormod: add categories</p>
<hr />
<div>NitrOS-9 is a multi-task operating system for the Dragon and CoCo computers. It was originally based on OS-9 from Microware as an optimized version for the 6309 microprocessor. Over time it turned into a open-source project and is still under development. NitrOS-9 Level 1 is similar to OS-9 Level 1 and can run on the Dragon 64. It can actually boot on a Dragon 32 as well, but with very little RAM left to do anything useful. NitrOS-9 Level 2 is similar to OS-9 Level 2 and requires the GIME memory management unit (MMU) and extra memory of the CoCo3.<br />
<br />
NitrOS-9 has support for the Dragon Data disk controller (thanks to Phill) and for [[DriveWire]].<br />
<br />
Visit the [http://www.nitros9.org NitrOS-9 project] for more information.<br />
<br />
<br />
[[Category:Software]][[Category:System Software]]</div>Tormodhttps://worldofdragon.org/index.php?title=NitrOS-9&diff=8284NitrOS-92016-05-07T20:25:52Z<p>Tormod: Created page with "NitrOS-9 is a multi-task operating system for the Dragon and CoCo computers. It was originally based on OS-9 from Microware as an optimized version for the 6309 microprocessor..."</p>
<hr />
<div>NitrOS-9 is a multi-task operating system for the Dragon and CoCo computers. It was originally based on OS-9 from Microware as an optimized version for the 6309 microprocessor. Over time it turned into a open-source project and is still under development. NitrOS-9 Level 1 is similar to OS-9 Level 1 and can run on the Dragon 64. It can actually boot on a Dragon 32 as well, but with very little RAM left to do anything useful. NitrOS-9 Level 2 is similar to OS-9 Level 2 and requires the GIME memory management unit (MMU) and extra memory of the CoCo3.<br />
<br />
NitrOS-9 has support for the Dragon Data disk controller (thanks to Phill) and for [[DriveWire]].<br />
<br />
Visit the [http://www.nitros9.org NitrOS-9 project] for more information.</div>Tormodhttps://worldofdragon.org/index.php?title=Dweebs&diff=8180Dweebs2016-05-04T21:47:19Z<p>Tormod: /* SAVE/RESAVE */</p>
<hr />
<div>== What are dweebs? ==<br />
<br />
They're '[[DWLOAD]] Extensible Execution Blocks', a method for extending the functionality of [[DWLOAD]], a tool used to access [[DriveWire]].<br />
<br />
== How do they work? ==<br />
<br />
The DWLOAD client is relatively simple, due to the space constraints in the ROM. The dweeb is a mechanism to dynamically extend the functionality of DWLOAD. The dweeb is loaded from the server like any other program, but accesses the I/O routines of DWLOAD. It also reads its command parameters from the DWLOAD command line.<br />
<br />
The best example is the "SAVE" dweeb. There is not enough room in the ROM to include support for saving files over DriveWire. However, this functionality can be loaded on demand. DLOAD"SAVE""MYFILE.BAS" saves a BASIC program to the DriveWire server. The SAVE functionality is only temporarily loaded into RAM and used during this invocation.<br />
<br />
Since a dweeb uses the I/O routines of the calling DWLOAD, it is independent of the real transport being used, which makes development with for instance the Becker interface in XRoar very convenient.<br />
<br />
Examples:<br />
<br />
DLOAD"VLOAD""MYIMAGE.VDK""MYFILE.BAS"<br />
DLOAD"DOS"<br />
DLOAD"LROM""GAME.ROM"<br />
<br />
== How do you install them? ==<br />
<br />
Normally, dweebs live in the top directory of your Drivewire server - simply unzip the archive and put the files in there. However, you can create subdirectories in your Drivewire directory, for example:<br />
<br />
DLOAD"DWEEB/DATE"<br />
DLOAD"VDK/VDIR""DISK.VDK"<br />
<br />
You can also use variables with your dweebs, for example:<br />
<br />
D$="DWEEB/DATE"<br />
DLOADD$<br />
<br />
== The Dweeb Directory ==<br />
<br />
This is a list of the known Dweebs, extracted from posts on the forum. Please feel free to add any others to this list. <br />
''Note:'' CocoSDC users will use DWLOAD instead of DLOAD for all these examples.<br />
<br />
=== File Manipulation Dweebs ===<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&p=12300&hilit=LDAF#p12300 LDAF] ====<br />
Allows the user to load an ASCII basic file.<br />
DLOAD"LDAF""HELLO.BAS"<br />
''Note:'' See [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=LDAF&start=50#p14791 this post]] for the latest version. Also note that LDA (and the original version of LDAF) '''only''' work with DOS files.<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968#p12106 LROM] ====<br />
Allows the user to load (and run) any ROM file.<br />
DLOAD"LROM""ROMName (no need to put the .ROM extension)<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=CAS&start=50#p13706 CAS] ====<br />
A simple CAS parser to load CAS files directly from the DriveWire server.<br />
DLOAD"CAS""MYFILE.CAS"<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 SAVE/RESAVE] ====<br />
Save a basic program to the DriveWire server. ''Note:'' The commonly used Java based DW4 server currently doesn't support saving to a new file. In this case, use RESAVE to save over the top of an existing, possibly empty, file.<br />
DLOAD"SAVE""MYFILE.BAS"<br />
DLOAD"RESAVE""MYFILE.BAS"<br />
<br />
=== Disk Manipulation Dweebs ===<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=FLO2V#p12107 FLO2V] ====<br />
Allows copying a floppy from the default Dragon drive to a new VDK file in the PC Windows file system so you can save a backup of the disk and use it on XRoar as well.<br />
DLOAD"FLO2V""VDKName.VDK"<br />
''Note:'' See [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=VLOAD&start=40#p13154 this post]] for the latest version<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=V2FLO#p12107 V2FLO] ====<br />
Allows copying an VDK to a floppy on the default Dragon drive to restore a previous backup or simply to transfer a XRoar disk to the real Dragon drives.<br />
DLOAD"V2FLO""VDKName.VDK"<br />
''Note:'' See [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=VLOAD&start=40#p13154 this post]] for the latest version<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=VDIR#p12108 VDIR] ====<br />
Produces a directory list of the disk image.<br />
DLOAD"VDIR""DiskName"<br />
''Note:'' See [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=VDIR&start=30#p13033 this post] for the latest version<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=VLOAD#p12110 VLOAD] ====<br />
Allows the user to load and run/execute any program contained in any VDK image<br />
DLOAD"VLOAD""DiskName""FileName.Ext"<br />
''Note:'' Also see [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=VLOAD&start=30#p13037 this post] for the latest version.<br />
<br />
=== Drivewire and other Dweebs ===<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 DATE] ====<br />
Displays date and time from the DW4 server<br />
DLOAD"DATE"<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968&hilit=DW&start=10#p12164 DW] ====<br />
Sends requests to the DriveWire server.<br />
DLOAD"DW""DW SERVER STATUS"<br />
<br />
==== [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 DOS] ====<br />
Boot from disk 0 on DW4 server (for launching NitrOS-9)<br />
DLOAD"DOS"</div>Tormodhttps://worldofdragon.org/index.php?title=DriveWire&diff=8179DriveWire2016-05-04T21:44:25Z<p>Tormod: link to spec + minor fixups</p>
<hr />
<div>== Overview ==<br />
<br />
DriveWire is a way to connect your Dragon to a PC. It allows you to transfer files from the PC to your Dragon, or to use the PC as a virtual disk for the Dragon. A server program runs on the PC and services requests from the Dragon. Instead of a PC, a stand-alone DriveWire server like the [[uDW SD-card DriveWire microserver|uDW]] can be used.<br />
<br />
== DriveWire software ==<br />
<br />
DriveWire on the Dragon uses the printer port. On the Dragon, software is needed that can "talk" to the DriveWire server through the printer port. Operating systems like HDB-DOS and NitrOS-9 have support for DriveWire, and can use the DriveWire server as a full replacement for a normal floppy or hard disk drive. See [[Drivewire for dummies]] for how to use HDB-DOS and DriveWire.<br />
<br />
For Dragon there is also [[DWLOAD]] - a small program that can be used to load programs from the DriveWire server without needing a disk operating system. DWLOAD can be embedded in a modified BASIC ROM, replacing the "DLOAD" command.<br />
<br />
== DriveWire adapters ==<br />
<br />
On the Dragon you will need an adapter to convert the printer port signals to a compatible serial port (or USB virtual serial port).<br />
<br />
See [[Dragon_32/64_Drivewire_Adapter]].<br />
<br />
== DriveWire server software ==<br />
<br />
The Drivewire4 (DW4) server is a Java application and can be downloaded here: https://sites.google.com/site/drivewire4/download<br />
<br />
A lightweight alternative is "DriveWire Lite": A reimplementation in C of the server side of the DriveWire 3 protocol: http://sourceforge.net/projects/dwlite/<br />
<br />
There is also an open-source DriveWire server written in Python: https://github.com/6809/DwLoadServer<br />
<br />
== Drivewire4 (DW4) server usage ==<br />
<br />
Just choose CoCo2 in the DriveWire4 server "Simple Config Wizard".<br />
Keep all the default selections.<br />
<br />
If you would like to use the server under Windows without installing the JRE, use this batch file for startup:<br />
<pre><br />
SET JDK=%~dp0\jre<br />
SET JAVA_EXE=%JDK%\bin\java.exe<br />
"%JAVA_EXE%" -XX:+UseConcMarkSweepGC -jar DW4UI.jar --backup &<br />
pause<br />
</pre><br />
Download a JRE and put it into DriveWire directory together with this batch file.<br />
<br />
== Links ==<br />
<br />
* [https://sourceforge.net/p/drivewireserver/wiki/DriveWire_Specification/ DriveWire specification]<br />
<br />
[[Category:Documentation]] [[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_32/64_Drivewire_Adapter&diff=7244Dragon 32/64 Drivewire Adapter2015-08-28T22:27:37Z<p>Tormod: explain what adapter it is and how it works</p>
<hr />
<div>[[File:Drivewire.jpg]] <br />
<br />
See also [[DriveWire]] and [[Drivewire_for_dummies]]<br />
<br />
== Overview ==<br />
<br />
[[DriveWire]] on Dragon uses pins on the printer port to communicate with an external DriveWire server. To convert the signal from the printer port (driven by bit-banger routines in software) into a RS232-compatible serial line, a signal inverter and level converters are needed.<br />
<br />
The DriveWire adapter presented on this page is made by Tormod and combines an inverting circuit and a USB interface to provide a solution that plugs directly to the Dragon printer port on one end and a normal USB port in the other end.<br />
<br />
Note that the specialized, standalone [[uDW SD-card DriveWire microserver|uDW]] DriveWire server has input circuitry adapted to the Dragon printer port and can therefore be plugged in directly without any adapter. <br />
<br />
== Hardware ==<br />
<br />
The built-in serial UART is the CP2102 from Silicon Labs.<br />
<br />
== Windows ==<br />
<br />
Windows driver can be downloaded from the chip manufacturer: http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx<br />
<br />
== Linux ==<br />
<br />
In most cases, you simply need to run "sudo adduser $USER dialout". Read on for more details. <br />
<br />
Some helpful commands:<br />
<pre><br />
~ $ sudo lsusb | grep UART<br />
Bus 001 Device 002: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light<br />
<br />
$ dmesg | grep -ie cp210*<br />
[17479.466698] usb 1-1: Product: CP2102 USB to UART Bridge Controller<br />
[17479.548508] usbcore: registered new interface driver cp210x<br />
[17479.548520] usbserial: USB Serial support registered for cp210x<br />
[17479.548535] cp210x 1-1:1.0: cp210x converter detected<br />
[17480.428168] usb 1-1: cp210x converter now attached to ttyUSB0<br />
</pre><br />
<br />
Look at the last line, to see that the adapter is assigned to '''ttyUSB0'''. Check which groups have access to it:<br />
<br />
<pre><br />
$ ls -l /dev/ttyUSB0 <br />
crw-rw---- 1 root dialout 188, 0 Nov 11 13:15 /dev/ttyUSB0<br />
</pre><br />
In this case you should assure that your user is in the user group '''dialout''', e.g.:<br />
<pre><br />
$ groups # Display the user groups for the current user<br />
user_foo : user_foo adm tty dialout fax cdrom floppy tape sudo audio dip video plugdev netdev fuse lpadmin scanner<br />
</pre><br />
Is the group is not listed, add your user to the group, e.g:<br />
<pre><br />
sudo adduser $USER dialout<br />
</pre><br />
<br />
You will have to logout and relogin after this command!<br />
<br />
<br />
<br />
<br />
== Links ==<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=781 DIY instructions]<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=6&t=4270 buy a tormod's Drivewire Adapter]<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=6&t=4854 buy a tormod's Drivewire deluxe cased adapters]<br />
* [[DWLOAD]]<br />
<br />
[[Category:Documentation]] [[Category:Hardware]] [[Category:DIY_Projects]] [[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=Repository&diff=7240Repository2015-08-23T10:58:23Z<p>Tormod: add NitrOS-9 and FUZIX</p>
<hr />
<div>There are many Software projects around 6809, Dragon and CoCo ...<br />
<br />
Here a link collection of theses:<br />
<br />
=== ToolShed ===<br />
<br />
ToolShed is a package of utilities to perform cross-development from Windows, Linux or Mac OS X computers to the Tandy Color Computer and Dragon microcomputers. Tools are included to read/write both OS-9 RBF disk images and CoCo Disk BASIC disk images, generate cassette WAV files and more.<br />
<br />
* Webpage: http://toolshed.sourceforge.net/<br />
* Project page: http://sourceforge.net/projects/toolshed/<br />
* Sourcecode repo: http://sourceforge.net/p/toolshed/code/<br />
<br />
<br />
=== LWTOOLS ===<br />
<br />
LWTOOLS is a set of cross-development tools for the Motorola 6809 and Hitachi 6309 microprocessors. It supports assembling to raw binaries, CoCo LOADM binaries, and a proprietary object file format for later linking. It also supports macros and file inclusion among other things.<br />
<br />
* Project page / Sourcecode: http://lwtools.projects.l-w.ca/<br />
<br />
=== M6809 computer tools ===<br />
<br />
Stuff for the M6809-based Dragon and similar computers.<br />
<br />
* https://gitorious.org/m6809-computer-tools<br />
<br />
==== conv-tools ====<br />
Various conversion tools for e.g. cassette and disk binary formats.<br />
* https://gitorious.org/m6809-computer-tools/conv-tools<br />
<br />
==== dload-dragon ====<br />
Patched DLOAD command for Dragon 32. Uses HDB-DOS DriveWire routines to talk serial on the Dragon printer port.<br />
* https://gitorious.org/m6809-computer-tools/dload-dragon<br />
<br />
==== dload-server ====<br />
A server for the DLOAD protocol, to be run on the host computer. Originally written by Burt Mitchell and ported to UNIX by Bryan Clingman.<br />
* https://gitorious.org/m6809-computer-tools/dload-server<br />
<br />
=== m6809 ===<br />
Motorola 6809 dev tools: Linux packages '''xroar''', '''lwtools''', '''toolshed'''<br />
* https://launchpad.net/~tormodvolden/+archive/ubuntu/m6809<br />
<br />
<br />
=== '6809' GitHub organization ===<br />
Stuff around 6809 CPU and homecomputers like Dragon 32/64, CoCo...<br />
* https://github.com/6809/<br />
<br />
==== DwLoadServer ====<br />
DWLOAD server implemented in Python <br />
* https://github.com/6809/DwLoadServer<br />
<br />
==== dragonlib ====<br />
Python library around 6809 computers like Dragon 32/64, CoCo... <br />
* https://github.com/6809/dragonlib<br />
<br />
==== sbc09 ====<br />
sbc09 stands for Lennart Benschop 6809 Single Board Computer.<br />
It contains a assembler and simulator for the Motorola M6809 processor.<br />
* https://github.com/6809/sbc09<br />
<br />
==== rom-info ====<br />
Collected Informations/Comments for 6809 ROM Images like Dragon 32 / 64 etc... <br />
* https://github.com/6809/rom-info<br />
<br />
<br />
=== NitrOS-9 ===<br />
An open-source OS-9 variant for Dragon and Tandy CoCo<br />
* Webpage: http://www.nitros9.org/<br />
* Project page: http://sourceforge.net/projects/nitros9/<br />
* Sourcecode repo: http://sourceforge.net/p/nitros9/code/<br />
<br />
<br />
=== FUZIX ===<br />
A new UNIX-like operating system for 8-bit computers, including Dragon and Tandy CoCo <br />
* https://github.com/EtchedPixels/FUZIX<br />
<br />
<br />
Missing links? Just edit this page and insert it ;)<br />
<br />
[[Category:Software]] [[Category:6809]]</div>Tormodhttps://worldofdragon.org/index.php?title=DWLOAD&diff=7239DWLOAD2015-08-22T20:33:33Z<p>Tormod: /* DriveWire overview */ link to uDW</p>
<hr />
<div>== DriveWire overview ==<br />
<br />
[[DriveWire]] is a way to connect your Dragon to a PC. It allows you to transfer files from the PC to your Dragon, or to use the PC as a virtual disk for the Dragon. A server program runs on the PC and services requests from the Dragon. Instead of a PC, a stand-alone DriveWire server like the [[uDW SD-card DriveWire microserver|uDW microserver]] can be used.<br />
<br />
DriveWire on the Dragon uses the printer port. On the Dragon, software is needed that can "talk" to the DriveWire server through the printer port. Operating systems like HDB-DOS and NitrOS-9 have support for DriveWire, and can use the DriveWire server as a full replacement for a normal floppy or hard disk drive.<br />
<br />
For Dragon there is also DWLOAD - a small program that can be used to load programs from the DriveWire server without needing a disk operating system. DWLOAD can be embedded in a modified BASIC ROM, replacing the "DLOAD" command.<br />
<br />
== DWLOAD concept ==<br />
<br />
DWLOAD is designed to be so small that it fits into unused parts of the Dragon BASIC ROM. Nonetheless, it allows you to simply download and run files from the DriveWire server from within BASIC without any resident use of memory. DWLOAD can be enhanced by "DriveWire Executable Extension Blocks" (dweebs) which are small program loaded from the server to provide further DriveWire capabilities on demand. Some examples are "VLOAD" to load files from VDK images residing on the DriveWire server, "LROM" to load a ROM image into high RAM, and "DOS" to boot NitrOS-9 over DriveWire.<br />
<br />
DWLOAD can also be used together with HDB-DOS or Dragon DOS. You can for instance load files from the PC (plain files or from inside VDK images) and save them on your Dragon DOS floppy drive. Or load files from your Dragon DOS floppy drive and save them on the PC (currently only BASIC files supported via the "SAVE" dweeb).<br />
<br />
== Requirements ==<br />
<br />
In addition to your Dragon 32 or Dragon 64 or compatible home computer you will need either<br />
<br />
DriveWire adapter + PC running DriveWire server (DW4) <br />
<br />
or<br />
<br />
uDW microserver <br />
<br />
Of course, on the Dragon you will need DriveWire software. If you have the DWLOAD EPROM you are all set and can load everything (also HDB-DOS or NitrOS-9) via DriveWire. Otherwise, software (including a DWLOAD program) can be loaded from disk or cassette tape to get started. <br />
<br />
== Using DWLOAD ==<br />
<br />
DWLOAD is a small DriveWire client for BASIC which works without needing a DOS. It loads files as-is from the DriveWire server, that is, not using disk images like HDB-DOS or NitrOS-9 does.<br />
<br />
Simply put: Just drop the files in your DriveWire4 server folder, and access them from the Dragon using DWLOAD.<br />
<br />
The files can be Dragon DOS binary or BASIC files, or DECB binaries.<br />
<br />
The DWLOAD client can be loaded from tape or disk or, most conveniently, embedded into the BASIC ROM, like the DWLOAD EPROM.<br />
<br />
If you have the DWLOAD EPROM, use the "DLOAD" command to load files. Examples:<br />
<br />
DLOAD"MYFILE.BAS"<br />
to load and run the file "MYFILE.BAS" from the DriveWire server. To only load the program, use "DLOADN":<br />
DLOADN"BROKEN.BAS"<br />
<br />
Note that the filename ending is not significant, since the DWLOAD deduces the file type from its content.<br />
<br />
<br />
== DWLOAD Extensible Execution Blocks (dweeb) ==<br />
<br />
The DWLOAD client is relatively simple, due to the space constraints in the ROM. The dweeb is a mechanism to dynamically extend the functionality of DWLOAD. The dweeb is loaded from the server like any other program, but accesses the I/O routines of DWLOAD. It also reads its command parameters from the DWLOAD command line.<br />
<br />
The best example is the "SAVE" dweeb. There is not enough room in the ROM to include support for saving files over DriveWire. However, this functionality can be loaded on demand. DLOAD"SAVE""MYFILE.BAS" saves a BASIC program to the DriveWire server. The SAVE functionality is only temporarily loaded into RAM and used during this invocation.<br />
<br />
Another typical dweeb is "DOS" for booting an operating system (NitrOS-9), similar to the DOS command in HDB-DOS or the DWDOS program.<br />
<br />
Pere has also created some dweebs for accessing VDK disk images on the DriveWire server, this is very useful for accessing Dragon DOS program collections without using a disk drive or DOS.<br />
<br />
Since a dweeb uses the I/O routines of the calling DWLOAD, it is independent of the real transport being used, which makes development with for instance the Becker interface in XRoar very convenient.<br />
<br />
Examples:<br />
<br />
DLOAD"SAVE""MYFILE.BAS"<br />
<br />
DLOAD"VLOAD""MYIMAGE.VDK""MYFILE.BAS"<br />
<br />
DLOAD"DOS"<br />
<br />
DLOAD"LROM""GAME.ROM"<br />
<br />
== Links ==<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 DWLOAD forum thread]<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968 dweebs forum thread]<br />
<br />
[[Category:Documentation]] [[Category:Hardware]] [[Category:DIY_Projects]] [[Category:Software]][[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=DriveWire&diff=7238DriveWire2015-08-22T20:30:34Z<p>Tormod: /* Overview */ add uDW link</p>
<hr />
<div>== Overview ==<br />
<br />
DriveWire is a way to connect your Dragon to a PC. It allows you to transfer files from the PC to your Dragon, or to use the PC as a virtual disk for the Dragon. A server program runs on the PC and services requests from the Dragon. Instead of a PC, a stand-alone DriveWire server like the [[uDW SD-card DriveWire microserver|uDW]] can be used.<br />
<br />
== DriveWire software ==<br />
<br />
DriveWire on the Dragon uses the printer port. On the Dragon, software is needed that can "talk" to the DriveWire server through the printer port. Operating systems like HDB-DOS and NitrOS-9 have support for DriveWire, and can use the DriveWire server as a full replacement for a normal floppy or hard disk drive. See [[Drivewire for dummies]] for how to use HDB-DOS and DriveWire.<br />
<br />
For Dragon there is also [[DWLOAD]] - a small program that can be used to load programs from the DriveWire server without needing a disk operating system. DWLOAD can be embedded in a modified BASIC ROM, replacing the "DLOAD" command.<br />
<br />
== DriveWire adapters ==<br />
<br />
On the Dragon you will need an adapter to convert the printer port signals to a compatible serial port (or USB virtual serial port).<br />
<br />
See [[Dragon_32/64_Drivewire_Adapter]].<br />
<br />
<br />
== DriveWire servers ==<br />
<br />
The Drivewire4 server is a Java application and can be downloaded here: https://sites.google.com/site/drivewire4/download<br />
<br />
There exist also "DriveWire Lite": a reimplementation in C of the server side of the DriveWire 3 protocol: http://sourceforge.net/projects/dwlite/<br />
<br />
There is also a OpenSource DriveWire Server written in Python: https://github.com/6809/DwLoadServer<br />
<br />
== Drivewire4 (DW4) server usage ==<br />
<br />
Just choose CoCo2 in the DriveWire4 server "Simple Config Wizard".<br />
Keep all the default selections.<br />
<br />
If you would like to use the server under Windows without installing the JRE, use this batch file for startup:<br />
<pre><br />
SET JDK=%~dp0\jre<br />
SET JAVA_EXE=%JDK%\bin\java.exe<br />
"%JAVA_EXE%" -XX:+UseConcMarkSweepGC -jar DW4UI.jar --backup &<br />
pause<br />
</pre><br />
Download a JRE and put it into DriveWire directory together with this batch file.<br />
<br />
<br />
[[Category:Documentation]] [[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=UDW_SD-card_DriveWire_microserver&diff=7237UDW SD-card DriveWire microserver2015-08-22T20:26:19Z<p>Tormod: /* uDW (by Tormod) */</p>
<hr />
<div>= uDW (by Tormod) =<br />
<br />
The uDW DriveWire microserver is a standalone, SD card based mass-storage solution for the Dragon. It plugs into the printer port (instead of a DriveWire adapter) and contains an embedded DriveWire server. Programs and files are stored on a micro SD card and are accessed the same way as if they were on a PC-based DriveWire server.<br />
<br />
* Dimensions 10 x 5 x 3 cm<br />
* Compatible with all DriveWire software (DWLOAD, HDB-DOS, NitrOS-9, ...)<br />
* Connects to printer port via IDC flat cable<br />
* Powered by the Dragon<br />
* Uses standard micro-SD cards (FAT formatted)<br />
* Built-in real time clock<br />
* Firmware upgradeable over USB<br />
<br />
[[File:udw.jpg]]<br />
<br />
http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=6&t=4981<br />
<br />
[[Category:Hardware]] [[Category:DIY_Projects]] [[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=DIY_Projects&diff=7236DIY Projects2015-08-22T20:24:54Z<p>Tormod: /* Cartridges & Expansions */ added uDW</p>
<hr />
<div>The Dragon series of computers offers programming models and a cartridge expansion connector that are ideally suited to hardware hackers and hobbyist experimenters. Below, you can find a selection of projects that have been created by members of the Dragon community.<br />
<br />
Click the item to learn more about it, buy one or download schematics and associated software (where applicable). <br />
<br />
== Adapters & Cables ==<br />
* [[Replacement power supply unit]]<br />
* [[Dragon32/iPhone Bi-Directional Data Cable (Rink)]]<br />
* [[Dragon 32/64 Drivewire Adapter]]<br />
* [[Floppy Cable]]<br />
<br />
== Cartridges & Expansions ==<br />
* [[Multicart by Prime (Phill Harvey-Smith)]]<br />
* [[DragonMMC SDCard Interface by Prime (Phill Harvey-Smith)]]<br />
* [[Dragon ROM/RAM Cartridge (Rink)]]<br />
* [[Dragon I/O Cartridge (Rink)]]<br />
* [[Dragon Multi Cartridge version 1.0 (Rolo)]]<br />
* [[Dragon Multi Cartridge version 1.5 (Rolo)]]<br />
* [[80 Column WordPak]] (CoCoDemus)<br />
* [[Dragon Lab-Cartridge version 1.0 (Rolo)]]<br />
* [[uDW SD-card DriveWire microserver]] (Tormod)<br />
<br />
== 6809 DIY construction kits ==<br />
Here a list of external DIY instructions to build a own 6809 based computer:<br />
<br />
* [http://searle.hostei.com/grant/Multicomp/ Grant's Low-cost FPGA project "MULTICOMP"]<br />
* [http://searle.hostei.com/grant/6809/Simple6809.html Grant's 6-chip 6809 computer]<br />
* [http://www.msarnoff.org/projects/6809/ Ultim809: Homebrew 8-Bit Computer]<br />
* [http://www.8bitforce.com/simon6809/ Simon 6809]<br />
* [http://laurent68k.free.fr/Site/RedBoard6809.html HOMEBREW Computer 6809: RedBoard]<br />
<br />
See also forums thread related to this list: http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=8&t=4338<br />
<br />
<br />
[[Category:Documentation]] [[Category:Hardware]] [[Category:DIY_Projects]]</div>Tormodhttps://worldofdragon.org/index.php?title=UDW_SD-card_DriveWire_microserver&diff=7235UDW SD-card DriveWire microserver2015-08-22T20:24:06Z<p>Tormod: new uDW page</p>
<hr />
<div>= uDW (by Tormod) =<br />
<br />
The uDW DriveWire microserver is a standalone, SD card based mass-storage solution for the Dragon. It plugs into the printer port (instead of a DriveWire adapter) and contains an embedded DriveWire server. Programs and files are stored on a micro SD card and are accessed the same way as if they were on a PC-based DriveWire server.<br />
<br />
* Dimensions 10 x 5 x 3 cm<br />
* Compatible with all DriveWire software (DWLOAD, HDB-DOS, NitrOS-9, ...)<br />
* Connects to printer port via IDC flat cable<br />
* Powered by the Dragon<br />
* Uses standard micro-SD cards (FAT formatted)<br />
* Built-in real time clock<br />
* Firmware upgradeable over USB<br />
<br />
[[File:udw.jpg]]<br />
<br />
http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=6&t=4981</div>Tormodhttps://worldofdragon.org/index.php?title=File:Udw.jpg&diff=7234File:Udw.jpg2015-08-22T20:21:46Z<p>Tormod: uDW DriveWire microserver by Tormod</p>
<hr />
<div>uDW DriveWire microserver by Tormod</div>Tormodhttps://worldofdragon.org/index.php?title=DWLOAD&diff=7233DWLOAD2015-08-22T17:05:24Z<p>Tormod: /* DriveWire overview */</p>
<hr />
<div>== DriveWire overview ==<br />
<br />
[[DriveWire]] is a way to connect your Dragon to a PC. It allows you to transfer files from the PC to your Dragon, or to use the PC as a virtual disk for the Dragon. A server program runs on the PC and services requests from the Dragon. Instead of a PC, a stand-alone DriveWire server like uDW can be used.<br />
<br />
DriveWire on the Dragon uses the printer port. On the Dragon, software is needed that can "talk" to the DriveWire server through the printer port. Operating systems like HDB-DOS and NitrOS-9 have support for DriveWire, and can use the DriveWire server as a full replacement for a normal floppy or hard disk drive.<br />
<br />
For Dragon there is also DWLOAD - a small program that can be used to load programs from the DriveWire server without needing a disk operating system. DWLOAD can be embedded in a modified BASIC ROM, replacing the "DLOAD" command.<br />
<br />
== DWLOAD concept ==<br />
<br />
DWLOAD is designed to be so small that it fits into unused parts of the Dragon BASIC ROM. Nonetheless, it allows you to simply download and run files from the DriveWire server from within BASIC without any resident use of memory. DWLOAD can be enhanced by "DriveWire Executable Extension Blocks" (dweebs) which are small program loaded from the server to provide further DriveWire capabilities on demand. Some examples are "VLOAD" to load files from VDK images residing on the DriveWire server, "LROM" to load a ROM image into high RAM, and "DOS" to boot NitrOS-9 over DriveWire.<br />
<br />
DWLOAD can also be used together with HDB-DOS or Dragon DOS. You can for instance load files from the PC (plain files or from inside VDK images) and save them on your Dragon DOS floppy drive. Or load files from your Dragon DOS floppy drive and save them on the PC (currently only BASIC files supported via the "SAVE" dweeb).<br />
<br />
== Requirements ==<br />
<br />
In addition to your Dragon 32 or Dragon 64 or compatible home computer you will need either<br />
<br />
DriveWire adapter + PC running DriveWire server (DW4) <br />
<br />
or<br />
<br />
uDW microserver <br />
<br />
Of course, on the Dragon you will need DriveWire software. If you have the DWLOAD EPROM you are all set and can load everything (also HDB-DOS or NitrOS-9) via DriveWire. Otherwise, software (including a DWLOAD program) can be loaded from disk or cassette tape to get started. <br />
<br />
== Using DWLOAD ==<br />
<br />
DWLOAD is a small DriveWire client for BASIC which works without needing a DOS. It loads files as-is from the DriveWire server, that is, not using disk images like HDB-DOS or NitrOS-9 does.<br />
<br />
Simply put: Just drop the files in your DriveWire4 server folder, and access them from the Dragon using DWLOAD.<br />
<br />
The files can be Dragon DOS binary or BASIC files, or DECB binaries.<br />
<br />
The DWLOAD client can be loaded from tape or disk or, most conveniently, embedded into the BASIC ROM, like the DWLOAD EPROM.<br />
<br />
If you have the DWLOAD EPROM, use the "DLOAD" command to load files. Examples:<br />
<br />
DLOAD"MYFILE.BAS"<br />
to load and run the file "MYFILE.BAS" from the DriveWire server. To only load the program, use "DLOADN":<br />
DLOADN"BROKEN.BAS"<br />
<br />
Note that the filename ending is not significant, since the DWLOAD deduces the file type from its content.<br />
<br />
<br />
== DWLOAD Extensible Execution Blocks (dweeb) ==<br />
<br />
The DWLOAD client is relatively simple, due to the space constraints in the ROM. The dweeb is a mechanism to dynamically extend the functionality of DWLOAD. The dweeb is loaded from the server like any other program, but accesses the I/O routines of DWLOAD. It also reads its command parameters from the DWLOAD command line.<br />
<br />
The best example is the "SAVE" dweeb. There is not enough room in the ROM to include support for saving files over DriveWire. However, this functionality can be loaded on demand. DLOAD"SAVE""MYFILE.BAS" saves a BASIC program to the DriveWire server. The SAVE functionality is only temporarily loaded into RAM and used during this invocation.<br />
<br />
Another typical dweeb is "DOS" for booting an operating system (NitrOS-9), similar to the DOS command in HDB-DOS or the DWDOS program.<br />
<br />
Pere has also created some dweebs for accessing VDK disk images on the DriveWire server, this is very useful for accessing Dragon DOS program collections without using a disk drive or DOS.<br />
<br />
Since a dweeb uses the I/O routines of the calling DWLOAD, it is independent of the real transport being used, which makes development with for instance the Becker interface in XRoar very convenient.<br />
<br />
Examples:<br />
<br />
DLOAD"SAVE""MYFILE.BAS"<br />
<br />
DLOAD"VLOAD""MYIMAGE.VDK""MYFILE.BAS"<br />
<br />
DLOAD"DOS"<br />
<br />
DLOAD"LROM""GAME.ROM"<br />
<br />
== Links ==<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 DWLOAD forum thread]<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968 dweebs forum thread]<br />
<br />
[[Category:Documentation]] [[Category:Hardware]] [[Category:DIY_Projects]] [[Category:Software]][[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=DriveWire&diff=7232DriveWire2015-08-22T17:00:25Z<p>Tormod: /* DriveWire software */ link to DWLOAD and Drivewire for dummies</p>
<hr />
<div>== Overview ==<br />
<br />
DriveWire is a way to connect your Dragon to a PC. It allows you to transfer files from the PC to your Dragon, or to use the PC as a virtual disk for the Dragon. A server program runs on the PC and services requests from the Dragon. Instead of a PC, a stand-alone DriveWire server like uDW can be used.<br />
<br />
== DriveWire software ==<br />
<br />
DriveWire on the Dragon uses the printer port. On the Dragon, software is needed that can "talk" to the DriveWire server through the printer port. Operating systems like HDB-DOS and NitrOS-9 have support for DriveWire, and can use the DriveWire server as a full replacement for a normal floppy or hard disk drive. See [[Drivewire for dummies]] for how to use HDB-DOS and DriveWire.<br />
<br />
For Dragon there is also [[DWLOAD]] - a small program that can be used to load programs from the DriveWire server without needing a disk operating system. DWLOAD can be embedded in a modified BASIC ROM, replacing the "DLOAD" command.<br />
<br />
== DriveWire adapters ==<br />
<br />
On the Dragon you will need an adapter to convert the printer port signals to a compatible serial port (or USB virtual serial port).<br />
<br />
See [[Dragon_32/64_Drivewire_Adapter]].<br />
<br />
<br />
== DriveWire servers ==<br />
<br />
The Drivewire4 server is a Java application and can be downloaded here: https://sites.google.com/site/drivewire4/download<br />
<br />
There exist also "DriveWire Lite": a reimplementation in C of the server side of the DriveWire 3 protocol: http://sourceforge.net/projects/dwlite/<br />
<br />
There is also a OpenSource DriveWire Server written in Python: https://github.com/6809/DwLoadServer<br />
<br />
== Drivewire4 (DW4) server usage ==<br />
<br />
Just choose CoCo2 in the DriveWire4 server "Simple Config Wizard".<br />
Keep all the default selections.<br />
<br />
If you would like to use the server under Windows without installing the JRE, use this batch file for startup:<br />
<pre><br />
SET JDK=%~dp0\jre<br />
SET JAVA_EXE=%JDK%\bin\java.exe<br />
"%JAVA_EXE%" -XX:+UseConcMarkSweepGC -jar DW4UI.jar --backup &<br />
pause<br />
</pre><br />
Download a JRE and put it into DriveWire directory together with this batch file.<br />
<br />
<br />
[[Category:Documentation]] [[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=Drivewire_for_dummies&diff=7231Drivewire for dummies2015-08-22T16:56:45Z<p>Tormod: this is HDB-DOS only, link to DriveWire page</p>
<hr />
<div>Drivewire for Dummies - by Robert Hermanek <br />
(originally posted on the CoCo mailing list)<br />
<br />
NOTE: This is only about HDB-DOS - see [[DriveWire]] for more general information.<br />
<br />
== Drivewire for Dummies - Part 1 ==<br />
<br />
<br />
Background: Once upon a time, if you were lucky you had a color computer with a disk controller. (If not, you were biting your nails hoping your cassettes loaded.) If you had a disk system, then you could have up to 4 drives, and they were labelled drives 0 through 3, and you selected which disk drive you wanted to use with the drive command: <br />
<br />
DRIVE n <br />
<br />
Each of these four physical 5 1/4 floppies would store approximately 160k of data. Back in the day, this was pretty huge. Although disks were more reliable and much faster than cassette, disk failures or directory crashes were still quite common. <br />
<br />
After the floppy era, hard drives started making an appearance. Harddrives are orders of magnitude larger (megs vs. kilobytes) however for usage in disk extended basic on a color computer, these larger devices would still have to be presented as "virtual floppies" of 160k each, so that a massive rewrite of DECB (disk extended color basic) would not be necessary, and also to avoid incompatibilities with old software. <br />
<br />
HDB-DOS appeared on the scene eventually in order to facilitate connecting to a hard drive from DECB and getting access to your new space in friendly 160k virtual disks. <br />
<br />
Next, some very clever folks (insert list of all the geniuses involved here) came up with "DriveWire." For the coco, it still comes down to be connected to some large "device." But in fact all read/write disk requests are redirected out the rs-232 port, and a server application on the far side (on a modern PC) will respond to the request and send data back to the coco. The coco sees this data as the response of a sector read (for example) from a floppy disk, just like back in the day when it was connected to actual coco disk drives via a disk controller. <br />
<br />
For drivewire to work then, there are four things you need: <br />
# a coco running HDB-DOS <br />
# a cable connecting rs-232 to serial port on PC <br />
# a drivewire server application running on the PC <br />
# a disk image mounted and ready in the drivewire server app. <br />
<br />
<br />
Now a little discussion of disk images, and people can correct me if I'm wrong. <br />
<br />
Once, disk images (files with a DSK extension) were just a handy way of storing the data on a 35 track standard coco disk, so again about a 160k file. This file simply contains each track, each sector, in order, and the 256 bytes that make up each sector. <br />
<br />
For the purpose of drivewire however, these DSK images started being placed in collections, since we didn't want to just work with one virtual floppy, but many virtual floppies. <br />
<br />
Going back to the coco running HDB-DOS, there are now two commands for selecting which drive you want to access: <br />
<br />
DRIVE n <br />
<br />
This is the same command I mentioned above, and it will choose which virtual disk you want to use on the currently selected device. Now for original coco's running a disk controller, there was no talk of what device you wanted to access--you were accessing your disk controller, and if you were lucky you had more than one drive connected to it. You could then say DRIVE 0 or DRIVE 3 to access your disks. <br />
<br />
When connecting to scsi devices came about, a new command was added: <br />
<br />
DRIVE #n <br />
<br />
Yes, looks the same except for the # symbol. This command selects which device you want to access. For example, if you had a scsi controller connected to your coco, with 2 physical harddrives attached, each of these harddrives would contain their own collections of virtual floppy disks. So all of the following are possible: <br />
<br />
DRIVE #0 <br />
DRIVE 0 - first virtual disk on device 0 <br />
DRIVE 1 - next virutal disk on device 0 <br />
(etc) <br />
<br />
DRIVE #1 <br />
DRIVE 0 - first virtual disk on device 1 <br />
DRIVE 1 - next virtual disk on device 1 <br />
<br />
(etc) <br />
<br />
Now we get our sites back on drivewire, and here is what we come up with: <br />
<br />
1) When you use the DRIVE #n command, you are selecting the "device," but for drivewire this simply means which source file (collection) of virtual floppies you wish to use. This collection is a single file (like a single physical harddrive back in the day) that contains, one after another, virtual floppy disk images. <br />
<br />
2) When you use the DRIVE n command, you are choosing which virtual floppy on the currently selected collection you wish to use. <br />
<br />
3) The real bonus: Back in the day with physical devices, you were limited to how many devices and disks you had by what you really had--in drivewire there is no limit other than the device and disk #'s have to be a byte value. That means you can select any device # 0 - 255 (DW4 server), and any drive # 0 to 255 on each device. 256 X 256 = 65,536 virtual disks that can be accessed by a coco connected to a drivewire server. That's a whole bunch of space! <br />
<br />
<br />
So a final summary is: <br />
<br />
# Get HDB-DOS running on coco, get server running on PC, get connected with a cable. (we'll get the specifics of the cable soon) <br />
# In the server application, choose as many disk collections (that will be seen as "devices" in HDB-DOS) mounted as you would like. <br />
# Select your current collection from the coco using the DRIVE #n command, and then choose your current virtual floppy disk using the DRIVE n command.<br />
<br />
<br />
<br />
== Drivewire for Dummies - Part 2 - The Cable ==<br />
<br />
Dragon Adapter<br />
[[Dragon_32/64_Drivewire_Adapter]]<br />
<br />
or<br />
<br />
CoCo Drivewire Cable<br />
http://www.mediafire.com/?c91gj67kw7q6yzu (CoCo DriveWire Serial Cable <br />
pin-out diagrams) <br />
<br />
<br />
== Drivewire for Dummies - Part 3 - Chicken and Egg ==<br />
<br />
<br />
All the previous explanation assumes that you have HDB-DOS running on your coco. So how do you get it running on your coco? <br />
<br />
1) If you have a disk system, you can get or create a physical disk that contains the HDB-DOS program. This includes a loader that basically gets HDB-DOS into RAM, then pulls the rug out from under DECB and replaces it with HDB-DOS. From then on you are accessing virtual disks through your rs-232 port instead of real disks through your controller cartridge. <br />
<br />
There have been .DSK images posted here, that if restored to a physical floppy, would give you a nice HDB-DOS loader disk. However if you do not have drivewire already running, it can be pretty difficult to get the .DSK copied to a real floppy. There are PC utilities that can do this, assuming you have properly configured floppy drives on your PC (I've never gotten this to work myself.) Your best bet might be to have someone you know help you out and mail you a disk. Otherwise, does anyone know if you can still get a HDB-DOS disk from cloud9tech? That would be a valuable service I think... <br />
<br />
2) You can load HDB-DOS loader from cassette. Now, you don't have to use an actual tape -- if you have a .WAV file on your PC that contains all the screeching and wailing we all know and love from our younger days, you can get the audio out on your PC connected to the audio in on your coco, then hit play on your .WAV file and "load" it into your coco. Or, you could play the .WAV onto an actual tape recorder if you wanted to load from a physical cassette. I feel like someone recently successfully loaded HDB-DOS using a .WAV file, if so, please reply directly to me with your audio file if you are willing--I'd like to test it myself, keep it on hand, and possibly help other drivewire newbies in the future... <br />
<br />
3) You can burn an eprom with hdb-dos and place it in a cartridge so that it loads on boot. This is by far the most elegant, but also the most technically challenging. How to burn and install ROM images is a subject all its own, and I'm afraid I do not know enough about it. Again, cloud9tech will help you out, they did me!<br />
<br />
<br />
<br />
== Drivewire for Dummies - Part 4 - DRIVE #n vs. DRIVE n ==<br />
<br />
<br />
When it comes to daily usage, the most initially confusing thing about DriveWire I think is all this talk of "devices" versus "disks," and sometimes other terms are used. I'm not really sure what the best approach is to clarify this, but I'll take a shot at it... <br />
<br />
First, it is unfortunate perhaps that we did not choose a different file extension for files that are collections of images, as opposed to a single image. If you have a .DSK file that contains a single image, this is what you will have (in terms of DECB):<br />
<br />
35 tracks X 18 sectors X 256 bytes per sector = 161,280 bytes, or approximately a 160k file. <br />
<br />
For the purposes of DriveWire, however, when you mount a .DSK file as DRIVE #0 for example (in the slot for device 0), this .DSK file is actually a collection of images, and as I mentioned before, perhaps we should have chosen a different file extension such as ".DEV" for "device" or "DWD" for drivewire disks (or something.) Regardless, this file is simple, and is just virtual disk images lined up one after another. The server application figures out what offset is necessary to find the right data. <br />
<br />
An example: Let's say you mount file "MyUtils.DSK" in slot 0 on DriveWire server, and "MyGames.DSK" in slot 1 on DriveWire server. Then the following HDB-DOS commands on your CoCo will perform these functions: <br />
<br />
DRIVE #0 <br />
-- selects MyUtils.DSK <br />
<br />
DRIVE 0 <br />
-- will access first 160k disk, data starting at byte 1 through byte 161,280. <br />
<br />
DRIVE 1 <br />
-- will access second disk, data starting at byte 161,281 through byte 322,560 <br />
<br />
DRIVE 2 <br />
-- will access third disk, data starting at byte 322,561 through byte 483,840 <br />
<br />
To access your games... <br />
<br />
DRIVE #1 <br />
-- selects MyGames.DSK <br />
<br />
Now, the DRIVE 0 command mentioned above will not give you access to the first disk on your Utils collection, but instead the first disk in your Games collection. <br />
<br />
In the new Drivewire4 server application, it sounds like all these mappings can be changed as needed, but for this discussion I'm just assuming that DRIVE 0 through DRIVE 255 on the coco are mapped in the same order into a corresponding file on the server side. <br />
<br />
This is basically all you need to know about DriveWire to access data from your PC... When I have a little more time, I'll try to list the commands for some of the more common things people do with Drivewire.<br />
<br />
<br />
[[Category:Documentation]] [[Category:Hardware]] [[Category:Software]] [[Category:DIY_Projects]] [[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_32/64_Drivewire_Adapter&diff=7230Dragon 32/64 Drivewire Adapter2015-08-22T16:52:23Z<p>Tormod: link to DriveWire page</p>
<hr />
<div>[[File:Drivewire.jpg]] <br />
<br />
See also [[DriveWire]] and [[Drivewire_for_dummies]]<br />
<br />
== Hardware ==<br />
<br />
The built-in serial UART is the CP2102 from Silicon Labs.<br />
<br />
== Windows ==<br />
<br />
Windows driver can be downloaded from the chip manufacturer: http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx<br />
<br />
== Linux ==<br />
<br />
In most cases, you simply need to run "sudo adduser $USER dialout". Read on for more details. <br />
<br />
Some helpful commands:<br />
<pre><br />
~ $ sudo lsusb | grep UART<br />
Bus 001 Device 002: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light<br />
<br />
$ dmesg | grep -ie cp210*<br />
[17479.466698] usb 1-1: Product: CP2102 USB to UART Bridge Controller<br />
[17479.548508] usbcore: registered new interface driver cp210x<br />
[17479.548520] usbserial: USB Serial support registered for cp210x<br />
[17479.548535] cp210x 1-1:1.0: cp210x converter detected<br />
[17480.428168] usb 1-1: cp210x converter now attached to ttyUSB0<br />
</pre><br />
<br />
Look at the last line, to see that the adapter is assigned to '''ttyUSB0'''. Check which groups have access to it:<br />
<br />
<pre><br />
$ ls -l /dev/ttyUSB0 <br />
crw-rw---- 1 root dialout 188, 0 Nov 11 13:15 /dev/ttyUSB0<br />
</pre><br />
In this case you should assure that your user is in the user group '''dialout''', e.g.:<br />
<pre><br />
$ groups # Display the user groups for the current user<br />
user_foo : user_foo adm tty dialout fax cdrom floppy tape sudo audio dip video plugdev netdev fuse lpadmin scanner<br />
</pre><br />
Is the group is not listed, add your user to the group, e.g:<br />
<pre><br />
sudo adduser $USER dialout<br />
</pre><br />
<br />
You will have to logout and relogin after this command!<br />
<br />
<br />
<br />
<br />
== Links ==<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=781 DIY instructions]<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 DWLOAD]<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=6&t=4270 buy a tormod's Drivewire Adapter]<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=6&t=4854 buy a tormod's Drivewire deluxe cased adapters]<br />
<br />
<br />
[[Category:Documentation]] [[Category:Hardware]] [[Category:DIY_Projects]] [[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=Technical&diff=7229Technical2015-08-22T16:51:22Z<p>Tormod: /* Informations */ add DriveWire link</p>
<hr />
<div>'''PLEASE NOTE:'''<br />
''The Dragon Archive and all of its contributors accept no liability for any injury or damage resulting from any persons attempting to use or follow any instructions contained within this section. The content is provided for information only and the resposibility for using that information lies with the individual performing the work.''<br />
<br />
<br />
== Schematics ==<br />
<br />
[[Dragon 32 Schematics]]<br />
<br />
[[Dragon 64 Schematics]]<br />
<br />
[[Project Alpha / Dragon Professional Schematics]]<br />
<br />
[[Project Beta / Dragon 128 Schematics]]<br />
<br />
[[Dragon DOS Schematic]]<br />
<br />
[[Cumana DOS Schematic]]<br />
<br />
== Hardware Pictures ==<br />
<br />
[[Motherboard_Pictures|Motherboard Pictures]]<br />
<br />
[[PSU_Pictures|PSU Pictures]]<br />
<br />
[[Game_Cartridges|Cartridge PCB Pictures]].<br />
<br />
== Service Sheets ==<br />
<br />
[[Dragon 32 - Service Information (RWEW/KA/0080a)]]<br />
<br />
[[Dragon 32 - Service Information (RWEW/KA/0081a)]]<br />
<br />
[[Dragon 32 - Service Information (RWEW/RA/0082a) ]]<br />
<br />
[[Dragon 32 - REPLACEMENT OF POWER SUPPLY AND CENTRAL PROCESSING UNITS ON THE DRAGON 32]]<br />
<br />
[[Dragon 32 - CPU and PSU Modifcations and Compatibility]]<br />
<br />
<br />
== N.D.U.G ==<br />
<br />
<br />
[[Dragon 32 - 64K Upgrade]]<br />
<br />
[[Dragon Notebook]]<br />
<br />
<br />
== Tutorials ==<br />
<br />
[[Importing images into the Dragon]]<br />
<br />
<br />
== DIY Projects ==<br />
<br />
[[Dragon Peripheral Controller (Electrónica Fácil magazine)]]<br><br />
[[Dragon 32 Input/Output Ports (Maplin Projects Book Eight)]]<br><br />
[[Dragon 32 RS232 Modem Interface (Maplin Projects Book Eight)]]<br />
<br />
<br />
== Informations ==<br />
<br />
* [[Keyboard]]<br />
* [[CharMap]]<br />
* [[Tokens]]<br />
* [[DriveWire]]<br />
<br />
Chips:<br />
<br />
* [[MC6809E]] - Dragon CPU<br />
* [[MC6847]] - Video Display Generator (VDG)<br />
* [[SN74LS783]] - Synchronous Address Multiplexor (SAM)</div>Tormodhttps://worldofdragon.org/index.php?title=Dragon_32/64_Drivewire_Adapter&diff=7228Dragon 32/64 Drivewire Adapter2015-08-22T16:48:52Z<p>Tormod: moved server software parts to new DriveWire page</p>
<hr />
<div>[[File:Drivewire.jpg]] <br />
<br />
See also: [[Drivewire_for_dummies]]<br />
<br />
== Hardware ==<br />
<br />
The built-in serial UART is the CP2102 from Silicon Labs.<br />
<br />
== Windows ==<br />
<br />
Windows driver can be downloaded from the chip manufacturer: http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx<br />
<br />
== Linux ==<br />
<br />
In most cases, you simply need to run "sudo adduser $USER dialout". Read on for more details. <br />
<br />
Some helpful commands:<br />
<pre><br />
~ $ sudo lsusb | grep UART<br />
Bus 001 Device 002: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light<br />
<br />
$ dmesg | grep -ie cp210*<br />
[17479.466698] usb 1-1: Product: CP2102 USB to UART Bridge Controller<br />
[17479.548508] usbcore: registered new interface driver cp210x<br />
[17479.548520] usbserial: USB Serial support registered for cp210x<br />
[17479.548535] cp210x 1-1:1.0: cp210x converter detected<br />
[17480.428168] usb 1-1: cp210x converter now attached to ttyUSB0<br />
</pre><br />
<br />
Look at the last line, to see that the adapter is assigned to '''ttyUSB0'''. Check which groups have access to it:<br />
<br />
<pre><br />
$ ls -l /dev/ttyUSB0 <br />
crw-rw---- 1 root dialout 188, 0 Nov 11 13:15 /dev/ttyUSB0<br />
</pre><br />
In this case you should assure that your user is in the user group '''dialout''', e.g.:<br />
<pre><br />
$ groups # Display the user groups for the current user<br />
user_foo : user_foo adm tty dialout fax cdrom floppy tape sudo audio dip video plugdev netdev fuse lpadmin scanner<br />
</pre><br />
Is the group is not listed, add your user to the group, e.g:<br />
<pre><br />
sudo adduser $USER dialout<br />
</pre><br />
<br />
You will have to logout and relogin after this command!<br />
<br />
<br />
<br />
<br />
== Links ==<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=781 DIY instructions]<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 DWLOAD]<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=6&t=4270 buy a tormod's Drivewire Adapter]<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=6&t=4854 buy a tormod's Drivewire deluxe cased adapters]<br />
<br />
<br />
[[Category:Documentation]] [[Category:Hardware]] [[Category:DIY_Projects]] [[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=DriveWire&diff=7227DriveWire2015-08-22T16:47:38Z<p>Tormod: new page</p>
<hr />
<div>== Overview ==<br />
<br />
DriveWire is a way to connect your Dragon to a PC. It allows you to transfer files from the PC to your Dragon, or to use the PC as a virtual disk for the Dragon. A server program runs on the PC and services requests from the Dragon. Instead of a PC, a stand-alone DriveWire server like uDW can be used.<br />
<br />
== DriveWire software ==<br />
<br />
DriveWire on the Dragon uses the printer port. On the Dragon, software is needed that can "talk" to the DriveWire server through the printer port. Operating systems like HDB-DOS and NitrOS-9 have support for DriveWire, and can use the DriveWire server as a full replacement for a normal floppy or hard disk drive.<br />
<br />
For Dragon there is also DWLOAD - a small program that can be used to load programs from the DriveWire server without needing a disk operating system. DWLOAD can be embedded in a modified BASIC ROM, replacing the "DLOAD" command. <br />
<br />
== DriveWire adapters ==<br />
<br />
On the Dragon you will need an adapter to convert the printer port signals to a compatible serial port (or USB virtual serial port).<br />
<br />
See [[Dragon_32/64_Drivewire_Adapter]].<br />
<br />
<br />
== DriveWire servers ==<br />
<br />
The Drivewire4 server is a Java application and can be downloaded here: https://sites.google.com/site/drivewire4/download<br />
<br />
There exist also "DriveWire Lite": a reimplementation in C of the server side of the DriveWire 3 protocol: http://sourceforge.net/projects/dwlite/<br />
<br />
There is also a OpenSource DriveWire Server written in Python: https://github.com/6809/DwLoadServer<br />
<br />
== Drivewire4 (DW4) server usage ==<br />
<br />
Just choose CoCo2 in the DriveWire4 server "Simple Config Wizard".<br />
Keep all the default selections.<br />
<br />
If you would like to use the server under Windows without installing the JRE, use this batch file for startup:<br />
<pre><br />
SET JDK=%~dp0\jre<br />
SET JAVA_EXE=%JDK%\bin\java.exe<br />
"%JAVA_EXE%" -XX:+UseConcMarkSweepGC -jar DW4UI.jar --backup &<br />
pause<br />
</pre><br />
Download a JRE and put it into DriveWire directory together with this batch file.<br />
<br />
<br />
[[Category:Documentation]] [[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=DWLOAD&diff=7226DWLOAD2015-08-22T16:34:37Z<p>Tormod: /* DWLOAD Extensible Execution Blocks (dweeb) */</p>
<hr />
<div>== DriveWire overview ==<br />
<br />
DriveWire is a way to connect your Dragon to a PC. It allows you to transfer files from the PC to your Dragon, or to use the PC as a virtual disk for the Dragon. A server program runs on the PC and services requests from the Dragon. Instead of a PC, a stand-alone DriveWire server like uDW can be used.<br />
DriveWire software<br />
<br />
DriveWire on the Dragon uses the printer port. On the Dragon, software is needed that can "talk" to the DriveWire server through the printer port. Operating systems like HDB-DOS and NitrOS-9 have support for DriveWire, and can use the DriveWire server as a full replacement for a normal floppy or hard disk drive.<br />
<br />
For Dragon there is also DWLOAD - a small program that can be used to load programs from the DriveWire server without needing a disk operating system. DWLOAD can be embedded in a modified BASIC ROM, replacing the "DLOAD" command. <br />
<br />
<br />
== DWLOAD concept ==<br />
<br />
DWLOAD is designed to be so small that it fits into unused parts of the Dragon BASIC ROM. Nonetheless, it allows you to simply download and run files from the DriveWire server from within BASIC without any resident use of memory. DWLOAD can be enhanced by "DriveWire Executable Extension Blocks" (dweebs) which are small program loaded from the server to provide further DriveWire capabilities on demand. Some examples are "VLOAD" to load files from VDK images residing on the DriveWire server, "LROM" to load a ROM image into high RAM, and "DOS" to boot NitrOS-9 over DriveWire.<br />
<br />
DWLOAD can also be used together with HDB-DOS or Dragon DOS. You can for instance load files from the PC (plain files or from inside VDK images) and save them on your Dragon DOS floppy drive. Or load files from your Dragon DOS floppy drive and save them on the PC (currently only BASIC files supported via the "SAVE" dweeb).<br />
<br />
== Requirements ==<br />
<br />
In addition to your Dragon 32 or Dragon 64 or compatible home computer you will need either<br />
<br />
DriveWire adapter + PC running DriveWire server (DW4) <br />
<br />
or<br />
<br />
uDW microserver <br />
<br />
Of course, on the Dragon you will need DriveWire software. If you have the DWLOAD EPROM you are all set and can load everything (also HDB-DOS or NitrOS-9) via DriveWire. Otherwise, software (including a DWLOAD program) can be loaded from disk or cassette tape to get started. <br />
<br />
== Using DWLOAD ==<br />
<br />
DWLOAD is a small DriveWire client for BASIC which works without needing a DOS. It loads files as-is from the DriveWire server, that is, not using disk images like HDB-DOS or NitrOS-9 does.<br />
<br />
Simply put: Just drop the files in your DriveWire4 server folder, and access them from the Dragon using DWLOAD.<br />
<br />
The files can be Dragon DOS binary or BASIC files, or DECB binaries.<br />
<br />
The DWLOAD client can be loaded from tape or disk or, most conveniently, embedded into the BASIC ROM, like the DWLOAD EPROM.<br />
<br />
If you have the DWLOAD EPROM, use the "DLOAD" command to load files. Examples:<br />
<br />
DLOAD"MYFILE.BAS"<br />
to load and run the file "MYFILE.BAS" from the DriveWire server. To only load the program, use "DLOADN":<br />
DLOADN"BROKEN.BAS"<br />
<br />
Note that the filename ending is not significant, since the DWLOAD deduces the file type from its content.<br />
<br />
<br />
== DWLOAD Extensible Execution Blocks (dweeb) ==<br />
<br />
The DWLOAD client is relatively simple, due to the space constraints in the ROM. The dweeb is a mechanism to dynamically extend the functionality of DWLOAD. The dweeb is loaded from the server like any other program, but accesses the I/O routines of DWLOAD. It also reads its command parameters from the DWLOAD command line.<br />
<br />
The best example is the "SAVE" dweeb. There is not enough room in the ROM to include support for saving files over DriveWire. However, this functionality can be loaded on demand. DLOAD"SAVE""MYFILE.BAS" saves a BASIC program to the DriveWire server. The SAVE functionality is only temporarily loaded into RAM and used during this invocation.<br />
<br />
Another typical dweeb is "DOS" for booting an operating system (NitrOS-9), similar to the DOS command in HDB-DOS or the DWDOS program.<br />
<br />
Pere has also created some dweebs for accessing VDK disk images on the DriveWire server, this is very useful for accessing Dragon DOS program collections without using a disk drive or DOS.<br />
<br />
Since a dweeb uses the I/O routines of the calling DWLOAD, it is independent of the real transport being used, which makes development with for instance the Becker interface in XRoar very convenient.<br />
<br />
Examples:<br />
<br />
DLOAD"SAVE""MYFILE.BAS"<br />
<br />
DLOAD"VLOAD""MYIMAGE.VDK""MYFILE.BAS"<br />
<br />
DLOAD"DOS"<br />
<br />
DLOAD"LROM""GAME.ROM"<br />
<br />
== Links ==<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 DWLOAD forum thread]<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968 dweebs forum thread]<br />
<br />
[[Category:Documentation]] [[Category:Hardware]] [[Category:DIY_Projects]] [[Category:Software]][[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=DWLOAD&diff=7225DWLOAD2015-08-22T16:32:50Z<p>Tormod: /* Links */ Add link to forum thread on dweebs</p>
<hr />
<div>== DriveWire overview ==<br />
<br />
DriveWire is a way to connect your Dragon to a PC. It allows you to transfer files from the PC to your Dragon, or to use the PC as a virtual disk for the Dragon. A server program runs on the PC and services requests from the Dragon. Instead of a PC, a stand-alone DriveWire server like uDW can be used.<br />
DriveWire software<br />
<br />
DriveWire on the Dragon uses the printer port. On the Dragon, software is needed that can "talk" to the DriveWire server through the printer port. Operating systems like HDB-DOS and NitrOS-9 have support for DriveWire, and can use the DriveWire server as a full replacement for a normal floppy or hard disk drive.<br />
<br />
For Dragon there is also DWLOAD - a small program that can be used to load programs from the DriveWire server without needing a disk operating system. DWLOAD can be embedded in a modified BASIC ROM, replacing the "DLOAD" command. <br />
<br />
<br />
== DWLOAD concept ==<br />
<br />
DWLOAD is designed to be so small that it fits into unused parts of the Dragon BASIC ROM. Nonetheless, it allows you to simply download and run files from the DriveWire server from within BASIC without any resident use of memory. DWLOAD can be enhanced by "DriveWire Executable Extension Blocks" (dweebs) which are small program loaded from the server to provide further DriveWire capabilities on demand. Some examples are "VLOAD" to load files from VDK images residing on the DriveWire server, "LROM" to load a ROM image into high RAM, and "DOS" to boot NitrOS-9 over DriveWire.<br />
<br />
DWLOAD can also be used together with HDB-DOS or Dragon DOS. You can for instance load files from the PC (plain files or from inside VDK images) and save them on your Dragon DOS floppy drive. Or load files from your Dragon DOS floppy drive and save them on the PC (currently only BASIC files supported via the "SAVE" dweeb).<br />
<br />
== Requirements ==<br />
<br />
In addition to your Dragon 32 or Dragon 64 or compatible home computer you will need either<br />
<br />
DriveWire adapter + PC running DriveWire server (DW4) <br />
<br />
or<br />
<br />
uDW microserver <br />
<br />
Of course, on the Dragon you will need DriveWire software. If you have the DWLOAD EPROM you are all set and can load everything (also HDB-DOS or NitrOS-9) via DriveWire. Otherwise, software (including a DWLOAD program) can be loaded from disk or cassette tape to get started. <br />
<br />
== Using DWLOAD ==<br />
<br />
DWLOAD is a small DriveWire client for BASIC which works without needing a DOS. It loads files as-is from the DriveWire server, that is, not using disk images like HDB-DOS or NitrOS-9 does.<br />
<br />
Simply put: Just drop the files in your DriveWire4 server folder, and access them from the Dragon using DWLOAD.<br />
<br />
The files can be Dragon DOS binary or BASIC files, or DECB binaries.<br />
<br />
The DWLOAD client can be loaded from tape or disk or, most conveniently, embedded into the BASIC ROM, like the DWLOAD EPROM.<br />
<br />
If you have the DWLOAD EPROM, use the "DLOAD" command to load files. Examples:<br />
<br />
DLOAD"MYFILE.BAS"<br />
to load and run the file "MYFILE.BAS" from the DriveWire server. To only load the program, use "DLOADN":<br />
DLOADN"BROKEN.BAS"<br />
<br />
Note that the filename ending is not significant, since the DWLOAD deduces the file type from its content.<br />
<br />
<br />
== DWLOAD Extensible Execution Blocks (dweeb) ==<br />
<br />
The DWLOAD client is relatively simple, due to the space constraints in the ROM. The dweeb is a mechanism to dynamically extend the functionality of DWLOAD. The dweeb is loaded from the server like any other program, but accesses the I/O routines of DWLOAD. It also reads its command parameters from the DWLOAD command line.<br />
<br />
The best example is the "SAVE" dweeb. There is not enough room in the ROM to include support for saving files over DriveWire. However, this functionality can be loaded on demand. DLOAD"SAVE""MYFILE.BAS" saves a BASIC program to the DriveWire server. The SAVE functionality is only temporarily loaded into RAM and used during this invocation.<br />
<br />
Another typical dweeb is "DOS" for booting an operating system (NitrOS-9), similar to the DOS command in HDB-DOS or the DWDOS program.<br />
<br />
Pere has also created some dweebs for accessing VDK disk images on the DriveWire server, this is very useful for accessing Dragon DOS program collections without using a disk drive or DOS.<br />
<br />
Since a dweeb uses the I/O routines of the calling DWLOAD, it is independent of the real transport being used, which makes development with for instance the Becker interface in XRoar very convenient.<br />
<br />
Examples:<br />
<br />
DLOAD"SAVE""MYFILE.BAS"<br />
<br />
DLOAD"VLOAD""MYIMAGE.VDK""MYFILE.BAS<br />
<br />
DLOAD"DOS"<br />
<br />
<br />
<br />
== Links ==<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 DWLOAD forum thread]<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4968 dweebs forum thread]<br />
<br />
[[Category:Documentation]] [[Category:Hardware]] [[Category:DIY_Projects]] [[Category:Software]][[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=DWLOAD&diff=7224DWLOAD2015-08-22T16:31:05Z<p>Tormod: Add my own DWLOAD information</p>
<hr />
<div>== DriveWire overview ==<br />
<br />
DriveWire is a way to connect your Dragon to a PC. It allows you to transfer files from the PC to your Dragon, or to use the PC as a virtual disk for the Dragon. A server program runs on the PC and services requests from the Dragon. Instead of a PC, a stand-alone DriveWire server like uDW can be used.<br />
DriveWire software<br />
<br />
DriveWire on the Dragon uses the printer port. On the Dragon, software is needed that can "talk" to the DriveWire server through the printer port. Operating systems like HDB-DOS and NitrOS-9 have support for DriveWire, and can use the DriveWire server as a full replacement for a normal floppy or hard disk drive.<br />
<br />
For Dragon there is also DWLOAD - a small program that can be used to load programs from the DriveWire server without needing a disk operating system. DWLOAD can be embedded in a modified BASIC ROM, replacing the "DLOAD" command. <br />
<br />
<br />
== DWLOAD concept ==<br />
<br />
DWLOAD is designed to be so small that it fits into unused parts of the Dragon BASIC ROM. Nonetheless, it allows you to simply download and run files from the DriveWire server from within BASIC without any resident use of memory. DWLOAD can be enhanced by "DriveWire Executable Extension Blocks" (dweebs) which are small program loaded from the server to provide further DriveWire capabilities on demand. Some examples are "VLOAD" to load files from VDK images residing on the DriveWire server, "LROM" to load a ROM image into high RAM, and "DOS" to boot NitrOS-9 over DriveWire.<br />
<br />
DWLOAD can also be used together with HDB-DOS or Dragon DOS. You can for instance load files from the PC (plain files or from inside VDK images) and save them on your Dragon DOS floppy drive. Or load files from your Dragon DOS floppy drive and save them on the PC (currently only BASIC files supported via the "SAVE" dweeb).<br />
<br />
== Requirements ==<br />
<br />
In addition to your Dragon 32 or Dragon 64 or compatible home computer you will need either<br />
<br />
DriveWire adapter + PC running DriveWire server (DW4) <br />
<br />
or<br />
<br />
uDW microserver <br />
<br />
Of course, on the Dragon you will need DriveWire software. If you have the DWLOAD EPROM you are all set and can load everything (also HDB-DOS or NitrOS-9) via DriveWire. Otherwise, software (including a DWLOAD program) can be loaded from disk or cassette tape to get started. <br />
<br />
== Using DWLOAD ==<br />
<br />
DWLOAD is a small DriveWire client for BASIC which works without needing a DOS. It loads files as-is from the DriveWire server, that is, not using disk images like HDB-DOS or NitrOS-9 does.<br />
<br />
Simply put: Just drop the files in your DriveWire4 server folder, and access them from the Dragon using DWLOAD.<br />
<br />
The files can be Dragon DOS binary or BASIC files, or DECB binaries.<br />
<br />
The DWLOAD client can be loaded from tape or disk or, most conveniently, embedded into the BASIC ROM, like the DWLOAD EPROM.<br />
<br />
If you have the DWLOAD EPROM, use the "DLOAD" command to load files. Examples:<br />
<br />
DLOAD"MYFILE.BAS"<br />
to load and run the file "MYFILE.BAS" from the DriveWire server. To only load the program, use "DLOADN":<br />
DLOADN"BROKEN.BAS"<br />
<br />
Note that the filename ending is not significant, since the DWLOAD deduces the file type from its content.<br />
<br />
<br />
== DWLOAD Extensible Execution Blocks (dweeb) ==<br />
<br />
The DWLOAD client is relatively simple, due to the space constraints in the ROM. The dweeb is a mechanism to dynamically extend the functionality of DWLOAD. The dweeb is loaded from the server like any other program, but accesses the I/O routines of DWLOAD. It also reads its command parameters from the DWLOAD command line.<br />
<br />
The best example is the "SAVE" dweeb. There is not enough room in the ROM to include support for saving files over DriveWire. However, this functionality can be loaded on demand. DLOAD"SAVE""MYFILE.BAS" saves a BASIC program to the DriveWire server. The SAVE functionality is only temporarily loaded into RAM and used during this invocation.<br />
<br />
Another typical dweeb is "DOS" for booting an operating system (NitrOS-9), similar to the DOS command in HDB-DOS or the DWDOS program.<br />
<br />
Pere has also created some dweebs for accessing VDK disk images on the DriveWire server, this is very useful for accessing Dragon DOS program collections without using a disk drive or DOS.<br />
<br />
Since a dweeb uses the I/O routines of the calling DWLOAD, it is independent of the real transport being used, which makes development with for instance the Becker interface in XRoar very convenient.<br />
<br />
Examples:<br />
<br />
DLOAD"SAVE""MYFILE.BAS"<br />
<br />
DLOAD"VLOAD""MYIMAGE.VDK""MYFILE.BAS<br />
<br />
DLOAD"DOS"<br />
<br />
<br />
<br />
== Links ==<br />
<br />
* [http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4964 DWLOAD Forum Thread]<br />
<br />
<br />
[[Category:Documentation]] [[Category:Hardware]] [[Category:DIY_Projects]] [[Category:Software]][[Category:Drivewire]]</div>Tormodhttps://worldofdragon.org/index.php?title=Category:Drivewire&diff=7223Category:Drivewire2015-08-22T15:58:01Z<p>Tormod: </p>
<hr />
<div>All pages about Drivewire</div>Tormodhttps://worldofdragon.org/index.php?title=The_Dragon_Composer&diff=6795The Dragon Composer2015-04-11T10:46:50Z<p>Tormod: add manual cover page</p>
<hr />
<div>{| align="right" valign="top"<br />
|{{Infobox Game<br />
|Image = [[Image:DragonComposer_Screenshot01.png|center|300px]]<br />
|Gamenumber = <br />
|Company = [[Microdeal]]<br />
|Developer =<br />
|Publisher = [[Microdeal]]<br />
|Musician = <br />
|Release = [[:Category:Game_1983|1983]]<br />
|Platform = [[Dragon 32]] or [[Dragon 64]]<br />
|Genre = Music<br />
|Gamemode = 1P<br />
|Operation = {{Keyboard}}<br />
|Media = {{Cassette}}<br />
|Language = {{EN}} <br />
|Info =<br />
}}<br />
|}<br />
<br />
The Dragon Composer is a music program by [[Microdeal]]. It compiles a basic file with the melody into machine code and allows playing them back and modify parameters such as tempo.<br />
<br />
== Screenshots ==<br />
<br />
[[File:DragonComposer_Screenshot02.png|300px|Screen02]][[File:DragonComposer_Screenshot03.png|300px|Screen03]]<br />
<br />
== Packaging ==<br />
<br />
[[File:DragonComposer.jpg|500px|Cover]]<br><br />
[[File:DragonComposer_Tape.jpg|300px|Cassette]]<br />
[[File:Composer-manual-cover-bw.jpg|300px|Manual cover page]]<br />
<br />
== Downloads ==<br />
* [http://archive.worldofdragon.org/archive/index.php?dir=Tapes/Dragon/cas/&file=The%20Dragon%20Composer%20%281983%29%28Microdeal%29%5B%21%5D.zip The Dragon Composer] (Zipped .CAS file)<br />
<br />
[[Category:Games]] [[Category:Game_Online]] [[Category:Game_1983]] [[Category:Music]]</div>Tormodhttps://worldofdragon.org/index.php?title=File:Composer-manual-cover-bw.jpg&diff=6794File:Composer-manual-cover-bw.jpg2015-04-11T10:43:56Z<p>Tormod: </p>
<hr />
<div></div>Tormodhttps://worldofdragon.org/index.php?title=Dragonstikka&diff=6793Dragonstikka2015-04-11T10:34:24Z<p>Tormod: add cover of all my issues</p>
<hr />
<div>== Dragonstikka ==<br />
<br />
* Publisher: Dragonklubben (Nesbru, Norway)<br />
* Editors: Ole Garm & Erik Hicks<br />
<br />
[[Image:Dragonstikka-cover-1985nr3.jpg|200px]]<br />
[[Image:Dragonstikka-cover-1985nr5.jpg|200px]]<br />
[[Image:Dragonstikka-cover-1985nr6.jpg|200px]]<br />
[[Image:Dragonstikka-cover-1985nr7.jpg|200px]]<br />
[[Image:Dragonstikka-cover-1985nr8.jpg|200px]]<br />
[[Image:Dragonstikka-cover-1985nr9.jpg|200px]]<br />
[[Image:Dragonstikka-cover-1986nr1.jpg|200px]]<br />
[[Image:Dragonstikka-cover-1986nr2.jpg|200px]]<br />
[[Image:Dragonstikka-cover-1986nr3.jpg|200px]]<br />
[[Image:Dragonstikka-cover-1986nr4.jpg|200px]]<br />
<br />
===Issues===<br />
1985:<br />
* Nr.1 ?<br />
* Nr.2 ?<br />
* Nr.3<br />
* Nr.4 ?<br />
* Nr.5<br />
* Nr.6 <br />
* Nr.7<br />
* Nr.8<br />
* Nr.9/10<br />
1986:<br />
* Nr.1<br />
* Nr.2 (March)<br />
* Nr.3 (May)<br />
* Nr.4 (October)<br />
<br />
<br />
Program Library (Programbiblioteket) 3/1985<br />
* 1 A Roadrace<br />
* 2 B Regnskap<br />
* 3 B Tegning<br />
* 4 B Kalkyler<br />
* 5 A Squash<br />
* 6 A Enarmet banditt<br />
* 7 A Lunar Lander<br />
<br />
Program Library (Programbiblioteket) 7/1985<br />
* 1 A Roadrace O.Garm<br />
* 2 B Regnskap O.Garm<br />
* 3 B Tegning O.Garm<br />
* 4 A Enarmet banditt E.Hicks<br />
* 5 A Lunar Lander O.Garm<br />
* 6 A Bygderennet S.Aurlund & R.Nomedal<br />
* 7 A 3D-Maze T.Olsen<br />
* 8 C/D Klokka O.Garm<br />
* 9 A Island O.Garm<br />
* 10 A Romkamp O.Garm<br />
* 11 A Dragonflight J.Baustad<br />
* 12 A Lander J.Baustad<br />
* 13 A Sjokkmann J.Baustad<br />
* 14 D Hires-2 R.Michelsen<br />
* 15 A Hangman R.Michelsen<br />
* 16 A Geografi O.Garm</div>Tormodhttps://worldofdragon.org/index.php?title=File:Dragonstikka-cover-1986nr4.jpg&diff=6792File:Dragonstikka-cover-1986nr4.jpg2015-04-11T10:22:00Z<p>Tormod: </p>
<hr />
<div></div>Tormod