
	
; *** Macros Test des drapeaux ***

; *** N et Z

TEST_NZ: MACRO
 	move	ccr,d0
	andi.w	#%00001100,d0	; Bits Z et N
	andi.b	#%01111101,d4   ; (bits N et Z de P a 0)
	or.b	TabNZ-TabP(A3,D0.W),D4
	ENDM

		
; *** Macro Test des drapeaux N,Z et C ***
	
TEST_NZC: MACRO
 	move	ccr,d0
	andi.w	#%00001101,d0	; Bits Z,N et C
	andi.b	#%01111100,d4   ; (bits N,Z et C de P a 0)
	or.b	TabNZC-TabP(A3,D0.W),D4
	ENDM

; *** Macro Test des drapeaux N,Z,C et V ***
	
TEST_NZCV: MACRO
 	move	ccr,d0
	andi.w	#%00001111,d0	; Bits Z,N,C et V
	andi.b	#%00111100,d4   ; (bits N,V,Z et C de P a 0)
	or.b	TabNZCV-TabP(A3,D0.W),D4
	ENDM

; *** Mettre Z de CCR a 0 et X en fction de C de P

SET_C2X:MACRO
	move	ccr,D0
	TST_PB	C_BIT
	beq.b	SCX_NoCarry\@
	bset	#4,D0
	bra.b	SCX_End\@
SCX_NoCarry\@:
	bclr	#4,D0
SCX_End\@:
	move	D0,ccr
	ENDM

SET_XZ_ADC:MACRO
	move	ccr,D0
	TST_PB	C_BIT
	beq.b	SXZA_NoCarry\@
	bset	#4,D0
	bra.b	SXZA_End\@
SXZA_NoCarry\@:
	bclr	#4,D0
SXZA_End\@:
	bset	#2,D0	; Mettre Z a 1
	move	D0,ccr
	ENDM

SET_XZ_SBC:MACRO
	move	ccr,D0
	TST_PB	C_BIT
	bne.b	SXZS_NoCarry\@
	bset	#4,D0
	bra.b	SXZS_End\@
SXZS_NoCarry\@:
	bclr	#4,D0
SXZS_End\@:
	bset	#2,D0	; Mettre Z a 1
	move	D0,ccr
	ENDM

; *** Macros Tests NZC pour CMP,CPX,CPY ***

TEST_CMP: MACRO
 	move	ccr,d0
	andi.w	#%00001101,d0	; Bits Z,N et C
	andi.b	#%01111100,d4   ; (bits N,Z et C de P a 0)
	or.b	TabNZC_CMP-TabP(A3,D0.W),D4
	ENDM

TO_LOOP:MACRO
TOLoop\@:
	addq.l	#1,D0
	move.w	(A6,D0.L*2),D6
	beq.b	TOFock	
	cmp.l	D6,D7
	bne.b	TOLoop\@

	lea	IO_AmigaRoutineTable(PC),A6
	move.l	(A6,D0.L*4),A6
	jmp	(A6)
	ENDM
	
