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F#N#~y<#Ʌo#~#>  *w := #:<2#:=AL!>"2É :i>Y 22!-P*":­=e 2"!4w ;  ڀ#€+À*xP>;>29 :9 : Z ; >29 :- '9 29 '9 >2#6 #6"xP> > qa{_Y{͗ 3͗ E͗ W͗ ͗ ax͗ ͗ ͡ × _ANI AND CMA CPL CMC CCF CPI CP HLT HALT JMP JP ORI OR RAL RLA RAR RRA RLC RLCA RRC RRCA STC SCF SUI SUB XRI XOR DB DEFB DS DEFS DW DEFW SET DEFL ENT ENTRYNAM NAME RAM DATA ROG REL ANA AND CMP CP DCR DEC INR INC MVI LD ORA OR SUB SUB XRA XOR DCX DEC INX INC LXI LD POP POP PUSH PUSH REQ RNE RLT RGE CEQ CNE CLT CGE JEQ JNE JLT JGE RC RNC RZ RNZ RP RM RPE RPO CC CNC CZ CNZ CP CM CPE CPO JC JNC JZ JNZ JP JM JPE JPO DAD ADD ADD ADD ADC ADC SBB SBC ADI ADD ACI ADC SBI SBC IN IN LDA LD LDAX LD LHLD LD MOV LD PCHL JP *RST RST 3SHLD LD ?SPHL LD VSTA LD eOUT OUT eSTAX LD XCHG EX XTHL EX IFC IF ICL *INCLLST LIST MAC MACRO" XLATE5 8080-to-Z80 Translator 11/01/84 XLATE translates an 8080 source code file into a new Z80 source code file that is ready to assemble using the Microsoft M80 assembler. To use, all these examples expect 'HELLO' to be an 8080 source code file. If a single name is used the output file will have the same name, with a .MAC type. A>XLATE HELLO (1) A>XLATE HELLO.ASM (2) A>XLATE HELLO.ASM TEST.TXT (3) Two lines will be automatically added at the very start, for use with the M80 assembler: .Z80 and ASEG. The first makes it unnecessary to use the "/Z" when assembling and the second insures absolute addresses when using L80 to load the 'HELLO.REL' file made by M80. All source code will be capitalized. Any comment line starting with an asterisk will be changed to a semilcolon. Colons will be placed behind all labels except EQU, MACRO and SET. The time it takes to run the program may double, depending where on the disk the input and output files are physically located at the moment. A dot is shown each 10 pmg lines, 50 dots to a line - two are 1000 pgm lines. Source file: destination file: .Z80 ASEG ++ Output file write error ++ ++ No source file found, for help type XLATE ? ++ ++ No directory space ++ Output file already exists - delete it and continue (Y/N)?  ++ Aborting to CP/M ++ Processing complete  The following pseudo-ops have been used in your source and have not been fully translated. You must complete the translation using an editor. Original: Must Be Translated To: #ENDIF ENDIF ICL *INCLUDE LST LIST MAC <$parameters> MACRO <#parameters> [ ... ] MEND #macro-call macro-call ASMMACit takes to run the program may double, depending where on the disk the input and output files are physically located at the moNAME : XLATE5 DATE : 01 NOV 84 FROM : IRV HOFF W6FFC NOTE: THIS PROGRAM MAY BE ASSEMBLED WITH ASM.COM AND WORKS FINE WITH 8080 OR 8085 COMPUTERS, AS WELL AS Z80 UNITS. XLATE takes a 8080 source code .ASM file using Intel mnemonics and creates a new Z80 source code .MAC file using Zilog mnemonics. This is done in such a manner the new program is immediately ready to run on a Microsoft Z80 assembler. XLATE adds two lines at the very beginning of the new program: .Z80 ASEG The first makes it unnecessry to add the "/Z" parameter for the M80 assembler and the second makes absolute addresses for the L80 linking loader - without such a statement in the new program, it would get only relative addresses. There are at least three other similar programs which translate 8080 source code to Z80 - MAKEZ80, IZ (Intel-Zilog) and ITOZ (Intel-to-Zilog). They will be discussed in turn. SPECIAL NOTE ------------ ZTOI (Zilog-to-Intel) is a special program that does just the oppos- ite from the other four - it takes a Zilog Z80 source code program and writes a new one in Intel 8080 source code. This is a commercial com- panion to ITOZ. It makes no attempt to alter Z80 specific commands but usually puts a statement into the program at that point as well as dis- play it on the screen: "FOLLOWING INSTRUCTION IS NOT RECOGNIZED". Both these program handle IF/ENDIF statements in an unusual manner, replacing them with COND and ENDC. Both ITOZ and ZTOI REQUIRE upper-case source code, putting out error lines if any lower-case is encountered. They are commercial programs, the rest are free. They are both under 5k in length. XLATE5 ------ XLATE5 is written in 8080 assembly language and is 39 records (under 5k). It is slightly longer than XLATE4 which was written in Z80 code which utilized a number of Z80-specific commands that do save object code length. If assembled and loaded with M80, it will come out 43 re- cords long, but that is due to L80 converting all the DS statements to 00 and adding them to the total file length. XLATE is faster than MAKEZ80, considerably faster than IZ and much slower than ITOZ which is (by far) the fastest of the group. (ITOZ is also the only commercial version, the rest being free.) Since XLATE (also IZ) only writes one record at a time, its speed will vary considerably, depending where on the disk the input and output files are physically located. It was written in May 1982 by Richard Conn who disassembled a comparable program available from Cromenco, then adapted it for public domain use. It has since been updated by Bill Al- bright and Irv Hoff. The source code is written in Z80 mnemonics and is public domain. XLATE is surely the easiest of the four to use, as only one file name is required (although two many be used if desired). XLATE5 is now written in 8080 source code, having been rewritten by Irv Hoff from the Z80-specific source code on previous versions. MAKEZ80 ------- MAKEZ80 is written in AZTEC 'C' by Richard Covert. While MAKEZ80.COM is available in public domain, he asks $25 for the source code. Current version is 3.2 dated 19 February 1984. It is 201 records (26k) long but is the "less noisey" than IZ or MAKEZ80 since it uses reasonably large buffers for file handling - the other two only use one record at a time with considerable disk activity and take unpredictable lengths of time. ITOZ is comparable to MAKEZ80 in this respect. IZ (Intel-to-Zilog) ------------------- IZ is written in PASCAL by John Hastwell-Batten. It is available in public domain. The current version is 2.0 dated June 1982. It consists actually of two programs, IZ.COM which is 200 records (26k) and IZ.DAT which is 111 records (14k). The latter contains all the data needed to convert TDL, PASM and Z80 mnemonics. The program is probably the most versatile of the three since it will accept Intel 8080 or TDL 8080 source mnemonics, PASM code, has optional global label generation, and can dis- play the "before and after" line by line on the CRT. (While it is nice to watch the translation on the CRT, doing this a few times is more than adequate and the user will likely turn off that feature on subsequent uses of the program. However, score a big one for IZ.) ================================================= Back to XLATE now. If no filename is included, a short message will remind the user and that a help message is available: A>XLATE ? This gives an excllent page of information on how to use the program. Normally, only one file name will be used: A>XLATE HELLO This assumes the file 'HELLO' is in reality a 'HELLO.ASM' 8080 source code file. The output file will then be automatically named HELLO.MAC and will be ready for immediate use with the Microsoft M80 assembler. XLATE removes any colons after labels in lines with EQU, MACRO or SET statements. It also converts any lower-case source code to upper-case. Unlike the other two programs, it does not attempt to reformat the pos- ition of the comments to column 24 if possible, but leaves them however they originally appeared. (Many people use column 32 for comments these days, which looks much better on Z80 code in particular, which has longer expression field use than 8080 code.) Two file names may be used, if preferred: A>XLATE HELLO.ASM NUNAME.MAC If the second file name already exists, a warning will be displayed asking if it should be erased or not. This can be most valuable under obvious circumstances. (MAKEZ80 and IZ would just wipe out the exist- ing program without mentioning anything.) XLATE displays a 'dot' on the CRT each ten lines of input file it handles. It puts 50 dots to a line, so two lines of dots are 1,000 program lines. This gives the user some idea of what is happening. ====================================================== DIFFERENCES BETWEEN IZ, ITOZ, MAKEZ80 AND XLATE4 ------------------------------------------------ There are substantial differences. The Microsoft M80 assembler re- quires colons after all labels, but no colons for labels in EQU, MACRO or SET lines. There MUST be a label on any EQU line. Keeping that in mind, away we go: M80 will not accept an asterisk in the first column. COLONS: Handled properly by IZ and XLATE4. Totally ignored by MAKEZ80 and ITOZ, which leaves them however they were in the original. (Count off heavily for MAKEZ80 and ITOZ here.) LABELS over 7 characters: XLATE puts a space after labels (whether EQU or not) that are too long. MAKEZ80 puts a tab, which often changes the apparance of the output file. IZ puts the label on a line by itself then starts a new line with a tab. While pleasing in appearance this provides assembly errors on EQU lines which MUST HAVE a label on the same line. It also changes the appearance of the original where we could assume the author knew the label was too long. ITOZ seems to just handle them however the author provided. (Score for XLATE here, perhaps, count off for IZ for EQU's and count off heavily for MAKEZ80. ITOZ sort of neutral.) INLINE COMMENT LINES: On source code lines with comments, XLATE leaves them where they were, whenever possible. Both IZ and MAKEZ80 put only one tab after the new expression field, regardless how many the original file had. ITOZ will also make a ragged appearance. (Score for XLATE here.) ASTERISK in first column: MAKEZ80 and ITOZ leave it an asterisk. (Produces errors with M80.) XLATE changes it to a semicolon for M80. IZ indents two tabs to column 16 thinking is is an operand character. (Score heavily for XLATE here.) LOWER-CASE source code: Converted to upper-case by XLATE. Left in lower-case by IZ and MAKEZ80, except the new Z80 instructions are upper-case, giving a rather awkward appearance. ITOZ puts out an error for each line containing any lower-case source code (as does ZTOI). (Score for XLATE here.) BLANK LINES: IZ erases all blank lines, compressing the appearance. XLATE, ITOX and MAKEZ80 all leave them as they were. (Count off for IZ here.) EASE OF USE: XLATE only requires one filename. The .ASM need not be typed. It can use two file names. ITOZ is similar to XLATE but needs the file type. MAKEZ80 requires two file names. IZ can use two file names on the command line, but if none are given, will only ask for one. In any case, it asks if you are using Intel or TDL mnemonics, if you want global labels and if you want a visual display. (Score for XLATE here.) SPEED: ITOZ (and ZTOI) are in a class by themselves, much faster than any of the others. XLATE is the pretty fast but quite noisy and unpredicable on time as it only handles one record at a time. MAKEZ80 is reasonably fast and rather quiet as uses large buf- fers. IZ is by far the slowest but can optionally display the translations as they are being done. (Score for XLATE here, count off heavily for IZ for very slow speed. It will take 3-4 times longer than XLATE.) M80 HELP: XLATE puts two lines on each file, .Z80 and ASEG. MAKEZ80 just puts a little advertisement on that mentions it was used to make the translation. IZ puts just .Z80 on, you still need to add the ASEG yourself to that file, normally. ITOZ doesn't do any- thing at all. (Score for XLATE, half-score for IZ, count off for ITOZ and MAKEZ80.) WHAT IT DID: MAKEZ80 provides no information. XLATE shows a series of dots as the program progresses, one line of 50 dots for each 500 lines of input file handled. IZ displays a nice summary at the end. ITOZ and MAKEZ80 give no information on progress or results. ERRORS: ------ ITOZ and MAKEZ80 attempts to inform the user of problems with the code during translation, much as an assembler might do. ====================================================== CONCLUSIONS: ----------- I have tried to point out the differences in the four programs that are available. XLATE5, ITOZ and ZTOI are all under 5k, the other two at least 5 times larger. I have tried to modify the previous version of XLATE to be the best of the group overall, although not as fast as ITOZ. I feel certain the typical user would prefer the results obtained from XLATE5 when compared with the other three. It is the easiest to use and in my opinion has none of the shortcomings of the others. no information. XLATE shows a series of dots as the program progresses, one line of 50 dots for each 500 lines of input file handled. IZ displays a nice summary at the end. ITOZ and MAKEZ80 give no information on progress or results. ERRORS: ------ ITOZ and MAKEZ80 attempts to inform the user of problems with the code during translation, much as an assembler might do. ====================================================== CONCLUSIONS: ----------- I have tried to point outv_LXLATE5.ASM]  !"#$%&'()*+,-./0123456789:;<=>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[ 'x'=8D=QHA冊`'lgժӱO}qb膶}r6(?!*RP"ǦeP[r6(-5O^iP'g)"E"l!*l ll })t쓳Tn@dNr^Kq,݅ ӓb J r^m8IoBDFm}I1|DdMGQ9o6ZIo*7TiRl/M6}/.M}ѧc7jwrC">>"#|`N-OR$_/TnHV n;ŏE6"E29~BZovNc!J>9)n/BDFm}I1|DdMGQ9o6ZI\PR|&pd.~,Eu{\8b?}:Y *76}xxx"l/M_ӱORPE?wyhۢ_d~mrm>0Ha0m3(teӍFsV :C?EZA *7t?C?)С?CHa0 ot#no*7t?CuA *7t?C?)С?C<|M #`su>G"C63)Q= ݿJa0H*4:z嵅hezP͠pFjsuNjuA{)bN;gvO?F$v +Ha*vf?F]VWť\ѽF "#[ x9Fy*Wt/`A+F׆k{lJ #żZ/0R[JCw A'ZoY #Ŝ,Bޤ0RT r=11|pJ #"_B>Ha0F>8V+-E>8VfPhe).ՋRM #AU49 ^ym-A4t;<:C #E:׋RM #A;BE8>oЃju0RT&K+HaP NCױS?0RTݿJa0H*x u0R̻dwrE"s{@ .]he)\ѯDWW:-w>F Z{Aisl[x Ia7Wz1^Ia0H`t;O;BE)x oA4t;)rER) f R)/nR_Fd!X? AoR)j/.TW5-㨴c0Ha0m3(teӍFsV :C?EZA *7t?C?)С?CHa0 ot#no*7t?CuA *7t?C m XLT80 translates Zilog Z80 assembly language source code into Intel 8080 assembly language source code. It is invoked by a command of the form: XLT80 [d:]srcfile[.typ] [d:destfile.typ] All parameters in brackets are optional, and, if omitted, the following values are assumed: Source filetype -- Z80 Destination filetype -- ASM Destination filename -- same as source filename Drive -- current drive Press any key to continue - Examples: XLT80 PRGM1 {translates PRGM1.Z80 to PRGM1.ASM} XLT80 PRGM1 PRGM2 {translates PRGM1.Z80 to PRGM2.ASM} XLT80 PRGM1.MAC PRGM2.TXT {translates PRGM1.MAC to PRGM2.TXT} XLT80 also has the following features: Case will be preserved as well as possible -- if an opcode has a lower case character, the translated opcode will be in lower case. Asterisks at the beginning of lines will be replaced with semicolons. User may choose to flag Z80 opcodes which do not have an 8080 translation. A dot is printed on the console for every 100 lines of input processed. !9"z1z:] ›^*zͧͬ Þ^> 2>!2 222[2>2 ʭY̽ʭYʭY8>ʭY̋ʭLU>2|<2%AZ80-to-8080 Translator version 1.04 Use space (default TAB) after opcode ? [Y/ret=N/esc/^C] !> wStart comment in column 33 (default 25) ? [Y/ret=N/esc/^C] ! >)wTranslate JR to absolute JMP ? [Y/ret=N/esc/^C] >2[Flag intrinsic Z80 opcodes and write line nos. to output file? [Y/N/esc/^C] >#2>!2 Translate instructions to Upper/Lower or preserve case ? [U/L/ret/esc/^C] 222Ϳ!! 22!%P*%z-H{H%=2>wz-{%"%w'\:/2:ʙ:y~;vy2:™:™:~ʕAØJw~ ʸ ʮ #+#6 #6"%*#"* 4D w#w ͮͬ  ] e n .*S   *  *** Job Cancelled *** J  Ran out of memory for table of line numbers of intrinsic Z80 opcodes.  lines in input file processed. *** Finished *** The following operands have been used in your source and have not been fully translated. You must complete the translation using an editor. ELSE MACRO Condition code PO or PE found, check 8080-Z80 difference. !-"   * ^#V#" | > 0Sº . ú > . Line numbers containing untranslated opcodes: !-" !q z * ^#V#" |X > 0͉+ f >; + > f f >;> > ; ; Line numbers containing untranslated opcodes: ; ;-!%ͧ !dT$!TI!Tʬ! T'! Tʉ!Tʧ!T!  T! T!  T! T!. TI*}N *22~ ʧ ʧ z; ʃ '| | #W ͸#~; :' ʟ ʟ > >!ï ͸ ʃ ;~ &W | ͸!:| = > >  :' > ~#ʇ  zCPL CMA CCF CMC SCF STC HALT HLT RLA RAL RRA RAR RLCA RLC RRCA RRC DAA DAA NOP NOP DI DI EI EI EXX EXX LDIR LDIR LDI LDI LDDR LDDR LDD LDD CPI CPI CPIR CPIR CPD CPD CPDR CPDR INI INI INIR INIR IND IND INDR INDR OUTI OUTI OTIR OTIR OUTD OUTD OTDR OTDR NEG NEG RLD RLD RRD RRD RETI RETI RETN RETN IM0 IM0 IM1 IM1 IM2 IM2 DJNZ DJNZ BIT BIT SET SET RES RES RLC RCL RL RL RRC RRC RR RR SLA SLA SRA SRA SRL SRL IM IM DB DB DW DW DS DS DEFB DB DEFW DW DEFS DS EQU EQU DL SET DEFL SET ORG ORG OR ORI ORA AND ANI ANA XOR XRI XRA CP CPI CMP SUB SUI SUB ADD ADI ADD ADC ACI ADC SBC SBI SBB EX XCHG PUSH PUSH POP POP INC INX INR DEC DCX DCR LD MVI MOV IN IN OUT OUT RST RST rJP JMP /JR JMP (CALL CALL \RET RET cMEND ENDM MACROMACROELSE ELSE ~   ;*6;~:   ;# ͸ FF&i:#~:#>:͸~ FF;. &"}͙͸"< N#F~h~ T  A~ :~ #~:~A#~:~A#x~# LF6zp~ / #&~ J,E#6+~)ɷ~;[ [#L+~ [ [#s#i~:+-/*)!~, ; Hs~# xså~  #ø}o|g> bk ~# x!z*}N # ** 4s#r#" > 2] > 2 K > 2e > 2 ͸K *9"Ac͸K !;*9"Ac͘sz:,:,#:G:22P!ͻN DAD*9"Ac͘z:,:~_ABCDEHL~( #s+!5͛####s###:>M- w"#~(HL)~_A#~,#++~_A#s+~_IR~(#zp++)+++~_I#~_XʐYʐ+#s++~_H#~_Lʐ+~(#͘)¿#s++++!>j##s++BCBDEDHLHSPSPAFPSW!>j####s++++(BC)B(DE)D*!q> jv!T!|> j!s:G:2N DE,HLXCHG(SP),HLXTHL*S"͸K *APÙ*T~(czU4#6##͘H!&ͻ N !*STASHLDSTAX,#H"!/ͻK ,#PSʊ~(ʨ!ͻ>,N LXIz͘k"!K SPHLH#L)+!ͻ6zN LHLD,#~(AU:cL#͘))++++F+~###w"#p#:>M% wA*~_AL)+!HþLDA*~_A!mͻN LDAX͸*>/>8N *9~(™#͸L)«+6 N ~(#~_C#~)#s+++*Ͳ~(#~,;" "#+~)#"&"&##H""͸*&6zK :[*ͩʀcͻʡʡ ʑͻK *?*ͻʢʢ ʒK !N PCHL#> 2n â#*}~z_RĻN ~_ZCPM~#͉~_N~#~_ZC+~2#͉++~_P~#~_EO+!\ ~ B?B!\o :lX2o:m lp!m:u ʀx!u!͟!o͟ ~§:@>:#;>.~# ¾Source File: , Destination File: #!-"%Z80) No Source File Found o¬oʐo>2!"ASM No Directory Space oNOutput File Already Exists -- Delete it and Continue ? (Y/N) 2'*w ( ( -:|= 1>1:|<2|#:=>>2|%r}rö́z%P{P!"~#z Output File Write Error >:®*|}oö́::_.Y  *%A[ a{_'qqdq q}0/sx0„0'ͧͧdͧ ͧ}0/ҩx0º0:=2>.>d2:=2> > 2:=2.>22d 2************************************************************************ XLT80 translates ZILOG Z80 mnemonics to INTEL 8080 mnemonics. Based on Richard Conn's XLATE2 which translates 8080 to Z80 mnemonics. Version 1.00 -- 10/28/84 -- Frank J. Zerilli ************************************************************************ XLT80 translates Zilog Z80 mnemonic assembly language source code into Intel 8080 mnemonic assembly language source code. Command line: XLT80 [d:]srcfile[.typ] [d:destfile.typ] All parameters in brackets are optional, and, if omitted, the default values are: Source file-type -- Z80 Destination file-type -- ASM Destination file-name -- same as the source file-name Drive -- current drive Examples: XLT80 { prints help message } XLT80 FILE1 {translates FILE1.Z80 to FILE1.ASM} XLT80 FILE1 FILE2 {translates FILE1.Z80 to FILE2.ASM}  XLT80 FILE1.MAC FILE2.TXT {translates FILE1.MAC to FILE2.TXT} This version will not split up unrecognized names longer than 5 characters. It operates faster because it uses larger buffers. It handles long labels properly. This program gives the choice of converting the case of instructions to upper or lower case or of trying to preserve the case of instructions. This program will not translate Z80 intrinsic opcodes (Z80 opcodes with no 8080 counterpart) but gives the choice of flagging them and writing the line numbers in which they are found to the output file. Asterisks at the beginning of lines will be replaced with semicolons. An activity dot is printed on the console for every 100 lines of input processed.  {translates FILE1.Z80 to FILE1.ASM} XLT80 FILE1 FILE2 {translates FILE1.Z80 to FILE2.ASM} ; ; XLT80 ; Translate ZILOG Z80 mnemonics to INTEL 8080 mnemonics ; VERS EQU 104 ; ; See help messages below for info. ; ; Based on Richard Conn's XLATE2 which translates 8080 ; to Z80 mnemonics. ; ; Version 1.00 -- 10/28/84 Frank J. Zerilli ; ; This version will not split up unrecognized names ; longer than 5 characters. It operates faster because ; it uses larger buffers. It handles long labels ; properly. ; ; It gives you the choice of converting instructions to ; upper or lower case or to try to preserve the case ; as much as possible. ; ; This program will not translate Z80 intrinsic opcodes ; (Z80 opcodes with no 8080 counterpart) but gives the ; choice of flagging them and writing the line numbers ; in which they are found to the output file. The omission ; of the choice of translation of these intrinsic Z80 ; opcode mnemonics to TDL Z80 mnemonics was intentional, ; since the program is envisioned as a tool to convert ; Z80 programs to run on an 8080. ;  N00 EQU 0 N01 EQU 1 ; N07 EQU 7 N09 EQU 9 ;tab every 8th col. NF8 EQU 0F8H ;mod 8 ; LBUFLN EQU 80 ;line buffer length OPBFLN EQU 5 ;opcode buffer length MEMSIZ EQU 4 ;memory available in Kb IBNUM EQU 4*MEMSIZ OBNUM EQU 4*MEMSIZ RECLEN EQU 128 ; STCKLN EQU 128 ;stack size IBFLEN EQU IBNUM*RECLEN OBFLEN EQU OBNUM*RECLEN ; CTRLC EQU 3 EOT EQU 4 BEL EQU 7 HT EQU 9 LF EQU 0AH CR EQU 0DH ESC EQU 1BH QUOTE EQU 27H ; ABORT EQU 0000 BDOS EQU 0005 DFCB1 EQU 005CH DFCB2 EQU 006CH ; FNLEN EQU 8 EOS EQU EOT ; not used in this program EOF EQU 1AH NFF EQU 0FFH ; disk error return ; ; BDOS functions ; nCIN EQU 1 nCOUT EQU 2 nCDAV EQU 0BH nOPEN EQU 0FH nCLOSE EQU 10H nDEL EQU 13H nRDNR EQU 14H nWRNR EQU 15H nCREAT EQU 16H nCDISK EQU 19H nDMA EQU 1AH ; ORG 100H JMP START ; ; flags ; TCASFL: DB 0 ; 0 to preserve case LCASFL: DB 0 ; 0 for upr case if TCASFL set ; ; HELP MESSAGE ; HMSG1: DB CR,LF DB CR,LF DB 'XLT80 translates Zilog Z80 assembly language source',CR,LF DB 'code into Intel 8080 assembly language source code.',CR,LF DB 'It is invoked by a command of the form:',CR,LF DB CR,LF DB ' XLT80 [d:]srcfile[.typ] [d:destfile.typ]',CR,LF DB CR,LF DB 'All parameters in brackets are optional, and,',CR,LF DB 'if omitted, the following values are assumed:',CR,LF DB CR,LF DB ' Source filetype -- Z80',CR,LF DB ' Destination filetype -- ASM',CR,LF DB ' Destination filename -- same as source filename',CR,LF DB ' Drive -- current drive',CR,LF DB CR,LF DB 'Press any key to continue - ',0 HMSG2: DB CR,LF DB CR,LF DB 'Examples:',CR,LF DB CR,LF DB 'XLT80 PRGM1 {translates PRGM1.Z80 to PRGM1.ASM}',CR,LF DB 'XLT80 PRGM1 PRGM2 {translates PRGM1.Z80 to PRGM2.ASM}',CR,LF DB 'XLT80 PRGM1.MAC PRGM2.TXT {translates PRGM1.MAC to PRGM2.TXT}',CR,LF DB CR,LF DB 'XLT80 also has the following features:',CR,LF DB CR,LF DB ' Case will be preserved as well as possible -- if an opcode has',CR,LF DB ' a lower case character, the translated opcode will be in lower',CR,LF DB ' case.',CR,LF DB CR,LF DB ' Asterisks at the beginning of lines will be replaced with',CR,LF DB ' semicolons.',CR,LF DB CR,LF DB ' User may choose to flag Z80 opcodes which do not have an 8080',CR,LF DB ' translation.',CR,LF DB CR,LF DB ' A dot is printed on the console for every 100 lines of input',CR,LF DB ' processed.',CR,LF DB CR,LF DB 0 ; ; Program starts here. ; START: LXI H,0 DAD SP SHLD SPBDOS LXI SP,STACK LDA DFCB1+1 ; check for a file name CPI ' ' ; print help if no name JNZ BEGIN ; no help requested LXI D,SIGNON CALL PRTLIN LXI D,HMSG1 ; print help message CALL PRTLIN MVI C,nCIN ; wait for any character CALL BDOS LXI D,HMSG2 ; print rest of help CALL PRTLIN LHLD SPBDOS ; retrieve system stack SPHL ; pointer and pop RET ; to PC BEGIN: CALL HELLO ;signon, open in & out files NXTLIN: CALL GETLIN ;get line from input file to buf CALL PROCLIN ; process line JMP NXTLIN ;******************************************************* ; ; Print signon, open input ; and output files. ; HELLO: LXI D,SIGNON CALL PRTLIN HELLO0: MVI A,HT ; HT after opcode STA PUTHT+1 MVI A,33 ; tab comments to col 25 STA PUTND5+1 XRA A STA TCASFL ; don't convert case STA LCASFL ; reset lower case flag STA JRJPFL ; don't trns JR to JMP STA FLGSTR ; don't flag intrnsc Z80 opcodes MVI A,0C9H STA PUTUNK ; don't write their line nos. LXI D,SPCMSG CALL PRTLIN ; use space after CALL CHKYES ; opcode ? CPI ESC JZ HELLO0 CPI CTRLC JZ ABORT CPI 'Y' CZ SETSPC LXI D,COLMSG CALL PRTLIN ; CALL CHKYES ; start comment CPI ESC JZ HELLO0 CPI CTRLC JZ ABORT CPI 'Y' CZ SETCOL ; in column 33 ? LXI D,JRJPMG CALL PRTLIN ; translate JR CALL CHKYES ; to JMP ? CPI ESC JZ HELLO0 CPI CTRLC JZ ABORT CPI 'Y' CZ SETJRP LXI D,FLGMSG CALL PRTLIN ; flag intrinsic CALL CHKYES ; Z80 opcodes ? CPI ESC JZ HELLO0 CPI CTRLC JZ ABORT CPI 'Y' CZ FLGZ80 LXI D,TRNMSG CALL PRTLIN CALL CHKYES CPI ESC JZ HELLO0 CPI CTRLC JZ ABORT CPI 'L' CZ SETLC CPI 'U' CZ SETUC MVI A,N01 STA COLNUM MVI C,nCDISK CALL BDOS INR A STA xCDISK CALL MAKFNS CALL OPENIN CALL CREATO RET ; SIGNON: DB 'Z80-to-8080 Translator version ' DB VERS/100+'0','.',(VERS MOD 100)/10+'0' DB (VERS MOD 10)+'0' DB CR,LF,0 ; SPCMSG: DB 'Use space (default TAB) after opcode ? ' DB '[Y/ret=N/esc/^C] ',0 ; SETSPC: LXI H,PUTHT+1 MVI A,' ' MOV M,A RET ; COLMSG: DB 'Start comment in column 33 (default 25) ? ' DB '[Y/ret=N/esc/^C] ',0 ; SETCOL: LXI H,PUTND5+1 MVI A,41 MOV M,A RET ; JRJPMG: DB 'Translate JR to absolute JMP ? ' DB '[Y/ret=N/esc/^C] ',0 ; SETJRP: MVI A,0FFH STA JRJPFL RET ; FLGMSG: DB 'Flag intrinsic Z80 opcodes and write ' DB 'line nos. to output file? ' DB '[Y/N/esc/^C] ',0 ; FLGZ80: MVI A,'#' STA FLGSTR MVI A,21H ; LXI H,nn instruction STA PUTUNK RET ; TRNMSG: DB 'Translate instructions to Upper/Lower ' DB 'or preserve case ? ' DB '[U/L/ret/esc/^C] ',0 ; SETLC: STA TCASFL STA LCASFL RET ; SETUC: STA TCASFL RET ;******************************************************* ; ; Gets line from input file to line ; buffer until CR. Filters out ctrl ; chars except for HT. Truncates ; lines after LBUFLN chars. ; Terminates line with CR, LF, 0. ; GETLIN: CALL PDOT ; print activity dot CALL CHKIN ; check for abort CPI CTRLC JZ JABORT XRA A STA QUOTFL STA CMNTFL LXI H,LBUFF ;line buffer MVI B,LBUFLN ;max # of char GETLN1: XCHG LHLD xIBUFF XCHG MOV A,D CPI (IBUFF+IBFLEN)/256 JNZ GETLN4 MOV A,E CPI (IBUFF+IBFLEN) MOD 256 JNZ GETLN4 PUSH H PUSH B LXI D,IBUFF GETLN2: MVI C,nDMA PUSH D CALL BDOS POP D XCHG LXI D,INFCB MVI C,nRDNR PUSH H CALL BDOS POP H DCR A JNZ GETLN3 MVI A,EOF MOV M,A GETLN3: LXI D,RECLEN DAD D XCHG MOV A,D CPI (IBUFF+IBFLEN)/256 JNZ GETLN2 MOV A,E CPI (IBUFF+IBFLEN) MOD 256 JNZ GETLN2 POP B POP H LXI D,IBUFF GETLN4: LDAX D INX D XCHG SHLD xIBUFF XCHG MOV M,A CPI QUOTE ; set or reset JNZ GTLN41 ; QUOTFL LDA QUOTFL CMA STA QUOTFL GTLN41: LDA TCASFL ; Translate to upper or ORA A ; lower case ? JZ GTLN46 ; NO LDA QUOTFL ; If in quote, ORA A ; do nothing JNZ GTLN43 MOV A,M ; otherwise, ';' sets CPI ';' ; CMNTFL JZ GTLN42 CPI EOS ; and EOS resets it JNZ GTLN43 XRA A GTLN42: STA CMNTFL GTLN43: LDA QUOTFL ; If in quote, ORA A ; do nothing JNZ GTLN46 LDA CMNTFL ; If in comment, ORA A ; do nothing JNZ GTLN46 LDA LCASFL ; Otherwise, ORA A ; if LCASFL set MOV A,M JZ GTLN44 CALL LCASE ; trans to lower case JMP GTLN45 GTLN44: CALL UCASE ; else tran to upper case GTLN45: MOV M,A GTLN46: MOV A,M CPI CR JZ GETLN6 CPI HT ; filters out JZ GETLN5 ; all ctrl chars CPI EOF JZ GETLN7 CPI ' ' ; except tab  JC GETLN1 GETLN5: DCR B INX H JNZ GETLN1 INR B DCX H JMP GETLN1 ; GETLN6: INX H MVI M,LF INX H MVI M,N00 XCHG SHLD xIBUFF LHLD LINENO INX H SHLD LINENO RET ; LINENO: DW 0 QUOTFL: DB 0 CMNTFL: DB 0 ; ; Exit ; GETLN7: LHLD xUNKTB CALL CHKBDOS ;ret NC if HL=41? JNC PTND54 DCR A ;no, insert ANI NF8 ;tabs to ADI N09 ;start output CMP B ;at col. 33 JZ PTND54 JC PTND52 MVI A,' ' JMP PTND53 ; PTND52: MVI A,HT PTND53: CALL PUTCHR JMP PTND51 PTND54: LDA TEMP ; insure CPI ' ' ; space JZ PUTND6 ; before CPI HT ; semi-colon JZ PUTND6 ; MVI A,' ' ; CALL PUTCHR ; PUTND6: MOV A,M INX H CPI EOS JZ PTND22 ORA A RZ CALL PUTCHR JMP PUTND6 ; ; Put line at HL to output file until 0 ; and reset colnum to 1. ; PUTLNB: XTHL ;filter trailing POP H ;blanks or tabs PUTLNC: JMP PUTLIN ;******************************************************* ; ; Opcode tables ; OPTONE: DB 'CPL CMA ' DB 'CCF CMC ' DB 'SCF STC ' DB 'HALT HLT ' DB 'RLA RAL ' DB 'RRA RAR ' DB 'RLCA RLC ' DB 'RRCA RRC ' DB 'DAA DAA ' DB 'NOP NOP ' DB 'DI DI ' DB 'EI EI ' DB 0 OPT1Z80: DB 'EXX EXX ' DB 'LDIR LDIR ' DB 'LDI LDI ' DB 'LDDR LDDR ' DB 'LDD LDD ' DB 'CPI CPI ' DB 'CPIR CPIR ' DB 'CPD CPD ' DB 'CPDR CPDR ' DB 'INI INI ' DB 'INIR INIR ' DB 'IND IND ' DB 'INDR INDR ' DB 'OUTI OUTI ' DB 'OTIR OTIR ' DB 'OUTD OUTD ' DB 'OTDR OTDR ' DB 'NEG NEG ' DB 'RLD RLD ' DB 'RRD RRD ' DB 'RETI RETI ' DB 'RETN RETN ' DB 'IM0 IM0 ' DB 'IM1 IM1 ' DB 'IM2 IM2 ' DB 0 OPT2Z80: DB 'DJNZ DJNZ ' DB 'BIT BIT ' DB 'SET SET ' DB 'RES RES ' DB 'RLC RCL ' DB 'RL RL ' DB 'RRC RRC ' DB 'RR RR ' DB 'SLA SLA ' DB 'SRA SRA ' DB 'SRL SRL ' DB 'IM IM ' DB 0 OPTPSD: DB 'DB DB ' DB 'DW DW ' DB 'DS DS ' DB 'DEFB DB ' DB 'DEFW DW ' DB 'DEFS DS ' DB 'EQU EQU ' DB 'DL SET ' DB 'DEFL SET ' DB 'ORG ORG ' DB 0 OPTLOG: DB 'OR ORI ORA ' DB 'AND ANI ANA ' DB 'XOR XRI XRA ' DB 'CP CPI CMP ' DB 'SUB SUI SUB ' DB 0 OPTADD: DB 'ADD ADI ADD ' DB 0 OPTADC: DB 'ADC ACI ADC ' DB 'SBC SBI SBB ' DB 0 OPTEX: DB 'EX XCHG ' DB 0 OPTPP: DB 'PUSH PUSH ' DB 'POP POP ' DB 0 OPTINC: DB 'INC INX INR ' DB 'DEC DCX DCR '  DB 0 OPTLD: DB 'LD MVI MOV ' DB 0 OPTIO: DB 'IN IN ' DW DOIN DB 'OUT OUT ' DW DOUT DB 'RST RST ' DW DORST DB 'JP JMP ' DW DOJP DB 'JR JMP ' DW DOJR DB 'CALL CALL ' DW DOCAL DB 'RET RET ' DW DORET DB 'MEND ENDM ' DW DO180 DB 'MACROMACRO' DW DOMACR DB 'ELSE ELSE ' DW DOELSE DB 0 ;******************************************************* ; ; Process labels, find potential opcode. ; FNDOPC: MOV A,M CPI ' ' JZ FNDOP3 CPI HT JZ FNDOP3 CPI CR ;Pass blank RZ ; lines and CPI ';' ; comment lines RZ CPI '*' ; asterisk in first column JNZ FNDOP1 ; is a comment line MVI M,';' RET ; Come here to process label FNDOP1: MVI C,N00 ; C will have length of label FNDOP2: MOV A,M CPI ':' JZ FNDOP4 CPI HT JZ FNDOP6 CPI ' ' JZ FNDOP6 CPI CR RZ CPI EOS RZ CPI ';' JZ FNDOP7 CALL PUTCHR INX H INR C JMP FNDOP2 ; Comes here only if space or tab at beginning ; of line. FNDOP3: PUSH H CALL SKSPHT ;Find first non-sp or tab CPI CR ;Filter out tabs or JZ FNDOP9 ; spaces at end of line. CPI EOS JZ FNDOP9 POP H CALL PUTSPT ;print until non-sp or ht PUSH H CALL FINDLM ;find ,:+-/*); CR HT or SP at HL CPI ':' POP H JZ FNDOP1 ; found a label, process it JMP FNDOP7 ; ; colon terminating label comes here ; FNDOP4: INX H MOV A,M CPI ':' ; is it a double colon ? JNZ FNDOP5 CALL PUTCHR INX H FNDOP5: MVI A,':' CALL PUTCHR ; HT or SP comes here FNDOP6: ; See if there is an opcode field FNDOP7: PUSH H CALL SKSPHT MOV A,M CPI CR JZ FNDOP9 ; filter trailing SP or TAB CPI EOS JZ FNDOP9 ; exclamation point separator CPI ';' JNZ FNDOP8 ; found opcode field XTHL ; found comment field POP H POP B ; clear return JMP PUTND5 ; tab to proper column ; Have located opcode field FNDOP8: POP H CALL PUTSPT ; Move potential opcode to OPCBUF MOVOPC: SHLD xOPCOD MVI B,OPBFLN LXI D,OPCBUF CALL MOVBDH ;move up to B char from HL to CALL SKSPHT ;DE until ,:+-/*); CR HT SP SHLD xOPRND SUB A INR A RET ; come here on CR to filter trailing SP or TAB FNDOP9: XTHL POP H RET ;******************************************************* ; ; Gets routine address from ; HL+2*OPBFLN and jumps to routine. ; EXEC: PUSH H LXI B,2*OPBFLN DAD B MOV C,M INX H MOV B,M POP H PUSH B ;address on stack RET ;go to it ; ; Scan table at HL for match to OPBFLN ; char string at OPCBUF. ; Ret Z and HL-> entry if match. ; SCANOP: MOV A,M ANA A JZ SCNOP1 PUSH B MVI B,OPBFLN LXI D,OPCBUF CALL CBDEHL ;comp B bytes (DE)-(HL) POP B RZ DAD B JMP SCANOP ; SCNOP1: INR A RET ; ; Scan table at HL for match to string pointed to ; by DE. Enter with A = string length and ; BC = offset to next entry. ; ; Return Z and HL pointing to table entry if ; match. ; SCAN: PUSH B MOV B,A MOV A,M ORA A JZ NOTFND CALL COMP ; comp B bytes (DE)-(HL) MOV A,B POP B RZ  DAD B JMP SCAN ; NOTFND: INR A POP B RET ; ; Compares B chars at DE with chars ; at HL. ; Ret Z if match. ; Preserve HL, DE, BC ; CBDEHL: PUSH H PUSH D PUSH B CBDH1: LDAX D CPI 'a' JC CBDH2 STA LCFLAG ANI 05FH CBDH2: CMP M JNZ CBDH3 INX H INX D DCR B JNZ CBDH1 CBDH3: POP B POP D POP H RET LCFLAG: DB 0 ; ; Compare B bytes at DE with B bytes at HL. ; Set (LCDFLG) if any byte at DE is lower case. ; COMP: PUSH H PUSH D PUSH B COMP1: LDAX D CPI 'a' JC COMP2 STA LCDFLG ANI 5FH COMP2: CMP M JNZ COMP3 INX H INX D DCR B JNZ COMP1 COMP3: POP B POP D POP H RET ; LCDFLG: DB 0 ; ; Put up to OPBFLN char at HL+OPBFLN ; to output file. Stop at space, ; and put tab to output file. ; PUTOPHT: CALL PUTOPC PUTHT: MVI A,HT JMP PUTCHR ; ; ; PUTOPC: LXI B,OPBFLN DAD B ;HL->new opcode MOV B,C PUTOP1: MOV A,M CPI ' ' RZ CPI HT RZ LDA LCFLAG ORA A MOV A,M JZ PUTOP2 ORI 20H PUTOP2: CALL PUTCHR INX H DCR B JNZ PUTOP1 RET ; ; Put string at HL to output file until 0. ; If (LCFLAG) set, convert to lower case. ; PUTOPS: MOV A,M ORA A RZ LDA LCFLAG ORA A MOV A,M JZ PUTOS0 CALL LCASE PUTOS0: CALL PUTCHR INX H JMP PUTOPS ; ; Put string at HL to output file until 0. ; If (LCDFLG) set, convert to lower case. ; PUTRND: MOV A,M ORA A RZ LDA LCDFLG ORA A MOV A,M JZ PUTRN0 CALL LCASE PUTRN0: CALL PUTCHR INX H JMP PUTRND ; ; Put BC character string at HL to output file. ; PUTSTR: MOV A,B ORA C RZ MOV A,M CALL PUTCHR INX H DCX B JMP PUTSTR ; ; Put string at HL until End of Expression (EOE). ; EOE is the first of the tabs or spaces before a ; semicolon or CR. ; ; Returns HL pointing to EOE. ; PUTEOE: PUSH B PUSH D PUSH H ; HL -> start CALL FNDEOE ; returns HL -> EOE MOV B,M MVI M,0 POP H ; HL -> start CALL PUTLIN MOV M,B ; restore original char POP D POP B RET ; ; Put spaces or tabs at HL to output ; file until non-(space or tab) ; PUTSPT: MOV A,M CPI ' ' JZ PUTSP1 CPI HT RNZ PUTSP1: CALL PUTCHR INX H JMP PUTSPT ; ; Find '),' and return HL -> ')'. ; Return NZ if not found. ; FINDPR: MOV A,M CPI CR JZ FNDNPR CPI ',' JZ FNDPR1 INX H JMP FINDPR ; FNDPR1: DCX H MOV A,M CPI ')' RET ; FNDNPR: ORA A RET ; ; Find End of Expression (EOE). ; EOE is the first of the spaces or tabs before ; a semicolon or CR. ; ; Returns HL -> EOE. ; FNDEOE: MOV A,M CPI ';' JZ FNDEO1 CPI CR JZ FNDEO1 INX H JMP FNDEOE ; FNDEO1: DCX H MOV A,M CPI ' ' JZ FNDEO1 CPI HT JZ FNDEO1 INX H RET ; ; Find first ,:+-/*); CR HT SP or exclamation ; point at HL, ; return A = (HL). ; FINDLM: PUSH B CALL CHKDLM POP B RZ INX H JMP FINDLM ; ; Ret Z, A=(HL) if ; HL is ,:+-/*); CR HT SP or exclamation point ; CHKDLM: MOV A,M CPI ':' RZ CPI '+' RZ CPI '-' RZ CPI '/' RZ CPI '*' RZ CPI ')' RZ CPI '!' RZ ; ; Ret Z, A=(HL) if (HL) is CR, SP, HT, ; comma, or semicolon. ; CHKSEP: MOV A,M CPI ',' RZ CPI ' ' RZ CPI HT RZ CPI ';' RZ CPI CR RET ; ; Fill B locations at DE with spaces. ; Move up to B char from HL to DE until ; ,:+-/*); CR HT or SP encountered. ; Return Z and HL->special char if found. ; (search B+1 loc for special char.) ; MOVBDH: MOV C,B MVI B,N00 PUSH B PUSH D PUSH H ; fill BC locations CALL FILLBD ; at DE with spaces POP H ; POP D POP B MOVBD1: PUSH B ; ret Z, A=(HL) CALL CHKDLM ; if (HL) is POP B ; ,:+-/*); CR HT or SP RZ MOV A,M STAX D INX D INX H DCX B MOV A,B ORA C JZ CHKDLM JMP MOVBD1 ; ; Skip spaces and tabs. ; Return HL->non-space or non-tab ; SKSPHT: MOV A,M CPI ' ' JZ SKSPT1 CPI HT RNZ SKSPT1: INX H JMP SKSPHT ; ; Subtract DE from HL, result in HL. ; SBCHLDE: MOV A,L SUB E MOV L,A MOV A,H SBB D MOV H,A RET ; ; Fill BC locations starting at ; DE with spaces. ; Returns A = space, DE -> next free ; location, HL = DE - 1, BC = 0. ; FILLBD: MVI A,' ' STAX D MOV H,D MOV L,E INX D DCX B ; ; (DE)=(HL), INC HL, INC DE, DEC BC ; Repeat until BC = 0. ; MOVIR: MOV A,M STAX D INX H INX D DCX B MOV A,B ORA C JNZ MOVIR RET ;******************************************************* ; ; TRANLATION ROUTINES ; ;******************************************************* ; ; All untranslatable opcodes come here. ; (Well, almost all -- completely unrecognized ; opcodes are passed through unprocessed.) ; DOUNK: POP H ; ; Untranslatable implied addressing Z80 opcodes ; DO1Z80: ; ; Untranslatable register addressing Z80 opcodes ; DO2Z80: CALL ADDLIN ; add line # to unk. table LXI H,FLGSTR CALL PUTLIN ; mark opcode LHLD xOPCOD JMP PUTEND ; FLGSTR: DB '# ',0 ; ; Add current line number to UNKTBL ; ADDLIN: LHLD LINENO XCHG LHLD xUNKTB CALL CHKBDOS ; ret NC if ok RC MOV M,E INX H MOV M,D INX H SHLD xUNKTB RET ; ; ELSE comes here. ; DOELSE: MVI A,HT STA ELSEFL DOPSD1: MVI A,CR STA UPSMSG ; ; Translatable 8080 implied addressing opcodes ; DO180: CALL PUTOPC JMP PUTOPR ; ; Untranslatable pseudo-ops come here. ; DOMACR: MVI A,HT STA MACRFL DOPSD0: MVI A,CR STA UPSMSG ; ; Pseudo-opcodes come here ; DOPSD: CALL PUTOPHT JMP PUTOPR ; ; Logical opcodes SUB, AND, OR, XOR, CP ; DOLOG: PUSH H ; HL -> first translated opcode LHLD xOPRND CALL CHKAC SHLD xOPRND CALL CHKR ; A, B, C, D, E, H, L, (HL) ? JZ DOLOGR CALL CHKIXD ; (IX+d) or (IY+d) ? JZ DOUNK DOLOGL: POP H ; it's a label DOLOG0: CALL PUTOPHT JMP PUTOPR ; ; Register addressed ; DOLOGR: POP D ; DE -> first translated opcode LXI H,OPBFLN DAD D ; HL -> second translation JMP DOLOG0 ; ; Arithmetic ADD ; DOADD: PUSH H LHLD xOPRND CALL CHKAC ; skip 'A,' in A,s form SHLD xOPRND CALL CHKR ; register ? JZ DOLOGR CALL CHKIXD ; (IX+d) or (IY+d) ? JZ DOUNK CALL CHKHL ; ADD HL,xx ? JZ DOADDH CALL CHKIXY ; ADD IX,xx ? JNZ DOLOGL CPI ',' JNZ DOLOGL JMP DOUNK ; ; ADD HL,ss ; DOADDH: CPI ',' JNZ DOUNK INX H LDA LCDFLG MOV B,A LDA LCFLAG ORA B STA LCFLAG XRA A STA LCDFLG CALL CHKRP ;ret DE->reg.pair trans.,HL->nxt JNZ DOUNK LDAX D CPI 'P' JZ DOUNK PUSH H LXI H,OPDAD CALL PUTOPS CALL PUTHT POP H XCHG CALL PUTRND XCHG POP D JMP PUTEND ; OPDAD: DB 'DAD',0 ; ; Arithmetic opcodes ADC, SBC ; DOADC: PUSH H LHLD xOPRND CALL CHKAC ; skip A, in A,s form SHLD xOPRND CALL CHKR ; register ? JZ DOLOGR CALL CHKIXD ; (IX+d) or (IY+d) ? JZ DOUNK CALL CHKHL ; ADD HL,xx ? JZ DOUNK CALL CHKIXY ; ADD IX,xx ? JNZ DOLOGL CPI ',' JNZ DOLOGL JMP DOUNK ; ; Return Z set, HL pointing to delimiter if HL on entry ; points to 'A', 'B', 'C', 'D', 'E', 'H', 'L', or '(HL)'. ; ; If '(HL)' convert to 'M' and modify (xOPRND) to point ; to 'M'. ; CHKR: MOV A,M ANI 5FH CHKR0: CPI 'A' JZ CHKR2 CPI 'B' JZ CHKR2 CPI 'C' JZ CHKR2 CPI 'D'  JZ CHKR2 CPI 'E' JZ CHKR2 CPI 'H' JZ CHKR2 CPI 'L' JZ CHKR2 MOV A,M CPI '(' JZ CHKR3 RET ; CHKR2: INX H CALL CHKDLM ; ret A=(HL) and Z if ,:+-/*); RZ ; SP, CR, or HT DCX H RET ; CHKR3: XCHG ; DE -> '(' LXI H,MREG MVI B,4 CALL COMP ; comp. B bytes (DE)-(HL) XCHG ; HL -> '(' RNZ PUSH H INX H INX H INX H INX H ; HL -> d CALL CHKDLM POP H ; HL -> '(' RNZ INX H INX H INX H LDA LCDFLG ORA A MVI A,'M' JZ CHKR30 ORI 20H ; convert to lower case CHKR30: MOV M,A SHLD xOPRND XRA A ; return Z INX H ; HL -> ',' MOV A,M RET ; MREG: DB '(HL)' ; ; If HL is pointing to 'A,' ; then increment HL by 2 and ; return Z. ; CHKAC: MOV A,M ANI 5FH CPI 'A' RNZ INX H MOV A,M CPI ',' INX H RZ DCX H DCX H RET ; ; If HL -> 'Ad' where d is a delimiter, ; then return Z and HL -> d. ; Otherwise, return NZ and HL unchanged. ; CHKA: MOV A,M ANI 5FH CPI 'A' RNZ INX H CALL CHKDLM RZ DCX H RET ; ; If HL -> 'Id' or 'Rd' where d is a delimiter ; then return Z and HL -> d. ; Otherwise, return NZ and HL unchanged. ; CHKIR: MOV A,M ANI 5FH CPI 'I' JZ CHKR2 CPI 'R' RNZ JMP CHKR2 ; ; If HL is pointing to '(IX+d)' or '(IY+d)' ; then return Z and HL pointing to '+' or ; ')'. ; ; Else, return NZ and HL unchanged. ; CHKIXD: MOV A,M CPI '(' RNZ INX H CALL CHKIXY JZ CHKI1 DCX H RET ; CHKI1: CPI '+' RZ CPI ')' RZ DCX H DCX H DCX H RET ; ; If HL is pointing to IXd or IYd where d is a ; delimiter, then return Z and HL pointing to d. ; ; Else, return NZ and HL unchanged. ; CHKIXY: MOV A,M ANI 5FH CPI 'I' RNZ INX H MOV A,M ANI 5FH CPI 'X' JZ CHKD CPI 'Y' JZ CHKD DCX H RET ; CHKD: INX H CALL CHKDLM RZ DCX H DCX H RET ; ; If HL is pointing to 'HLd' where d is a ; delimiter, then return Z and HL pointing to d. ; ; Otherwise, return NZ and HL unchanged. ; CHKHL: MOV A,M ANI 5FH CPI 'H' RNZ INX H MOV A,M ANI 5FH CPI 'L' JZ CHKD DCX H RET ; ; If HL -> '(HL)d' where d is a delimiter, ; then return Z and HL -> d. ; Otherwise, return NZ and HL unchanged. ; CHKM: MOV A,M CPI '(' RNZ INX H CALL CHKHL JNZ CHKM2 CPI ')' JNZ CHKM1 INX H CALL CHKDLM RZ DCX H CHKM1: DCX H DCX H CHKM2: DCX H RET ; ; If HL is pointing to one of the following ; register pairs, return Z, HL pointing to d ; where d is a delimiter, and DE pointing to ; translation: ; ; rp translation ; ; AFd PSW ; BCd B ; DEd D ; HLd H ; SPd SP ; ; Otherwise, return NZ and HL unchanged. ; CHKRP: XCHG LXI H,RPTBL MVI A,2 ; string length LXI B,6 ; increment to next table entry CALL SCAN XCHG RNZ INX D INX D ; DE points to translation INX H INX H ; HL points to d CALL CHKDLM RZ DCX H DCX H RET ; RPTBL: DB 'BCB',0,0,0 DB 'DED',0,0,0 DB 'HLH',0,0,0 DB 'SPSP',0,0 DB 'AFPSW',0 DB 0 ; ; If HL is pointing to '(BC)d' or '(DE)d', ; then return Z, HL pointing to d, and ; DE pointing to translation. ; CHKBCDE: XCHG LXI H,BCDETBL MVI A,4 ; string length LXI B,6 ; offset to next entry CALL SCAN ; ret Z and HL->entry XCHG ; if DE in table RNZ INX D INX D INX D INX D ; DE->translation INX H INX H INX H INX H ; HL->d CALL CHKDLM RZ DCX H DCX H DCX H DCX H RET ; BCDETBL: DB '(BC)B',0 DB '(DE)D',0 DB 0 ; ; EX ; DOEX: PUSH H ; HL -> first translated opcode LHLD xOPRND XCHG LXI H,EXTBL1 ; EX DE,HL ? MVI A,5 ; string length LXI B,10 ; offset to nxt entry CALL SCAN LXI B,EXTBL1+5 LXI H,5 JZ DOXCHG LXI H,EXTBL2 ; EX (SP),HL ? MVI A,7 LXI B,12 CALL SCAN ; return HL -> entry LXI B,EXTBL2+7 JNZ DOUNK ; DOXTHL: LXI H,7 DOXCHG: DAD D PUSH B CALL CHKDLM ; preserves HL, DE POP D ; DE->trans. JNZ DOUNK XCHG ; HL->translated opcode LDA LCDFLG MOV B,A LDA LCFLAG ORA B STA LCFLAG CALL PUTOPS ; put string at HL XCHG POP D ; clear stack JMP PUTEND ; EXTBL1: DB 'DE,HL'  DB 'XCHG',0 DB 0 ; EXTBL2: DB '(SP),HL' DB 'XTHL',0 DB 0 ; ; PUSH or POP ; DOPP: PUSH H ; HL -> translated opcode LHLD xOPRND CALL CHKRP ; ret DE->transl., HL->nxt JNZ DOUNK LDAX D CPI 'S' JZ DOUNK DOOPR: SHLD xOPRND POP H CALL PUTOPHT XCHG CALL PUTRND JMP PUTOPR ; ; INC or DEC ; DOINC: PUSH H ; HL-> first translated opcode LHLD xOPRND CALL CHKR JZ DOLOGR CALL CHKRP ; ret DE->transl., HL->nxt JNZ DOUNK LDAX D CPI 'P' JZ DOUNK JMP DOOPR ; ; LD ; DOLD: PUSH H ; HL->first translated opcode LHLD xOPRND CALL CHKR JZ DOLDR CALL CHKRP ; ret HL->dlm, DE->tranl. RP JZ DOLDRP MOV A,M CPI '(' JNZ DOUNK CALL CHKIXD JZ DOUNK CALL CHKIXY JZ DOUNK CALL CHKIR JZ DOUNK CALL CHKBCDE JZ DOSTAX ; ; Do LD (nn),HL or LD (nn),a ; INX H PUSH H CALL FINDPR ; find '),' POP D ; DE -> nn JNZ DOUNK PUSH H CALL SBCHLDE XTHL ; (SP) = length INX H ; HL -> ',' INX H ; HL -> 'A' or 'HL' CALL CHKHL JZ DOSHLD CALL CHKA POP B ; BC = length JNZ DOUNK ; ; LD (nn),A -> STA nn ; DOSTA: PUSH H ; DE->nn, HL->rest LXI H,OPSTA DOST1: CALL PUTOPS CALL PUTHT ; put HT XCHG ; HL->nn CALL PUTSTR ; put BC chars at HL POP H ; HL->rest of line POP D ; clean stack JMP PUTEND ; ; LD (nn),HL -> SHLD nn ; DOSHLD: POP B PUSH H LXI H,OPSHLD JMP DOST1 ; OPSTA: DB 'STA',0 OPSHLD: DB 'SHLD',0 OPSTAX: DB 'STAX',0 ; ; LD (DE),A or LD (BC),A -> STAX D or B ; DOSTAX: CPI ',' JNZ DOUNK INX H CALL CHKA JNZ DOUNK SHLD xOPRND LXI H,OPSTAX CALL PUTOPS CALL PUTHT XCHG ; HL-> translation CALL PUTRND POP D ; clean stack JMP PUTOPR ; ; LD BC,nn -> LXI B,nn ; LD DE,nn -> LXI D,nn ; LD HL,nn -> LXI H,nn ; LD HL,(nn) -> LHLD nn ; LD SP,nn -> LXI SP,nn ; LD SP,HL -> SPHL ; LD SP,IX -> unk ; LD SP,IY -> unk ; LD dd,(nn) -> unk ; ; HL -> delim, DE -> translated RP. ; DOLDRP: CPI ',' INX H JNZ DOUNK LDAX D CPI 'P' JZ DOUNK CPI 'S' JZ DOLDRS MOV A,M CPI '(' JZ DOLDPL ; ; LD dd,nn ; DOLDLX: PUSH H ; HL -> nn LXI H,OPLXI CALL PUTOPS CALL PUTHT XCHG ; HL -> translated RP CALL PUTRND MVI A,',' CALL PUTCHR POP H ; HL -> nn CALL PUTEOE ; put nn to output file POP D ; clean stack JMP PUTEND ; OPLXI: DB 'LXI',0 ; ; LD SP,xx ; ; HL -> next, DE -> translated RP. ; DOLDRS: CALL CHKIXY JZ DOUNK CALL CHKHL JNZ DOLDLX SHLD xOPRND LXI H,OPSPHL CALL PUTOPS POP D ; clean stack JMP PUTOPR ; OPSPHL: DB 'SPHL',0 ; ; LD dd,(nn) ; DOLDPL: LDAX D ; DE -> translated RP CPI 'H' JNZ DOUNK INX H ; HL -> nn PUSH H CALL FNDEOE ; find end of expression nn CPI ')' POP D ; DE -> nn, HL -> EOE JNZ DOUNK DCX H ; HL -> ')' PUSH H LXI H,OPLHLD DOLDPL1: CALL PUTOPS CALL PUTHT POP H ; HL -> ')', DE -> nn MVI M,0 XCHG ; HL -> nn INX D ; DE -> EOE CALL PUTLIN XCHG ; HL -> EOE POP D ; clean stack JMP PUTEND ; OPLHLD: DB 'LHLD',0 ; ; LD r,x ; DOLDR: CPI ',' JNZ DOUNK INX H MOV A,M CPI '(' JZ DOLDR1 CALL CHKR JZ DOLOGR CALL CHKIR ; LD I,x or LD R,x JZ DOUNK JMP DOLOGL ; DOLDR1: CALL CHKIXD JZ DOUNK CALL CHKBCDE JZ DOLDAX INX H ; HL-> nn) CALL CHKHL JNZ DOLDA CPI ')' JNZ DOUNK DCX H DCX H DCX H DCX H MOV B,M DCX H MOV A,M INX H INX H INX H MOV M,A SHLD xOPRND INX H MOV M,B INX H LDA LCDFLG ORA A MVI A,'M' JZ DOLDR2 ORI 20H DOLDR2: MOV M,A JMP DOLOGR ; ; LD r,(nn) ; ; HL -> '(' ; DOLDA: PUSH H LHLD xOPRND MOV A,M POP H ANI 5FH CPI 'A' JNZ DOUNK PUSH H ; HL -> nn) CALL FNDEOE CPI ')' POP D ; DE -> nn, HL -> EOE JNZ DOUNK DCX H ; HL -> ')' PUSH H LXI H,OPLDA JMP DOLDPL1 ; OPLDA: DB 'LDA',0 ; ; LD r,(BC) or LD r,(DE) ; ; DE -> tranlated RP, HL -> d ; DOLDAX: PUSH H LHLD xOPRND MOV A,M POP H ANI 5FH CPI 'A' JNZ DOUNK PUSH H LXI H,OPLDAX CALL PUTOPS CALL PUTHT POP H ; HL -> d XCHG ; HL -> translated RP CALL PUTRND XCHG ; HL -> d POP D ; clean stack JMP PUTEND ; OPLDAX: DB 'LDAX',0 ; ; RST nn -> RST nn/8 ; DORST: CALL PUTOPHT LHLD xOPRND CALL PUTEOE MVI A,'/' CALL PUTCHR MVI A,'8' CALL PUTCHR JMP PUTEND ; ; IN r,(C) -> unk ; IN A,(nn) or IN A,nn -> IN nn ; DOIN: PUSH H LHLD xOPRND CALL CHKAC JNZ DOUNK MOV A,M CPI '(' JNZ DOIN1 INX H DOIN1: XCHG ; DE -> nn POP H ; HL -> translated opcode CALL PUTOPHT XCHG ; HL -> nn PUSH H CALL FNDEOE CPI ')' JNZ DOIN2 DCX H MVI M,' ' DOIN2: POP H ; HL -> nn CALL PUTEOE JMP PUTEND ; ; If HL -> '(C)d' where d is a delimiter, ; then return Z and HL -> d. ; Otherwise, return NZ and HL unchanged. ; CHKC: MOV A,M CPI '(' RNZ INX H MOV A,M ANI 5FH CPI 'C' JNZ CHKC2 INX H MOV A,M CPI ')' JNZ CHKC1 INX H CALL CHKDLM RZ DCX H CHKC1: DCX H CHKC2: DCX H RET ; ; OUT (C),A -> unk ; OUT (nn),A or OUT nn,A -> OUT nn ; DOUT: PUSH H ; HL -> translated opcode LHLD xOPRND CALL CHKC JZ DOUNK MOV A,M CPI '(' JNZ DOUT1 INX H DOUT1: PUSH H ; HL -> nn DOUT10: MOV A,M CPI ',' JZ DOUT11 CPI ';' JZ DOUT4 CPI CR JZ DOUT4 INX H JMP DOUT10 ; DOUT11: DCX H MOV A,M CPI ')' JZ DOUT2 INX H SHLD XEND JMP DOUT3 ; DOUT2: SHLD XEND INX H DOUT3: INX H ; HL -> 'A' CALL CHKA JNZ DOUT4 SHLD xOPRND POP D ; DE -> nn POP H ; HL -> opcode CALL PUTOPHT LHLD XEND MVI M,0 XCHG ; HL -> nn CALL PUTLIN JMP PUTOPR ; DOUT4: POP H JMP DOUNK ; XEND: DW 0 ; ; Translate JR to absolute JMP if requested ; DOJR: LDA JRJPFL ORA A JZ DO2Z80 ; ; JP (HL) -> PCHL JP (IX) -> unk ; JP nn -> JMP nn JP (IY) -> unk ; ; JP NZ,nn -> JNZ nn JP Z,nn -> JZ nn ; JP NC,nn -> JNC nn JP C,nn -> JC nn ; JP PO,nn -> JPO nn JP P,nn -> JP nn ; JP PE,nn -> JPE nn JP M,nn -> JM nn ; DOJP: PUSH H ; HL -> translated opcode (JMP) LHLD xOPRND CALL CHKM ; '(HL)' ? JZ DOPCHL CALL CHKIXD ; '(IX)' or '(IY)' JZ DOUNK DOJP1: CALL CHKCC ; 'Z', 'C', 'P', or 'M' ? JZ DOCC CALL CHKNC ; 'NZ', 'NC' ? JZ DONC CALL CHKPOE ; 'PO', 'PE' ? JZ DOPOE POP H ; HL -> translated opcode CALL PUTOPC CALL PUTHT JMP PUTOPR JRJPFL: DB 0 ; ; CALL ; DOCAL: PUSH H LHLD xOPRND JMP DOJP1 ; ; RET ; DORET: PUSH H LHLD xOPRND DORET1: CALL CHKCC ; 'Z', 'C', 'P', or 'M' ? JZ DORCC CALL CHKNC ; 'NZ', 'NC' ? JZ DORCC CALL CHKPOE ; 'PO', 'PE' ? JZ DORPOE POP H ; HL -> translated opcode CALL PUTOPC JMP PUTOPR ; ; JP (HL) ; DOPCHL: PUSH H LXI H,OPPCHL CALL PUTOPS POP H POP D ; clear stack JMP PUTEND ; OPPCHL: DB 'PCHL',0 ; ; Condition codes 'PO' or 'PE' ; DOPOE: INX H DORPOE: MVI A,CR STA POEFLG PUSH H PUSH D CALL ADDLIN POP D POP H JMP DORCC ; ; Condition Codes 'Z', 'C', 'P', or 'M' ; DOCC: DONC: INX H DORCC: PUSH H ; HL -> nn LHLD xOPCOD MOV A,M CALL PUTCHR XCHG ; HL -> cc CALL PUTLIN LDAX D ; DE -> opcode ANI 5FH CPI 'R' CNZ PUTHT POP H ; HL -> nn POP D ; clean stack JMP PUTEND  ; ; If HL -> 'Zs', 'Cs', 'Ps', or 'Ms', ; where s is SP, HT, CR, comma, or semicolon ; then return Z and HL -> s. ; Otherwise, return NZ and HL unchanged. ; CHKCC: MOV A,M ANI 5FH CPI 'Z' JZ CHKCC1 CPI 'C' JZ CHKCC1 CPI 'P' JZ CHKCC1 CPI 'M' JZ CHKCC1 RET ; CHKCC1: MOV A,M LXI D,OPCC STAX D INX H CALL CHKSEP ; SP HT CR , ; JNZ CHKCC2 RET ; OPNC: DB 0 OPCC: DB 0,0 ; ; If HL -> 'NCs' or 'NZs' where s is ; SP, HT, CR, comma or semicolon then ; return Z, HL -> s, DE -> cc string. ; Otherwise, return NZ and HL, DE unchanged. ; CHKNC: MOV A,M ANI 5FH CPI 'N' RNZ MOV A,M LXI D,OPNC STAX D INX H MOV A,M ANI 5FH CPI 'Z' JZ CHKNC1 CPI 'C' JZ CHKNC1 DCX H RET ; CHKNC1: MOV A,M STA OPCC INX H CALL CHKSEP RZ ; CHKNC2: DCX H CHKCC2: DCX H RET ; ; If HL -> 'POs' or 'PEs' then ; return Z, HL -> s, and DE -> cc. ; Otherwise, return NZ and HL unchanged. ; CHKPOE: MOV A,M ANI 5FH CPI 'P' RNZ MOV A,M LXI D,OPNC STAX D INX H MOV A,M ANI 5FH CPI 'E' JZ CHKNC1 CPI 'O' JZ CHKNC1 DCX H RET ;******************************************************* ; ; Set up input and output FCB's from DFCB ; MAKFNS: LXI H,DFCB1 LXI D,INFCB LXI B,FNLEN+1 CALL MOVIR MOV A,M ; typ specified ? CPI ' ' JZ MKFNS1 CPI '?' JZ MKFNS1 LXI B,3 CALL MOVIR MKFNS1: LXI H,DFCB1 LXI D,OUTFCB LXI B,FNLEN+1 CALL MOVIR LDA DFCB2 ; ORA A ; allows output to JZ MKFNS2 ; different drive STA OUTFCB ; than input MKFNS2: LDA DFCB2+1 ; CPI ' ' ; JZ MKFNS3 ; allows output LXI B,8 ; file to have LXI D,OUTFCB+1 ; different name LXI H,DFCB2+1 ; from input file CALL MOVIR ; MKFNS3: LDA DFCB2+9 CPI ' ' JZ MKFNS4 LXI B,3 LXI D,OUTFCB+9 LXI H,DFCB2+9 CALL MOVIR MKFNS4: LXI D,PRFNM1 CALL PRTLIN LXI H,INFCB CALL PRFNAM LXI D,PRFNM2 CALL PRTLIN LXI H,OUTFCB CALL PRFNAM LXI D,CRLFMG CALL PRTLIN RET ; ; Print Filenames ; PRFNAM: MOV A,M ; disk number ORA A  JNZ PRFN1 LDA xCDISK PRFN1: ADI '@' CALL CONOUT MVI A,':' CALL CONOUT INX H MVI B,8 CALL PRFN MVI A,'.' CALL CONOUT MVI B,3 PRFN: MOV A,M INX H CPI ' ' CNZ CONOUT DCR B JNZ PRFN RET ; PRFNM1: DB 'Source File: ',0 PRFNM2: DB ', Destination File: ',0 ; ; Open source file with ext Z80 ; OPENIN: LXI D,INFCB MVI C,nOPEN CALL BDOS CPI NFF JZ NSFERR LXI H,IBUFF+IBFLEN SHLD xIBUFF RET ; INFCB: DB 0,0,0,0,0,0,0,0 DB 0,'Z80',0,0,0,0 DB 0,0,0,0,0,0,0,0 DB 0,0,0,0,0,0,0,0 DB 0 ; NSFERR: LXI D,NSFMSG ;'No Source File' JMP EREXIT ; NSFMSG: DB 'No Source File Found' DB CR,LF,BEL,0 ; ; Create output file with ext ASM ; CREATO: LXI D,OUTFCB MVI C,nOPEN CALL BDOS CPI NFF JNZ OFEERR CREAT4: LXI D,OUTFCB MVI C,nCREAT CALL BDOS CPI NFF JZ NDSERR LXI D,OUTFCB MVI C,nOPEN CALL BDOS MVI A,RECLEN STA OBUFCT LXI H,OBUFF SHLD xOBUFF RET ; OUTFCB: DB 0,0,0,0,0,0,0,0 DB 0,'ASM',0,0,0,0 DB 0,0,0,0,0,0,0,0 DB 0,0,0,0,0,0,0,0 DB 0 ; NDSERR: LXI D,NDSMSG ;'No directory space' JMP EREXIT ; NDSMSG: DB 'No Directory Space' DB CR,LF,BEL,0 ; OFEERR: LXI D,OFEMSG ;'Output file exists' CALL PRTLIN CALL CHKYES JNZ ABORT LXI D,OUTFCB MVI C,nDEL CALL BDOS JMP CREAT4 ; OFEMSG: DB 'Output File Already Exists' DB ' -- Delete it and Continue ? (Y/N) ' DB BEL,0 ; ; Put char in A to output file, ; update column number. ; PUTCHR: PUSH H PUSH D PUSH B PUSH PSW STA TEMP LHLD xOBUFF MOV M,A CPI CR JZ PUTCH0 CPI LF JZ PUTCH0 CPI HT JNZ PUTCH1 LDA COLNUM DCR A ANI NF8 ADI N09 JMP PUTCH2 TEMP: DB 0 ; PUTCH0: MVI A,1 JMP PUTCH2 ; PUTCH1: LDA COLNUM INR A PUTCH2: STA COLNUM INX H ;inc obuff ptr LDA OBUFCT DCR A ;dec obuff count JNZ PTCH21 MVI A,RECLEN PTCH21: STA OBUFCT MOV A,H CPI (OBUFF+OBFLEN)/256 JNZ PUTCH4 MOV A,L CPI (OBUFF+OBFLEN) MOD 256 JNZ PUTCH4 LXI D,OBUFF PUTCH3: MVI C,nDMA PUSH D CALL BDOS POP D  XCHG LXI D,OUTFCB CALL WRTREC ;write record LXI D,RECLEN DAD D XCHG MOV A,D CPI (OBUFF+OBFLEN)/256 JNZ PUTCH3 MOV A,E CPI (OBUFF+OBFLEN) MOD 256 JNZ PUTCH3 LXI H,OBUFF PUTCH4: SHLD xOBUFF POP PSW POP B POP D POP H RET ; ; Put line at HL to output file until 0. ; PUTLIN: MOV A,M ORA A RZ CALL PUTCHR INX H JMP PUTLIN ; ; Write record. ; WRTREC: MVI C,nWRNR PUSH H CALL BDOS POP H ANA A RZ LXI D,OFWMSG ;'output file write error' JMP EREXIT ; OFWMSG: DB 'Output File Write Error' DB CR,LF,BEL,0 ; ; Fill rest of obuff with EOF, ; write record, and close file. ; CLOSEO: MVI A,EOF CALL PUTCHR LDA OBUFCT CPI RECLEN JNZ CLOSEO ; CLOSE1: LXI D,OBUFF LHLD xOBUFF MOV A,H CMP D JNZ CLOSE3 MOV A,L CMP E JNZ CLOSE3 CLOSE2: LXI D,OUTFCB MVI C,nCLOSE JMP BDOS ; CLOSE3: MVI C,nDMA PUSH D CALL BDOS POP D XCHG LXI D,OUTFCB CALL WRTREC LXI D,RECLEN DAD D XCHG LDA xOBUFF+1 CMP D JNZ CLOSE3 LDA xOBUFF CMP E JNZ CLOSE3 JMP CLOSE2 ;******************************************************* ; ; Print line at DE until 0 ; on console. ; PRTLIN: LDAX D ANA A RZ CALL CONOUT INX D JMP PRTLIN ; ; Console Output character in A. ; CONOUT: PUSH PSW PUSH B PUSH D PUSH H MOV E,A MVI D,N00 MVI C,nCOUT CALL BDOS POP H POP D POP B POP PSW RET ; ; Get char in A from CONSOLE and ; return Z set if char.AND.5FH = 'Y'. ; CHKYES: MVI C,nCIN CALL BDOS PUSH PSW CALL CRLF POP PSW ANI 0DFH CPI 'Y' RET ; ; Return Z if no char available, ; otherwise, get char in A. ; CHKIN: MVI C,nCDAV CALL BDOS ORA A RZ MVI C,nCIN CALL BDOS RET ; ; ; CRLF: LXI D,CRLFMG JMP PRTLIN ; ; If HL < base of bdos - 255 ; then return NC. ; Otherwise, return C. ; CHKBDOS: PUSH D XCHG LHLD BDOS+1 DCR H ORA A CALL SBCHLDE ; HL = ^bdos-^table XCHG POP D RET ; ; Convert upper case in A to lower case. ; LCASE: CPI 'A' RC CPI 'Z'+1 RNC ORI 20H RET ; ; Convert lower case in A to upper case. ; UCASE: CPI 'a' RC CPI 'z'+1 RNC ANI 5FH RET ; ; Prints the number in HL ; as a decimal number. ; PDNHL: LXI D,10000 CALL PDDHL LXI D,1000 CALL PDDHL LXI D,100 CALL PDDHL LXI D,10 CALL PDDHL MOV A,L ADI '0' JMP CONOUT ; ; Prints on console decimal digits of ; the number in HL. Call repetitively ; with DE equal to 10000, 1000, 100, 10, ; and 1. Each call prints one digit. ; Do not disturb HL between calls. ; Enter with C = 0 to suppress leading ; zeros or C = '0' to print leading zeros. ; PDDHL: MVI B,'0'-1 PDD0: INR B ORA A CALL SBCHLDE JNC PDD0 DAD D MOV A,B CPI '0' JNZ PDD1 CMP C RNZ PDD1: MVI C,'0' JMP CONOUT ; ; ; Puts to output file the number ; in HL as a decimal number. ; FDNHL: LXI D,10000 CALL FDDHL LXI D,1000 CALL FDDHL LXI D,100 CALL FDDHL LXI D,10 CALL FDDHL MOV A,L ADI '0' JMP PUTCHR ; ; Puts to output file decimal digits of ; the number in HL. Call repetitively ; with DE equal to 10000, 1000, 100, 10, ; and 1. Each call prints one digit. ; Do not disturb HL between calls. ; Enter with C = 0 to suppress leading ; zeros or C = '0' to print leading zeros. ; FDDHL: MVI B,'0'-1 FDD0: INR B ORA A CALL SBCHLDE JNC FDD0 DAD D MOV A,B CPI '0' JNZ FDD1 CMP C RNZ FDD1: MVI C,'0' JMP PUTCHR ; ; Print activity dot every 100 lines ; PDOT: LDA LNCNT DCR A STA LNCNT RNZ MVI A,'.' CALL CONOUT MVI A,100 ; Dot every 100 lines STA LNCNT LDA DOTCNT DCR A STA DOTCNT JNZ PDOT1 MVI A,' ' CALL CONOUT MVI A,10 ; Space every 10 dots STA DOTCNT PDOT1: LDA NLCNT DCR A STA NLCNT RNZ CALL CRLF MVI A,50 ; 50 dots per line STA NLCNT RET ; LNCNT: DB 100 ; Dot every 100 lines DOTCNT: DB 10 ; Space every 10 dots NLCNT: DB 50 ; 50 dots per line ; Uninitialized data area xCDISK: DS 1 DS STCKLN STACK: EQU $ SPBDOS: DS 2 COLNUM: DS 1 xOPCOD: DS 2 OPCBUF: DS OPBFLN xOPRND: DS 2 xOBUFF: DS 2 OBUFCT: DS 1 OBUFF: DS OBFLEN LBUFF: DS LBUFLN+3 xIBUFF: DS 2 IBUFF: DS IBFLEN UNKTBL: DS 1 END START ading zeros. ; FDDHL: MVI B,'0'-1 FDD0: INR B ORA A CALL SBCHLDE JNC FDD0 DAD D MOV A,B CPI '0' JNZ FDD1 CMP C RNZ FDD1: MVI C,'0' JMP PUTCHR ; ; Print activity dot every 100 lines ; PDOT: LDA LNCNT DCR A STA LNCNT RNZ MVI A,'.' CALL CONOUT MVI A,100 ; Dot every 100 lines STA LNCNT LDA DOTCNT DCR A STA DOTCNT JNZ PDOT1 MVI A,' ' CALL CONOUT MVI A,10 ; Space every 10 dots STA DOTCNT PDOT1: LDA NLCNT DCR A STA NLCNT RNZ CALL CRLF MVI A,50 ; 50 dots per line STA NLCNT RET ; LNCNT: DB 100 ; Dot every 100 lines DOTCNT: DB 10 ; Space every 10 dots NLCNT: DB 50 ; 50 dots per line ; Uninitialized data area xCDISK: DS 1 DS STCKLN STACK: EQU $ SPBDOS: DS 2 COLNUM: DS 1 xOPCO9 XLTZ80 translates Intel 8080 assembly language source code into Zilog Z80 assembly language source code. It is invoked by a command of the form: XLTZ80 [d:]srcfile[.typ] [d:destfile.typ] The brackets denote optional parameters and the default values are: Source file-type -- ASM Destination file-type -- Z80 Destination file-name -- same as source file-name Drive -- current drive *** This program will run only on a Z80 processor *** Press any key to continue - Examples: XLTZ80 PRGM1 --translates PRGM1.ASM to PRGM1.Z80 XLTZ80 PRGM1 PRGM2 --translates PRGM1.ASM to PRGM2.Z80 XLTZ80 PRGM1.TXT PRGM2.MAC --translates PRGM1.TXT to PRGM2.MAC XLTZ80 also has the following features: Case will be preserved as well as possible -- if an opcode has a lower case character, the translated opcode will be in lower case. All asterisks at the beginning of lines will be replaced with semicolons. A dot is printed on the console for every 100 lines of input processed. !9"j1:] ;*jqͷZ ;>D2g > 2>)2e >222:p{(YĢ:((Y(Y#*(Y[awL̬U̳>2<2i#:!a8080-to-Z80 Translator version 2.64 .Z80 ASEG 22 2Translate DB & EQU ? [Y/ret=N/esc/^C] 2g Use space (default TAB) after opcode ? [Y/ret=N/esc/^C] !> wStart comment in column 25 (default 33) ? [Y/ret=N/esc/^C] !e >!wIgnore ! statement separator ? [Y/ret=N/esc/^C] >2Translate instructions to Upper/Lower or preserve case ? [U/L/ret/esc/^C] 2220 22!P[L z( 4{N /N = >wz( {N N SL w' :/2~͂w:(/: ~;( 2: : :~('w~ ( ( (-( #+#6 #6SL !:>!>͝    E  *** Job Cancelled *** The following operands have been used in your source and have not been fully translated. You must complete the translation using an editor. original: must be translated to: #ENDIF ENDIF ICL *INCLUDE LST LIST MAC <$parameters> MACRO <#parameters> [ ... ] MEND #macro-call macro-call *** End of Job *** !ͤ ʑ !9  ͻʇ!  ͻʍ!g  ͻʇ!|  ͻʓ!  ͻ!ͻ3![ͻʄ!ͻʓ!ͻʞ! ͻ**2|2~ (U (Q ;(_ '  (#4#~;(I:( ~ 6 ] :& ( (> >!] 4 (Q(;~( 4):0= ( 8> > :& ( (> ~# ~ (4 (0 ;* 6;~:(4 (? (; ;(1# 4 (Q(M:(#~: #>:4~ (&("; d "4"  A~ :|~( #~:~(#?#H}??~ ( #~ ,; :+-/*)a82|_ #> bk   *~M( m #!#! (HL)(hl)*  2~a82_B(D(H(P(>2*#-#0##~a82_S #~_W '#++AFBCDEHL:!tE(-!vN(&!xL(!zG(!|e(!~n( !l(!~2#~2Z NZC NCz nzc nc!Ͳ RET ! CALL !Ͳ>, JP :: !:|(!HL,hl,!:|ʨ!èA,a,! :|X!LA,(a,(*~a82_B(D( !;d!BdA,(BC)A,(DE)!f:|(!k;>) HL,(hl,(*~M( m !!#~#Ù;!:|2!2,A,a!:|ʨ!è!è8*>(;!:|(F!A),HL),hl!:|ʨ!èSP,HLsp,hl>(;!9:|(!= ),A),a*~a82_B(D( !n!u*# (BC),A(DE),A!:|( !DE,HLde,hl!:|(! (SP),HL(sp),hl*~;( ((#+~ ( (#*z {~#> 2 > 2  > 2 > 2 > 2 !\ ~ ( ?(!\k :l(2k:m ( l!m:u ( t!u!̓!k̓~ :i@>:#͡>.~# Source File: , Destination File: ( >!N("L õNo Source File Found ASMk ]k(k>2!"UõNo Directory Space Z80kOutput File Already Exists -- Delete it and Continue ? (Y/N) ~#~ ( #> > 2&* >!w ( ( :=  >:<2#:= >2| (} #ksz { !"õOutput File Write Error >: *| } kks: : __Y  A[ a{_:f=2f>.>d2f:g=2g > > 2g:h=2h>22hd 2_:|( !DE,HLde,hl!:|(! (SP),HL(sp),hl*~;( ((#+~ ( (#*z {~#> 2 > 2  > 2 > 2 > 2 !\ ~ ( ?(!\k :l(2k:m ( l!m:u ( t!u!̓!k̓~ :i@>:#͡>.~# Source File: , Destination File: ( >!N("L õNo Source File Found ************************************************************************ XLTZ80 Translates Intel 8080 assembly language source code to Zilog Z80 assembly language source code. ************************************************************************ This is a modified version of Richard Conn's XLATE2 with several improvements. It does not split long unrecognized macro names. It uses larger buffers so that it operates much faster. It processes lines with the exclamation point statement separator correctly. It strips trailing blanks or tabs from lines. It replaces initial asterisks in lines with semicolons. It gives you several options to format the output file for best appearance. This program gives the choice of converting the case of instructions to upper or lower case or of trying to preserve the case of instructions. An activity dot is printed on the console for every 100 lines of input processed. Note that this program runs only on a Z80. 11/12/84 Frank J. Zerilli Command line: XLTZ80 [d:]srcfile[.typ] [d:destfile.typ] All parameters in brackets are optional, and, if omitted, the default values are: Source file-type -- ASM Destination file-type -- Z80 Destination file-name -- same as the source file-name Drive -- current drive Examples: XLTZ80 { prints help message } XLTZ80 FILE1 {translates FILE1.ASM to FILE1.Z80} XLTZ80 FILE1 FILE2 {translates FILE1.ASM to FILE2.Z80} XLTZ80 FILE1.TXT FILE2.MAC {translates FILE1.TXT to FILE2.MAC} FLAG LOCATIONS: 103H -- Change to non-zero value to suppress translation of several non-standard opcodes: REQ, RNE, RLT, RGE, CEQ, CNE, CLT, CGE, JEQ, JNE, JLT, JGE, ENT, NAM, RAM, ROG, IFC, ICL, LST, MAC 104H -- If non-zero (default) XLTZ80 converts lines with multiple statements separated by DR's '!' separator into separate lines. Change to zero for output on a single line with the translated statements separated by '!'. 105H -- Change to non-zero to output the header lines .Z80 ASEG for the M80 assembler. Default is not to output these lines. ve -- current drive Examples: XLTZ80 { prints help message } XLTZ80 FILE1 {translates FILE1.ASM to FILE1.Z80} XLTZ80 FILE1 FILE2 {translates FILE1.ASM to FILE2.Z80} XLTZ80 FILE1.TXT FILE2.MAC {translates FILE1.TXT to FILE2.MAC} FLAG LOCATIONS: 103H -- Change to non-zero value to suppress translation of several non-standard opcodes: REQ, RNE, RLT, RGE, CEQ, CNE, CLT, CGE, JEQ, JNE, JLT, JGE, ENT, NAM, RAM, ROG, IFC, ICL, LST, MAC 104H -- If non-zero (default) XLTZ80 converts lines with multiple stat; ; XLTZ80 ; ; Translates Intel 8080 assembly language source code ; to Zilog Z80 assembly language source code. ; VERS: EQU 264 ; ; This is a modified version of Richard Conn's ; XLATE2 with several improvements. It does ; not split long unrecognized macro names. It ; uses larger buffers so that it operates much ; faster. It preserves the case of instructions ; or gives you the option to translate to upper ; or lower case. It processes lines ; with the exclamation point statement separator ; correctly. It strips trailing blanks or tabs ; from lines. It replaces initial asterisks in ; lines with semicolons. It gives you several ; options to format the output file for best ; appearance. ; ; This program runs only on a Z80. ; ; 11/12/84 Frank J. Zerilli ; ; ; ; FLAG LOCATIONS: ; ;103H -- Change to non-zero value to suppress ; translation of several non-standard opcodes: ; REQ, RNE, RLT, RGE, CEQ, CNE, CLT, CGE, ; JEQ, JNE, JLT, JGE, ; ENT, NAM, RAM, ROG, IFC, ICL, LST, MAC ; ;104H -- If non-zero (default) XLTZ80 converts lines ; with multiple statements separated by DR's '!' ; separator into separate lines. ; Change to zero for output on a single line with ; the translated statements separated by '!'. ; ;105H -- Change to non-zero to output the header lines ; .Z80 ; ASEG ; for the M80 assembler. Default is not to ; output these lines. ; N00: EQU 0 N01: EQU 1 ; N07: EQU 7 N09: EQU 9 ;tab every 8th col. N29: EQU 41 ;col+8 for trailing ; NF8: EQU 0F8H ;mod 8 ; LBUFLN: EQU 80 ;line buffer length OPBFLN: EQU 5 ;opcode buffer length MEMSIZ: EQU 4 ;memory available in Kb IBNUM: EQU 4*MEMSIZ OBNUM: EQU 4*MEMSIZ RECLEN: EQU 128 ; STCKLN: EQU 128 ;stack size IBFLEN: EQU IBNUM*RECLEN OBFLEN: EQU OBNUM*RECLEN ; CTRLC: EQU 3 EOT: EQU 4 BEL: EQU 7 HT: EQU 9 LF: EQU 0AH CR: EQU 0DH ESC: EQU 1BH QUOTE: EQU 27H ; ABORT: EQU 0000 BDOS: EQU 0005 DFCB1: EQU 005CH DFCB2: EQU 006CH ; FNLEN: EQU 8 EOS: EQU EOT ; replacement for '!' EOF: EQU 1AH NFF: EQU 0FFH ;disk error return ; $CIN: EQU 1 $COUT: EQU 2 $CDAV: EQU 0BH $OPEN: EQU 0FH $CLOSE: EQU 10H $DEL: EQU 13H $RDNR: EQU 14H $WRNR: EQU 15H $CREAT: EQU 16H $CDISK: EQU 19H $DMA: EQU 1AH ; ORG 100H ; JP START ; ; OPTION FLAGS ; PSEFLG: DB 0 ;(103H) 0 to translate non- ; standard opcodes MLTLFL: DB 0FFH ;(104H) 0 to put lines with '!' ; to output on single line M80FLG: DB 0 ;(105H) 1 to output .Z80, ASEG ; for M80 TCASFL: DB 0 ;(106H) 0 to preserve case ; LCASFL: DB 0 ;(107H) 0 for upper case if ; TCASFL not zero ; ; HELP MESSAGE ; HMSG1: DB CR,LF DB LF DB 'XLTZ80 translates Intel 8080 assembly language source',CR,LF DB 'code into Zilog Z80 assembly language source code.',CR,LF DB LF DB 'It is invoked by a command of the form:',CR,LF DB LF DB ' XLTZ80 [d:]srcfile[.typ] [d:destfile.typ]',CR,LF DB LF DB 'The brackets denote optional parameters and the ',CR,LF DB 'default values are:',CR,LF DB LF DB ' Source file-type -- ASM',CR,LF DB ' Destination file-type -- Z80',CR,LF DB ' Destination file-name -- same as source file-name',CR,LF DB ' Drive -- current drive',CR,LF DB CR,LF DB ' *** This program will run only on a Z80 processor ***',CR,LF DB CR,LF DB 'Press any key to continue - ',0 HMSG2: DB CR,LF DB LF DB 'Examples:',CR,LF DB LF DB 'XLTZ80 PRGM1 --translates PRGM1.ASM to PRGM1.Z80',CR,LF DB 'XLTZ80 PRGM1 PRGM2 --translates PRGM1.ASM to PRGM2.Z80',CR,LF DB 'XLTZ80 PRGM1.TXT PRGM2.MAC --translates PRGM1.TXT to PRGM2.MAC',CR,LF DB LF DB 'XLTZ80 also has the following features:',CR,LF DB LF DB 'Case will be preserved as well as possible -- if an opcode has',CR,LF DB 'a lower case character, the translated opcode will be in lower',CR,LF DB 'case.',CR,LF DB LF DB 'All asterisks at the beginning of lines will be replaced with',CR,LF DB 'semicolons.',CR,LF DB LF DB 'A dot is printed on the console for every 100 lines of input ',CR,LF DB 'processed.',CR,LF DB LF DB 0 ; ;============================================================================= ; ; Program begins here ; START: LD HL,0 ADD HL,SP LD (SPBDOS),HL LD SP,STACK LD A,(DFCB1+1) ; check for a file name CP ' ' ; print help if no name JR NZ,BEGIN ; no help requested LD DE,SIGNON CALL PRTLIN LD DE,HMSG1 ; print help message CALL PRTLIN LD C,$CIN ; wait for any character CALL BDOS LD DE,HMSG2 ; print rest of help CALL PRTLIN LD HL,(SPBDOS) ; retrieve system stack LD SP,HL ; pointer and pop RET ; to PC BEGIN: CALL HELLO ;signon, open in & out files NXTLIN: CALL GETLIN ;get line from input file to buf CALL PROCLIN ; process line JR NXTLIN ; ; ; ;******************************************************* ; ; Print signon, open input ; and output files. ; HELLO: LD DE,SIGNON CALL PRTLIN HELLO0: LD A,'D' ; translate DB & EQU (for LD (OPTBDB),A ; uniform formatting) LD A,HT  ; HT after opcode LD (PUTHT+1),A LD A,41 ; tab comments to col 33 LD (PUTND5+1),A LD A,0FEH ; CP instruction LD (EXCLAM),A XOR A LD (TCASFL),A ; don't translate case LD (LCASFL),A ; lower case flag LD A,(PSEFLG) ; translate non-standard OR A ; opcodes ? CALL NZ,NXPSD ; LD DE,DBMSG CALL PRTLIN ; CALL CHKYES ; xlat DB & EQU ? CP ESC JR Z,HELLO0 CP CTRLC JP Z,ABORT CP 'Y' CALL NZ,NXDBEQ LD A,(MLTLFL) ; force space after OR A ; opcode if MLTLFL not set JR Z,HELLO2 LD DE,SPCMSG CALL PRTLIN ; use space after CALL CHKYES ; opcode ? CP ESC JR Z,HELLO0 CP CTRLC JP Z,ABORT CP 'Y' HELLO2: CALL Z,SETSPC LD DE,COLMSG CALL PRTLIN ; CALL CHKYES ; start comment CP ESC JR Z,HELLO0 CP CTRLC JP Z,ABORT CP 'Y' CALL Z,SETCOL ; in column 25 ? LD DE,EXCMSG CALL PRTLIN ; ignore '!' statement CALL CHKYES ; separator ? CP ESC JR Z,HELLO0 CP CTRLC JP Z,ABORT CP 'Y' CALL Z,SETNEX LD DE,TRNMSG  CALL PRTLIN ; translate case ? CALL CHKYES CP ESC JP Z,HELLO0 CP CTRLC JP Z,ABORT CP 'L' CALL Z,SETLC CP 'U' CALL Z,SETUC LD A,N01 LD (COLNUM),A LD C,$CDISK CALL BDOS INC A LD (@CDISK),A CALL MAKFNS CALL OPENIN CALL CREATO LD A,(M80FLG) OR A RET Z LD HL,M80HDR CALL PUTLIN RET ; SIGNON: DB '8080-to-Z80 Translator version ' DB VERS/100+'0','.',(VERS MOD 100)/10+'0' DB (VERS MOD 10)+'0' DB CR,LF,0 ; M80HDR: DB HT,'.Z80',CR,LF DB HT,'ASEG',CR,LF,0 ; NXPSD: XOR A LD (OPCTBD),A LD (OPTENT),A LD (OPTIFC),A RET DBMSG: DB 'Translate DB & EQU ? ' DB '[Y/ret=N/esc/^C] ',0 ; NXDBEQ: XOR A LD (OPTBDB),A RET ; SPCMSG: DB 'Use space (default TAB) after opcode ? ' DB '[Y/ret=N/esc/^C] ',0 ; SETSPC: LD HL,PUTHT+1 LD A,' ' LD (HL),A RET ; COLMSG: DB 'Start comment in column 25 (default 33) ? ' DB '[Y/ret=N/esc/^C] ',0 ; SETCOL: LD HL,PUTND5+1 LD A,33 LD (HL),A RET ; EXCMSG: DB 'Ignore ! statement separator ? ' DB '[Y/ret=N/esc/^C] ',0 ; SETNEX: LD A,0C9H ; RET instruction LD (EXCLAM),A RET ; TRNMSG: DB 'Translate instructions to Upper/Lower ' DB 'or preserve case ? [U/L/ret/esc/^C] ',0 ; SETLC: LD (TCASFL),A LD (LCASFL),A RET ; SETUC: LD (TCASFL),A RET ;******************************************************* ; ; Gets line from input file to line ; buffer until CR. Filters out ctrl ; chars except for HT. Truncates ; lines after LBUFLN chars. ; Terminates line with CR, LF, 0. ; GETLIN: CALL PDOT ; print activity dot CALL CHKIN CP CTRLC JP Z,JABORT XOR A LD (QUOTFL),A ; in quote LD (CMNTFL),A ; in comment LD HL,LBUFF ;line buffer LD B,LBUFLN ;max # of char GETLN1: LD DE,(@IBUFF) LD A,D CP HIGH IBUFF+IBFLEN JR NZ,GETLN4 LD A,E CP LOW IBUFF+IBFLEN JR NZ,GETLN4 EXX LD DE,IBUFF GETLN2: LD C,$DMA PUSH DE CALL BDOS POP DE EX DE,HL LD DE,INFCB LD C,$RDNR PUSH HL CALL BDOS POP HL DEC A JR NZ,GETLN3 LD A,EOF LD (HL),A GETLN3: LD DE,RECLEN ADD HL,DE EX DE,HL LD A,D CP HIGH IBUFF+IBFLEN JR NZ,GETLN2 LD A,E CP LOW IBUFF+IBFLEN JR NZ,GETLN2 EXX LD DE,IBUFF GETLN4: LD A,(DE) INC DE LD (@IBUFF),DE LD (HL),A CP QUOTE ; set or reset JR NZ,GTLN41 ; QUOTFL LD A,(QUOTFL) CPL LD (QUOTFL),A GTLN41: LD A,(HL) ; translate '!' which CALL EXCLAM ; is not in quote LD (HL),A ; to EOS LD A,(TCASFL) ; translate to upper or OR A ; lower case ? JR Z,GTLN46 ; NO LD A,(QUOTFL) ; if in quote, do OR A ; nothing JR NZ,GTLN43 LD A,(HL) ; otherwise, ';' sets CP ';' ; CMNTFL and EOS resets JR Z,GTLN42 ; it CP EOS JR NZ,GTLN43 XOR A GTLN42: LD (CMNTFL),A GTLN43: LD A,(QUOTFL) ; if in quote, OR A ; do nothing JR NZ,GTLN46 LD A,(CMNTFL) ; if in comment, OR A ; do nothing JR NZ,GTLN46 LD A,(LCASFL) ; otherwise, OR A ; if LCASFL set LD A,(HL) JR Z,GTLN44 CALL LCASE ; trans to lwr case JR GTLN45 GTLN44: CALL UCASE ; else trans to upr case GTLN45: LD (HL),A GTLN46: LD A,(HL) CP CR JR Z,GETLN6 CP HT ; filters out all ctrl JR Z,GETLN5 ; chars except tab CP EOF JR Z,GETLN7 CP EOS JR Z,GETLN5 CP ' ' JP C,GETLN1 GETLN5: DEC B INC HL JP NZ,GETLN1 INC B DEC HL JP GETLN1 ; GETLN6: INC HL LD (HL),LF INC HL LD (HL),N00 LD (@IBUFF),DE RET ; ; Change '!' to EOS in A. ; EXCLAM: CP '!' RET NZ LD A,(QUOTFL) OR A LD A,'!' RET NZ LD A,EOS RET ; QUOTFL: DB 0 CMNTFL: DB 0 ; ; Exit ; GETLN7: CALL CLOSEO LD DE,UPSMSG CALL PRTLIN LD DE,ENDIFL CALL PRTLIN LD DE,ICLFLG CALL PRTLIN LD DE,LSTFLG CALL PRTLIN LD DE,MACFLG CALL PRTLIN LD DE,EOJMSG ; ; Print message at DE and abort ; EREXIT: PUSH DE LD DE,CRLFMG CALL PRTLIN POP DE CALL PRTLIN JP ABORT ; JABORT: LD DE,JABTMG CALL PRTLIN JR GETLN7 ; JABTMG: DB CR,LF,'*** Job Cancelled ***',CR,LF,0 ; UPSMSG: DB 0,LF,'The following operands' DB ' have been used in your ' DB 'source and have not' DB CR,LF DB 'been fully translated. You must ' DB 'complete the translation using an editor.' DB CR,LF,HT DB 'original:',HT,HT DB 'must be translated to:' DB CR,LF,0 ENDIFL: DB 0,'#ENDIF',HT,HT,HT DB 'ENDIF',CR,LF,0 ICLFLG: DB 0,'ICL',HT,HT,HT DB '*INCLUDE' DB CR,LF,0 LSTFLG: DB 0,'LST ',HT,HT DB 'LIST ' DB CR,LF,0 MACFLG: DB 0,'MAC <$parameters>',HT DB 'MACRO <#parameters>' DB CR,LF DB HT,'[ ... ]',HT,HT,HT,'MEND' DB CR,LF DB HT,'#macro-call',HT,HT,'macro-call' DB CR,LF,0 ; EOJMSG: DB '*** End of Job ***',CR,LF,0 ;******************************************************* ; ; Process line ; PROCLIN: LD HL,LBUFF PROCLN0: CALL FNDOPC JP Z,PUTND6 PROCLN1: LD HL,OPCTBI ;imm or one byte LD BC,2*OPBFLN CALL SCANOP JP Z,DOIMM LD HL,OPCTBS ; one byte opcodes LD BC,2*OPBFLN CALL SCANOP JP Z,DO$ONE LD HL,OPTBDB ; db and equ LD BC,2*OPBFLN CALL SCANOP JP Z,DOIMM LD HL,OPCTBR ;register LD BC,2*OPBFLN CALL SCANOP JP Z,DOREG LD HL,OPCTBW ;16 bit LD BC,2*OPBFLN CALL SCANOP JP Z,DOWRD LD HL,OPCTBD ;tdl LD BC,OPBFLN CALL SCANOP CALL Z,DOTDL LD HL,OPCTBRT ;ret LD BC,OPBFLN CALL SCANOP JP Z,DORET LD HL,OPCTBC ;call LD BC,OPBFLN CALL SCANOP JP Z,DOCALL LD HL,OPCTBJ ;jump LD BC,OPBFLN CALL SCANOP JP Z,DOJMP LD HL,OPCTBM ;index & misc LD BC,2*OPBFLN+2 CALL SCANOP JP Z,EXEC LD HL,(@OPCOD) ;this fix prevents macro JR PUTEND ;names from being split PUTOPR: LD HL,(@OPRND) PUTEND: XOR A LD (LCFLAG),A LD (LCDFLG),A LD C,N00 ; putout w/o PUTND1: LD A,(HL) ; change CP ' ' JR Z,PUTND3 CP HT JR Z,PUTND3 CP CR JP Z,PUTLIN CP ';' JR Z,PUTND4 CP EOS ; process exclamation JP Z,PTND21 ; point separator CP QUOTE JR NZ,PUTND2 DEC C JR Z,PUTND2 LD C,N01 PUTND2: CALL PUTCHR INC HL JR PUTND1 ; PTND21: ; LD A,(HL) ; fix to process '!' ; DEC C ; in quote ; INC C ; if not zero ; JR NZ,PUTND2 CALL SKSPHT INC HL ; inc past '!' PTND22: LD A,(HL) CP ';' JR Z,PUTND5 LD A,(MLTLFL) ; put out as OR A ; separate lines ? JR Z,PTND24 ; no ; LD A,(HL) CP ' ' JR NZ,PTND23 LD (HL),HT PTND23: CALL PCRLF JP PROCLN0 ; PTND24: LD A,(TEMP) CP ' ' JR Z,PTND25 CP HT JR Z,PTND25 LD A,' ' CALL PUTCHR PTND25: LD A,'!' CALL PUTCHR JP PROCLN0 ; PUTND3: PUSH HL ;Space or Tab comes here CALL SKSPHT CP CR ;this fix filters out JR Z,PUTLNB ;trailing spaces or tabs POP HL CP EOS ; fix to process '!' JR Z,PTND21 CP ';' LD A,(HL) ;prevent blank being replaced ;by ';' in string data JR Z,PUTND4 CALL PUTSPT JR PUTND1 ; ; ';' comes here ; PUTND4: DEC C ; in quote if INC C ; C not zero JR NZ,PUTND2 CALL SKSPHT ; Tab comments to proper column PUTND5: LD B,41 PTND51: LD A,(COLNUM) CP B ;colnum>=41? JR NC,PTND54 DEC A ;no, insert AND NF8 ;tabs to ADD A,N09 ;start output CP B ;at col. 33 JR Z,PTND54 JR C,PTND52  LD A,' ' JR PTND53 ; PTND52: LD A,HT PTND53: CALL PUTCHR JR PTND51 PTND54: LD A,(TEMP); insure CP ' ' ; space JR Z,PUTND6; before CP HT ; semi-colon JR Z,PUTND6; LD A,' ' ; CALL PUTCHR ; PUTND6: LD A,(HL) INC HL CP EOS JP Z,PTND22 OR A RET Z CALL PUTCHR JR PUTND6 ; ; Put line at HL to output file until 0 ; PUTLNB: EX (SP),HL ;filter trailing POP HL ;blanks or tabs PUTLNC: JP PUTLIN ;******************************************************* ; ; Process labels, find potential opcode. ; FNDOPC: LD A,(HL) CP ' ' JR Z,FNDOP3 CP HT JR Z,FNDOP3 CP CR ; pass blank lines RET Z CP EOS ; '!' separator RET Z CP ';' RET Z CP '*' ; asterisk in first column JR NZ,FNDOP1 ; is a comment line LD (HL),';' RET FNDOP1: LD C,N00 FNDOP2: LD A,(HL) CP ':' JR Z,FNDOP4 CP HT JR Z,FNDOP6 CP ' ' JR Z,FNDOP6 CP CR RET Z CP EOS RET Z CP ';' JR Z,FNDOP7 CALL PUTCHR INC HL INC C JR FNDOP2 ; Comes here only if space or tab at beginning ; of line. FNDOP3: PUSH HL CALL SKSPHT ;find first non-sp or tab CP CR JR Z,FNDOP9 CP EOS JR Z,FNDOP9 POP HL CALL PUTSPT ;print until non-sp or ht PUSH HL CALL FINDLM ;find ,:+-/*); CR HT or SP at HL CP ':' POP HL JR Z,FNDOP1 JR FNDOP7 ; ; Colon terminating label comes here ; FNDOP4: INC HL LD A,(HL) CP ':' JR NZ,FNDOP5 CALL PUTCHR INC HL FNDOP5: LD A,':' CALL PUTCHR ; ; HT or SP comes here ; FNDOP6: ; ; See if there is an opcode field ; FNDOP7: PUSH HL CALL SKSPHT LD A,(HL) CP CR JR Z,FNDOP9 ; filter trailing SP or TAB CP EOS JR Z,FNDOP9 ; '!' separator CP ';' JR NZ,FNDOP8 EX (SP),HL POP HL POP BC ; clear return JP PUTND5 ; tab to proper column ; ; Have located opcode field ; FNDOP8: POP HL CALL PUTSPT ; Move potential opcode to OPCBUF MOVOPC: LD (@OPCOD),HL LD B,OPBFLN LD DE,OPCBUF CALL MOVBDH ;move up to B char from HL to CALL SKSPHT ;DE until ,:+-/*); CR HT SP LD (@OPRND),HL SUB A INC A RET ; come here on CR to filter trailing SP or TAB FNDOP9: EX (SP),HL POP HL RET ;******************************************************* ; ; Opcode tables ; OPCTBI: DB 'ACI ADC ' DB 'ADI ADD ' DB 'ANI AND ' DB 'CALL CALL ' DB 'CPI CP ' DB 'JMP JP ' DB 'ORI OR ' DB 'SBI SBC ' DB 'SUI SUB ' DB 'XRI XOR ' DB 'DS DS ' DB 'DW DW ' DB 'SET DL ' OPTENT: DB 'ENT ENTRY' DB 'NAM NAME ' DB 'RAM DATA ' DB 'ROG REL ' DB 0 OPCTBS: DB 'RET RET ' DB 'CMA CPL ' DB 'CMC CCF ' DB 'HLT HALT ' DB 'RAL RLA ' DB 'RAR RRA ' DB 'RLC RLCA ' DB 'RRC RRCA ' DB 'STC SCF ' DB 'DAA DAA ' DB 'NOP NOP ' DB 'DI DI ' DB 'EI EI ' DB 0 OPTBDB: DB 'DB DB ' DB 'EQU EQU ' DB 0 OPCTBR: DB 'ADC ADC ' DB 'ADD ADD ' DB 'ANA AND ' DB 'CMP CP ' DB 'DCR DEC ' DB 'INR INC ' DB 'MVI LD ' DB 'ORA OR ' DB 'SBB SBC ' DB 'SUB SUB ' DB 'XRA XOR ' DB 0 OPCTBW: DB 'DCX DEC ' DB 'INX INC ' DB 'LXI LD ' DB 'POP POP ' DB 'PUSH PUSH ' DB 0 OPCTBD: DB 'REQ RNE ' DB 'RLT RGE ' DB 'CEQ CNE ' DB 'CLT CGE ' DB 'JEQ JNE ' DB 'JLT JGE ' DB 0 OPCTBRT:DB 'RC RNC ' DB 'RZ RNZ ' DB 'RP RM ' DB 'RPE RPO ' DB 0 OPCTBC: DB 'CC CNC ' DB 'CZ CNZ ' DB 'CP CM ' DB 'CPE CPO ' DB 0 OPCTBJ: DB 'JC JNC ' DB 'JZ JNZ ' DB 'JP JM ' DB 'JPE JPO ' DB 0 OPCTBM: DB 'DAD ADD ' DW DODAD DB 'IN IN ' DW DOIN DB 'LDA LD ' DW DOLDA DB 'LDAX LD ' DW DOLDAX DB 'LHLD LD ' DW DOLHLD DB 'MOV LD ' DW DOMOV DB 'OUT OUT ' DW DOOUT DB 'PCHL JP ' DW DOPCHL DB 'RST RST ' DW DORST DB 'SHLD LD ' DW DOSHLD DB 'SPHL LD ' DW DOSPHL DB 'STA LD ' DW DOSTA DB 'STAX LD ' DW DOSTAX DB 'XCHG EX ' DW DOXCHG DB 'XTHL EX ' DW DOXTHL OPTIFC: DB 'IFC IF ' DW DOIFC DB 'ICL *INCL' DW DOICL DB 'LST LIST ' DW DOLST DB 'MAC MACRO' DW DOMAC DB 0 ;******************************************************* ; ; Scan table at HL for match to OPBFLN ; char string at OPCBUF. ; Ret Z and HL-> entry if match. ; SCANOP: LD A,(HL) AND A JR Z,SCNOP1 PUSH BC LD B,OPBFLN LD DE,OPCBUF CALL CBDEHL ;comp B bytes (DE)-(HL) POP BC RET Z ADD HL,BC JR SCANOP ; SCNOP1: INC A RET ; ; Gets routine address from ; HL+2*OPBFLN and jumps to routine. ; EXEC: PUSH HL LD BC,2*OPBFLN ADD HL,BC LD C,(HL) INC HL LD B,(HL) POP HL PUSH BC ;address on stack RET ;go to it ; ; Put up to OPBFLN char at HL+OPBFLN ; to output file. Stop at space, ; and put tab to output file. ; PUTOPHT: CALL PUTOPC PUTHT: LD A,HT JP PUTCHR ; ; ; PUTOPC: LD BC,OPBFLN ADD HL,BC ; HL -> new opcode LD B,C PUTOP1: LD A,(HL) CP ' ' RET Z CP HT RET Z LD A,(LCFLAG) OR A LD A,(HL) JR Z,PUTOP2 OR 20H PUTOP2: CALL PUTCHR INC HL DJNZ PUTOP1 RET ; ; Put string at HL to output file until 0. ; If (LCDFLG) set, convert to lower case. ; PUTRND: LD A,(HL) OR A RET Z LD A,(LCDFLG) OR A LD A,(HL) JR Z,PUTRN0 CALL LCASE PUTRN0: CALL PUTCHR INC HL JR PUTRND ; LCDFLG: DB 0 ; ; Find first ,:+-/*); CR HT or SP at HL, ; return A = (HL). ; FINDLM: PUSH BC CALL CHKDLM POP BC RET Z INC HL JR FINDLM ; ; Fill B locations at DE with spaces. ; Move up to B char from HL to DE until ; ,:+-/*); CR HT or SP encountered. ; Return Z and HL->special char if found. ; (search B+1 loc for special char.) ; MOVBDH: LD C,B LD B,N00 PUSH BC PUSH DE PUSH HL ; fill BC locations CALL FILLBD ; at DE with spaces POP HL ; POP DE POP BC MOVBD1: PUSH BC ; ret Z, A=(HL) CALL CHKDLM ; if (HL) is POP BC ; ,:+-/*); CR HT or SP RET Z LDI ; (DE)=(HL), inc DE,HL, dec BC JP PO,CHKDLM ;PO=>BC=0 JR MOVBD1 ; ; Skip spaces and tabs. ; Return HL->non-space or non-tab ; SKSPHT: LD A,(HL) CP ' ' JR Z,SKSPT1 CP HT RET NZ SKSPT1: INC HL JR SKSPHT ; ; Ret Z, A=(HL) if ; HL is ',:+-/*);!', CR, HT, or SP ; CHKDLM: LD A,(HL) CP HT RET Z CP ' ' RET Z CP ',' RET Z CP ';' RET Z CP CR RET Z CP ':' RET Z CP '+' RET Z CP '-' RET Z CP '/' RET Z CP '*' RET Z CP ')' RET Z CP EOS RET ; ; Compares B chars at DE with chars ; at HL. ; Ret Z if match. ; Preserve HL, DE, BC ; CBDEHL: PUSH HL PUSH DE PUSH BC CBDH1: LD A,(DE) CP 'a' JR C,CBDH2 LD (LCFLAG),A AND 5FH CBDH2: CP (HL) JR NZ,CBDH3 INC HL INC DE DJNZ CBDH1 CBDH3: POP BC POP DE POP HL RET LCFLAG: DB 0 ; ; Fill BC locations starting at ; DE with spaces. ; Returns A = space, DE -> next free ; location, HL = DE - 1, BC = 0. ; FILLBD: LD A,' ' LD (DE),A LD H,D LD L,E INC DE DEC BC LDIR RET ;******************************************************* ; ; Translation Routines ; ;******************************************************* ;  ; Immediate, implied, and JMP ; DOIMM: CALL PUTOPHT JP PUTOPR ; ; One byte (implied) ; DO$ONE: CALL PUTOPC JP PUTOPR ; ; Register instructions ; DOREG: CALL PUTOPHT ;put out opcode+tab LD HL,(@OPRND) DOREG1: LD A,(HL) CP 'M' JR Z,DOREG2 CP 'm' JP NZ,PUTEND INC HL PUSH HL LD HL,OPRLM JR DOREG3 DOREG2: INC HL ; change M PUSH HL ; to (HL) LD HL,OPRM ;'(HL)' DOREG3: CALL PUTLIN POP HL JP PUTEND ; OPRM: DB '(HL)',0 OPRLM: DB '(hl)',0 ; ; Index register, pop, push ; DOWRD: CALL PUTOPHT DOWRD1: LD HL,(@OPRND) CALL TRNRP ; DE -> rp', HL -> next JP NZ,PUTOPR EX DE,HL CALL PUTRND EX DE,HL JP PUTEND ; ; Translate 16 bit registers. ; Enter with HL -> rp. ; If rp matches then return HL -> next char, ; DE -> translation, and Z set. ; Otherwise, return NZ and HL unchanged. ; TRNRP: XOR A LD (LCDFLG),A LD A,(HL) CP 'a' JR C,TRNRP1 LD (LCDFLG),A TRNRP1: AND 5FH CP 'B' JR Z,TRNRPB CP 'D' JR Z,TRNRPD CP 'H' JR Z,TRNRPH CP 'P' JR Z,TRNRPP TRNRP2: LD A,0 LD (LCDFLG),A RET ; TRNRPB: LD DE,OPRBC INC HL RET ; TRNRPD: LD DE,OPRDE INC HL RET ; TRNRPH: LD DE,OPRHL INC HL RET ; TRNRPP: INC HL LD A,(HL) CP 'a' JR C,TRPP1 LD (LCDFLG),A TRPP1: AND 5FH CP 'S' JR NZ,TRNRP4 INC HL LD A,(HL) AND 5FH CP 'W' JR NZ,TRNRP3 LD DE,OPRAF INC HL RET ; TRNRP3: DEC HL TRNRP4: DEC HL JR TRNRP2 ; OPRAF: DB 'AF',0 OPRBC: DB 'BC',0 OPRDE: DB 'DE',0 OPRHL: DB 'HL',0 ; ; Strange opcodes ; DOTDL: LD A,(OPCBUF+1) LD HL,CCZ ;'Z ' CP 'E' JR Z,DOTDL1 LD HL,CCNZ ;'NZ' CP 'N' JR Z,DOTDL1 LD HL,CCC ;'C ' CP 'L' JR Z,DOTDL1 LD HL,CCNC ;'NC' CP 'G' JR Z,DOTDL1 LD HL,CCZL CP 'e' JR Z,DOTDL1 LD HL,CCNZL CP 'n' JR Z,DOTDL1 LD HL,CCCL CP 'l' JR Z,DOTDL1 LD HL,CCNCL DOTDL1: LD A,(HL) LD (OPCBUF+1),A INC HL LD A,(HL) LD (OPCBUF+2),A RET ; CCZ: DB 'Z ' CCNZ: DB 'NZ' CCC: DB 'C ' CCNC: DB 'NC' CCZL: DB 'z ' CCNZL: DB 'nz' CCCL: DB 'c ' CCNCL: DB 'nc' ; ; Return conditional ; DORET: LD HL,OP$RET-OPBFLN CALL PUTCC JP PUTOPR ; OP$RET: DB 'RET ',0 ; ; Call conditional ; DOCALL: LD HL,OP$CAL-OPBFLN JR DOJMP1 ; OP$CAL: DB 'CALL ',0 ; ; Jump conditional ; DOJMP: LD HL,OP$JP-OPBFLN DOJMP1: CALL PUTCC LD A,',' CALL PUTCHR JP PUTOPR ; OP$JP: DB 'JP ',0 ; ; ; PUTCC: CALL PUTOPHT LD A,(OPCBUF+1) CALL PUTCHR LD A,(OPCBUF+2) CP ' ' RET Z JP PUTCHR ; ; DAD rp -> ADD HL,rp' ; DODAD: CALL PUTOPHT LD HL,OPRHLC ;'HL,' LD A,(LCFLAG) OR A JR Z,DODAD1 LD HL,OPRHLCL DODAD1: CALL PUTLIN JP DOWRD1 ; OPRHLC: DB 'HL,',0 OPRHLCL:DB 'hl,',0 ; ; IN n -> IN A,n ; DOIN: CALL PUTOPHT LD HL,OPRAC ;'A,' LD A,(LCFLAG) OR A JP Z,DOOPRND LD HL,OPRACL JP DOOPRND ; OPRAC: DB 'A,',0 OPRACL: DB 'a,',0 ; ; LDA nn -> LD A,(nn) ; DOLDA: CALL PUTOPHT LD HL,OPACP ;'A,(' LD A,(LCFLAG) OR A JP Z,DOLD1 LD HL,OPACPL JR DOLD1 ; OPACP: DB 'A,(',0 OPACPL: DB 'a,(',0 ; ; LDAX d -> LD A,(dd) ; DOLDAX: CALL PUTOPHT LD HL,(@OPRND) LD A,(HL) CP 'a' JR C,DOLDX0 LD (LCDFLG),A DOLDX0: AND 5FH CP 'B' JR Z,DOLDX1 CP 'D' JR Z,DOLDX2 JP PUTEND ; DOLDX1: LD HL,OPLDXB ;'A,(BC)' JP DOSTX5 ; DOLDX2: LD HL,OPLDXD ;'A,(DE)' JP DOSTX5 ; OPLDXB: DB 'A,(BC)',0 OPLDXD: DB 'A,(DE)',0 ; ; LHLD nn -> LD HL,(nn) ; DOLHLD: CALL PUTOPHT LD HL,OPHLCP ;'HL,(' LD A,(LCFLAG) OR A JR Z,DOLD1 LD HL,OPHLCPL DOLD1: CALL PUTLIN CALL PUTEXP LD A,')' CALL PUTCHR JP PUTEND ; OPHLCP: DB 'HL,(',0 OPHLCPL:DB 'hl,(',0 ; ; MOV r,s -> LD r,s ; DOMOV: CALL PUTOPHT LD HL,(@OPRND) LD A,(HL) CP 'M' JR Z,DOMOV1 CP 'm' JR NZ,DOMOV4 PUSH HL LD HL,OPRLM JR DOMOV2 DOMOV1: PUSH HL LD HL,OPRM ;'(HL)' DOMOV2: CALL PUTLIN POP HL DOMOV3: INC HL LD A,(HL) CALL PUTCHR INC HL JP DOREG1 ; DOMOV4: CALL PUTCHR JR DOMOV3 ; ; OUT n -> OUT n,A ; DOOUT: CALL PUTOPHT CALL PUTEXP PUSH HL LD HL,OPRCA ;',A' LD A,(LCFLAG) OR A JP Z,DOSTA1 LD HL,OPRCAL JP DOSTA1 ; JR DOSTA1 ; OPRCA: DB ',A',0 OPRCAL: DB ',a',0 ; ; PCHL -> JP (HL) ; DOPCHL: CALL PUTOPHT LD HL,OPRM ;'(HL)' LD A,(LCFLAG) OR A JP Z,DOOPRND LD HL,OPRLM JP DOOPRND ; ; RST n -> RST 8*n ; DORST: CALL PUTOPHT LD HL,OPR8M ;'8*' JP DOOPRND ; OPR8M: DB '8*',0 ; ; SHLD nn -> LD (nn),HL ; DOSHLD: CALL PUTOPHT LD A,'(' CALL PUTCHR CALL PUTEXP PUSH HL LD HL,OPCHL ;'),HL' LD A,(LCFLAG) OR A JR Z,DOSTA1 LD HL,OPCHLL JR DOSTA1 ; OPCHL: DB '),HL',0 OPCHLL: DB '),hl',0 ; ; SPHL -> LD SP,HL ; DOSPHL: CALL PUTOPHT LD HL,OPSPHL ;'SP,HL' LD A,(LCFLAG) OR A JP Z,DOOPRND LD HL,OPSPHLL JP DOOPRND ; OPSPHL: DB 'SP,HL',0 OPSPHLL:DB 'sp,hl',0 ; ; STA nn -> LD (nn),A ; DOSTA: CALL PUTOPHT LD A,'(' CALL PUTCHR CALL PUTEXP PUSH HL LD HL,OPCA ;'),A' LD A,(LCFLAG) OR A JR Z,DOSTA1 LD HL,OPCAL DOSTA1: CALL PUTLIN POP HL JP PUTEND ; OPCA: DB '),A',0 OPCAL: DB '),a',0 ; ; STAX d -> LD (dd),A ; DOSTAX: CALL PUTOPHT LD HL,(@OPRND) LD A,(HL) CP 'a' JR C,DOSTX0 LD (LCDFLG),A DOSTX0: AND 5FH CP 'B' JR Z,DOSTX1 CP 'D' JR Z,DOSTX4 JP PUTEND ; DOSTX1: LD HL,OPSTXB ;'(BC),A' JR DOSTX5 ; DOSTX4: LD HL,OPSTXD ;'(DE),A' DOSTX5: CALL PUTRND LD HL,(@OPRND) INC HL JP PUTEND ; OPSTXB: DB '(BC),A',0 OPSTXD: DB '(DE),A',0 ; ; XCHG -> EX DE,HL ; DOXCHG: CALL PUTOPHT LD HL,OPDEHL ;'DE,HL' LD A,(LCFLAG) OR A JR Z,DOOPRND LD HL,OPDHL JR DOOPRND ; OPDEHL: DB 'DE,HL',0 OPDHL: DB 'de,hl',0 ; ; XTHL -> EX (SP),HL ; DOXTHL: CALL PUTOPHT LD HL,OPESH ;'(SP),HL' LD A,(LCFLAG) OR A JR Z,DOOPRND LD HL,OPESHL DOOPRND: CALL PUTLIN JP PUTOPR ; OPESH: DB '(SP),HL',0 OPESHL: DB '(sp),hl',0 ; ; Put 'expression' to output file. ; 'expression' is everything between ; (@OPRND) up to the tab or spaces before ; a ';' or CR. ; PUTEXP: LD HL,(@OPRND) PUTEX1: LD A,(HL) CP ';' JR Z,PUTEX4 CP CR JR Z,PUTEX4 CP EOS JR Z,PUTEX4 PUTEX2: INC HL JR PUTEX1 ;PUTEX3: ; DEC HL ; LD A,(HL) ; INC HL ; CP ' ' ; JR Z,PUTEX4 ; CP HT ; JR Z,PUTEX4 ; JR PUTEX2 ; PUTEX4: DEC HL LD A,(HL) CP ' ' JR Z,PUTEX4 CP HT JR Z,PUTEX4 INC HL EX DE,HL LD HL,(@OPRND) PUTEX5: LD A,D CP H JR NZ,PUTEX6 LD A,E CP L RET Z PUTEX6: LD A,(HL) CALL PUTCHR INC HL JR PUTEX5 ; ; IFC -> IF ; DOIFC: LD A,HT LD (ENDIFL),A JR DOUPS ; ; ICL -> *INCL ; DOICL: LD A,HT LD (ICLFLG),A JR DOUPS ; ; LST -> LIST ; DOLST: LD A,HT LD (LSTFLG),A JR DOUPS ; ; MAC -> MACRO ; DOMAC: LD A,HT LD (MACFLG),A DOUPS: CALL PUTOPHT LD A,CR LD (UPSMSG),A JP PUTOPR ;******************************************************* ; ; File operations ; ;******************************************************* ; ; Set up input and output FCB's from DFCB ; MAKFNS: LD HL,DFCB1 LD DE,INFCB LD BC,FNLEN+1 LDIR LD A,(HL) ; typ specified ? CP ' ' JR Z,MKFNS1 CP '?' JR Z,MKFNS1 LD BC,3 LDIR MKFNS1: LD HL,DFCB1 LD DE,OUTFCB LD BC,FNLEN+1 LDIR LD A,(DFCB2) ; OR A ; allows output to JR Z,MKFNS2 ; different drive LD (OUTFCB),A ; than input MKFNS2: LD A,(DFCB2+1) ; CP ' ' ; JR Z,MKFNS3 ; allows output LD BC,8 ; file to have LD DE,OUTFCB+1 ; different name LD HL,DFCB2+1 ; from input file LDIR ; MKFNS3: LD A,(DFCB2+9) CP ' ' JR Z,MKFNS4 LD BC,3 LD DE,OUTFCB+9 LD HL,DFCB2+9 LDIR MKFNS4: LD DE,PRFNM1 CALL PRTLIN LD HL,INFCB CALL PRFNAM LD DE,PRFNM2 CALL PRTLIN LD HL,OUTFCB CALL PRFNAM LD DE,CRLFMG CALL PRTLIN RET ; ; Print Filenames ; PRFNAM: LD A,(HL) ; disk number OR A JR NZ,PRFN1 LD A,(@CDISK) PRFN1: ADD A,'@' CALL CONOUT LD A,':' CALL CONOUT INC HL LD B,8 CALL PRFN LD A,'.' CALL CONOUT LD B,3 PRFN: LD A,(HL) INC HL CP ' ' CALL NZ,CONOUT DJNZ PRFN RET ; PRFNM1: DB 'Source File: ',0 PRFNM2: DB ', Destination File: ',0 ; ; Open source file with ext ASM ; OPENIN: LD DE,INFCB LD C,$OPEN CALL BDOS CP NFF JR Z,NSFERR LD A,RECLEN LD HL,IBUFF+IBFLEN LD (@IBUFF),HL RET ; NSFERR: LD DE,NSFMSG ;'No Source File' JP EREXIT ; NSFMSG: DB 'No Source File Found' DB CR,LF,BEL,0 ; INFCB: DB 0,0,0,0,0,0,0,0 DB 0,'ASM',0,0,0,0 DB 0,0,0,0,0,0,0,0 DB 0,0,0,0,0,0,0,0 DB 0 ; ; Create output file with ext Z80 ; CREATO: LD DE,OUTFCB LD C,$OPEN CALL BDOS CP NFF JR NZ,OFEERR CREAT4: LD DE,OUTFCB LD C,$CREAT CALL BDOS CP NFF JR Z,NDSERR LD DE,OUTFCB LD C,$OPEN CALL BDOS LD A,RECLEN LD (OBUFCT),A LD HL,OBUFF LD (@OBUFF),HL RET ; NDSERR: LD DE,NDSMSG ;'No directory space' JP EREXIT ; NDSMSG: DB 'No Directory Space' DB CR,LF,BEL,0 ; OUTFCB: DB 0,0,0,0,0,0,0,0 DB 0,'Z80',0,0,0,0 DB 0,0,0,0,0,0,0,0 DB 0,0,0,0,0,0,0,0 DB 0 ; ; OFEERR: LD DE,OFEMSG ;'Output file exists' CALL PRTLIN CALL CHKYES JP NZ,ABORT LD DE,OUTFCB LD C,$DEL CALL BDOS JR CREAT4 ; OFEMSG: DB 'Output File Already Exists' DB ' -- Delete it and Continue ? (Y/N) ' DB BEL,0 ;******************************************************* ; ; Put line at HL to output file until 0. ; PUTLIN: LD A,(HL) AND A RET Z CALL PUTCHR INC HL JR PUTLIN ; ; Put spaces or tabs at HL to output ; file until non-(space or tab) ; PUTSPT: LD A,(HL) CP ' ' JR Z,PUTSP1 CP HT RET NZ PUTSP1: CALL PUTCHR INC HL JR PUTSPT ; ; Put CR, LF to output file. ; PCRLF: LD A,CR CALL PUTCHR LD A,LF ; ; Put char in A to output file, ; update column number. ; PUTCHR: PUSH HL PUSH DE PUSH BC PUSH AF LD (TEMP),A LD HL,(@OBUFF) CP EOT JR NZ,PCHR0 LD A,'!' PCHR0: LD (HL),A CP CR JR Z,PUTCH0 CP LF JR Z,PUTCH0 CP HT JR NZ,PUTCH1 LD A,(COLNUM) DEC A AND NF8 ADD A,N09 JR PUTCH2 TEMP: DB 0 ; PUTCH0: LD A,1 JR PUTCH2 ; PUTCH1: LD A,(COLNUM) INC A PUTCH2: LD (COLNUM),A INC HL ;inc obuff ptr LD A,(OBUFCT) DEC A  ;dec obuff count JR NZ,PTCH21 LD A,RECLEN PTCH21: LD (OBUFCT),A LD A,H CP HIGH OBUFF+OBFLEN JR NZ,PUTCH4 LD A,L CP LOW OBUFF+OBFLEN JR NZ,PUTCH4 LD DE,OBUFF PUTCH3: LD C,$DMA PUSH DE CALL BDOS POP DE EX DE,HL LD DE,OUTFCB CALL WRTREC ;write record LD DE,RECLEN ADD HL,DE EX DE,HL LD A,D CP HIGH OBUFF+OBFLEN JR NZ,PUTCH3 LD A,E CP LOW OBUFF+OBFLEN JR NZ,PUTCH3 LD HL,OBUFF PUTCH4: LD (@OBUFF),HL POP AF POP BC POP DE POP HL RET ; ; Write record. ; WRTREC: LD C,$WRNR PUSH HL CALL BDOS POP HL AND A RET Z LD DE,OFWMSG ;'output file write error' JP EREXIT ; OFWMSG: DB 'Output File Write Error' DB CR,LF,BEL,0 ; ; Fill rest of obuff with EOF, ; write record, and close file. ; CLOSEO: LD A,EOF CALL PUTCHR LD A,(OBUFCT) CP RECLEN JR NZ,CLOSEO ; CLOSE1: LD DE,OBUFF LD HL,(@OBUFF) LD A,H CP D JR NZ,CLOSE3 LD A,L CP E JR NZ,CLOSE3 CLOSE2: LD DE,OUTFCB LD C,$CLOSE JP BDOS ; CLOSE3: LD C,$DMA PUSH DE CALL BDOS POP DE EX DE,HL LD DE,OUTFCB CALL WRTREC LD DE,RECLEN ADD HL,DE EX DE,HL LD A,(@OBUFF+1) CP D JR NZ,CLOSE3 LD A,(@OBUFF) CP E JR NZ,CLOSE3 JR CLOSE2 ; ; Print line at DE until 0 ; on console. ; PRTLIN: LD A,(DE) AND A RET Z CALL CONOUT INC DE JR PRTLIN ; ; Console Output character in A. ; CONOUT: PUSH AF PUSH BC PUSH DE PUSH HL LD E,A LD D,N00 LD C,$COUT CALL BDOS POP HL POP DE POP BC POP AF RET ; ; Get char from CONSOLE and return ; Z set if char.AND.5FH = 'Y' ; CHKYES: LD C,$CIN CALL BDOS PUSH AF CALL CRLF POP AF AND 5FH CP 'Y' RET ; ; Return Z if no char available, ; otherwise, get char in A. ; CHKIN: LD C,$CDAV CALL BDOS OR A RET Z LD C,$CIN CALL BDOS RET ; ; ; CRLF: LD DE,CRLFMG JR PRTLIN ; CRLFMG: DB CR,LF,0 ; ; Convert upper case in A to lower case. ; LCASE: CP 'A' RET C CP 'Z'+1 RET NC OR 20H RET ; ; Convert lower case in A to  upper case. ; UCASE: CP 'a' RET C CP 'z'+1 RET NC AND 5FH RET ; ; Print activity dot ; PDOT: LD A,(LNCNT) DEC A LD (LNCNT),A RET NZ LD A,'.' CALL CONOUT LD A,100 ; Dot every 100 lines LD (LNCNT),A LD A,(DOTCNT) DEC A LD (DOTCNT),A JR NZ,PDOT1 LD A,' ' CALL CONOUT LD A,10 ; Space every 10 dots LD (DOTCNT),A PDOT1: LD A,(NLCNT) DEC A LD (NLCNT),A RET NZ CALL CRLF LD A,50 ; 50 dots per line LD (NLCNT),A RET ; LNCNT: DB 100 ; dot every 100 lines DOTCNT: DB 10 ; space every 10 dots NLCNT: DB 50 ; 50 dots per line ; ; Uninitialized Data ; @CDISK: DS 1 SPBDOS: DS 2 DS STCKLN STACK: EQU $ COLNUM: DS 1 @OPCOD: DS 2 OPCBUF: DS OPBFLN @OPRND: DS 2 @OBUFF: DS 2 OBUFCT: DS 1 OBUFF: DS OBFLEN LBUFF: DS LBUFLN+3 @IBUFF: DS 2 IBUFF: DS IBFLEN END START ; ; 8080 assembler test instruction file ; org 100h ;test org pseudo op label1 equ $ ;test equ pseudo op dw label1 ;test defw pseudo op db 03fh ;test defb pseudo op form 1 db 'THIS IS A TEST' ;test defb pseudo op form 2 ds 55 ;test defs pseudo op ; ibm 'ASCII FIRST,0DFF,THEN HEX ; mov a,b ;test load mvi a,0ffh mov a,m mov b,c ;test load mvi b,0ffh mov b,m mov m,b mov m,m mvi m,23 stax b stax d sta label1 ldax b ldax d lda label1 lxi b,label1 lxi d,label1 lxi h,label1 lxi sp,label1 lhld label1 shld label1 sphl push b push d push h push psw pop b pop d pop h pop psw xchg xthl add a adi 0ffh add m adc a aci 0ffh adc m sub a sui 0ffh sub m sbb a ana a ani 0ffh ana m ora a xra a cmp a inr a inr m dcr m dad b inx b inx d inx h inx sp dcx b dcx d dcx h dcx sp rlc ral rrc rar daa cma cmc stc nop hlt di ei jmp label1 jnz label1  jz label1 jnc label1 jc label1 jpo label1 jpe label1 jp label1 jm label1 pchl call label1 cnz label1 cz label1 cpo label1 cpe label1 ret rnz rz rpo rst 7 in 03h out 034h label jnz $+3 ; test !label2 jmp label ; comment ! lb3:rpo ******************************************************** ;******************************************************* ; file: xTHL ; comment 17 XCHg ; comment 25 ; comment 25 longname ; comment 33 longname ; comment 41 longname:: xra a ; comment 25 longname::stc ; comment 25 longname:: stc ; elab:: lhld nnnnnnnnnnNnn ; comment 33 longname:stc longname: stc short1::stc ;comment short: ; comment 9 short ; comment 9 ; comment 9 label stc!stc! stc ; comment 25 label stc !stc !stc ; comment 25 label stc ! stc ! stc ; comment 25 daa ; comment 17 end ; comment 17 end $  dcx d dcx h dcx sp rlc ral rrc rar daa cma cmc stc nop hlt di ei jmp label1 jnz label1 ; ; Z80 ASSEMBLER TEST INSTRUCTION FILE ; ORG 100H ;TEST ORG PSEUDO OP LABEL1 EQU $ ;TEST EQU PSEUDO OP DEFW LABEL1 ;TEST DEFW PSEUDO OP DEFB 03FH ;TEST DEFB PSEUDO OP FORM 1 DEFB 'THIS IS A TEST' ;TEST DEFB PSEUDO OP FORM 2 DEFS 55 ;TEST DEFS PSEUDO OP ; ; THE HEX NUMBERS MUST BE IN PAIRS AND MUST NOT HAVE 'H' AFTER THEM ; THE ASCII STRINGS CAN INCLUDE ANY CHARACTERS (INCLUDING QUOTES AND ; SEMI-COLONS EXCEPT NO COMMAS ; IBM 'ASCII FIRST,0DFF,THEN HEX ; LD A,B ;TEST LOAD LD A,0FFH LD A,(HL) LD A,(IX+5) LD A,(IY+6) LD B,C ;TEST LOAD LD B,0FFH LD B,(HL) LD B,(IX+5) LD B,(IY+6) LD (HL),B LD (HL),(HL) LD (IX+5),B LD (IY+5),B LD (HL),23 LD (IX+1),24 LD (IY+1),25 LD (BC),A LD (DE),A LD (LABEL1),A LD A,(BC) LD A,(DE) LD A,(LABEL1) LD A,I LD A,R LD I,A LD R,A LD BC,LABEL1 LD DE,LABEL1 LD HL,LABEL1 LD SP,LABEL1 LD IX,LABEL1 LD IY,LABEL1 LD BC,(LABEL1) LD DE,(LABEL1) LD HL,(LABEL1) LD IX,(LABEL1) LD IY,(LABEL1) LD (LABEL1),HL LD (LABEL1),BC LD (LABEL1),DE LD (LABEL1),IX LD (LABEL1),IY LD SP,HL LD SP,IX LD SP,IY PUSH BC PUSH DE PUSH HL PUSH AF PUSH IX PUSH IY POP BC POP DE POP HL POP IX POP IY POP AF EX DE,HL EX AF,AF' EXX EX (SP),HL EX (SP),IX EX (SP),IY LDI LDIR LDD LDDR CPI CPIR CPD CPDR ADD A ADD 0FFH ADD (HL) ADD (IX+5) ADD (IY+6) ADC A ADC 0FFH ADC (HL) ADC (IX+5) ADC (IY+5) SUB A SUB 0FFH SUB (HL) SUB (IX+5) SUB (IY+5) SBC A AND A AND 0FFH AND (HL) AND (IX+5) AND (IY+5) OR A XOR A CP A ADD A,A ADD A,0FFH ADD A,(HL) ADD A,(IX+5) ADD A,(IY+6) ADC A,A ADC A,0FFH ADC A,(HL) ADC A,(IX+5) ADC A,(IY+5) SUB A,A SUB A,0FFH SUB A,(HL) SUB A,(IX+5) SUB A,(IY+5) SBC A,A AND A,A AND A,0FFH AND A,(HL) AND A,(IX+5) AND A,(IY+5) OR A,A XOR A,A CP A,A INC A INC (HL) INC (IX+3) INC (IY+5) DEC (HL) ADD HL,BC ADC HL,DE SBC HL,DE ADD IX,BC ADD !IY,DE INC BC INC DE INC HL INC SP INC IX INC IY DEC BC DEC DE DEC HL DEC SP DEC IX DEC IY RLCA RLA RRCA RRA RLC B RLC (HL) RLC (IX+5) RLC (IY+4) RL B RRC B RR B SLA B SRA B SRL B RLD RRD DAA CPL NEG CCF SCF NOP HALT DI EI IM0 IM1 IM2 IM 0 BIT 5,E BIT 5,(HL) BIT 5,(IX+5) BIT 5,(IY+4) SET 4,B SET 4,(HL) SET 4,(IX+5) SET 4,(IY+4) RES 4,E RES 4,(HL) JP LABEL1 JP NZ,LABEL1 JP Z,LABEL1 JP NC,LABEL1 JP C,LABEL1 JP PO,LABEL1 JP PE,LABEL1 JP P,LABEL1 JP M,LABEL1 JR +6 JR C,5 JR NC,5 JR Z,5 JR NZ,5 JP (HL) JP (IX) JP (IY) DJNZ 5 CALL LABEL1 CALL NZ,LABEL1 CALL Z,LABEL1 CALL PO,LABEL1 CALL PE,LABEL1 RET RET NZ RET Z RET PO RETI RETN RST 38H IN A,(03H) IN B,(C) INI INIR IND INDR OUT (034H),A OUT (C),E OUTI OTIR OUTD OTDR END $ ; ; z80 assembler test instruction file ; org 100h ;test org pseudo op label1 equ $ ;test equ pseudo op defw label1 ;test defw pseudo op defb 03fh ;test defb pseudo op form 1 defb 'THIS IS A TEST' ;test defb pseudo op form 2 defs 55 ;test defs pseudo op ; ibm 1a0000,top of screen on lear seigler adm3,0d0a0d0a,down 3 lines ; ld a,b ;test load ld a,0ffh ld a,(hl) ld a,(ix+5) ld a,(iy+6) ld b,c ;test load ld b,0ffh ld b,(hl) ld b,(ix+5) ld b,(iy+6) ld (hl),b ld (hl),(hl) ld (ix+5),b ld (iy+5),b ld (hl),23 ld (ix+1),24 ld (iy+1),25 ld (bc),a ld (de),a ld (label1),a ld a,(bc) ld a,(de) ld a,(label1) ld a,i ld a,r ld i,a ld r,a ld bc,label1 ld de,label1 ld hl,label1 ld sp,label1 ld ix,label1 ld iy,label1 ld bc,(label1) ld de,(label1) ld hl,(label1) ld ix,(label1) ld iy,(label1) ld (label1),hl ld (label1),bc ld (label1),de ld (label1),ix ld (label1),iy ld sp,hl ld sp,ix ld sp,iy push bc push de push hl push af push ix push iy pop bc pop de pop hl pop ix pop iy pop af ex de,hl ex af,af' exx ex (sp),hl ex (sp),ix ex (sp),iy ldi ldir ldd lddr cpi cpir cpd cpdr add a add 0ffh add (hl) add (ix+5) add (iy+6) adc a adc 0ffh adc (hl) adc (ix+5) adc (iy+5) sub a sub 0ffh sub (hl) sub (ix+5) sub (iy+5) sbc a and a and 0ffh and (hl) and (ix+5) and (iy+5) or a xor a cp a add a,a add a,0ffh add a,(hl) add a,(ix+5) add a,(iy+6) adc a,a adc a,0ffh adc a,(hl) adc a,(ix+5) adc a,(iy+5) sub a,a sub a,0ffh sub a,(hl) sub a,(ix+5) sub a,(iy+5) sbc a,a and a,a and a,0ffh and a,(hl) and a,(ix+5) and a,(iy+5) or a,a xor a,a cp a,a inc a inc (hl) inc (ix+3) inc (iy+5) dec (hl) add hl,bc adc hl,de sbc hl,de add ix,bc add iy,de inc bc inc de inc hl inc sp inc ix inc iy dec bc dec de dec hl dec sp dec ix dec iy rlca rla rrca rra rlc b rlc (hl) rlc (ix+5) rlc (iy+4) rl b rrc b rr b sla b sra b srl b rld rrd daa cpl neg ccf scf nop halt di ei im0 im1 im2 im 0 bit 5,e bit 5,(hl) bit 5,(ix+5) bit 5,(iy+4) set 4,b set 4,(hl) set 4,(ix+5) set 4,(iy+4) res 4,e res 4,(hl) jp label1 jp nz,label1 jp z,label1 jp nc,label1 jp c,label1 jp po,label1 jp pe,label1 jp p,label1 jp m,label1 jr +6 jr c,5 jr nc,5 jr z,5 jr nz,5 jp (hl) jp (ix) jp (iy) djnz 5 call label1 call nz,label1 call z,label1 call po,label1 call pe,label1 ret ret nz ret z ret po reti retn rst 38h in a,(03h) in b,(c) ini inir ind indr out (034h),a out (c),e outi otir outd otdr MULT:; UNSIGNED SIXTEEN BIT INTEGER MULTIPLY. ; ON ENTRANCE: MULTIPLIER IN DE. ; MULTIPLICAND IN HL. ; ; ON EXIT: RESULT IN HL. ; ; REGISTER USES: ; ; ; H HIGH ORDER PARTIAL RESULT ; L LOW ORDER PARTIAL RESULT ; D HIGH ORDER MULTIPLICAND ; E LOW ORDER MULTIPLICAND ; B COUNTER FOR NUMBER OF SHIFTS ; C HIGH ORDER BITS OF MULTIPLIER ; A LOW ORDER BITS OF MULTIPLIER ; LD B,16; NUMBER OF BITS- INITIALIZE LD C,D; MOVE MULTIPLIER LD A,E; LD X,Y ;SHOULD GET 'U' ERROR LOAD A,B ;SHOULD GET 'O' ERROR CP 'A' ;TEST 'X' FORMAT EX DE,HL; MOVE MULTIPLICAND LD HL,0; CLEAR PARTIAL RESULT EJECT ;TEST EJECT PROCESSING MLOOP: SRL C; SHIFT MULTIPLIER RIGHT RRA; LEAST SIGNIFICANT BIT IS IN CARRY JR NC,NOADD-$; IF NO CARRY SKIP THE ADD ADD HL,DE; ELSE ADD MULTIPLICAND TO PARTIAL RESULT NOADD: EX DE,HL; SHIFT MULTIPLICAND LEFT ADD HL,HL; BY MULTIPLYING IT BY TWO EX DE,HL; DJNZ MLOOP-$; REPEAT UNTIL NO MORE BITS RET; END; ; ; LABEL1: LD (LABEL1),A ; COMMENT ld (lAbel1),A ; comment LD (laBel1),a ; comment ; LD (HL),B ;comment LD A,B ;comment LD (HL),0 ; COMMENT ; IN A,LABEL1 in A,03H ; JP PO,LABEL1 jp PO,Label1 JP po,lABLE1 ; ADD A,A ADD A,B add a,b ; or a,b OR A,B ; ELSE ENDIF ; LD (LABEL1),HL ; COMMENT ld (lAbel"1),HL ; comment LD (laBel1),hl ; comment ; ******************************************************** ;******************************************************* ; file: eX (SP),HL ; comment 25 EX dE,HL ; comment 25 ; comment 25 longname ; comment 33 longname ; comment 41 longname:: xor a ; comment 25 longname::scf ; comment 25 longname:: scf longname scf longname scf ; elab:: ld hl,(nnnnnnnnnnNnn); comment 35 longname:scf longname: scf short1::scf ;comment short: ; comment 9 short ; comment 9 ; comment 9 label scf!scf! scf ; comment 25 label scf ! scf !scf ; comment 25 daa ; comment 17 end ; comment 17 end $ nt ; LD (HL),B ;comment LD A,B ;comment LD (HL),0 ; COMMENT ; IN A,LABEL1 in A,03H ; JP PO,LABEL1 jp PO,Label1 JP po,lABLE1 ; ADD A,A ADD A,B add a,b ; or a,b OR A,B ; ELSE ENDIF ; LD (LABEL1),HL ; COMMENT ld (lAbel This is the release date of the disk. TEST1B Z80 TEST1B .ASM 9D F2 1920 15 TEST1B .Z80 F4 86 7936 62  Fog Library Disk FOG-CPM.040 Copyright (1986) by Fog International Computer Users Group to the extent not copyrighted by the original author for the exclusive use and enjoyment of its members. Any reproduction or distribution for profit or personal gain is strictly forbidden. For information, contact FOG, P. O. Box 3474, Daly City, CA. 94015-0474. as part of the description of a file indicates that the program is distributed on a "try first, pay if you like it" basis. If you find the program(s) meet your need, please refer to the author's documentation for information on becoming a registered user. Only by registering and paying for the programs you like and use will the authors of such programs continue development. Often, more complete documentation, additional modules, and new releases are available only to registered users. Z80 to 8080 and 8080 to Z80 translators. Filename Description -04-00 .86 This is the release date of the disk. -CPM040 .DOC This is the description of the disk contents. XLATE5 .COM 933A 5K ver. 5 [Translate 1 of 3] Takes 8080 Intel source and creates a Zilog Z80 file ready for assembly with M80. 8080 source is included. XLATE5 .DOC A7D8 11K ver. 5 [Translate 2 of 3] XLATE5 .AQM 7D02 31K ver. 5 [Translate 3 of 3] XLT80 .COM D3B2 7K ver. 1.04 [XLT80 1 of 4] Translates Zilog Z80 to Intel 8080 code and flags intrinsic Z80 opcodes by printing line numbers. 8080 source included. XLT80 .DOC FC5E 2K ver. 1.04 [XLT80 2 of 4] XLT80 .ASM 92F5 45K ver. 1.04 [XLT80 3 of 4] TEST1B .ASM 9DF2 2K ver. 1.04 [XLT80 4 of 4] XLTZ80 .COM 6D4C 6K ver. 2.64 [XLTZ80 1 of 4] Translates Intel 8080 to Zilog Z80 code. Z80 source included. XLTZ80 .DOC 21B3 3K ver. 2.64 [XLTZ80 2 of 4] XLTZ80 .Z80 62DB 33K ver. 2.64 [XLTZ80 3 of 4] TEST1B .Z80 F486 8K ver. 2.64 [XLTZ80 4 of 4]  ? " #$%&'