beautypg.com

Zilog Z16C35 User Manual

Page 294

background image

Application Note

Technical Considerations When Implementing LocalTalk Link Access Protocol

14-6

LISTING 3

1131

;******************************

1132

;receive int service routine.

1133

;******************************

1134

;save received character in receiver buffer

1135

;to by rxpointer

1136

0000044d

1137recint:

0000044d f5

1138

push

af

;save af

0000044e d5

1139

push

de

0000044f e5

1140

push

hl

00000450 dbe9

1141

in

a,(scc_data)

;read scc data

00000452 2aWwww

1142

ld

hl,(rxpointer)

;

00000455 77

1143

ld

(hl),a

;save it

00000456 23

1144

inc

hl

;update pointer

00000457 22Www

1145

ld

(rxpointer),hl

;

0000045a ed5bWwww

1146

ld

de,(rxbufend)

;end of rx buffer

0000045e af

1147

xor

a

;reset cy

0000045f ed52

1148

sbc

hl,de

;

00000461 c2Wwww

1149

jp

nz,recexit

;if not zero,then receive
byte length is ok

00000464 21Wwww

1150

ld

hl,recerrflg

;

00000467 cbc6

1151

set

0,(hl)

;set bit0=1 maxfrmflg to indicate error

1152

;because of max frame
size exceeded.

00000469

1153recexit:

00000469 3e38

1154

ld

a,038h

0000046b d3e8

1155

out

(scc_cont),a

;reset highest ius

0000046d e1

1156

pop

hl

0000046e d1

1157

pop

de

0000046f f1

1158

pop

af

;restore af

00000470 fb

1159

ei

;enable int

00000471 c9

1160

ret

;return from int

1161

;note ret and not reti is used for scc

1162

;interrupts on the z80181.

1163
1164

;*********************************************

1165

;special receive interrupt service routine

1166

;*********************************************

1167;

“parity is special condition” bit is off.

1168;

special conditions are eof or rx overrun error.

1169;

crc error flag is valid only if eof is valid.

1170;

if frame is ok then recerrflg bit1=0, otherwise

1171

00000472

1172 spcond:

00000472 f5

1173

push

af

;save af reg

00000473 c5

1174

push

bc

;

00000474 e5

1175

push

hl;

1176

00000475 3e01

1177

ld

a,01h

00000477 d3e8

1178

out

(scc_cont),a

;read rr1

00000479 dbe8

1179

in

a,(scc_cont)

0000047b e660

1180

and

01100000b

;check bit6 (crc) or bit5 (overrun)

0000047d caWwww

1181

jp

z,ok

;

1182 ;

00000480 21Wwww

1183

ld

hl,recerrflg

;fetch receive error flag

00000483 cbce

1184

set

1,(hl)

;set bit1=1 for frame not ok

00000485 c3Wwww

1185

jp

crc_exit

Page 288 of 316

UM011002-0808