There was a need on comp.sys.cbm for a good assembler with documentation for the c64, so I dug out this one from a Brittish magazine I used to subscribe to. Below is a summary of the commands explained in the article. An article on error codes was to appear in the following number but it didn't. The binary file is for c64 and has been zipped with PKZIP204G for the PC. Hope someone will find the assembler useful. Birgitta Noren internet: kosu_birgit@garbo.lucas.lu.se ------------------------------------------------------------------------- 6510+ Assembler from Commodore Disk User Magazine 4/6 a three-pass disk-based assembler/editor/monitor for c64. Standard 6502 mnemoics and addressing modes Built in machine code monitor Enhanced screen editor User definable function keys Assembly from disk THE ASSEMBLER Labels may be used. They must start with a letter A-Z and must not exceed 250 characters. A comment must start with either a semi colon (;) or an exclamation mark (!). All 56 standard mnemoics are accepted plus the following BYT used to reserve one byte of memory. Values may be comma separated and will then be stored in consecutive memory locations. ASCII strings may be generated by enclosing the string in double quotes: BYT 2,3 FRED BYT 'HELLO WORLD' (it is actually single quotes in the magazine) BYT 5+4,'YES',0 WOR is for reserving two bytes of data at a time. Each value will be stored in standard low-byte-first format WOR $1234 WOR %1100101011001 END is to indicate the last line of source code. The assembler will ignore any line after this statement. OUT causes a listing to be generated on the third (and last) pass on the assembly. Listing will start where the OUT command is found. Default printing is to the screen. To send to printer: OPEN4,4 CMD 4 before assembly. OFF turns off the listing (several OUT and OFF may appear in the code). CHN is to chain files together if the code becomes too long. There is no restriction on the number of files you can have. The last file must use an END command followed by the name of the first file in the chain! file 'part1' 10 INC FRED 20 RTS 30 CHN 'PART2' file 'part2' 10 FRED=53280 60 END 'PART1' LNK link, does the same thing as CHN. LIB allows you to insert source code from another file. When the assembler encounters the LIB directive, it temporarily stops reading the code from memory and instead reads one line at a time from the named file. Processing of the in-memory source resumes after either an end of file or an END command is encountered in the LIB file. file 'ONE' 10 *=49152 20 FRED=53280 40 END 30 LIB 'TWO' file 'TWO' 25 INC FRED 99 RTS 100 END The main program can in fact consist of a series of LIB calls: 1000 *=49152 1010 ; 1020 LIB 'START' 1030 LIB 'MIDDLE BIT' 1040 LIB 'SOMETHING ELSE' 1050 LIB 'THE END' 1060 ; 1070 END Expression: example result + Addition 10+4 14 - Subtraction $1a-11 15 * Multiplication %1010*13 130 / Division 54/10 5 % Mod (remainder) 54%10 4 & Bitwise AND 6&3 2 ^ Bitwise OR 6^3 7 > Bit shift right 1>4 %10000 < Bit shift left %10110<2 %101 " take ASCII value "A 65 < take low byte <$1234 $34 > take high byte >$1234 $12 all operators have equal precedence. $ hex number % binary otherwise decimal Brackets may be used to force evaluation from default of left to right: 1+2*3=9 1+(2*3)=7 *= start address of the code @= place code in other memory address, must always appear after the *= 10 *=$80000 20 @=$40000 will assemble the code to $8000 but since this is the address of the 6510+ code the at-counter tells the 6510+ to put the final assembled code in $4000 (i.e. with addresses as if it was at $8000). This may also be written as 10 *=$8000, $4000 THE EDITOR Screen Editor enhancements: left SHIFT key pause output to the screen when listing SKIFT LOCK pause and hold output to screen when listing RUN/STOP quotes mode and outstanding insert flags are zeroed SHIFT + un-home, puts cursor in lower left corner Additional disk related commands: @ give disk drive status (error channel) $ display directory on screen @N:new disk,ok format new diskette $0:A*=S display all sequential files (=S) with names A...something Basic Extensions: Any Basic commands will accept hex and binary numbers: PRINT $123*%1010 PRINT CHR$($40) OLD recover program which was lost with NEW AUTO (line#(,step)) automatic line numbering. Turn off by pressing return on a blank line, Default step value is 10. RENUMBER (startline (,step)) renumber from startline, next line at startline + step. DELETE line-range delete lines DELETE 1230-2000 DELETE 100- DELETE -1293 FIND XstringX search source code for string given. Any line containing the string will be listed on screen. X is any character not included in the string (do not use X-characters that will be tokenised by BASIC, see CHANGE) FIND "HELLO" FIND /LDA/ CHANGE XstringX replacementX substitute string with replacement. Each line modified is listed on the screen CHANGE @HELLO@HELLO WORLD@ CHANGE "!" " will remove all '!'s from the code i.e. commented lines CHANGE /!/*/ will NOT work since '/' is tokenised into 'divide'. Use "!"*". Function Keys KEY will display all strings currently defined for the 8 F-keys A left-arrow represents a RETURN KEY number, string assign string to key number KEY 1 "OLD", renumber KEYSAVE "name"(,device) saves key definitions to disk or tape KEYLOAD "name"(,device) loads key definitions HELP will display a brief reminder of all commands (new and modified says the article, it had been published before) Disk related commands: LOAD "name" SAVE "name" VERIFY "name" uses default device TYPE "name"(,device) read a file and display it on the screen. Only for SEQ files. DUMP "name"(,device) display file in hex and ASCII. Works on PRG, SEQ and USR MERGE "name"(,device) merge two PRG files. If the same line number appears twice then the one from the file will overwrite the one in memory APPEND "name"(,device) like merge but appends to the end of the program in memory. Use RENUMBER to fix line numbers afterwards. Assembler commands from the editor: ASSEMBLE (linenumber) assemble source code in memory. Default start is first line. Stop any time with RUN/STOP key. DISASSEMBLE address Display disassebly of memory from given address. Stop by pressing RUN/STOP, pause with left SHIFT or SHIFT LOCK. Abbreviation: D shift-I DISASSEMBLE START DISASSEMBLE 4096*12 NUMBER expression evaluate expression and display result in hex, decimal and binary. Useful when checking labels or converting between number bases. TABLE display symbolic table. Labels are listed in alphabetical order also showing their hex value SYMSAVE "name"(,device) save the symbol table to disk. FORMAT line range Same as LIST but neatly formatted SET label = expression allows manual adding or modification of symbols SET BANANA=FRED*2 SET X=$2345 SET LO=