2 IMPLEMENTING THE DEBUG MONITOR
EPSON S1C33 FAMILY DEBUG MONITOR
OPERATION MANUAL
8
(2) void m_snd_1byte(unsigned char)
This is a routine that sends 1-byte data. This routine receives 1-byte data as the argument (R12 register) and
sends it via the serial interface. Return value is not necessary.
Example: m_snd_1byte( ) of "m3s_sci.s"
;******************************************************************************
;
; void m_snd_1byte( sdata )
; 1 byte send function
; IN : uchar sdata (R12) send data
;
;******************************************************************************
.global m_snd_1byte
m_snd_1byte:
pushn %r3 ;save r3-r0
snd000:
xbtst [SSR1],0x1 ;TDBE1(bit1) == 0(full) ?
jreq snd000 ;if full, jp snd000
xld.b [STDR1],%r12 ;write data
popn %r3 ;restore r3-r0
ret
(3) unsigned char m_rcv_1byte( )
This is a routine that receives 1-byte data. Store received 1-byte data into m_rcv_data. It returns following
error codes (unsigned char) as the return value:
0: received normally
1: framing error
2: parity error
3: overrun error
Example: m_rcv_1byte( ) of "m3c_sci.s"
;******************************************************************************
;
; uchar m_rcv_1byte()
; 1 byte receive function
; OUT : 0 receive OK
; 1 receive ERROR (framing err)
; 2 (parity err)
; 3 (over run err)
;
;******************************************************************************
.global m_rcv_1byte
m_rcv_1byte:
pushn %r3 ;save r3-r0
rcv000:
xbtst [SSR1],0x0 ;RDBF1(bit0) == 0(empty) ?
jreq rcv000 ;if empty, jp rcv000
ld.w %r10,0x0
xbtst [SSR1],0x4 ;FER1(bit4) == 0 ?
jreq rcv010
xbclr [SSR1],0x4 ;FER1(bit4) 0 clear
ld.w %r10,0x1 ;return 1
rcv010:
xbtst [SSR1],0x3 ;PER1(bit3) == 0 ?
jreq rcv020
xbclr [SSR1],0x3 ;PER1(bit3) 0 clear
ld.w %r10,0x2 ;return 2
rcv020:
xbtst [SSR1],0x2 ;OER1(bit2) == 0 ?
jreq rcv030
xbclr [SSR1],0x2 ;OER1(bit2) 0 clear
ld.w %r10,0x3 ;return 3
rcv030:
xld.b %r0,[SRDR1] ;read data
xld.b [m_rcv_data],%r0 ;read data set
popn %r3 ;restore r3-r0
ret