LASM3 Description as of 11/01/84 This is an enhanced version of Pete Mack's LASM assembler which was it- self an improved version of Ward Christenson's LINKASM assembler. I have added all of the Z80 op codes in the style of the 8080. I also corrected the program so that the symbol cross reference (requested by the XREF directive) will be printed on the console if the normal listing has been directed there (the previous version only generated the XREF listing if the normallisting was directed to a .PRN file). There is one incompatibility between this assembler and the ASM assem- bler. ASM has a SET directive which is like EQU but allows the label to be redefined later. The Z80 has an op code called SET for setting a selected bit in a byte. Since the SET directive is rarely used in ASM, I decided it would probably cause few problems if I renamed the SET di- rective (to NOW) and used SET for the Z80 op code so that is what I did. Steve Schlaifer 1500 Rollin St. So. Pasadena, Calif. 91030 (818) 441-1236 ======================================================================== LASM3 Description as of 11/01/84 Directives which are recognized by LASM but not by ASM include LINK, XREF, SYM, and TITLE. LINK 'file' LINK closes the current input source file, opens the named file which must be on the same drive with the extension .ASM and continues the as- sembly process using this new file as a continuation of the previous one. I have found this useful with my Apple CP/M system since my disks are small and I have difficulties editting files which are larger than about 50K. With the link directive, I can break up a large source file into smaller pieces for editting and then assemble them without having to remerge them. XREF XREF has no operands. It causes a cross-reference of all the labels in the assembled source file to be listed at the end of the source listing with the line numbers where they are defined followed by the line num- bers where they are used. SYM SYM has no operands. It causes a file with the extension .SYM to be created on the same drive on which the .HEX file is being written. This file contains a list of all the labels and their assembled addresses. TITLE 'title string' TITLE takes a string operand. It causes the string to be printed at the top of each page of the source listing for titling the listing. The following is a complete list of the op codes recognized by this as- sembler and their Z80 equivalents. For a detailed description of the Z80 op codes, I refer you to one of the many books which have been pub- lished on it. I use "programming the Z80" by Rodnay Zaks. A single register is designated as 'r' and may be one of A, B, C, D, E, H, L, or M; a double register is designated as 'rr' and may be one of B, D, H, or SP; 'rx' is the same as 'rr', except H is replaced with X (the Z80 IX register); 'ry' is the same as 'rr' except H is replaced with Y (the Z80 IY register). At times, the PSW is referred to. This is the AF register pair. The operands for the relative jump instructions (e.g. DJNZ, JR, JRNZ, etc.) are to be given as full addresses. For example: JOE op : : DJNZ JOE The (new) Z80 op codes are flagged with an 'x' in column 1. LASM Description as of 3/23/84 ADC r ADC r STA nn LD (nn),A x ADCX d ADC A,(IX+d) x SIXD nn LD (nn),IX x ADCY d ADC A,(IY+d) x SIYD nn LD (nn),IY ACI n ADC A,n x SBCD nn LD (nn),BC x DADC rr ADC HL,rr x SDED nn LD (nn),DE ADD r ADD A,r SHLD nn LD (nn),HL x ADDX d ADD A,(IX+d) x SSPD nn LD (nn),SP x ADDY d ADD A,(IY+d) LDAX B LD A,(BC) ADI n ADD A,n LDAX D LD A,(DE) DAD rr ADD HL,rr SPHL LD SP,HL x DADX rx ADD IX,rx x SPIX LD SP,IX x DADY ry ADD IY,rr x SPIY LD SP,IY ANA r AND r x LDAI LD A,I x ANDX d AND (IX+d) x STAI LD I,A x ANDY d AND (IY+d) x LDAR LD A,R ANI n AND n x STAR LD R,A x BIT b,r BIT b,r x LDD LDD x BITX b,d BIT b,(IX+d) x LDDR LDDR x BITY b,d BIT b,(IY+d) x LDI LDI CALL pq CALL pq x LDIR LDIR CNZ pq CALL NZ,pq x NEG NEG CZ pq CALL Z,pq NOP NOP CNC pq CALL NC,pq ORA r OR r CC pq CALL C,pq x ORX d OR (IX+d) CPO pq CALL PO,pq x ORY d OR (IY+d) CPE pq CALL PE,pq ORI n OR n CP pq CALL P,pq x OTDR OTDR CM pq CALL M,pq x OTIR OTIR CMC CCF x OUTP r OUT (C),r CMP r CP r OUT n OUT (n),A x CMPX d CP (IX+d) x OUTD OUTD x CMPY d CP (IY+d) x OUTI OUTI CPI n CP n POP PSW POP AF x CCD CPD POP B POP BC x CCDR CPDR POP D POP DE x CCI CPI POP H POP HL x CCIR CPIR x POP X POP IX CMA CPL x POP Y POP IY DAA DAA PUSH PSW PUSH AF DCR r DEC r PUSH B PUSH BC x DCRX d DEC (IX+d) PUSH D PUSH DE x DCRY d DEC (IY+d) PUSH H PUSH HL DCX rr DEC rr x PUSH X PUSH IX x DCXX DEC IX x PUSH Y PUSH IY x DCXY DEC IY x RES b,r RES b,r DI DI x RESX b,d RES b,(IX+d) x DJNZ e DJNZ e x RESY b,d RES b,(IY+d) EI EI RET RET x EXAF EX AF,AF' RNZ RET NZ XCHG EX DE,HL RZ RET Z XTHL EX (SP),HL RNC RET NC x XTIX EX (SP),IX RC RET C x XTIY EX (SP),IY RPO RET PO x EXX EXX RPE RET PE HLT HALT RP RET P x IM0 IM 0 RM RET M x IM1 IM 1 x RETI RETI x IM2 IM 2 x RETN RETN x INP r IN r,(C) RAL RLA IN n IN A,(n) x RALR r RL r INX rr INC rr x RALX d RL (IX+d) x INXX INC IX x RALY d RL (IY+d) x INXY INC IY RLC RLCA INR r INC r x RLCR r RLC r x INRX d INC (IX+d) x RLCX d RLC (IX+d) x INRY d INC (IY+d) x RLCY d RLC (IY+d) x IND IND x RLD RLD x INDR INDR x RRD RRD x INI INI RAR RRA x INIR INIR x RARR r RR r JMP pq JP pq x RARX d RR (IX+d) JNZ pq JP NZ,pq x RARY d RR (IY+d) JZ pq JP Z,pq RRC RRCA JNC pq JP NC,pq x RRCR r RRC r JC pq JP C,pq x RRCX d RRC (IX+d) JPO pq JP PO,pq x RRCY d RRC (IY+d) JPE pq JP PE,pq RST p RST p JP pq JP P,pq SBB r SBC A,r JM pq JP M,pq x SBBX d SBC A,(IX+d) PCHL JP (HL) x SBBY d SBC A,(IY+d) x PCIX JP (IX) SBI n SBC A,n x PCIY JP (IY) x DSBB rr SBC HL,rr x JR e JR e STC SCF x JRNZ e JR NZ,e x SET b,r SET b,r x JRZ e JR Z,e x SETX b,d SET b,(IX+d) x JRNC e JR NC,e x SETY b,d SET b,(IY+d) x JRC e JR C,e x SAL SLA A LHLD nn LD HL,(nn) x SALR r SLA r x LIXD nn LD IX,(nn) x SALX d SLA (IX+d) x LIYD nn LD IY,(nn) x SALY d SLA (IY+d) x LBCD nn LD BC,(nn) x SAR SRA A x LDED nn LD DE,(nn) x SARR r SRA r x LSPD nn LD SP,(nn) x SARX d SRA (IX+d) LXI rr,nn LD rr,nn x SARY d SRA (IY+d) x LXIX nn LD IX,nn x SLR SRL A x LXIY nn LD IY,nn x SLRR r SRL r MVI r,n LD r,n x SLRX d SRL (IX+d) x MVIX n,d LD (IX+d),n x SLRY d SRL (IY+d) x MVIY n,d LD (IY+d),n SUB r SUB r MOV r,r' LD r,r' x SUBX d SUB (IX+d) x MOVX r,d LD r,(IX+d) x SUBY d SUB (IY+d) x MOVY r,d LD r,(IY+d) SUI n SUB n x STX r,d LD (IX+d),r XRA r XOR r x STY r,d LD (IY+d),r x XORX d XOR (IX+d) STAX B LD (BC),A x XORY d XOR (IY+d) STAX D LD (DE),A XRI n XOR n LDA nn LD A,(nn) ========================================================================