[Contents] [Commodore] [New] [Search] [Home]

Commodore 128 CP/M v3.0
Z80 assembly macros

;       @CHK MACRO USED FOR CHECKING 8 BIT DISPLACMENTS
;
@CHK	MACRO	?DD	;; USED FOR CHECKING RANGE OF 8-BIT DISP.S
	IF (?DD GT 7FH) AND (?DD LT 0FF80H)
 'DISPLACEMENT RANGE ERROR - Z80 LIB'
	ENDIF
	ENDM
LDX	MACRO	?R,?D	
	@CHK	?D
	DB	0DDH,?R*8+46H,?D
	ENDM
LDY	MACRO	?R,?D	
	@CHK	?D
	DB	0FDH,?R*8+46H,?D
	ENDM
STX	MACRO	?R,?D	
	@CHK	?D
	DB	0DDH,70H+?R,?D
	ENDM
STY	MACRO	?R,?D	
	@CHK	?D
	DB	0FDH,70H+?R,?D
	ENDM
MVIX	MACRO	?N,?D	
	@CHK	?D
	DB	0DDH,36H,?D,?N
	ENDM
MVIY	MACRO	?N,?D	
	@CHK	?D
	DB	0FDH,36H,?D,?N
	ENDM
LDAI	MACRO		
	DB	0EDH,57H
	ENDM
LDAR	MACRO		
	DB	0EDH,5FH
	ENDM
STAI	MACRO		
	DB	0EDH,47H
	ENDM
STAR	MACRO		
	DB	0EDH,4FH
	ENDM

LXIX	MACRO	?NNNN	
	DB	0DDH,21H
	DW	?NNNN
	ENDM
LXIY	MACRO	?NNNN	
	DB	0FDH,21H
	DW	?NNNN
	ENDM
LDED	MACRO	?NNNN	
	DB	0EDH,5BH
	DW	?NNNN
	ENDM
LBCD	MACRO	?NNNN	
	DB	0EDH,4BH
	DW	?NNNN
	ENDM
LSPD	MACRO	?NNNN	
	DB	0EDH,07BH
	DW	?NNNN
	ENDM
LIXD	MACRO	?NNNN	
	DB	0DDH,2AH
	DW	?NNNN
	ENDM
LIYD	MACRO	?NNNN	
	DB	0FDH,2AH
	DW	?NNNN
	ENDM
SBCD	MACRO	?NNNN	
	DB	0EDH,43H
	DW	?NNNN
	ENDM
SDED	MACRO	?NNNN	
	DB	0EDH,53H
	DW	?NNNN
	ENDM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?D, 3EH
	ENDM
SRLY	MACRO	?D	
	@CHK	?D
	DB	0FDH, 0CBH, ?D, 3EH
	ENDM
RLD	MACRO		
	DB	0EDH, 6FH
	ENDM
RRD	MACRO		
	DB	0EDH, 67H
	ENDM

[Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated December 01, 1998.