;======================================
;=	PUSH REGISTER & FLAG          =
;======================================

pushr	macro	regs,flag
	ifnb	<flag>
	pushf
	endif
	irp	reg,<regs>
	push	reg
	endm
	endm

;======================================
;=	POP REGISTER & FLAG           =
;======================================

popr	macro	regs,flag
	irp	reg,<regs>
	pop	reg
	endm
	ifnb	<flag>
	popf
	endif
	endm

;======================================
;=	PUSH & POP ALL                =
;======================================

pushall	macro
	pushr	<ax,bx,cx,dx,bp,si,di,ds,es>,f
	mov	bp,sp
	endm

popall	macro
	popr	<es,ds,di,si,bp,dx,cx,bx,ax>,f
	endm

;======================================
;=	GET REGISTER                  =
;======================================

get_f	macro
	mov	ax,[bp+12H]
	endm
get_ax	macro
	mov	ax,[bp+10H]
	endm
get_bx	macro
	mov	ax,[bp+0EH]
	endm
get_cx	macro
	mov	ax,[bp+0CH]
	endm
get_dx	macro
	mov	ax,[bp+0AH]
	endm
get_bp	macro
	mov	ax,[bp+08H]
	endm
get_si	macro
	mov	ax,[bp+06H]
	endm
get_di	macro
	mov	ax,[bp+04H]
	endm
get_ds	macro
	mov	ax,[bp+02H]
	endm
get_es	macro
	mov	ax,[bp+00H]
	endm
