
/*
	subAL_CL
	subAX_CX
	subEAX_ECX
*/

.proc	subAL_CL

	ldy #0

	lda :STACKORIGIN-1,x
	sub :STACKORIGIN,x
	sta :STACKORIGIN-1,x
	scs
	dey

	sty :STACKORIGIN-1+STACKWIDTH,x
	sty :STACKORIGIN-1+STACKWIDTH*2,x
	sty :STACKORIGIN-1+STACKWIDTH*3,x

	rts
.endp


.proc	subAX_CX

	ldy #0

	lda :STACKORIGIN-1,x		; ax
	sub :STACKORIGIN,x		; cx
	sta :STACKORIGIN-1,x

	lda :STACKORIGIN-1+STACKWIDTH,x
	sbc :STACKORIGIN+STACKWIDTH,x
	sta :STACKORIGIN-1+STACKWIDTH,x
	scs
	dey

	sty :STACKORIGIN-1+STACKWIDTH*2,x
	sty :STACKORIGIN-1+STACKWIDTH*3,x

	rts
.endp


.proc	subEAX_ECX

	lda :STACKORIGIN-1,x
	sub :STACKORIGIN,x
	sta :STACKORIGIN-1,x

	lda :STACKORIGIN-1+STACKWIDTH,x
	sbc :STACKORIGIN+STACKWIDTH,x
	sta :STACKORIGIN-1+STACKWIDTH,x

	lda :STACKORIGIN-1+STACKWIDTH*2,x
	sbc :STACKORIGIN+STACKWIDTH*2,x
	sta :STACKORIGIN-1+STACKWIDTH*2,x

	lda :STACKORIGIN-1+STACKWIDTH*3,x
	sbc :STACKORIGIN+STACKWIDTH*3,x
	sta :STACKORIGIN-1+STACKWIDTH*3,x

	rts
.endp
