$TITLE ('Configuration for MONITOR-51   (C) 1987-1995 KEIL')
;***********************************************************************
;*                                                                     *
;* MONITOR 8051  Configuration                                         *
;* COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 1995                          *
;*                                                                     *
;* written by:     RK  11.06.87                                        *
;* updated by:     RK  23.10.89                                        *
;* updated by:     HS  02.09.91                                        *
;* updated by:     HS  11.04.95                                        *
;* updated by:     HS  23.08.96   8250/16450/16550 support added       *
;*                                                                     *
;***********************************************************************

		NAME	CONFIG

PUBLIC	INCHAR		; CHARACTER INPUT-ROUTINE 
PUBLIC	OUTCHAR		; CHARACTER OUTPUT-ROUTINE 
PUBLIC	INSTAT		; INPUT STATUS OF SERIAL INTERFACE
PUBLIC	OUTSTAT		; OUTPUT STATUS OF SERIAL INTERFACE
PUBLIC  CLR_TI		; CLEAR SERIAL TRANSMIT INTERRUPT FLAG
PUBLIC  SET_TI		; SET SERIAL TRANSMIT INTERRUPT FLAG
PUBLIC  CLR_RI		; CLEAR SERIAL RECEIVE INTERRUPT FLAG
PUBLIC  CLR_SER_IE	; CLEAR SERIAL INTERRUPT ENABLE FLAG
PUBLIC  SET_SER_IE	; SET SERIAL INTERRUPT ENABLE FLAG
PUBLIC	SER_INT_ADR	; ADDRESS OF SERIAL INTERRUPT VECTOR
PUBLIC	SER_INT_ADR_OFF	; ADDRESS OF SERIAL INTERRUPT VECTOR + INT_ADR_OFF
PUBLIC	BEFORE_GO	; DO SOME THINGS BEFORE STARTING USER PROGRAM
PUBLIC	AFTER_GO	; DO SOME THINGS AFTER TERMINATION OF USER PROGRAM
PUBLIC	DEF_PC_VAL	; DEFAULT PC VALUE AFTER START UP

EXTRN CODE (MON51)	; START OF MONITOR-51
EXTRN CODE (SER_ISR)	; SERIAL INTERRUPT SERVICE ROUTINE

INT_ADR_OFF	EQU	8000H	; INTERRUPT VECTOR OFFSET IF MONITOR
				; IS INSTALLED AT ADDRESS 0000H
DEF_PC_VAL	EQU	0000H	; DEFAULT PC VALUE AFTER START UP

; INTERRUPT VECTOR NUMBER FOR SERIAL INTERFACE 
$IF (SERIAL = 3)		; 2ND SERIAL INTERFACE OF 80517
SER_INT_NO	EQU	10H	; 083H
$ELSEIF (SERIAL = 5)		; 2ND SERIAL INTERFACE OF 80320
SER_INT_NO	EQU	07H	; 03BH
$ELSEIF (SERIAL = 7)		; ECO
SER_INT_NO	EQU	4	; EXTERNAL INTERRUPT ?

DATA_AREA	SEGMENT		DATA
BIT_AREA	SEGMENT		BIT
		RSEG	DATA_AREA
SAVE_PSF:	DS	1
SAVE_PSC1:	DS	1

		RSEG	BIT_AREA
SAVE_WDIS:	DBIT	1

$ELSE
SER_INT_NO	EQU	4	; 023H (REGULAR SERIAL INTERFACE)
$ENDIF

INT_VECT_DIST	MACRO
$IF (SERIAL <> 7)
		NOP
		NOP
		NOP
		NOP
		NOP
$ENDIF
		ENDM


                CSEG    AT 0E000H
                LJMP    START

INITSEG		SEGMENT CODE
		RSEG	INITSEG

START:		LJMP	InitSerial

		REPT	SER_INT_NO
		LJMP	INT_ADR_OFF + $
		INT_VECT_DIST
		ENDM

		LJMP	SER_ISR

		REPT	(21 - SER_INT_NO)
		INT_VECT_DIST
		LJMP	INT_ADR_OFF + $
		ENDM


;********************************************************************
;* This Macro checks whether a PROM or a RAM is at Address 0.       *
;* If a PROM is detected -> Jump to Program in PROM (Address 0)     *
;* If a RAM  is detected -> Jump to Monitor                         *
;********************************************************************
PROMCHECK	MACRO
$IF (PROMCHECK)
		USING	0

		MOV	DPTR,#0			; IF EPROM THEN JMP 0
		CLR	A
		MOVC	A,@A+DPTR
		MOV	R1,A
		CPL	A
		MOVX	@DPTR,A
		CLR	A
		MOVC	A,@A+DPTR
		CPL	A
		CJNE	A,AR1,JMP0
		MOVX	@DPTR,A
$ENDIF
		ENDM

INSTALLCODE	SEGMENT CODE
		RSEG INSTALLCODE

$IF (PROMCHECK)
JMP0:		LJMP	0
$ENDIF


$IF (SERIAL = 0)
;********************************************************************
;*  Using TIMER 1 to Generate Baud Rates                            *
;*  Oscillator frequency = 11.059 MHz                               *
;*  Set Baudrate to 9600 Baud                                       *
;********************************************************************

InitSerial:	PROMCHECK               ; Check if PROM in System
                MOV	TMOD,#00100000B		;C/T = 0, Mode = 2
		MOV	TH1,#0FDH
		SETB	TR1
                MOV     SCON,#01011010B ; Init Serial Interface
		JMP	Mon51

$ENDIF

$IF (SERIAL = 1)
;********************************************************************
;*  Using internal Baud Rate Generator (only for 80515 and 80C517)  *
;*  Oscillator frequency = 12.000 MHz                               *
;*  Set Baudrate to 9600 Baud                                       *
;********************************************************************
BD      BIT     0DFH
P4      DATA    0E8H

DELAY:          MOV     R0,#0
                MOV     R1,#0
DEL1:           DJNZ    R1,DEL1
                DJNZ    R0,DEL1
                RET

InitSerial:     PROMCHECK               ; Check if PROM in System
                SETB	BD
                ORL     PCON,#10000000B
                MOV     SCON,#01011010B ; Init Serial Interface
                MOV     A,#0FFH
FLASH1:         MOV     P4,A
		CLR     C
                RRC     A
                LCALL   DELAY
                CJNE    A,#0,FLASH1
                MOV     P4,#0FFH
                JMP     Mon51
$ENDIF

$IF (SERIAL = 2)
;********************************************************************
;*  Using TIMER 2 to Generate Baud Rates (only for 8052)            *
;*  Oscillator frequency = 12.000 MHz                               *
;*  Set Baudrate to 9600 Baud                                       *
;********************************************************************
RCAP2L  DATA    0CAH
RCAP2H  DATA    0CBH
T2CON   DATA    0C8H

InitSerial:	PROMCHECK               ; Check if PROM in System
                MOV	T2CON,#34H
		MOV	RCAP2H,#0FFH
		MOV	RCAP2L,#0D9H
		MOV	SCON,#01011010B ; Init Serial Interface
		JMP	Mon51
$ENDIF


$IF (SERIAL = 3)
;********************************************************************
;*  Using Serial Interface 1 Baudrate Generator (only for 80C517)   *
;*  Oscillator frequency = 12.000 MHz                               *
;*  Set Baudrate to 9600 Baud                                       *
;********************************************************************
S1REL		DATA	09DH
S1CON		DATA	09BH
S1BUF		DATA	09CH
IEN2 		DATA	09AH

InitSerial:	PROMCHECK                ; Check if PROM in System
		MOV	S1REL,#0D9H	 ; Reload Value
		MOV	S1CON,#10111010B ; Init Serial Interface
		JMP	Mon51
$ENDIF

$IF (SERIAL = 4)
;********************************************************************
;*  Using TIMER 2 to Generate Baud Rates (only for 80C320/520/530)  *
;*  with dual data pointer support                                  *
;*  Oscillator frequency = 12.000 MHz                               *
;*  Set Baudrate to 9600 Baud                                       *
;********************************************************************
RCAP2L  DATA    0CAH
RCAP2H  DATA    0CBH
T2CON   DATA    0C8H
DPS     DATA    086H

InitSerial:	PROMCHECK               ; Check if PROM in System
		MOV	DPS,#00H
                MOV	T2CON,#34H
		MOV	RCAP2H,#0FFH
		MOV	RCAP2L,#0D9H    ; 9600 baud @ 12 MHz
;		MOV	RCAP2L,#0BFH    ; 9600 baud @ 20 MHz
;		MOV	RCAP2L,#095H    ; 9600 baud @ 33 MHz
;		MOV	RCAP2L,#0DCH    ; 9600 baud @ 11.0592 MHz
;		MOV	RCAP2L,#0EEH    ; 19200 baud @ 11.0592 MHz
;		MOV	RCAP2L,#0F7H    ; 38400 baud @ 11.0592 MHz
;		MOV	RCAP2L,#0FAH    ; 57600 baud @ 11.0592 MHz
		MOV	SCON,#01011010B ; Init Serial Interface
		JMP	Mon51
$ENDIF

$IF (SERIAL = 5)
;********************************************************************
;*  Using second serial interface of 80C320/520/530 with TIMER 1    *
;*  and dual data pointer support                                   *
;*  Oscillator frequency = 12.000 MHz                               *
;*  Set Baudrate to 9600 Baud                                       *
;********************************************************************
DPS     DATA    086H
CKCON   DATA    08EH
SCON1   DATA    0C0H
SBUF1   DATA    0C1H
WDCON   DATA    0D8H

InitSerial:	PROMCHECK               ; Check if PROM in System
		MOV	DPS,#00H
                MOV	TMOD,#00100000B	;C/T = 0, Mode = 2

		MOV	TH1,#0F6H       ; 9600 baud @ 12 MHz
		ORL	CKCON,#010H     ; Timer 1 uses a divide by 4 clock
;		ORL	WDCON,#10000000B; 19200 baud @ 12 MHz

;		MOV	TH1,#0FDH	; 9600 baud @ 11.0592 MHz

;		MOV	TH1,#0FFH	; 57600 baud @ 11.0592 MHz
;		ORL	WDCON,#10000000B

;		MOV	TH1,#0E5H       ; 9600 baud @ 33 MHz
;		ORL	CKCON,#010H     ; Timer 1 uses a divide by 4 clock
;		ORL	WDCON,#10000000B; 19200 baud @ 33 MHz

		SETB	TR1
		MOV	SCON1,#01011010B ; Init Serial Interface
		JMP	Mon51
$ENDIF

$IF (SERIAL = 6)
;********************************************************************
;*  Using external UART 16450/16550                                 *
;*  UART Oscillator frequency = 12.000 MHz                          *
;*  Set Baudrate to 9600 Baud                                       *
;********************************************************************
SIOCLK	  EQU  1843200        ; EXTERNAL SIO XTAL FREQUENZY
BAUDRATE  EQU  9600           ;9600 bps
BAUDDIV   EQU  (SIOCLK / 16) / BAUDRATE
SIOADDR	  EQU  0E000H         ; SIO Address

InitSerial:	PROMCHECK               ; Check if PROM in System
		MOV	DPTR,#SIOADDR+3
		MOV	A,#83H		; Select Baudrate Registers
		MOVX	@DPTR,A
		MOV	DPTR,#SIOADDR
		MOV	A,#LOW (BAUDDIV)
		MOVX	@DPTR,A
		INC	DPTR
		MOV	A,#HIGH (BAUDDIV)
		MOVX	@DPTR,A
		MOV	DPTR,#SIOADDR+3
		MOV	A,#03H		; Mode: 8-bit, 1 stop, no parity
		MOVX	@DPTR,A
		MOV	DPTR,#SIOADDR+1
		CLR	A
		MOVX	@DPTR,A		; disable all interrupts
		MOV	DPTR,#SIOADDR+4
		MOVX	@DPTR,A
		JMP	Mon51

$ENDIF

$IF (SERIAL = 7)
;********************************************************************
;*  Using external UART 82510 on DECT board                         *
;*  Set Baudrate to 9600 Baud                                       *
;********************************************************************

PSC1		DATA	0C8H		; prescaler control reg. 1
					; (bit addressable)
PSC2		DATA	0C9H		; prescaler control reg. 2
PSF		DATA	0CAH		; prescaler frequency
WDIS		BIT	PSC1.3		; disable watchdog
INDIS		DATA	0A9H		; Global interrupt disable flag

U_BASE		EQU	07FF0H

UST_TXD 	EQU	U_BASE+00H
UST_RXD 	EQU	U_BASE+00H
UST_BAL 	EQU	U_BASE+00H
UST_CLCF	EQU	U_BASE+00H

UST_BACF	EQU	U_BASE+01H
UST_BAH 	EQU	U_BASE+01H
UST_GER 	EQU	U_BASE+01H
UST_RXF 	EQU	U_BASE+01H
UST_BANK	EQU	U_BASE+02H
UST_LCR 	EQU	U_BASE+03H
UST_BBCF	EQU	U_BASE+03H
UST_MCR 	EQU	U_BASE+04H
UST_IMD 	EQU	U_BASE+04H
UST_LSR 	EQU	U_BASE+05H
UST_MSR 	EQU	U_BASE+06H
UST_ACR0	EQU	U_BASE+07H

UST_GSR		EQU	U_BASE+07H
UST_ICM		EQU	U_BASE+07H
UST_PMD 	EQU	U_BASE+04H

REG_0 		EQU	U_BASE+08H
REG_1 		EQU	U_BASE+09H
REG_2 		EQU	U_BASE+0AH
REG_3 		EQU	U_BASE+0BH
REG_4 		EQU	U_BASE+0CH
REG_5 		EQU	U_BASE+0DH
REG_6 		EQU	U_BASE+0EH
REG_7 		EQU	U_BASE+0FH

DLAB          	EQU	080H

TX_FIFO_EN    	EQU	001H
RX_FIFO_EN    	EQU	002H
RX_MACHINE    	EQU	004H
TX_MACHINE    	EQU	010H



InitSerial:	PROMCHECK		; Check if PROM in System
		MOV	SAVE_PSF,PSF
		MOV	PSF,#08H
		MOV	SAVE_PSC1,PSC1
		MOV	PSC1,#04H	; slow down CPU
;		MOV	C,WDIS
;		MOV	SAVE_WDIS,C
		SETB	WDIS		; disable watchdog timer
		MOV	INDIS,#01H	; disable all interrupts

		MOV	DPTR,#UST_BANK
		CLR	A
		MOVX	@DPTR,A

		MOV	DPTR,#UST_GER
		MOV	A,#(TX_FIFO_EN OR RX_FIFO_EN OR RX_MACHINE OR TX_MACHINE)
		MOVX	@DPTR,A

		MOV	DPTR,#UST_LCR
		MOV	A,#(DLAB OR 03H)
		MOVX	@DPTR,A

		MOV	DPTR,#UST_BAL
;		MOV	A,#180H		; prescale factor for 300 Baud
;		MOV	A,#0C0H		; prescale factor for 600 Baud
;		MOV	A,#060H		; prescale factor for 1200 Baud
;		MOV	A,#030H		; prescale factor for 2400 Baud
;		MOV	A,#018H		; prescale factor for 4800 Baud
		MOV	A,#00CH		; prescale factor for 9600 Baud
;		MOV	A,#006H		; prescale factor for 19200 Baud
;		MOV	A,#003H		; prescale factor for 38400 Baud
;		MOV	A,#002H		; prescale factor for 57600 Baud
;		MOV	A,#001H		; prescale factor for 115200 Baud
		MOVX	@DPTR,A

		MOV	DPTR,#UST_BAH
		CLR	A
		MOVX	@DPTR,A

		MOV	DPTR,#UST_LCR
		MOV	A,#03H
		MOVX	@DPTR,A

		MOV	DPTR,#UST_LSR
		CLR	A
		MOVX	@DPTR,A

		JMP	Mon51
$ENDIF


$IF (SERIAL = 3)
;********************************************************************
;*  Interface via additional 80517 UART                             *
;********************************************************************
SER_INT_ADR	EQU	83H		 ; ADDRESS OF SERIAL INTERRUPT VECTOR
SER_INT_ADR_OFF EQU (INT_ADR_OFF + SER_INT_ADR)

INSTAT:		PUSH	B		 ; INPUT STATUS OF SERIAL INTERFACE
		MOV	B,S1CON
		MOV	C,B.0
		POP	B
		RET

OUTSTAT:	PUSH	B		 ; OUTPUT STATUS OF SERIAL INTERFACE
		MOV	B,S1CON
		MOV	C,B.1
		POP	B
		RET

INCHAR:		MOV	A,S1BUF		 ; CHARACTER INPUT-ROUTINE 
		RET

OUTCHAR:	MOV	S1BUF,A		 ; CHARACTER OUTPUT-ROUTINE 
		RET

CLR_TI:		ANL	S1CON,#11111101B ; CLEAR SERIAL TRANSMIT INTERRUPT FLAG
		RET

SET_TI:		ORL	S1CON,#00000010B ; SET SERIAL TRANSMIT INTERRUPT FLAG
		RET

CLR_RI:		ANL	S1CON,#11111110B ; CLEAR SERIAL RECEIVE INTERRUPT FLAG
		RET

CLR_SER_IE:	ANL	IEN2,#11111110B  ; CLEAR SERIAL INTERRUPT ENABLE FLAG
		RET

SET_SER_IE:	ORL	IEN2,#00000001B  ; SET SERIAL INTERRUPT ENABLE FLAG
		RET

BEFORE_GO:                               ; this code is executed before a
		RET                      ; a go or proc step is executed

AFTER_GO:	                         ; this code is executed after a go
		RET                      ; command (when a breakpoint was set)


$ELSEIF (SERIAL = 5)
;********************************************************************
;*  Interface via additional 80C320 UART                            *
;********************************************************************
SER_INT_ADR	EQU	03BH		 ; ADDRESS OF SERIAL INTERRUPT VECTOR
SER_INT_ADR_OFF EQU (INT_ADR_OFF + SER_INT_ADR)
TI1     BIT     0C1H
RI1     BIT     0C0H
ES1     BIT     0AEH

INSTAT:		MOV	C,RI1		; INPUT STATUS OF SERIAL INTERFACE
		RET

OUTSTAT:	MOV	C,TI1		; OUTPUT STATUS OF SERIAL INTERFACE
		RET

INCHAR:		MOV	A,SBUF1		; CHARACTER INPUT-ROUTINE
		RET

OUTCHAR:	MOV	SBUF1,A		; CHARACTER OUTPUT-ROUTINE
		RET

CLR_TI:		CLR	TI1		; CLEAR SERIAL TRANSMIT INTERRUPT FLAG
		RET

SET_TI:		SETB	TI1		; SET SERIAL TRANSMIT INTERRUPT FLAG
		RET

CLR_RI:		CLR	RI1		; CLEAR SERIAL RECEIVE INTERRUPT FLAG
		RET

CLR_SER_IE:	CLR	ES1		; CLEAR SERIAL INTERRUPT ENABLE FLAG
		RET

SET_SER_IE:	SETB	ES1		; SET SERIAL INTERRUPT ENABLE FLAG
		RET

BEFORE_GO:                               ; this code is executed before a
		RET                      ; a go or proc step is executed

AFTER_GO:	                         ; this code is executed after a go
		RET                      ; command (when a breakpoint was set)


$ELSEIF (SERIAL = 6)
;********************************************************************
;*  Interface via external UART 16450/16550                         *
;********************************************************************
SER_INT_ADR	EQU	023H		 ; ADDRESS OF SERIAL INTERRUPT VECTOR
SER_INT_ADR_OFF EQU (INT_ADR_OFF + SER_INT_ADR)

INSTAT:		PUSH	DPL		; INPUT STATUS OF SERIAL INTERFACE
		PUSH	DPH
		PUSH	ACC
		MOV	DPTR,#SIOADDR+5	; LSR
		MOVX	A,@DPTR		; Check if Ready
		MOV	C,ACC.0
		POP	ACC	
		POP	DPH	
		POP	DPL	
		RET

OUTSTAT:	PUSH	DPL		; OUTPUT STATUS OF SERIAL INTERFACE
		PUSH	DPH
		PUSH	ACC
		MOV	DPTR,#SIOADDR+5	; LSR
		MOVX	A,@DPTR		; Check if Ready
		MOV	C,ACC.5
		POP	ACC
		POP	DPH
		POP	DPL
		RET

INCHAR:		PUSH	DPL		; CHARACTER INPUT-ROUTINE
		PUSH	DPH
		MOV	DPTR,#SIOADDR
		MOVX	A,@DPTR
		POP	DPH	
		POP	DPL	
		RET

OUTCHAR:	PUSH	DPL		; CHARACTER OUTPUT-ROUTINE
		PUSH	DPH
		MOV	DPTR,#SIOADDR
		MOVX	@DPTR,A
		POP	DPH
		POP	DPL
		RET

CLR_TI:					; CLEAR SERIAL TRANSMIT INTERRUPT FLAG
		RET

SET_TI:					; SET SERIAL TRANSMIT INTERRUPT FLAG
		RET

CLR_RI:					; CLEAR SERIAL RECEIVE INTERRUPT FLAG
		RET

CLR_SER_IE:				; CLEAR SERIAL INTERRUPT ENABLE FLAG
		RET

SET_SER_IE:				; SET SERIAL INTERRUPT ENABLE FLAG
		RET

BEFORE_GO:				; this code is executed before a
		RET			; a go or proc step is executed

AFTER_GO:				; this code is executed after a go
		RET			; command (when a breakpoint was set)


$ELSEIF (SERIAL = 7)
;********************************************************************
;*  Interface via external UART 82510                               *
;********************************************************************
SER_INT_ADR	EQU	0FH		 ; ADDRESS OF SERIAL INTERRUPT VECTOR
SER_INT_ADR_OFF EQU (INT_ADR_OFF + SER_INT_ADR)

INSTAT:		PUSH	DPL		 ; INPUT STATUS OF SERIAL INTERFACE
		PUSH	DPH
		PUSH	ACC
		MOV	DPTR,#UST_LSR
		MOVX	A,@DPTR
		MOV	C,ACC.0
		POP	ACC
		POP	DPH
		POP	DPL
		RET

OUTSTAT:	PUSH	DPL		 ; OUTPUT STATUS OF SERIAL INTERFACE
		PUSH	DPH
		PUSH	ACC
		MOV	DPTR,#UST_LSR
		MOVX	A,@DPTR
		MOV	C,ACC.5
		POP	ACC
		POP	DPH
		POP	DPL
		RET

INCHAR:		PUSH	DPL		 ; CHARACTER INPUT-ROUTINE 
		PUSH	DPH
		MOV	DPTR,#UST_RXD
		MOVX	A,@DPTR
		POP	DPH
		POP	DPL
		RET

OUTCHAR:	PUSH	DPL		 ; CHARACTER OUTPUT-ROUTINE 
		PUSH	DPH
		MOV	DPTR,#UST_TXD
		MOVX	@DPTR,A
		POP	DPH
		POP	DPL
		RET

CLR_TI:					 ; CLEAR SERIAL TRANSMIT INTERRUPT FLAG
		RET

SET_TI:					 ; SET SERIAL TRANSMIT INTERRUPT FLAG
		RET

CLR_RI:					 ; CLEAR SERIAL RECEIVE INTERRUPT FLAG
		RET

CLR_SER_IE:				 ; CLEAR SERIAL INTERRUPT ENABLE FLAG
		RET

SET_SER_IE:				 ; SET SERIAL INTERRUPT ENABLE FLAG
		RET

BEFORE_GO:	MOV	PSF,SAVE_PSF
		MOV	PSC1,SAVE_PSC1	 ; speed up CPU
;		MOV	C,SAVE_WDIS
;		MOV	WDIS,C		 ; enable watchdog timer
		RET

AFTER_GO:	MOV	SAVE_PSF,PSF
		MOV	PSF,#08H
		MOV	SAVE_PSC1,PSC1
		MOV	PSC1,#04H	 ; slow down CPU
		MOV	C,WDIS
		MOV	SAVE_WDIS,C
		SETB	WDIS		 ; disable watchdog timer
		RET

$ELSE

;********************************************************************
;*  Interface via standard 8051 UART                                *
;********************************************************************
SER_INT_ADR	EQU	23H		; ADDRESS OF SERIAL INTERRUPT VECTOR
SER_INT_ADR_OFF EQU (INT_ADR_OFF + SER_INT_ADR)

INSTAT:		MOV	C,RI		; INPUT STATUS OF SERIAL INTERFACE
		RET

OUTSTAT:	MOV	C,TI		; OUTPUT STATUS OF SERIAL INTERFACE
		RET

INCHAR:		MOV	A,SBUF		; CHARACTER INPUT-ROUTINE
		RET

OUTCHAR:	MOV	SBUF,A		; CHARACTER OUTPUT-ROUTINE
		RET

CLR_TI:		CLR	TI		; CLEAR SERIAL TRANSMIT INTERRUPT FLAG
		RET

SET_TI:		SETB	TI		; SET SERIAL TRANSMIT INTERRUPT FLAG
		RET

CLR_RI:		CLR	RI		; CLEAR SERIAL RECEIVE INTERRUPT FLAG
		RET

CLR_SER_IE:	CLR	ES		; CLEAR SERIAL INTERRUPT ENABLE FLAG
		RET

SET_SER_IE:	SETB	ES		; SET SERIAL INTERRUPT ENABLE FLAG
		RET

BEFORE_GO:				; this code is executed before a
		RET			; a go or proc step is executed

AFTER_GO:				; this code is executed after a go
		RET			; command (when a breakpoint was set)


$ENDIF


		END
