;	WinSTon

;	RTS

;	XNZVC
;	-----

PUBLIC _rts

;-----------------------------------------------------------------------
;RTS
_rts PROC NEAR
	mov		ebp,_Regs[REG_A7*4]						;SP
	MASK_24BIT_ADDR(ebp)							;as 24-bit address in PC memory

	mov		esi,DWORD PTR _STRam[ebp]				;PC(wrong endian)
	bswap	esi
	mov		[_PC],esi								;Retain top byte of program counter
	MASK_24BIT_ADDR(esi)							;New program counter
	add		esi,STRAM_OFFSET						;As PC address space

	add		DWORD PTR _Regs[REG_A7*4],SIZE_LONG				;SP+=4
	FRET
_rts ENDP
