home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
MACLIB
/
OPCODE.LQB
/
OPCODE.LIB
Wrap
Text File
|
2000-06-30
|
2KB
|
157 lines
;
; EXTENDED OPCODE LIBRARY
;
;
;REGISTER INDEXED ADDRESS
RXAD MACRO REGPR,BSADD ;(HL)<-REGPR+BSADD
LXI H,BSADD
DAD REGPR
ENDM
;
;REGISTER INDEXED LOAD
RXLD MACRO REG,REGPR,BSADD ;REG<-(REGPR+BSADD)
RXAD REGPR,BSADD
MOV REG,M
ENDM
;
;REGISTER INDEXED STORE
RXST MACRO REG,REGPR,BSADD ;(REGPR+BSADD)<-REG
RXAD REGPR,BSADD
MOV M,REG
ENDM
;
;REGISTER DIRECT LOAD
RDLD MACRO REG,ADDR ;REG<-(ADDR)
LXI H,ADDR
MOV REG,M
ENDM
;
;REGISTER DIRECT STORE
RDST MACRO REG,ADDR
LXI H,ADDR
MOV M,REG
ENDM
;
;REGISTER INDIRECT LOAD
LIND MACRO REG,ADDR ;REG<-((ADDR))
LHLD ADDR
MOV REG,M
ENDM
;
;REGISTER STORE INDIRECT
SIND MACRO REG,ADDR ;((ADDR))<-REG
LHLD ADDR
MOV M,REG
ENDM
;
;ADD TO ACCUMULATOR INDIRECT
ADDI MACRO ADDR ;A<-A+((ADDR))
LHLD ADDR
ADD M
ENDM
;
;SUBTRACT FROM ACCUMULATOR INDIRECT
SUBI MACRO ADDR ;A<-A-((ADDR))
LHLD ADDR
SUB M
ENDM
;
;IF REG NOT 0, THEN JUMP TO LABEL
JNZR MACRO REG,LABEL
XRA A
CMP REG
JNZ LABEL
ENDM
;
;IF REG 0, THEN JUMP TO LABEL
JZR MACRO REG,LABEL
CMP REG
JZ LABEL
ENDM
;
;(DE) STORED AT ADDRESS IN (HL)
STDM MACRO
MOV M,E
INX H
MOV M,D
ENDM
;
;SAVE ALL REGISTERS
SAVE MACRO
PUSH PSW
PUSH B
PUSH D
PUSH H
ENDM
;
;RESTORE ALL REGISTERS
UNSAVE MACRO
POP H
POP D
POP B
POP PSW
ENDM
;
;MOVE 'C' BYTES FROM (HL) TO (DE)
MOVE MACRO FROM,TO,NBYTES
LOCAL MO1
MVI C,NBYTES
LXI H,FROM
LXI D,TO
MO1: MOV A,M
STAX D
INX H
INX D
DCR C
JNZ MO1
ENDM
;
;FILL REGION FROM (HL) TO (DE) WITH CHAR
FILL MACRO FROM,TO,CHAR
LOCAL FI1
LXI H,FROM
LXI D,TO
FI1: MVI A,CHAR
MOV M,A
INX H
MOV A,L
CMP E
JNZ FI1
MOV A,H
CMP D
JNZ FI1
ENDM
;
;SHIFT ACCUMULATOR 1 BIT TO RIGHT
SHRT MACRO
RRC
ANI 7FH
ENDM
;
;SHIFT ACCUMULATOR 1 BIT TO LEFT
SHLT MACRO
RLC
ANI 0FEH
ENDM
;
;SHIFT ACCUMULATOR RIGHT AMT BITS INDEXED IN REG
SHRV MACRO REG,AMT
LOCAL SH1
MVI REG,AMT
SH1: RRC
ANI 7FH
DCR REG
JNZ SH1
ENDM
;
;SHIFT ACCUMULATOR LEFT AMT BITS INDEXED IN REG
SHLV MACRO REG,AMT
LOCAL SH1
MVI REG,AMT
SH1: RLC
ANI 0FEH
DCR REG
JNZ SH1
ENDM
;