08.04.2013 Views

Your Commodore - Commodore Is Awesome

Your Commodore - Commodore Is Awesome

Your Commodore - Commodore Is Awesome

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DATA VALUES will be saved on each<br />

line, followed by a computer<br />

checksum. All values are in HEX.<br />

On completion of the conversion of<br />

the program the Data Maker will save<br />

a LOADER on to the end of the<br />

TARGET program so that when<br />

LOADed it is ready to RUN.<br />

Whilst the program is running, it<br />

will display the DISK ERROR<br />

CHANNEL, the ADDRESS being<br />

read, and the BYTE value of the<br />

contents of that address. This tends to<br />

slow down the program slightly, but<br />

was considered necessary as it can be a<br />

lengthy process to convert a long<br />

machine code program into data<br />

statements, and one could think the<br />

program had crashed. For the same<br />

reason, the loader put on to the end of<br />

the target program will display both<br />

the ADDRESS being processed and<br />

the BYTE being POKEd into that<br />

address. After RUNning the TARGET<br />

program, a filename will be requested.<br />

This is the name under which the<br />

loader will save the assembled<br />

program to disk.<br />

The new program, TARGET, is<br />

now ready for use. Simply LOAD it<br />

into a CI 28 and type RUN. The<br />

machine code then be POKED into<br />

memory and SAVEd on to disk as a<br />

machine code file, i.e. the same as the<br />

original SOURCE program.<br />

Hints and Tips<br />

For some time we have been using<br />

Basic loaders for most of our machine<br />

code programs in <strong>Your</strong> <strong>Commodore</strong>.<br />

Inevitably we have of course come<br />

across some problems and below you<br />

will find some little tricks that we use<br />

to overcome these difficulties.<br />

Quite often the program that we<br />

wish to convert from machine code to<br />

DATA statements is too big to fit in<br />

the computer's memory at once.<br />

Obviously this is more likely to be a<br />

problem for CM owners than those<br />

using a C128 since more memory is<br />

available on the Cl28.<br />

Quite often the program that we<br />

wish to convert from machine code to<br />

DATA statements is too big to fit in<br />

the computer's memory at once.<br />

Obviously this is more likely to be a<br />

problem for CM owners than those<br />

using a Cl28 since more memory is<br />

available on the C128.<br />

When the program is too big you<br />

will have to split it into segments. To<br />

do this you will require access to a<br />

machine code monitor, C128 owners<br />

C64 AND C128111 CEO<br />

have one built in, C64 owners will have<br />

to LOAD One or use one from many<br />

of the cartridges that are available.<br />

Before you can split the program<br />

you will of course have to know the<br />

START ADDRESS and END<br />

ADDRESS of the machine code<br />

program.<br />

Use the S command in the monitor<br />

to SAVE your program into a number<br />

of equal parts. Then use the Data<br />

Maker programs to change each part<br />

into separate Basic loaders.<br />

When you want to use the machine<br />

code program generated by the DATA<br />

statements you will have to LOAD<br />

each of the Basic loaders into your<br />

computer one at a time and RUN<br />

them. If you want to get a little clever<br />

you can put an auto load at the end of<br />

each of the programs. Figure 2 gives an<br />

example of the type of loader that we<br />

Data Maker C128<br />

10FRINT"[CLEAR]IYELLOWHDOWN21"<br />

:COLOR0,1:COLOR4,1:GOT01000<br />

20:<br />

200PRINT#2,CHR$(1)CHR$(28);:RET<br />

URN<br />

210:<br />

300T-INT(LN/256):PRINT42,CHR$(1<br />

)CHR$(28)CHRULN-T*256)CHRUT)CH<br />

R$(131)" ";<br />

310LN-LWITL:RETURN<br />

320:<br />

4001311-RIG14TWIEMBY).2):SUM-S<br />

UM+BY:PRINT#2,8<br />

410:<br />

, 500S0$-HEX$(SUM):SUM-0:PRINT#2,<br />

14",";:RETURN<br />

SU$CHR$(0);:RETURN<br />

510:<br />

1000INFUT"[SPC3JSOURCE PROGRAM:<br />

".NS$ANPUTIDOWN31(SPC3ITARCET<br />

PROGRAM:",NT$<br />

1010INPUT"tDO1.N3ISTART LINE NUM<br />

BER[SPC31101LEFT41".LN$:LN-VAIAL<br />

N$)<br />

10201NPUT"[DOWN31[SPC8INCREMEN<br />

T[SPC31101LEFT41"1,PL$:PL-VAL(PL$<br />

1030D0PEN#1,(NS$)-0,P":IFDSTHEN<br />

PRINTICLEARHC6IDISK ERROR "DS$<br />

:DCLOSEIEND<br />

104000PEN#2,(N1$)#",P",W:IFDSTH<br />

ENPRINT"[CLEARIIC6]DISK ERROR "D<br />

S$:DCLOSE:END<br />

1050:<br />

2000GOSUB200:SUM-LN:GOSUB300:GE<br />

TNI,A$:GETN1,13$<br />

2010LOC-ASC(A$)+256*ASC(11$):SUM<br />

-LOC:00SUB500<br />

2020:<br />

3000CHAR1,0,20,"ISPC61DISKfSPC2<br />

ISTATUS[SPC4)ADDRESPC4IBYTEISPC6<br />

]",1<br />

301000:COSUB300:FORJ-0T019<br />

3020L0C-LOC.1:GET#1,A$:8Y<br />

$+CHR$(0)):IFSITHENEXIT<br />

,,<br />

3030CHAR1,0,22,"(SPC6NDSW[S<br />

PC4P ASC(A<br />

,<br />

HEX$(6Y),2),0<br />

3040G0S06400:NEXT:GOSUB500:LOOF<br />

HEX$ :DCLOSEWPRINT"(CLEARI"<br />

3050:<br />

(LOC 4000CHAR1,0,22,"FINISHED READIN<br />

)-4-" G DISK...(SPC2NRITING LOADER"<br />

401013Y-0:FORI-JT019:COSUB400:NE<br />

[SPC XT<br />

51"4<br />

-<br />

RIGH<br />

T$(<br />

YOUR COMMODORE november 1986:77<br />

use in <strong>Your</strong> <strong>Commodore</strong>. The program<br />

breaks down as follows.<br />

Line 5000 prints the keyword 'NEW'<br />

and the command LOAD FILE,8,1 on<br />

to the screen.<br />

Line 5010 prints the keyword 'RUN*,<br />

four lines further down the screen.<br />

Line 5020 POKES three carriage<br />

returns into the keyboard buffer which<br />

starts at location 631. The number of<br />

characters in the keyboard buffer is<br />

then POK Ed into memory location<br />

198, This location is the counter for the<br />

number of characters in the keyboard<br />

buffer. The cursor is then moved to the<br />

top of the screen and the program<br />

ends.<br />

Because there is a RETURN in the<br />

keyboard buffer the computer thinks<br />

that you have typed the keyword NEW<br />

and erases the program. The next<br />

RETURN in the buffer makes the<br />

402000S1JB500:COSUB300:PRINT#2,"<br />

LND"CHR$(0);<br />

4030FORJ-0T0319:READM:BY-DEC(<br />

811):PRINT#2,CHR$(8Y);:NEXT<br />

40400CL05E42:PRINT"[CLEAR]":END<br />

4050:<br />

50000ATA 411,1C,FB,F9,99,22,93,2<br />

2,3A,E7,30,2C,31,3A,E7,34<br />

t<br />

3A,E0<br />

5010DATA 31,2C,31,30dC,31,32,2<br />

2C,31, C,22,9E,57,4F,52,48,49,4E,47,2E,<br />

2E,2E<br />

50200ATA 2E,24,22,2C,31,3A,E0,3<br />

1,2C,31,34,2C,31,34,2C,22,50,4C,<br />

45,41<br />

5030DATA 53,45,20,20,57,41,49,5<br />

4,22,2C,31,3A,8C,00,71,1C,FC,F9,<br />

87,41<br />

5040DATA 24,3A,53032,D1,28,41,2<br />

4,29,3A,45032,53,3A,E13,3A,87,42,<br />

24,3A<br />

50500ATA 813,42,24,132,22,45,4E,4<br />

4,22,A7,ED,00,133,1C,FD,F9,53,55,<br />

82,30<br />

50600ATA 3A,81,4A,B2,30,A4,11,3<br />

9,3A,42,62,D1,28,42,24,29,3A,97,<br />

45,AA<br />

50700A1A 4A,2C,42,3A,53,55,132,5<br />

3,55,AA,42,3A,E0,31,2C,32,32,2C,<br />

31.32<br />

5080DATA 2C,D2,28,45,AA,4A,29,A<br />

A,22,3D,24,22,AA,42,24,2C,31,00,<br />

FD,1C •<br />

50900ATA FE,F9,87,42,24,3A,82,3<br />

A,45,132,45,AA,32,30,3A,86,53,55,<br />

83,81<br />

51000ATA D1,28,42,24,29,A7,99,2<br />

2,93,11,11,11,11,11,96,44,41,54,<br />

41,20<br />

51100ATA 45,52,52,4F,52,20,49,4<br />

E,20,4C,49,4E,45,22,C2,28,36,35,<br />

29,AA<br />

51200ATA 32,35,36,AC,C2,28,36,3<br />

6,29,3A,80,00,3F,1D,FF,F9,EC,3A,<br />

85,22<br />

51300ATA 93,11,11,11,11,11,11,4<br />

6,49,4C,45,4E,41,4D,45,20,4F,46,<br />

20,54<br />

51400A1A 41,52,47,45,54,20,46,4<br />

9,4C,45,3A,22,313,4E,24,3A,FE,10,<br />

28,4E<br />

5150DATA 24,29,2C,42,30,2C,50,2<br />

8,53,29,A4,50,28,45,29,3A,80,00,<br />

00,00

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!