27.01.2015 Views

titus-larsen-titus-1981-apple-interfacing

titus-larsen-titus-1981-apple-interfacing

titus-larsen-titus-1981-apple-interfacing

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

each decade. The bed code is used in many electronic devices,<br />

is used to control seven-segment displays and other decimally<br />

devices.<br />

We would like you. to try and write a program that will "split" a<br />

into its bed equivalents. The output port will be used to<br />

the different groups, two bed digits at a time. The ten's and<br />

digits should be displayed at the output port first, followed<br />

the thousand's and hundred's bed digits. You may use the REother<br />

key to "stop" the computer between displays of<br />

We used the following program:<br />

10 IN PUT "VALU E "; A<br />

20 IF A < 10000 TH EN 30 ELS E 10<br />

30 GOSUB 1000<br />

40 POKE 49 31 8, A+C<br />

50 GET A$:A = B<br />

60 GOSUB 1000<br />

70 POKE 49 318, A+C<br />

80 GOTO 10<br />

1000 B = 0: C = 0<br />

1010 IF A > 99 TH EN 1100<br />

1020 IF A < 10 TH EN RETURN<br />

1030 C = C + 16: A = A -10<br />

1040 GO TO 1020<br />

11 00 A = A-100: B = B+l<br />

1110 GOTO 1010<br />

In the subroutine, the variables are A, B, and C. In this case, the<br />

A represents the decimal value to be converted to bed (the starting<br />

value), B represents the "hundreds," while C represents the "tens."

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

Saved successfully!

Ooh no, something went wrong!