All pastes #1289947 Raw Edit

push and pop macros for ASM68k

public text v1 · immutable
#1289947 ·published 2008-12-20 01:47 UTC
rendered paste body
; push and pop macros for ASM68k
push macro
	move.\0	\1,-(sp)
    endm
pop macro
	if strlen("\1")=0
		if strcmp("\0","b")
			addq.l	#1,sp
		elseif strcmp("\0","w")
			addq.l	#2,sp
		elseif strlen("\0")=0
			addq.l	#2,sp
		elseif strcmp("\0","l")
			addq.l	#4,sp
		else
			inform 2,"Invalid size parameter on pop: \0"
		endif
	else
		move.\0	(sp)+,\1
	endif
    endm
; popq is like pop, except it uses addq.w instead of addq.l
popq macro
	if strlen("\1")=0
		if strcmp("\0","b")
			addq.w	#1,sp
		elseif strcmp("\0","w")
			addq.w	#2,sp
		elseif strlen("\0")=0
			addq.w	#2,sp
		elseif strcmp("\0","l")
			addq.w	#4,sp
		else
			inform 2,"Invalid size parameter on pop: \0"
		endif
	else
		move.\0	(sp)+,\1
	endif
    endm