02.06.2013 Views

The Rainbow Vol. 10 No. 11 - June 1991.pdf - TRS-80 Color ...

The Rainbow Vol. 10 No. 11 - June 1991.pdf - TRS-80 Color ...

The Rainbow Vol. 10 No. 11 - June 1991.pdf - TRS-80 Color ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

on psect can u e ymbolic name defined<br />

in an th r psect.<br />

T make thi proce ea ier to implement,<br />

the a embler gi e you the ability to<br />

declare your ym olic name a either lo al<br />

or glo al name . Local name are defined<br />

only in their psect and are unknown to<br />

ther psects. In fact,<br />

th r psect rna u<br />

th arne name for<br />

different value<br />

without an "multiply<br />

defined ymb 1 '<br />

conflict .<br />

1 bal . ymb Is<br />

are made available to<br />

all psect , but they<br />

are ref err d to only if<br />

the psect has n t<br />

defin d the arne<br />

name. If one psect<br />

d fin th ymbol<br />

buffer a a global<br />

symb I and a second<br />

defin buffer a a<br />

lo al ymb I. the<br />

.-ymbol in th . e nd<br />

psect i I al and<br />

ifferent fr m th<br />

gl bal . ymb I of the<br />

Off et<br />

0. 5<br />

2. S<br />

4,S<br />

6. 5<br />

8,S<br />

<strong>10</strong>,5<br />

Type<br />

BOOLEAN<br />

BY<br />

I TEGER<br />

REAL<br />

STRING<br />

I name when it i<br />

mb I w 1 1 ym-<br />

ing Multiple psect<br />

Dir t your attenti n to the ource c de<br />

in 1i tings , 4 and 5. <strong>The</strong> e three psect<br />

when linked together, form a program that<br />

wait for a k ypre from the keyboardt<br />

44 THE RAINBOW <strong>June</strong> 1991<br />

dump the alue o the 6 09 r gi, ters to the<br />

creen, and print the A CII valu , in d cimal<br />

of the key p!i d. ach li ling is a<br />

cparate ftle and i embled separately<br />

from the ther .<br />

otice that each psect ha a ymbol<br />

named buffer that lab I a non direct-page<br />

ize De cription<br />

return addres - don t change it<br />

number of parameter pa ed<br />

pointer to fir t parameter<br />

ize, in byte • of first parameter<br />

pointer to econd parameter<br />

ize, in byte of e nd parameter<br />

Figure 1: A Sample Data Block<br />

ize omments<br />

1 byte<br />

1 byte<br />

FF = true 0 = fal. e<br />

2 byte if left-m t bit set, numb r i negati e<br />

5 byte 8-bit exp nent t-bit manti a. I ign bit<br />

varie terminated with FF if le than max ize<br />

Figure 2: <strong>The</strong> Fh'e Basic Uata Types<br />

variable. he e thr e ymb I are all 1 cal<br />

to their psect and, thus, have different<br />

valu .<br />

here are three gl bal ymb 1 in thi ·<br />

gr up fpsect :Dec RegDump and Divide.<br />

<strong>The</strong>re i · a) ·o only one mainline psectrna<br />

1 n. tice thatthe ther psect dire tive<br />

pe ify the f)pelan 7 , atrrev, edition and<br />

entry ytes as z r .<br />

ariable name that ha e been declared<br />

as global ymb I can b a e: :ed fTom<br />

other psect. simply by u ing that ym I<br />

nam in y ur ur e de. Keep in mind<br />

that th as mbl r pass s only unresol ed<br />

reference t the linker o if th cod in a<br />

psectdefine a ym ol with the arne name<br />

as a global ·ymbol, the global symbol i: n t<br />

u ed.<br />

To acce a global variable from another<br />

psect, us one ofth f llowing methods. If<br />

the ariable i a n n direct-pag varia le<br />

ace them in the normal manner:<br />

leay IObuf.u<br />

ldx counter.u<br />

If a glo al direct-page variable i to<br />

acce ed, precede the variable name with<br />

the le -than ym ol (

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!