More updates to the assembler
This commit is contained in:
@@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
SYMWID: EQU 10
|
SYMWID: EQU 10
|
||||||
FCB: EQU 5CH
|
FCB: EQU 5CH
|
||||||
BUFSIZ: EQU 128 ;Source code buffer
|
BUFSIZ: EQU 128
|
||||||
LSTBUFSIZ:EQU BUFSIZ ;List file buffer
|
|
||||||
HEXBUFSIZ:EQU BUFSIZ ;Hex file buffer
|
|
||||||
EOL: EQU 13 ;ASCII carriage return
|
EOL: EQU 13 ;ASCII carriage return
|
||||||
OBJECT: EQU 100H ;DEFAULT "PUT" ADDRESS
|
OBJECT: EQU 100H ;DEFAULT "PUT" ADDRESS
|
||||||
|
|
||||||
@@ -127,7 +125,6 @@ ENDJ: JMP END
|
|||||||
ENDLN:
|
ENDLN:
|
||||||
XOR AL,AL ;Flag no errors on line
|
XOR AL,AL ;Flag no errors on line
|
||||||
ENDLIN:
|
ENDLIN:
|
||||||
;AL = error code for line. Stack depth unknown
|
|
||||||
MOV SP,STACK
|
MOV SP,STACK
|
||||||
CALL NEXLIN
|
CALL NEXLIN
|
||||||
JP LOOP
|
JP LOOP
|
||||||
@@ -236,10 +233,6 @@ NOMOD:
|
|||||||
|
|
||||||
|
|
||||||
MROPS:
|
MROPS:
|
||||||
|
|
||||||
; Get two operands and check for certain types, according to flag byte
|
|
||||||
; in CL. OP code in CH. Returns only if immediate operation.
|
|
||||||
|
|
||||||
PUSH CX ;Save type flags
|
PUSH CX ;Save type flags
|
||||||
CALL GETOP
|
CALL GETOP
|
||||||
PUSH DX ;Save first operand
|
PUSH DX ;Save first operand
|
||||||
@@ -372,29 +365,6 @@ GETOP2:
|
|||||||
|
|
||||||
|
|
||||||
GETOP:
|
GETOP:
|
||||||
|
|
||||||
; Get one operand. Operand may be a memory reference in brackets, a register,
|
|
||||||
; or a constant. If a flag (such as "B" for byte operation) is encountered,
|
|
||||||
; it is noted and processing continues to find the operand.
|
|
||||||
;
|
|
||||||
; On exit, AL (=DH) has the type of operand. Other information depends
|
|
||||||
; on the actual operand:
|
|
||||||
;
|
|
||||||
; AL=DH=0 Memory Reference. DL has the address mode properly prepared in
|
|
||||||
; the 8086 R/M format (middle bits zero). The constant part of the address
|
|
||||||
; is in ADDR. If an undefined label needs to be added to this, a pointer to
|
|
||||||
; its information fields is in ALABEL, otherwise ALABEL is zero.
|
|
||||||
;
|
|
||||||
; AL=DH=1 Value. The constant part is in DATA. If an undefined label needs
|
|
||||||
; to be added to this, a pointer to its information fields is in DLABEL,
|
|
||||||
; otherwise DLABEL is zero. "$" and "RET" are in this class.
|
|
||||||
;
|
|
||||||
; AL=DH=2 8-bit Register. DL has the register number.
|
|
||||||
;
|
|
||||||
; AL=DH=3 16-bit Register. DL has the register number.
|
|
||||||
;
|
|
||||||
; AL=DH=4 Segment Register. DL has the register number.
|
|
||||||
|
|
||||||
CALL GETSYM
|
CALL GETSYM
|
||||||
GETOP1:
|
GETOP1:
|
||||||
;Enter here if we don't need a GETSYM first
|
;Enter here if we don't need a GETSYM first
|
||||||
@@ -451,16 +421,8 @@ FLG:
|
|||||||
|
|
||||||
|
|
||||||
GETVAL:
|
GETVAL:
|
||||||
|
|
||||||
; Expression analyzer. On entry, if AL=0 then do not allow base or index
|
|
||||||
; registers. If AL=1, we are analyzing a memory reference, so allow base
|
|
||||||
; and index registers, and compute addressing mode when done. The constant
|
|
||||||
; part of the expression will be found in CON. If an undefined label is to
|
|
||||||
; be added to this, a pointer to its information fields will be found in
|
|
||||||
; UNDEF.
|
|
||||||
|
|
||||||
LAHF
|
LAHF
|
||||||
XCHG AX,BP ;Flag is kept in BP
|
XCHG AX,BP
|
||||||
SAHF
|
SAHF
|
||||||
PUSH BX
|
PUSH BX
|
||||||
MOV BX,0
|
MOV BX,0
|
||||||
@@ -706,23 +668,6 @@ ERR30: JNZ ERR3
|
|||||||
|
|
||||||
|
|
||||||
GETSYM:
|
GETSYM:
|
||||||
|
|
||||||
; The lexical scanner. Used only in the operand field. Returns with the token
|
|
||||||
; in SYM and AL, sometimes with additional info in BX or DX.
|
|
||||||
;
|
|
||||||
; AL=SYM=0 Undefined label. BX has pointer to information fields.
|
|
||||||
;
|
|
||||||
; AL=SYM=1 Constant (or defined label). DX has value.
|
|
||||||
;
|
|
||||||
; AL=SYM=2,3,4 8-bit register, 16-bit register, or segment register,
|
|
||||||
; respectively. DL has register number.
|
|
||||||
;
|
|
||||||
; AL=SYM=5 A mode flag (such as "B" for byte operation). Also stored in
|
|
||||||
; appropriate memory location--FLAG or LONG.
|
|
||||||
;
|
|
||||||
; All other values are the ASCII code of the character. Note that this may
|
|
||||||
; never be a letter or number.
|
|
||||||
|
|
||||||
CALL GETSY
|
CALL GETSY
|
||||||
MOV AL,[SYM]
|
MOV AL,[SYM]
|
||||||
RET
|
RET
|
||||||
@@ -1169,24 +1114,6 @@ EMPTY:
|
|||||||
|
|
||||||
|
|
||||||
CREATE:
|
CREATE:
|
||||||
|
|
||||||
; Add a new node to the identifier tree. The identifier is at ID with
|
|
||||||
; bit 7 of the last character set to one. The length of the identifier is
|
|
||||||
; in LENID, which is ID-1.
|
|
||||||
;
|
|
||||||
; Node format:
|
|
||||||
; 1. Length of identifier (1 byte)
|
|
||||||
; 2. Identifier (1-80 bytes)
|
|
||||||
; 3. Left link (2-byte pointer to alphabetically smaller identifiers)
|
|
||||||
; 4. Right link (0 if none larger)
|
|
||||||
; 5. Data field:
|
|
||||||
; a. Defined flag (0=undefined, 1=defined)
|
|
||||||
; b. Value (2 bytes)
|
|
||||||
;
|
|
||||||
; This routine returns with AL=zero and zero flag set (which indicates
|
|
||||||
; on return from LOOKUP that it has not yet been defined), DX points
|
|
||||||
; to start of new node, and BX points to data field of new node.
|
|
||||||
|
|
||||||
MOV AL,[LENID]
|
MOV AL,[LENID]
|
||||||
ADD AL,8 ;Storage needed for the node
|
ADD AL,8 ;Storage needed for the node
|
||||||
MOV BX,[HEAP]
|
MOV BX,[HEAP]
|
||||||
@@ -1432,8 +1359,6 @@ IMM:
|
|||||||
RET
|
RET
|
||||||
|
|
||||||
PUT:
|
PUT:
|
||||||
;Save byte in AL as pure code, with intermediate code bits 00. AL and
|
|
||||||
;DI destroyed, no other registers affected.
|
|
||||||
PUSH BX
|
PUSH BX
|
||||||
PUSH CX
|
PUSH CX
|
||||||
MOV CH,0 ;Flag as pure code
|
MOV CH,0 ;Flag as pure code
|
||||||
@@ -1443,7 +1368,6 @@ PUT:
|
|||||||
RET
|
RET
|
||||||
|
|
||||||
GEN:
|
GEN:
|
||||||
;Save byte of code in AL, given intermediate code bits in bits 7&8 of CH.
|
|
||||||
CALL PUTINC ;Save it and bump code pointer
|
CALL PUTINC ;Save it and bump code pointer
|
||||||
GEN1:
|
GEN1:
|
||||||
MOV AL,[RELOC]
|
MOV AL,[RELOC]
|
||||||
@@ -1490,9 +1414,6 @@ PUTCD1: MOV BX,[CODE]
|
|||||||
RET
|
RET
|
||||||
|
|
||||||
PUTWOR:
|
PUTWOR:
|
||||||
;Save the word value described by [DLABEL] and [DATA] as code. If defined,
|
|
||||||
;two bytes of pure code will be produced. Otherwise, appropriate intermediate
|
|
||||||
;code will be generated.
|
|
||||||
PUSH CX
|
PUSH CX
|
||||||
MOV CH,80H
|
MOV CH,80H
|
||||||
PUSH DX
|
PUSH DX
|
||||||
@@ -1500,7 +1421,6 @@ PUTWOR:
|
|||||||
JP PUTBW
|
JP PUTBW
|
||||||
|
|
||||||
PUTBYT:
|
PUTBYT:
|
||||||
;Same as PUTWOR, above, but for byte value.
|
|
||||||
PUSH CX
|
PUSH CX
|
||||||
MOV CH,40H
|
MOV CH,40H
|
||||||
PUSH DX
|
PUSH DX
|
||||||
@@ -1562,10 +1482,6 @@ NOUNDEF:
|
|||||||
PRETJ: JP PRET
|
PRETJ: JP PRET
|
||||||
|
|
||||||
PUTADD:
|
PUTADD:
|
||||||
;Save complete addressing mode. Addressing mode is in AL; if this is a register
|
|
||||||
;operation (>=C0), then the one byte will be saved as pure code. Otherwise,
|
|
||||||
;the details of the addressing mode will be investigated and the optional one-
|
|
||||||
;or two-byte displacement will be added, as described by [ADDR] and [ALABEL].
|
|
||||||
PUSH CX
|
PUSH CX
|
||||||
PUSH DX
|
PUSH DX
|
||||||
PUSH BX
|
PUSH BX
|
||||||
@@ -2289,10 +2205,6 @@ NOFIL:
|
|||||||
JP NEXCD
|
JP NEXCD
|
||||||
|
|
||||||
OUTLIN:
|
OUTLIN:
|
||||||
;Copy the source line to the ouput device. Line will be preceded by
|
|
||||||
;assembler-generated line number. This routine may be called several times
|
|
||||||
;on one line (once for each line of object code bytes), so it sets a flag
|
|
||||||
;so the line will only be output on the first call.
|
|
||||||
CALL LIST
|
CALL LIST
|
||||||
MOV AL,[LSTFCB]
|
MOV AL,[LSTFCB]
|
||||||
CMP AL,'Z'
|
CMP AL,'Z'
|
||||||
@@ -2700,7 +2612,7 @@ CONVLP:
|
|||||||
|
|
||||||
PRNT10:
|
PRNT10:
|
||||||
XCHG DX,BX
|
XCHG DX,BX
|
||||||
MOV CH,"0"-" " ;Enable leading zero suppression
|
MOV CH,'0'-' ' ;Enable leading zero suppression
|
||||||
MOV AL,CL
|
MOV AL,CL
|
||||||
CALL LODIG
|
CALL LODIG
|
||||||
MOV AL,BH
|
MOV AL,BH
|
||||||
@@ -2714,7 +2626,7 @@ PRNT10:
|
|||||||
LODIG:
|
LODIG:
|
||||||
CALL LHALF
|
CALL LHALF
|
||||||
DIGIT:
|
DIGIT:
|
||||||
CMP AL,"0"
|
CMP AL,'0'
|
||||||
JZ SUPZ
|
JZ SUPZ
|
||||||
MOV CH,0 ;Turn off zero suppression if not zero
|
MOV CH,0 ;Turn off zero suppression if not zero
|
||||||
SUPZ:
|
SUPZ:
|
||||||
@@ -2935,15 +2847,15 @@ LHALF:
|
|||||||
CMP AL,'9'+1
|
CMP AL,'9'+1
|
||||||
JC RET
|
JC RET
|
||||||
ADD AL,7
|
ADD AL,7
|
||||||
RET: RET
|
RET
|
||||||
|
|
||||||
INCBUF:
|
INCBUF:
|
||||||
INC BX
|
INC BX
|
||||||
CMP BX,HEXBUF+HEXBUFSIZ
|
CMP BX,HEXBUF+BUFSIZ
|
||||||
JZ RET
|
JZ RET
|
||||||
CMP BX,LSTBUF+LSTBUFSIZ
|
CMP BX,LSTBUF+BUFSIZ
|
||||||
JZ RET
|
JZ RET
|
||||||
CMP BX,HEXBUF2+HEXBUFSIZ
|
CMP BX,HEXBUF+BUFSIZ+BUFSIZ
|
||||||
JNZ RET
|
JNZ RET
|
||||||
MOV BX,HEXBUF ;Wrap back to first buffer
|
MOV BX,HEXBUF ;Wrap back to first buffer
|
||||||
RET
|
RET
|
||||||
@@ -2952,10 +2864,6 @@ NONE: DB 0
|
|||||||
|
|
||||||
; 8086 MNEMONIC TABLE
|
; 8086 MNEMONIC TABLE
|
||||||
|
|
||||||
; This table is actually a sequence of subtables, each starting with a label.
|
|
||||||
; The label signifies which mnemonics the subtable applies to--A3, for example,
|
|
||||||
; means all 3-letter mnemonics beginning with A.
|
|
||||||
|
|
||||||
A3:
|
A3:
|
||||||
DB 7
|
DB 7
|
||||||
DB 'dd'
|
DB 'dd'
|
||||||
@@ -3455,19 +3363,6 @@ X4:
|
|||||||
|
|
||||||
|
|
||||||
OPTAB:
|
OPTAB:
|
||||||
; Table of pointers to mnemonics. For each letter of the alphabet (the
|
|
||||||
; starting letter of the mnemonic), there are 5 entries. Each entry
|
|
||||||
; corresponds to a mnemonic whose length is 2, 3, 4, 5, and 6 characters
|
|
||||||
; long, respectively. If there are no mnemonics for a given combination
|
|
||||||
; of first letter and length (such as A-2), then the corresponding entry
|
|
||||||
; points to NONE. Otherwise, it points to a place in the mnemonic table
|
|
||||||
; for that type.
|
|
||||||
|
|
||||||
; This table only needs to be modified if a mnemonic is added to a group
|
|
||||||
; previously marked NONE. Change the NONE to a label made up of the first
|
|
||||||
; letter of the mnemonic and its length, then add a new subsection to
|
|
||||||
; the mnemonic table in alphabetical order.
|
|
||||||
|
|
||||||
DW NONE
|
DW NONE
|
||||||
DW A3
|
DW A3
|
||||||
DW NONE
|
DW NONE
|
||||||
@@ -3599,7 +3494,8 @@ OPTAB:
|
|||||||
DW NONE
|
DW NONE
|
||||||
DW NONE
|
DW NONE
|
||||||
|
|
||||||
HEADER: DB 13,10,'Seattle Computer Products 8086 Assembler Version 2.00',13,10,'$'
|
HEADER: DB 13,10,'Seattle Computer Products 8086 Assembler Version 2.00'
|
||||||
|
DB 13,10,'$'
|
||||||
ERRMES: DM '***** ERROR no. '
|
ERRMES: DM '***** ERROR no. '
|
||||||
NOSPAC: DB 13,10,'No directory space',13,10,24H
|
NOSPAC: DB 13,10,'No directory space',13,10,24H
|
||||||
ENDMES: DM 'H',13,10
|
ENDMES: DM 'H',13,10
|
||||||
@@ -3657,9 +3553,8 @@ LSTPNT: DS 2
|
|||||||
ERRCNT: DS 2
|
ERRCNT: DS 2
|
||||||
LSTRET: DS 2
|
LSTRET: DS 2
|
||||||
RETPT: DS 2
|
RETPT: DS 2
|
||||||
HEXBUF: DS HEXBUFSIZ
|
HEXBUF: DS BUFSIZ+BUFSIZ
|
||||||
HEXBUF2:DS HEXBUFSIZ
|
LSTBUF: DS BUFSIZ
|
||||||
LSTBUF: DS LSTBUFSIZ
|
|
||||||
BC: DS 2
|
BC: DS 2
|
||||||
DE: DS 2
|
DE: DS 2
|
||||||
HL: DS 2
|
HL: DS 2
|
||||||
@@ -3668,4 +3563,4 @@ IY: DS 2
|
|||||||
DS 50
|
DS 50
|
||||||
STACK: EQU $
|
STACK: EQU $
|
||||||
START: EQU $
|
START: EQU $
|
||||||
|
|
||||||
Binary file not shown.
+288
-418
File diff suppressed because it is too large
Load Diff
@@ -45,9 +45,6 @@ where
|
|||||||
|
|
||||||
This assembler can only produce Intel HEX files for object code, therefore you must convert them to binary before they can be executed on the 8086. Under CP/M, this can be done using the <code>LOAD</code> command. If you are using CDOS, which does not have <code>LOAD</code>, you will have to use <code>DEBUG</code> to load the .HEX file to memory and <code>SAVE</code> to save the loaded pages as a disk file.
|
This assembler can only produce Intel HEX files for object code, therefore you must convert them to binary before they can be executed on the 8086. Under CP/M, this can be done using the <code>LOAD</code> command. If you are using CDOS, which does not have <code>LOAD</code>, you will have to use <code>DEBUG</code> to load the .HEX file to memory and <code>SAVE</code> to save the loaded pages as a disk file.
|
||||||
|
|
||||||
> [!TIP]
|
|
||||||
> Don't forget to rename the source files from <code>.ASM</code> to <code>.A86</code>.
|
|
||||||
|
|
||||||
## TRANS86
|
## TRANS86
|
||||||
This is a reconstruction of the SCP Z80 to 8086 Translator shipped together with ASM86. Like ASM86, original copies are long gone and this is the 8086 version from 86-DOS 0.11 translated back to Z80.
|
This is a reconstruction of the SCP Z80 to 8086 Translator shipped together with ASM86. Like ASM86, original copies are long gone and this is the 8086 version from 86-DOS 0.11 translated back to Z80.
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -182,20 +182,20 @@ GETCH:
|
|||||||
LD DE,GETBUF ; Set `DMA address'.
|
LD DE,GETBUF ; Set `DMA address'.
|
||||||
LD C,SETDMA
|
LD C,SETDMA
|
||||||
CALL SYSTEM
|
CALL SYSTEM
|
||||||
LD DE,FCB ; Read the next record from source file.
|
LD DE,FCB ; Read the next record from source file.
|
||||||
LD C,READ
|
LD C,READ
|
||||||
CALL SYSTEM
|
CALL SYSTEM
|
||||||
OR A ; Entire record read OK?
|
OR A ; Entire record read OK?
|
||||||
LD A,EOF ; Force end-of-file character in case
|
LD A,EOF ; Force end-of-file character in case
|
||||||
JR NZ,TESEND ; there is nothing in the record.
|
JR NZ,TESEND ; there is nothing in the record.
|
||||||
LD HL,GETBUF ; Reset buffer pointer.
|
LD HL,GETBUF ; Reset buffer pointer.
|
||||||
GETIT:
|
GETIT:
|
||||||
LD A,(HL) ; Get next character from buffer.
|
LD A,(HL) ; Get next character from buffer.
|
||||||
INC HL ; Point to next character.
|
INC HL ; Point to next character.
|
||||||
LD (GETPT),HL ; Save new pointer.
|
LD (GETPT),HL ; Save new pointer.
|
||||||
TESEND:
|
TESEND:
|
||||||
LD (CHAR),A
|
LD (CHAR),A
|
||||||
JR NOTAF ; Pop registers and return.
|
JR NOTAF ; Pop registers and return.
|
||||||
LOAD:
|
LOAD:
|
||||||
CALL DELIM
|
CALL DELIM
|
||||||
JR Z,LOADOP
|
JR Z,LOADOP
|
||||||
@@ -450,7 +450,7 @@ LD:
|
|||||||
JP Z,STAX
|
JP Z,STAX
|
||||||
;If immediate move, check for byte memory reference
|
;If immediate move, check for byte memory reference
|
||||||
LD A,(OP1)
|
LD A,(OP1)
|
||||||
CP '[' ;Memory reference?
|
CP '[' ;Memory reference?
|
||||||
JR NZ,TWOOPS
|
JR NZ,TWOOPS
|
||||||
LD A,(OP1+1) ;Referencing IX as a word?
|
LD A,(OP1+1) ;Referencing IX as a word?
|
||||||
CP RIX
|
CP RIX
|
||||||
@@ -458,7 +458,7 @@ LD:
|
|||||||
CP RIY
|
CP RIY
|
||||||
JR Z,TWOOPS
|
JR Z,TWOOPS
|
||||||
LD A,(OP2)
|
LD A,(OP2)
|
||||||
CP 20H ;Could be immediate?
|
CP 20H ;Could be immediate?
|
||||||
LD A,9
|
LD A,9
|
||||||
CALL NC,BFLAG ;Add "B,"
|
CALL NC,BFLAG ;Add "B,"
|
||||||
CALL TRAN1
|
CALL TRAN1
|
||||||
@@ -661,7 +661,7 @@ DAD:
|
|||||||
|
|
||||||
INCDEC:
|
INCDEC:
|
||||||
LD A,(OP1)
|
LD A,(OP1)
|
||||||
CP RCX+1 ;16-bit?
|
CP RCX+1 ;16-bit?
|
||||||
JP NC,ONEOP
|
JP NC,ONEOP
|
||||||
LD HL,LAHF
|
LD HL,LAHF
|
||||||
CALL OUTSTR
|
CALL OUTSTR
|
||||||
@@ -1123,4 +1123,4 @@ RCH: DS 1
|
|||||||
RAL: DS 1
|
RAL: DS 1
|
||||||
RIX: DS 1
|
RIX: DS 1
|
||||||
RIY: DS 1
|
RIY: DS 1
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user