beautypg.com

Zilog Z16C35 User Manual

Page 288

background image

Application Note

Technical Considerations When Implementing LocalTalk Link Access Protocol

14-8

APPENDIX A

Listing 1- Asembler Code for SCC Initialization

LISTING 1

475

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

476

;subroutine to initialize scc registers

477

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

000001e2

478 initscc:

000001e2 f3

479

di

;disable int while programming scc

000001e3 f5

480

push

af

000001e4 c5

481

push

bc

000001e5 e5

482

push

hl

483

000001e6 3e09

484

ld

a,09h

;WR9

000001e8 d3e8

485

out

(scc_cont),a

;point to scc register

000001ea 3e80

486

ld

a,80h

;channel reset

000001ec d3e8

487

out

(scc_cont),a

;scc register value

000001ee 00

488

nop

;delay needed after scc reset

489
490

000001ef 21Wwww

491

ld

hl,scctable

;fetch start of scc init table

000001f2

492 scc1:

000001f2 7e

493

ld

a,(hl)

;fetch register pointer value

000001f3 feff

494

cp

0ffh

000001f5 caWwww

495

jp

z,finscc

;if reg a =0ffh then initscc finished

000001f8 d3e8

496

out

(scc_cont),a

000001fa 23

497

inc

hl

000001fb 7e

498

ld

a,(hl)

000001fc d3e8

499

out

(scc_cont),a

000001fe 23

500

inc

hl

000001ff c3R000+01f2,

501

jp

scc1

;loop back

502

00000202

503 scctable:

00000202 04

504

db

04h

;WR4

00000203 20

505

db

00100000b

;sdlc uses 1x,sdlc mode,no parity

506

00000204 01

507

db

01h

;WR1

00000205 00

508

db

00h

;nothing,rx,tx and ext int disabled

509

00000206 02

510

db

02h

;WR2

00000207 00

511

db

00h

;vector base is 00h

512

00000208 03

513

db

03h

;WR3

00000209 cc

514

db

0cch

;rx 8b/char,rx crc enabled,address

515

;search mode for adlc address filtering

516 ;rx

disabled.

517

0000020a 05

518

db

05h

;WR5

0000020b 60

519

db

60h

;tx 8b/char, set rts to disable drivers

520

0000020c 06

521

db

06h

;WR6

0000020d 00

522

db

00h

;address field=’myaddress’ in main pgm

523

0000020e 07

524

db

07h

;WR7

0000020f 7e

525

db

7eh

;flag pattern

526

00000210 09

527

db

09h

;WR9

00000211 01

528

db

01h

;stat low, vis therefore vector returned

529

;is a variable depending on the source

530

;of the interrupt.

531

Page 282 of 316

UM011002-0808