U assembler n entering machine code data is l a real problem. Since machine code is e simply a series of numbers, entering them into your computer leads to all sorts s of errors, resulting in your program's s total inability to functions. y <strong>Your</strong> <strong>Commodore</strong> uses Basic loaders o to help people to enter machine u code programs from the magazines. h These Basic loaders hold the numbers that make up the machine code a program in a line of data, the last number v being a checksu in. The Loader program e when RUN, reads the DATA into a memory, adding each number together, c then the total of each line is compared c with its checksum, if they are e not the same then you have done something wrong. s In the March 1986 issue of <strong>Your</strong> <strong>Commodore</strong> s we printed a Basic program t for the 64 (Datamaker) that would o read a machine code file from disk a and generate a machine code program. n This worked fine except for a couple of small problems. Firstly the program was very slow. Secondly, you had to have a disk drive to use it. With this article we are printing two new machine code to data statement conversion programs. One of them is for the C64 but this time the program is written in machine code and will now take machine code from memory as well as from disk. The second program is for the Cl28, this program isn't quite as fast as the one for the C64 but it does have the advantage that it generates its own SAVE routine at the end of the data so that, when RUN, the program will SAVE the machine code on to disk. C64 Data Maker As I mentioned earlier, this version of the data maker program is better than the old one. A further facility that has been added is an extra check in the C64 AND C1281 CI Datamaker Turn your machine code into Data with these two programs from M. Catley and K. °non. loader program. If, in the old version of the program, you omitted a number from a line of DATA, the computer would read the checksum and try to POKE it into memory. Since the checksum is usually greater than 255 this resulted in an illegal quantity error in the line that held the POKE statement. This new version of the program has a check that stops the program if the number to be POKEd into memory is greater than 255, giving the line from which the DATA was read, not the line of the POK E statement. As you can see this makes finding typing errors even easier. The CM Datamaker is presented here in the form of a Basic loader. In fact the program was used to make this loader. As already mentioned this is a machine code file that should be WADed and RUN at memory location 49152 ($C000 hex). To start the program you enter the following commands: NEW SYS 49152 As soon as you press RETURN the screen will clear and a promt 'INSERT READER PROGRAM Y/N' will appear. If yes is selected the simple loader program shown in Figure I will be entered into memory. Data maker will work out the last line of any program already in YOUR COMMODORE november 1986:76 memory, add 10 to it and start its own numbering from there. This allows DATA statements to be added on to an existing program. Once the reader has been entered or if no (N) was selected a second prompt •SELECT DISK OR MEMORY' will be displayed. If MEMORY is selected further prompts for start and end addresses will be displayed. These numbers may be entered in decimal or in hex by prefixing the number with a dollar sign. If DISK is selected a filename will be requested. Once the end has been reached Data Maker will insert the number of blocks, line number and memory start address into the reader part (only if the reader was entered of course.) It will then return to Basic with the READY prompt. Data Maker 128 Data Maker 128 is a utility program for the C128 computer with a disk drive. The program will take any file, the SOURCE program, from the disk, convert it into DATA statements and write it back to the disk under a supplied filename, the TARGET program. You will also be requested to supply a START LINE NUMBER and an increment value for the DATA STATEMENTS. Twenty individual
DATA VALUES will be saved on each line, followed by a computer checksum. All values are in HEX. On completion of the conversion of the program the Data Maker will save a LOADER on to the end of the TARGET program so that when LOADed it is ready to RUN. Whilst the program is running, it will display the DISK ERROR CHANNEL, the ADDRESS being read, and the BYTE value of the contents of that address. This tends to slow down the program slightly, but was considered necessary as it can be a lengthy process to convert a long machine code program into data statements, and one could think the program had crashed. For the same reason, the loader put on to the end of the target program will display both the ADDRESS being processed and the BYTE being POKEd into that address. After RUNning the TARGET program, a filename will be requested. This is the name under which the loader will save the assembled program to disk. The new program, TARGET, is now ready for use. Simply LOAD it into a CI 28 and type RUN. The machine code then be POKED into memory and SAVEd on to disk as a machine code file, i.e. the same as the original SOURCE program. Hints and Tips For some time we have been using Basic loaders for most of our machine code programs in <strong>Your</strong> <strong>Commodore</strong>. Inevitably we have of course come across some problems and below you will find some little tricks that we use to overcome these difficulties. Quite often the program that we wish to convert from machine code to DATA statements is too big to fit in the computer's memory at once. Obviously this is more likely to be a problem for CM owners than those using a C128 since more memory is available on the Cl28. Quite often the program that we wish to convert from machine code to DATA statements is too big to fit in the computer's memory at once. Obviously this is more likely to be a problem for CM owners than those using a Cl28 since more memory is available on the C128. When the program is too big you will have to split it into segments. To do this you will require access to a machine code monitor, C128 owners C64 AND C128111 CEO have one built in, C64 owners will have to LOAD One or use one from many of the cartridges that are available. Before you can split the program you will of course have to know the START ADDRESS and END ADDRESS of the machine code program. Use the S command in the monitor to SAVE your program into a number of equal parts. Then use the Data Maker programs to change each part into separate Basic loaders. When you want to use the machine code program generated by the DATA statements you will have to LOAD each of the Basic loaders into your computer one at a time and RUN them. If you want to get a little clever you can put an auto load at the end of each of the programs. Figure 2 gives an example of the type of loader that we Data Maker C128 10FRINT"[CLEAR]IYELLOWHDOWN21" :COLOR0,1:COLOR4,1:GOT01000 20: 200PRINT#2,CHR$(1)CHR$(28);:RET URN 210: 300T-INT(LN/256):PRINT42,CHR$(1 )CHR$(28)CHRULN-T*256)CHRUT)CH R$(131)" "; 310LN-LWITL:RETURN 320: 4001311-RIG14TWIEMBY).2):SUM-S UM+BY:PRINT#2,8 410: , 500S0$-HEX$(SUM):SUM-0:PRINT#2, 14",";:RETURN SU$CHR$(0);:RETURN 510: 1000INFUT"[SPC3JSOURCE PROGRAM: ".NS$ANPUTIDOWN31(SPC3ITARCET PROGRAM:",NT$ 1010INPUT"tDO1.N3ISTART LINE NUM BER[SPC31101LEFT41".LN$:LN-VAIAL N$) 10201NPUT"[DOWN31[SPC8INCREMEN T[SPC31101LEFT41"1,PL$:PL-VAL(PL$ 1030D0PEN#1,(NS$)-0,P":IFDSTHEN PRINTICLEARHC6IDISK ERROR "DS$ :DCLOSEIEND 104000PEN#2,(N1$)#",P",W:IFDSTH ENPRINT"[CLEARIIC6]DISK ERROR "D S$:DCLOSE:END 1050: 2000GOSUB200:SUM-LN:GOSUB300:GE TNI,A$:GETN1,13$ 2010LOC-ASC(A$)+256*ASC(11$):SUM -LOC:00SUB500 2020: 3000CHAR1,0,20,"ISPC61DISKfSPC2 ISTATUS[SPC4)ADDRESPC4IBYTEISPC6 ]",1 301000:COSUB300:FORJ-0T019 3020L0C-LOC.1:GET#1,A$:8Y $+CHR$(0)):IFSITHENEXIT ,, 3030CHAR1,0,22,"(SPC6NDSW[S PC4P ASC(A , HEX$(6Y),2),0 3040G0S06400:NEXT:GOSUB500:LOOF HEX$ :DCLOSEWPRINT"(CLEARI" 3050: (LOC 4000CHAR1,0,22,"FINISHED READIN )-4-" G DISK...(SPC2NRITING LOADER" 401013Y-0:FORI-JT019:COSUB400:NE [SPC XT 51"4 - RIGH T$( YOUR COMMODORE november 1986:77 use in <strong>Your</strong> <strong>Commodore</strong>. The program breaks down as follows. Line 5000 prints the keyword 'NEW' and the command LOAD FILE,8,1 on to the screen. Line 5010 prints the keyword 'RUN*, four lines further down the screen. Line 5020 POKES three carriage returns into the keyboard buffer which starts at location 631. The number of characters in the keyboard buffer is then POK Ed into memory location 198, This location is the counter for the number of characters in the keyboard buffer. The cursor is then moved to the top of the screen and the program ends. Because there is a RETURN in the keyboard buffer the computer thinks that you have typed the keyword NEW and erases the program. The next RETURN in the buffer makes the 402000S1JB500:COSUB300:PRINT#2," LND"CHR$(0); 4030FORJ-0T0319:READM:BY-DEC( 811):PRINT#2,CHR$(8Y);:NEXT 40400CL05E42:PRINT"[CLEAR]":END 4050: 50000ATA 411,1C,FB,F9,99,22,93,2 2,3A,E7,30,2C,31,3A,E7,34 t 3A,E0 5010DATA 31,2C,31,30dC,31,32,2 2C,31, C,22,9E,57,4F,52,48,49,4E,47,2E, 2E,2E 50200ATA 2E,24,22,2C,31,3A,E0,3 1,2C,31,34,2C,31,34,2C,22,50,4C, 45,41 5030DATA 53,45,20,20,57,41,49,5 4,22,2C,31,3A,8C,00,71,1C,FC,F9, 87,41 5040DATA 24,3A,53032,D1,28,41,2 4,29,3A,45032,53,3A,E13,3A,87,42, 24,3A 50500ATA 813,42,24,132,22,45,4E,4 4,22,A7,ED,00,133,1C,FD,F9,53,55, 82,30 50600ATA 3A,81,4A,B2,30,A4,11,3 9,3A,42,62,D1,28,42,24,29,3A,97, 45,AA 50700A1A 4A,2C,42,3A,53,55,132,5 3,55,AA,42,3A,E0,31,2C,32,32,2C, 31.32 5080DATA 2C,D2,28,45,AA,4A,29,A A,22,3D,24,22,AA,42,24,2C,31,00, FD,1C • 50900ATA FE,F9,87,42,24,3A,82,3 A,45,132,45,AA,32,30,3A,86,53,55, 83,81 51000ATA D1,28,42,24,29,A7,99,2 2,93,11,11,11,11,11,96,44,41,54, 41,20 51100ATA 45,52,52,4F,52,20,49,4 E,20,4C,49,4E,45,22,C2,28,36,35, 29,AA 51200ATA 32,35,36,AC,C2,28,36,3 6,29,3A,80,00,3F,1D,FF,F9,EC,3A, 85,22 51300ATA 93,11,11,11,11,11,11,4 6,49,4C,45,4E,41,4D,45,20,4F,46, 20,54 51400A1A 41,52,47,45,54,20,46,4 9,4C,45,3A,22,313,4E,24,3A,FE,10, 28,4E 5150DATA 24,29,2C,42,30,2C,50,2 8,53,29,A4,50,28,45,29,3A,80,00, 00,00
- Page 1 and 2:
11111111 YOUR BEST INDEPENDENT COMM
- Page 3 and 4:
1 REGULARS FEATURFq Irl V L U M E 3
- Page 5 and 6:
11/11 - fl E S Tt r Ha i gT h t Ei
- Page 7 and 8:
I I I R T fl S T F I T E U E N T E
- Page 9 and 10:
'44%4 4 , L a p 4 ., _ ,• 241 .
- Page 11 and 12:
Crystal Castles Diamond Plateaus in
- Page 13 and 14:
A wmay seem like a strange concept
- Page 15 and 16:
C64 LISTING 11 I i ' Please read 'L
- Page 17 and 18:
11111111•11DIMENSION 27/29 High S
- Page 19 and 20:
Drive - which allows you to change
- Page 21 and 22:
With the Commodore disk drive it is
- Page 23 and 24:
Nearly all code will need data tabl
- Page 25 and 26: A swhich enables you to store any s
- Page 27 and 28: Playing all sounds in memory Doing
- Page 29 and 30: 3,0375 10600ATA 4C,A1,15,AD,A7,10,C
- Page 31 and 32: SPECIAL OFFER — FREE MODEM WITH Y
- Page 33 and 34: memory you have left. MEM will disp
- Page 35 and 36: C64 REVIEWS The Newsralcom Desi91 -
- Page 37 and 38: 'po , • p • ; . • • • •
- Page 39 and 40: Checksum Program The hexadecimal nu
- Page 41 and 42: 1 Should you not have any of the ab
- Page 43 and 44: Vtt C4* 4eW computer show k9 * t Ch
- Page 45 and 46: Maintenance, Service. Support. Trai
- Page 47 and 48: O E c o m m o d olii r e At last th
- Page 49 and 50: ROJAN THE ULTIMATE IN GRAPHICS TOOL
- Page 51 and 52: RAD 28 95 AMSTRAD POW DISK 1945 ATA
- Page 53 and 54: W can a be like a stroll through a
- Page 55 and 56: 1 Games Reviews COLLAPSE REVIEWS Th
- Page 57 and 58: HOODOO VOODOO REVIEWS its detectors
- Page 59 and 60: SPEED KING The smell of petrol, the
- Page 61 and 62: of enemy lighters, its only after p
- Page 63 and 64: THE FINAL CARTRIDGEI I MO IMO oroYo
- Page 65 and 66: HARDWARE REVIEWS Pick of the Sticks
- Page 67 and 68: Y look o out for new programs, hint
- Page 69 and 70: ENT trfull arrie arp ikon the la y
- Page 71 and 72: MICROCOMPUTER HARDWARE SUPPLIES COM
- Page 73 and 74: PROGRAM: AUTOS AVE Please read 'LIS
- Page 75: EPILOG-I CARTRIDGE SYSTEM COMMODORE
- Page 79 and 80: C64 AND C128 ill D3 Al ,56,53,48,20
- Page 81 and 82: U page n at the sight of an acronym
- Page 83 and 84: LEAPER ••• •1 0 - 1 Amazing
- Page 85 and 86: I n data can be input into your cod
- Page 87 and 88: LISTING 6 MACHINE CODE 10 $0073 CHA
- Page 89 and 90: P P . A 0 • 7 TELETE\ i _c t C 0-
- Page 91 and 92: program allows you to set up the co
- Page 93 and 94: Going from left to right across the
- Page 95 and 96: Lineage: 45p per word. (52p incl. V
- Page 97 and 98: SOFTWARE LIBRARY MIDLAND COMPUTER L
- Page 100: k_ *8 digitally recorded drum sound