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
/
MISC
/
INSIDCPM.LBR
/
DPSUB.LQB
/
DPSUB.LIB
Wrap
Text File
|
2000-06-30
|
1KB
|
60 lines
DPSUBM MACRO
; * * * * * 16 BIT REGISTER SUBROUTINES
;
; Subroutine to load DE from M[HL+A]
; alters only DE, flags
;
DP$LDHA EQU $
PUSH H
MOV E,A ; make 16 bit offset
MVI D,0
DAD D ; add offset to base
MOV E,M ; pick up lsb
INX H
MOV D,M ; get msb
POP H
RET
;
; Subroutine to shift-right-logical DE
; alters [A], [F] (A = lsb Z, C flags set)
;
DP$SRLD EQU $
ORA A ; clear carry
MOV A,D ! RAR ! MOV D,A
MOV A,E ! RAR ! MOV E,A
RET
;
; Subroutine to add [A] to DE
; alters [A], [F] (A = msb, Z, C flags set)
;
DP$ADAD EQU $
ADD E
MOV E,A
MOV A,D
ACI 0
MOV D,A
RET
;
; Subroutine to add [A] to HL, as above
;
DP$ADAH EQU $
ADD L
MOV L,A
MOV A,H
ACI 0
MOV H,A
RET
;
; Subroutine to do an unsigned comparison
; of (B,C) :: (H,L). Alters [A], leaves
; flags set as for the compare instruction.
;
DP$CPBH EQU $
MOV A,B ! CMP H
RNZ ; exit if msb's differ
MOV A,C ! CMP L
RET ; B=H, exit with C:L flags
;
; * * * * * END OF DPSUB.LIB
ENDM