the transactor v2 10

42
8/7/2019 The Transactor V2 10 http://slidepdf.com/reader/full/the-transactor-v2-10 1/42 The Transactor VOll (kcornmodore comments and bulletins concerning your COMMODORE PET m BULLETIN # 10 PET™. . t 'T d k fed I lS a re lS erea ra emar 0 ommo ore nco REHAINDER$ One little known use of the NID$ function is "remainder string". If the third parameter of the NID$ function is omitted the resulting string will be every character to the right of the specified start position for the string be i n q operated on. For example: 1. AS = "123456789" 2. B$ = nrus ( A$, 2, 4 3. B$ = IUDS ( A$, 2 ) iequals "2345" ieguals "234567B9" 'I'h i s is not the same as RIGHT$ as this f unc t i on returns an absolute number cf characters starting from the rightmost position. This application works best when the right-hand portion of a string is wanted and the string length is not k nown , BASIC 4~ Preliminary Uote Bl,SIC 4.0 [:OIlsfor the 40 column PET are on tbeir way! The main differences are: 1. Faster garbage collection 2. Disk commands included in BI\SIC Of course most SYStem calls to non w i Ll, requ i re modification but PEEKs and POKEs shoUld remain valid except for some locations tbat may have been labelled unused in BASIC 2.0. More on DASIC 4.0 in a later issue. Also see Jim Butterfield's new BASIC 4.0 memory maps, this issue. All BASIC 2.0 programs will run on BASIC 4.0 except for one minor gotcha. BASIC 4.0 has reserved two nore variables for it's own use; DS and DB$. When called, DS will contain the error number from the disk and DS$ will return the error number, description, track and sector much like hitting "'> " and return with DOS Support. The same rule applies to DS and DS$ as ST, TI and TI$; they must not appear on the left of an "=" sign. If they do a ?SYNTAX ERROR will result. So if your programs use either of these two new reserved variables, it would be a good idea to change them before RUNning on BASIC 4.0. This could be easily done by running your programs through Jim Butterfield's Cross-Ref program from Transactor #9, Vol 2. The Transactor is produced on the new CBN 8032 using WordPro IV and the NEC Spinwriter.

Upload: cubemanpdx

Post on 08-Apr-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 1/42

The Transactor V O l l

(kcornmodorecomments and bulletins

concerning yourCOMMODORE PETm

BULLETIN # 10

PET™ . . t 'T d k fed IlS a re lS erea ra emar 0 ommo ore nco

REHAINDER$

One little known use of the NID$ function is "remainderstring". If the third parameter of the NID$ function isomitted the resulting string will be every character to theright of the specified start position for the string bein qoperated on. For example:

1. AS = "123456789"2. B$ = nrus ( A$, 2, 4

3.B$ =

IUDS (A$, 2 )

iequals "2345"

i eg ua ls " 234 567 B9 "

'I'his is not the same as RIGHT$ as this f unction returnsan absolute number cf characters starting from the rightmostposition. This application works best when the right-handportion of a string is wanted and the string length is notk nown ,

BASIC 4~ Preliminary Uote

Bl,SIC 4.0 [:OIlsfor the 40 column PET are on tbeir way!The main differences are:

1. Faster garbage collection2. Disk commands included in BI\SIC

Of course most SYStem calls to non w iLl, requ ire mo dif ica ti onbut PEEKs and POKEs shoUld remain valid except for somelocations tbat may have been labelled unused in BASIC 2.0.More on DASIC 4.0 in a later issue. Also see JimButterfield's new BASIC 4.0 memory maps, this issue.

All BASIC 2.0 programs will run on BASIC 4.0 except forone minor gotcha. BASIC 4.0 has reserved two nore variables

for it's own use; DS and DB$. When called, DS will containthe error number from the disk and DS$ will return the errornumber, description, track and sector much like hitting " '> "

and return with DOS Support. The same rule applies to DS andDS$ as ST, TI and TI$; they must not appear on the left of an"=" sign. If they do a ?SYNTAX ERROR will result. So ifyour programs use either of these two new reserved variables,it would be a good idea to change them before RUNning onBASIC 4.0. This could be easily done by running yourprograms through Jim Butterfield's Cross-Ref program fromTransactor #9, Vol 2.

The Transactor is produced on the new CBN 8032 usingWordPro IV and the NEC Spinwriter.

Page 2: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 2/42

10 Changer

COHPUTE magazine, issue #5, published an article that

allows the user to change the 10 of a diskette. This cancause irreparable damage to your disks! The program changes

only the the 10 that gets printed with the directory.

However, the 10 precedes every sector on the disk and thesedo not get changed. An update will be published in the next

COr1PUTE but this early warning will be appreciated by someI'm sure.

Printer ROf<!s

Recent deliveries of Commodore printers have beenreleased with the 04 ROM. Though this ROM fixes existing 03

ROf.!bugs, it has a tendency to lock into lower case,

inhibiting upper case character printing. This happens aftersending to secondary address 2 (receive data for format).

Commodo re has discontinued the 04 printer ROM and until the

08 RON is released (sometime in the fall) the followingsoftware fix will prevent this bug from appearing. Lines 30and 40 insert a 25 jiffy delay pr ior to OPENing the format

channel:

10 OPEN 4, 4, 020 PRINT#4, "HELLO"

30 T = TI40 IF TI - T < 25 THEN 4050 OPEN 5, 4, 2

60 PRINT#5, " AAA 999 •••etc.

This bug can also be used to your advantage

to the pr inter in lower case which was,impossible on printers containing an 03

however, an easier way of implementing it:

i.e.in

RON.

for LISTing

most cases,There is,

100 OPEN 7, 4, 7 : PRINT#7 : CLOSE 7

•••puts the pr inter in lower case mode. PO\'ler down and upgets you back to upper case and graphics.

PRINT Speed - Up

In Transactor #2, Vol 2, a POKE was published that madePRINT to the screen much faster than normal. On recent

mach ines this POKE can not only cause the machine to crash

but may also result in internal damage! Avoid including thisin you r programs •••especially those that you may want to RUNon other peoples machines. Software portability is veryimportant, particularly business software. If your packagecrashes your clients machine, you may find yourself in a veryembarassing situation.

Verbatim NO 577 Super Minidisk

In the pust Commodore has frowned on the use of Verbatim

diskettes for the 2040 floppy disk, particularly the MO

?

Page 3: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 3/42

525-16. Verbatirr. recognized the problems w ith their disksand have improved the qual ity substantially.Result: The MD 577 Super Mini.

First, the thickness of the jacket PVC material has beenincreased from 7.5 to 8 mils giving the disks greaterrigidity.

Secondly, the lamination pattern, which secures theinner lining to the jacket, was redesigned to eliminate

potential "pillowing" problems. "Pillows" are minute raisedareas on the lining surface wh i.ch can interfere with thesideways movement of the disk.

Host importantly though, the new Verbatin: nn 577s areprovided with a factory installed "hard hole" or hubreinf or cemerrt ring, thus creating better center ins abil ityand reducing the possibility of hub daraaqe , Coincidentally,the performance of almost any diskette can be substantiallyimproved by adding a hub ring prior to formatting.

Part of the problem waspackaged in, which put creasesdisks. These are no longer used.

also the boxes theyin the front two or

werethree

He have tested the Ve rbatLm 577s and found them to be ofquite high quality. We've also decided to use them fordistr ibuting Commodore software which should appear on themarket this fall.

3

Page 4: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 4/42

Controlling Garbage Collections Henry Troop,Toronto, Onto

We all know that the PET garbage collection can take an

annoyingly long time. One highly frustrating time for a

garbage collection to happen is while you are executing a GETloop input from the keyboard. There you are, typing away, and

suddenly the cursor is still flashing at you, but no inputs are

accepted.

To avoid this, we'd like to force an early garbage

collection, at the start of the input, but QD.ly if it wouldhave happened anyway.

First things first. A GET loopgarbage collections because it usestypical form of this loop is:

is very productive oflots of memory. The

10 GET A$: IF A$ = an THEN 10

20 B$=B$+A$

What this does is create a set of partial strings. If the

input is 'Mary had a little lamb', then the strings are:

M

Ha

MarMary

and so on toMary had a little lam

Hary had a little lamb

That's a lot. Exactly how much? We could count the

number of characters and sum the numbers from 1 to n, but a

rule of thumb is n squared over 2. (A more exact figure is (n

squared + n)/2) For 22 characters, the memory used is 242

bytes. For 80 characters, it's around 3240 bytes.

So, what can we do about it. Well, we need some way ofdetermining the free memory space. FRE(O) will do this - butit will cause a garbage collection, and we don't really wantone yet. Let's define a function, FNFR(X):

1 DEF FNFR(X) = PEEK(48) + 256*PEEK(49) - (PEEK(46) +256*PEEK(47»

That's simply the distance between the beginning of

strings and the end of arrays. The argument is a dummy, justlike FRE (X)•

Our test then is:

5 IF FNFR(X) < (L*L)/2 THEN Q = FRE(O)

where L is the anticipated maximum string length.

One peculiarity of FNFR is that the statement:

PRINT FNFR(O)-FRE(O)

PRINT FRE(O)-FNFR(O)

is almost never the same as:

which is always O.

Page 5: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 5/42

Softwure Product Heview: Gord Campbell,Toronto, Onto

El~STERN nOUSE SOFT~'ll\REssemble r Language nacro Packages

- Graphics Drawing Compiler- PET Music and Sound Composer

The t.wo macro packages have sirr.ilar requirements andcontent as follows:

Reguirernents

- ASSM/TED, Eastern House Software's assembler and texteditor. This in turn requires:

- 161: RAH

- BASIC 2.0 RONs

Content

- a library of macros. This includes several generalpurpose macros as well as those specific to the topic.

- complete and useful documentation- patches to enhance ASSM/TED

Recommendation

If you are really into assembler language, and havel,SSE/TED, you should buy the Graphics Compiler. This willgive you a 'cookbook' on how to write macros, some very handyenhancements to the assembler, and the macros themselves.

Gi ven the similar ities, it would seem appropr iate toobtain the package wh ich is of greater interest to you -music or graphics. However, I believe that the MusicComposer has a significant limitation: it supports only CB2

sound. Since CB2 can be driven entirely adequately fromBASIC, do it in BASIC. The raw speed and exactness of timingwhich are the main benefits of using assembler are notrequired, so simplicity should be most important. Besides,if you warrt real music, you should be using the entireparallel port and a digital-to-analog converter. This is notreally difficult to do, and the results are worth it. Keepin mind that the above comments reflect the attitudes andprejudices of one ~erson. Just 00 not expect more than CB2control from the Busic Composer.

The remainder of this review concentrates on the

Gr aphic s Co mpile r.

What You Get

The graphics package includes a cassette with the macroI ibrary and an example program, and some excellentdocumentation. This includes:

- Genreral introduction- Instruction Set - description of the 39 macros- Enhancements - description of the additions to ASSM/TED- Operation - how to use the package (mechanics)

5

Page 6: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 6/42

- Useful details - some programming suggestions- Adding your own macros - with a non-trivial example- Instruction set sunmary- Combining machine-language and BASIC programs- Graphics Compiler source listing- patches for the assembler

Instruction Set

J\ .DDSUBBEGINBELLCLEARHONEDOENDDEFINEDRAWDDRM-JLDRAHRDRM-.JUGRAPHNGRAPHYINPUTSINPUTCJUHPJUNPEJUHPGJUHPGEJUNPLJUHPLEJUHPNOUTPUTB

OUTPUTCPRINTPOSABSPOSREL

REVRSYREVRSNSETASETAB

SETABCSETABCD

VECTURVECTULVECTLHVECTLL

- single-byte add- single-byte subtract- initialization and all subroutines- make a beep on CB2- clear screen from current cursor position to end- home the cursor- loop the number of times specified in a variable- terminate a DO loop- set a variable to a specified value- draw a line - down

- left- right- up

- set upper/lower case mode- set graphics mode- input a byte as two hexadecimal digits- input one ASCII character- jump - unconditional

- if a (one byte) variable contains zeroif a variable is positiveif a variable is zero or positiveif a variable is negativeif a variable is negative or zeroif a variable is not zero

- output a byte as two hexadecimal digits

- output one ASCII character- print a text string- position the cursor to a specified location- move the cursor a specified number of rows and

columns- set reverse video on- set reverse video off- set the predefined variable A to a literal value- set A and B (note: A, B, C, and D are defined in

BEGIN)- set A, B, and C- setA, B, C, and D

- draw a diagonal line - up and right- up and left- Lower right- lower left

There are also two undocumented macros, vlAIT and SCROLL,as well as a number of internal macros used by begin.

The commands do provide some capabilities which are notfound in BASIC (as single statements), although there isnothing radical. I would appreciate some form of ARCfunction, even if it meant invoking a subroutine in ROM to dothe trigonometry, and the compatibility problems which

6

Page 7: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 7/42

result. As well, graphs made with the quarter-squares(considering the screen to be an area of 80 by 50 positions)are very nice (and slow in BASIC) but not supported.

Assembler Enhancements

There are three additions to the assembler itself.These are:

- BUILD - a new command with three operands:MACROS - to seal off your macros so that theyare unaffected by NUMBER, EDIT,PRINT, etc.

LIBRARY to seal off a library of externaldefinitions (eg. page zero locations)

CLEAR to a ILow you to modify macros orlibrary

- FORMAT (CLEAR or SET) n - where In' is the maximumlabel length from 1 to 31 (default10). This will clean up the listingif you have a narrow printer, and onthe screen.

- allowing you to return to BASIC from ASSM/TED. Sincethe assembler uses the first 64 bytes of page zero, itis normally not possible to return to BASIC. Thepatch maintains a page-zero swap area, allowing you togo back and forth from one to the other. It can beextremely useful for testing a routine which is to becalled from BASIC.

The enhancements corne in hard copy form. You arerequired to enter a 240-byte routine using the machine

language monitor, then single instructions at seven locationswi thin the assembler itself. 101emory required by theassembler thus goes up by two pages.

Summary

As stated earlier, I recommend the Graphics Compiler ifyou are a serious user of ASSloi/TED, whether you areinterested in graphics or not. The examples of macrodefinitions, several of which have nothing to do withgraphics, and the additions to the assembler have significantvalue. The fine documentation and actual graphics support

could well be treated as a bonus.

7

Page 8: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 8/42

More On Screen Print John HcDonald,

~;Jawa,Ont.

I found Jim Butterfield's machine language Screen Print

Routine (Transactor #5) very useful in a program I am

developing. But in order to stretch the forty columns on the

screen to eighty columns on the printer I have added an, :: :: :. , " " , I · ·· u . .: : : ; 8 . .1"-'1 .:::::: . = ~fir. o E : : : - t····.-1:: _

The change is quite easy.

Method #1 using Superrnonl.O

1. load the screen print routine code,

2. use command '.T 0359 03B3 035E' to open up 5 bytes in

the code at $0359,

3. use command '.M 0359 035E' and change

'.: 0359 A9 11 AE 4C E8 A9 11 AE' to

'.: 0359 A9 01 20 D2 FF A9 11 AE',

4. use command '. .1 . 03BO 03B7' and change 'A6' at $03BO to'AI' ,

5. use command'.S "dn:narne",dv,033A,03B9'.

Method #2 using the Basic Loader for the code

1. load the screen print routine basic loader,

2. change 947 in line 100 to 952,

3. add ',1,32,210,255,169' to the end of the DATA statementat line 230,

4. change 166 at the end of line 330 to 161,

5. save the modified program.

This modification sends a control character (CHR$(l) as

per the above modification) to the printer after every-carriage return.

To use the screen pr int routine simply use 'SYS826' inyour code. To change or ensure the mode of the routine just

use 'POF\E858,1 or 129' before the SYS826 command. ForI~:;::",~:j 1', "ul"'o .::::::: : ; : ; " .:A' mode, use '1' : for' unenhanced' mode, use

'129' •

8

Page 9: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 9/42

True ASCII Output Henry Troup,Toronto, Onto

~ie are all awar e that the PET does not use true ASCIIcoding internailly. However, many of us have printers that douse real ASCII. In order to get upper and lower caseoperation, some code conversion is needed.

In this article, I shall present two ways of doing the

conversion: one in BASIC, and one machine language. Bothoperate by a table lookup. This has the advantage that anyother code conversion (to screen poke, Baudot or teletype code,for example, or ISO, or EIA, or what have you) can be hadsimply by changing the table. Or, a simple conversion to lowercase can be had by ANDing each byte with 127.

I personally keep the conversion table in a disk file. Itis appended at the end of this article.

First, the BASIC method. We dimension an integer array,M%(255}, and use it as the table. Then we assign the string tobe converted to s a .

1 00 0 R El -1CO NV ERS IO N R OU TIN E1010 M$="" : IF S$="" THEN 10501020 FOR I = 1 TO LEN(S$}1030 M$ = M$ + CHR$ (M%(ASC(MID$(S$,I}}})1040 NEXT I1050 RETURN

This is slow, but tolerable if you're not doing too muchco nv er sion , It uses 519 bytes for storage of the table, andneeds an available space of about five times the length of the

string for working storage (it will work with less, but garbagecollections will cause delays).

Now, the machine language method. This is faster and usesless storage. Here is the assembler listing. This programoperates on the variable after the SYS. You must set up thetable (anywhere you can get 256 bytes of free memory), and movethe BASIC pointers. Then you can call the program.

9

Page 10: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 10/42

.skip

.skip

.skipstart

100p2

sl = $dd

ts = $7fOOva = $44

* = 826

Ida slphaIda sl+lphajsr $cdfSjsr $cf6dIda $07bne startjmp $cc9a

cpx #$00

beq nullIdy #$02Ida (va) ,ysta sl+ldeyIda (va),ysta sldeyIda (va) ,ytaybeq nulldeyIda (sl) ,y

iconvert2.srciconvert petascii to trueiascii by lookupia convenient place to putithe pointer (used in tape i/o)

istart of table

icheck comma;f ind va riableicheck type

itype mismatch error if numeric

icheck for null stringior undefined variable

iptr 10

iptr hi

ilength

iany character handling routineican be substituted for theinext lines

taxIda ts,x ido table lookupsta (sl ) ,y ;put back in stringdeycpy #$ff ;test for endbne 100p2

null pIa ;restore zero pagesta sl+lpIa

sta sl

.endrts

ito use this routine:;sys S26,(string variable)i the converted str ing ]Lis returned into the or iginal

spacemo te s if the variable is defined in text, it will be

changed in text !

istring array variables work, except for the Oth elementiundefined variables are taken as nulls.iundimrned arrays will be created

10

Page 11: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 11/42

And as a basic loader: (which locates the table from the

top of memory pointer)

10 DATA 165, 221, 72, 165, 222, 72

15 DATA 32, 248, 205, 32, 109, 207

20 DATA 165, 7, 208, , 3, 76, 154

25 DATA 204, 224, 0, 240, 31, 160

30 DATA 2, 177, 68, 133, 222, 136

35 DATA 177, 68, 133, 221, 136, 177

40 DATA 68, 168, 240, 14, 136, 177

45 DATA 221, 170, 189, -1, -2, 145

50 DATA 221, 136, 192, 255, 208, 24360 DATA 104, 133, 222, 104

1000 FOR X = 826 TO 914:READ P1010 IFP = -1 THEN P = PEEK(54) :REH RELOCATE TABLE1020 IFP = -2 THEN P = PEEK(53)1030 POKE X,P :NEXTX

A Sample Initialization:

10 POKE53,PEEK(53-1) :CLR:REH MOVE TOP OF MEMORY

20 OPEN4,4:GOSUB1000:REM GET PROGRAl-l40 OPEN5,8,5,"CONVERT,S,R":REMM GET TABLE FROM DISK50 FORX=OT0255:INPUT*5,M%:POKEPEEK(53)+X,M%:NEXTX:CLOSE5:REM

PUT TABLE IN60 S$="THIS IS A TEST":SYS826,S$:PRINTI4,S$:REM ACTUAL

CONVERSION

This is much faster, and needs only the 256 bytes to store thetable. The conversion table follows:

1000 data 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

1010 data 10, 11, 12, 13, 14, 151020 data 16, 17, 18, 19, 20, 21, 22, 23, 24, 251030 data 26, 27, 28, 29, 30, 31, 32, 33, 34, 351040 data 36, 37, 38, 39, 40, 41, 42, 43, 44, 451050 data 46, 47, 48, 49, 50, 51, 52, 53, 54, 551060 data 56, 57, 58, 59, 60, 61, 62, 63, 64, 97

1070 data 98 , 99, 100, 101, 102, 103, 104, 105, 106, 107

1080 data 108, 109, 110, Ill, 112, 113, 114, 115, 116, 117

1090 data 118, 119, 120, 121, 122, 91, 92, 93, 94, 951100 data 96, 97, 98, 99, 100, 101, 102, 103, 104, 1051110 data 106, 107, 108, 109, 110, Ill, 112, 113, 114, 1151120 data 116, 117, 118, 119, 120, 121, 122, 123, 124, 125

1130 data 126, 127, 128, 129, 130, 131, 132, 133, 134, 1351140 data 136, 137, 138, 139, 140, 141, 142, 143, 144, 1451150 data 146, 147, 148, 149, 150, 151, 152, 153, 154, 1551160 data 156, 157, 158, 159, 160, 161, 162, 163, 164, 1651170 data 166, 167, 168, 169, 170, 171, 172, 173, 174, 1751180 data 176, 177, 178, 179, 180, 181, 182, 183, 184, 1851190 data 186, 187, 188, 189, 190, 191, 192, 65 66, 671200 data 68, 69, 70, 71, 72, 73, 74, 75, 76 771210 data 78, 79, 80, 81, 82, 83, 84, 85, 86, 871220 data 88, 89, 90, 219, 220, 221, 222, 223, 224, 2251230 data 226, 227, 228, 229, 230, 231, 232, 233, 234, 2351240 data 236, 237, 238, 239, 240, 241, 242, 243, 244, 2451250 data 246, 247, 248, 249, 250, 251, 252, 253, 254, 255

Page 12: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 12/42

PET 2040 DISK BUFFER 1/0 ROUTINE J.HOOGSTRAAT,BOX 20. SITE 7. SS 1,CALGARY. ALTA.

The major difficulty in programming direct access

routines for the PET 2040 disk drives is the computation of

the exact location of the recorded information on a disk

sector, for the reason that the PET pr ints its data to the

disk rather than transferring it byte for byte.

This results in variable length records on each diskwrite, unless the programmer takes special care converting

each variable to a fixed length string variable before

wri ting it to the disk. This is not too bad for stringvar iables, but other variables could be ranging in length

from one to more than ten characters after conversion to an

equivalent string variable.

Suppose we want to program a direct access fileconsisting of records made up of an ITEM-NO, DESCRIPTION and

COST.

The ITEM-NO ranges from 1 to 9999

The DESCRIPTION is 12 bytes longThe COST ranges from .00 to 9999999.00

We need 4 characters for the ITEM-NO, 12 for the

DESCRIPTION and 10 for the COST. This would total up to 26

characters per record, but in order to be able to read itback we have to add at least one carriage return character

after the COST string. After reading we can de-compose the

information with MID$ calls. Or, if we wish to be able to

update each field individually, a carriage return charactermust be added after each field, which ups our total record

length to 29 characters

I personally found this method rather wasteful and

cumbersome to program with all the STR$ calls and BLANKpadding. No other software seemed to be available, exceptfor Bill Macleans Block Get Routine published in theCommodore Transactor Vol 2, Dec 31, 1979. An excellentroutine, but it can only read from the disk buffers with

special care to be taken for the allocation of the inputstring variable.

So, what I needed was a routine with the following

characteristics:

Be able to read the disk block buffers.

Be able to write the disk block buffers.

No need for blank padding of any variables or the need of

adding carriage return characters •

•• Record and read numeric variables as 5 binary characters,as stored in PET's memory. This allows records of up to 51numeric variables on a disk sector •

•• Be able to read single character string variables with an

Page 13: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 13/42

ASC value of zero, in stead of getting a NULL string.

Exercise full control over the Block Buffer Pointers.

Perform like a basic WRITE or READ statement •

•• No need for special declarations or dummy manipulations ofinput variables •

•• Be able to output any kind of proper expressions •

•• Be totally relocatable.

Aided with Jim Butterfields excellent PET maps and t.he

Macro-Tea assembler of Skyles Electr ic ~'Jorks, I succesfullycoded the needed routine.

1111 explain how to use it with some basic codingexamples.

The basic format for the call to the PET 2040 disk bufferI/O routine is:

SYS XX, 10, CH, ( BP ,VA ,(LN»

XX = Address were the routine is loaded.

10 = Input / Output key value.

CH = Disk direct access channel no.

BP = Buffer pointer value.

VA = Variable name.

LN = No of characters.

For single BP control the 10 values are:

o For normal reading.1 For normal writing.2 For special reading.3 Same as 1.

For multiple BP control the 10 values are:

4 For normal reading.5 For normal writing.6 For special reading.7 Same as 5

13

Page 14: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 14/42

BASIC NUMERIC VARIABLE EXAr-lPLES

10 DK = 1 : CE = 15: CH = 2: XX = 634

20 OPEN CE,8,CE

30 OPEN CH,8,CH,":ft"

40 T = 2: S = 5: BP = 13

50 REN t'lRITE3 VARIABLES TO DISK

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

60 SYS XX, 1, CH, BP, A, B, C :REM OUTPUT

70 PRINT:ftCE,"U2:"CH;DK;T;S

880 REH READ 3 VARIABLES FROM DISK

90 PRINTICE, "U2:"CH;DK;T;S

100 SYS XX, 0, CH, BP, X, Y, Z :REM INPUT

In this example we are writing the 3 numeric variables

(A,B,C) to the disk buffer starting at character position 13.

The result is then written to disk drive 1 at Track 2, Sector

5. The buffer pointer is automatically incremented by 5 foreach variable and the variables are recorded in internal PETformat. Note no padding or carriage returns needed. After

the write, the variables are read back into X, Y and Z.

For numeric variables the parameter LN is implied and

must not be coded.

If the PRINTICE calls were omitted, no

writing or reading would take place, but merely aand from the disk buffer allocated to channel CH,useful in passing parameters between overlays.

actual disk

transfer towhich maybe

Statement 60 could be something like

60 SYS XX, 1, CH, BP, 1 •, A, A+B*C :REN OUTPUT

or60 SYS XX, 1, CH, BP, SQR(A) , SIN(A+B) , AlB :REN OUTPUT

or60 SYS XX, 1, CH, BP, 1.+C, -A, -55.5 :REN OUTPUT

The number of concatenated variables is only limited bythe maximum length of a BASIC line. But at least one must be

specified. We could also replace statement 60 by the

following lines:

60 SYS XX, 1, CH, BP , A

61 SYS XX, 1, CH, BP+ 5, B

62 SYS XX, 1, CH, BP+IO, C

:REH OUTPUT

:REH OUTPUT

:REN OUTPUT

Which have the same effect as the original line 60.

Statement 100 could also be replaced by the following

lines, which would read back the exact same information in

14

Page 15: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 15/42

tile variables X, Y ant; Z.

J . O O SYS xx , 0, en , pp+ 5 , y , Z : ?I.:!: Irpur.r

101 SYE ; ' I "~ 0 en ~~p '" : R s r· ~ It'PUT\.1> , , r :, , L

If we want; more control over the buffer pointer on tbew rite, the value for 10 mus t be 4 for reading and 5 forwriting.

Statements 60 and 100 which were:

60 SYS XX, 1, e F , GP, 1', 1 3 , e :RrT OUTPUT

100 SYS vv 0, CP, BP, v Y, Z : RE I, : INPLJ'l'\t.\. , '" ,

can noV! be coded ac•.;;:).

60 SYS ,7" 5 , eli, BP, A, BP+ 5, B, BP+lO, C :REF OU'l'PU'l'v c. ,

100 SYS }~}~, 4, CP, EP, X, BP+ 5, Y, BP+lO, Z :REll IPP(,'l'

'rhe difference is thatpointer value preceeoing it.

each variable nov has a bufferThe statements can now also be:

60 SYS XX, 5, cn , 8P+ 5, D, BP, A, BP+ lO, C :REI·1OUTPUT

100 SYS ",.,br . . , 4, CII, BP+lO, Z, BP, X, BP+ 5, Y :REM INPUT

Since we now have full buffer pointer control.

BASIC STRIHG VARIA·BLES EXAriPLES

10 DK = 1 : CE = 15: cr = 2 : XX = 634

20 OPF.H CE,8,CE30 OPEN CIl,8,CIl,Ailif

40 T = 2 : S = 5 : EP = 13

50 REI, ' ~'JEITE3 S':L'RII7CARIABLES TO DISK

60 SYS XX, 1, CP, rtP, A$,5, 13$,6, C$,lO :REl·'OUTPUT70 PR IN T# CE , " U2 :" CH; DK ;T ;S

80 PEIi REI'.D 3 S'l'RING VARIABLES FROB DISK

90 PRINT#CE, "U2:"CE;DK;T;S

100 SYS XX, 0, CD, BP, XS,5, Y$,6, Z$,lO :REH INPUT

In this example 'vie are writing the 3 STRING variables(A$,B$,C$) to the disk buffer starting at character position13. The result is then written to disk drive 1 at Track 2,Sector 5.

The difference betwe en a numeric variable and a stringv ariab l e is that the string variable is followed by LN, itslength or number of characters. The specied length does nothave to be the actual length of the str ing variable. In ourexample the first 5 characters of X$ are transferred,

15

Page 16: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 16/42

followed by the first 6 characters of Y$ and then the first10 characters of Z$.

The buffer pointer is automatically incremented by 5,6 and10. Note no padding or carriage returns needed. After thewri te, the var iables are read back into the str ing$ X$, Y$and Z$

Lets now examine what happens if we have the f o lLow inqstatements:

55 Z$ = "HANS"+"r1ARGARET"

6 a SYS XX, 1, CH, BP, Z $,LEN (Z $) :REf,'!UTPUT

The disk buffer (C8) willcharacter position 13 the textresults of the next statement:

now contain starting at"HANSHARGARET". The same

60 SYS XX, 1, CH, BP, "HANS"+"MARGARET",12 :REM OUTPUT

And the statement:

100 SYS XX, 0, CH, BP, Z$,12 :REM INPUT

Will input and create a string variable with a length of12 characters and containing the text "HANSHARGARET".However the statement:

100 SYS XX, 0, CH, BP, Z$,lO :REM INPUT

Will input and create a string variable with a length of10 character s and containing the text "HANSt:IARGAR". Or thestatements:

100 SYS XX, 0, CH, BP , X$,6 :REM INPUT101 SYS XX, 0, CH, BP+7, Z$,5 :REM INPUT

Will input and create two str ing va riables X$ and Z $,containing "HANSMA" AND "GARET"

Note that no extra linefeeds or carriage returncharacters are written and that the record space needed forthe original ITEH-NO, DESCRIPTION and COST example is now5+12+5 or 22 characters instead of the 29 needed without thisbuffer I/O routine.

If the PRINTICE calls were omitted no actual diskwriting or reading would take place, but merely a transfer toand from the disk buffer allocated to channel CH, which againmaybe useful in passing parameters between overlays, or to dosome fancy string manipulations.

P. E. :

10 A$ = "XXXXXXXXXX"11 B$ = "YYYYY"12 SYS XX, 1, CH, 2, A$, LEt-J($) :REr-lOUTPUT13 SYS XX, 1, CH, 5, B$, LEN(B$) :REN OUTPUT14 SYSS XX, 0, CH, 2, A$, 10 :REM INPUT

16

Page 17: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 17/42

First writes the string variables A$ and B$ overlayingthe A$ information and then inputs and creates a stringvariable A$ containing "XXXYYYYYXX".

Statement 60 could be something like

60 SYS XX, 1, CH, BP, A$+"X",5, A$+B$,6, A$+"Z"+C$,lO

: R E f . 1 OUTPUT

The number of concatenated string variables is onlylimited by the maximum length of a BASIC line. But at least

one must be specified. We could also replace statement 60 by

the following lines:

60 SYS XX, 1, CH, BP , A$,5 : R E M OUTPUT61 SYS XX, 1, CH, BP+ 5, B$,6 : R E M OUTPUT62 SYS XX, 1, CH, BP+ll, C$,lO :REM OUTPUT

Which have the same effect as the original line 60.

Statement 100 could also be replaced by the following

lines, which would read back the exact same information inthe string variables X$, Y$ and Z$

100 SYS XX, 0, CH, BP+5, Y$,6, Z$,lO : R E M INPUT101 SYS XX, 0, CH, BP , X$,5 :REM INPUT

If we want more control over the buffer pointer on thewrite, the value for 10 must be 4 for reading and 5 forwriting.

Statements 60 and 100 which were:

60 SYS XX, 1, CH, BP, A$,5, B$,6, C$,lO :REM OUTPUT

100 SYS XX, 0, CH, BP, X$,5, Y$,6, Z$,lO : R E M INPUT

can now be coded as:

60 SYS XX,S, CH, BP,A$,5, BP+5,B$,6, BP+ll,C$,lO :REMOUTPUT

100 SYS XX, 4, CH, BP,X$,5, BP+5,Y$,6, BP+ll,Z$,lO :RE~1

INPUT

The difference is that each string variable nowbuffer pointer value preceeding it and still its

following it. The statements can now also be:

has alength

60 SYS XX,S, CH, BP+5,B$,6, BP+ll,C$,lO, BP,A$,5 :REl>1OUTPUT

100 SYS XX, 4, CH, BP+ll,Z$,lO, BP,A$,5, BP+5,Y$,6 : R E l J IINPUT

Since we now have full buffer pointer control.

So far I only discussed write and reads of string

variables of the same length on the writing and reading.

17

Page 18: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 18/42

Now suppose we have the following statements:

55 A$ = "HANS"60 SYS XX, 5, CH, 10,A$,10 , 20,A$+A$,10 :REM OUTPUT

This transfers to the buffer, starting at characterlocation 10, the characters "hans*****hanshans**", where the

"*" stands for an automatic padded carriage return characterwith an ASC value of 13. In other words the routine willalways wri te the number of character s requested but if the

output string expression is too short, the output will bepadded with carriage return characters. This has a nice

effect when we read the same data back with the following

statement:

100 SYS XX, 4, CH, 10,A$,10 , 20,B$,10 :REM INPUT

This call will input and create the two string variables

A$ and B$, but their contents will be "HANS" AND "HANSHANS",

since the input quits on the first encountered carriage

return characters for each variable and their length will be

4 and 8. However an otherwise null character string will

always be returned as a character string of ASC value zerowith a length of one.

Sometimes this technique is undesirable and we want to

get back every character, no matter what their ASC valuesare. Now the special read I/O values 2 or 6 are to be used.The statement:

100 SYS XX, 6, CH, 10,A$,10 , 20,B$,10 :REM INPUT

Will now input and create an A$ and B$ variable

containing "hans******" and "hanshans**".

Note, the length limit of a string variable is 255 bytes,allowing us to read or wr ite entire disk buffer blocks atonce.

By no means do we have to write separate statements for

numeric or string variables, we can mix them up. Thefollowing statements are quite legal:

51 IT = 546952 SS$ = "PET Cm,1PUTER"

53 CO = 1365.25

60 SYS XX, 1, CH, 2, IT, SS$,12, CO :REH OUTPUT

100 SYS XX, 6, CH, 7,A$,12 ,2,A, 19,B :REH INPUT

Again the read call for I/O = 6 will properly return:

A$ = "PET COMPUTER", A = 5469, B = 1365.25

Still confused, please contact me !

18

Page 19: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 19/42

027A-A511

027C-8501

027E-A512

0280-8502

0282-20F8CD

0010; ROUTINE TO TRANSFER FLOATING POINT VARIABLES AND STRING0020; VARIABLES BETWEEN PET'S HEr-lORYAND A D/A DISK BUFFER.

0030; -------------------------------------------------------------0040;

0050; WRITTEN BY J.HOOGSTRAAT

0060;0070 ;

0080 ;

0090;0100;

0110; -------------------------------------------------------------0120;0130; THIS ROUTINE IS TOTAL RELOCATABLE AND CAN BE LOADED ANYWHERE.

0140;0150; FLOATING POINT VARIABLES ARE TRANSFERRED AS 5 BYTES ONLY.

0160;0170; STRING VARIABLES ARE TRANSFERRED WITHOUT LINEFEEDS

0180; OR CARRIAGE RETURNS.

0190 ;

0200; THIS ROUTINE IS IDEALLY SUITABLE FOR DIRECT DISK ACCESSING,

0210; SINCE ALL BUFFER POINTERS CAN BE CALCULATED EXACTLY.0220;

0230; -------------------------------------------------------------

0240;0250;

0260

0270

0280 ;0290; LOCAL VARIABLES

0300;0310STADR

0320SYSXX

0330;034010

0350DCH

0360LNG

0370STP0380 ;

0390; LOCAL VALUES

0400;0410DCE

0420CRT0430FLN

0440;

0450; BASIC AREAS USED

0460;

0470DTP

0480SLN

0490SAD0500CAD

0510ACC0520NCH0530ASB

0540;

0550START

0560

0570

0580

0590;0600

BOX-20, SITE 7, SSl

CALGARY, T2M-4N3, ALTA

PHONE (403)239-0900

.OS

.BA 634

.DI $1

.DI $11

.DI $Bl

•DI $B2

•DI $B7•DI $B8

.DI $F•DI $D•DI $5

•DI

•DI

•DI.DI

•DI•DI•DI

$07

$16

$17$44$5E

$77$100

LDA *SYSXX

STA *STADR

LDA *SYSXX+lSTA *STADR+l

JSR CHKCOf>1

;FIRST CASSETTE BUFFER FOR NOW.

;SAVED ROUTINE START ADDRESS.

;BASIC ROUTINE START ADDRESS AS SYS ~X.

;SAVED 10•

;SAVED DCH •

;SAVED REQ. LENGTH •;SAVED DATA TYPE.

;DISK COM~~ND CHANNEL •

;CARRIAGE RETURN •;FLT PNT ~'lORDLENGTH.

;DATA TYPE •

iSTRING LENGTH •

iSTRING ADDRESS •iCURRENT VARIABLE

iACCUMULATOR •iNEXT INPUT FIELD

;ASC BUFFER •

ADDR.

CHAR •

;START START ADDR

;FOR SELF RELOCATION.

iUPTO NEXT FIELD.

19

Page 20: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 20/42

0285-209FCC

0288-20D2D6

028B-84B1

028D-20F8CD

0290-209FCC0293-20D2D60296-84B2

0298-20F8CD

029B-209FCC029E-20E9DC

02A1-A20F

02A3-20C9FF

02A6-AOC4

021\8-A5B2

02AA-093002AC-9101

02AE-AOC1

02BO-B10102B2-20D2FF

02B5-C8

02B6-COC6

02B8-DOF6

02BA-A20102BC-BDOOOl02BF-FOOA

02Cl-20D2FF02C4-E802C5-DOF5

02C7-F002

02C9-DOCD

02CB-20CCFF

02CE-A6B2

02DO-A5B102D2-290102D4-F005

02D6-20C9FF

02D9-D003

02DB-20C6FF

02DE-20F8CD

JSR EVAEXP

JSR FLTFIX

;EVALUATE EXPRESSION.

;CONVERT TO INTEGER.

iSAVE 10.

0610

0620

0630

0640 i

0650

066006700680

0690 ;

0700AGAIN

07100720

0730;

0740; ISSUE PRINTICE, "B-P:"CH;BP

0750i --------------------------

0760;

0770

07800790 ;

0800

0810 ;

0820

083008400850 ;

086008700UTBP

0880

0890

0900

09100920;

09300940BPOUT

0950

096009700980

09901000;

1010AGAJJ1020;

1030BPDON1040;

1050; ISSUE PRINTICH FOR INPUT OR OUTPUT

1060; ----------------------------------1070;

10801090;

1100111011201130i11400POUT

1150

1160i

11700PINP

1180 ;

1190TRFER

1200;

STY *10

JSR CHKCOH

JSR EVAEXPJSR FLTFIX

STY *DCH

iUPTO NEXT FIELD.;EVALUATE EXPRESSION.

iCONVERT TO INTEGER.

iSAVE DCE.

JSR CHKCOH

JSR EVAEXPJSR BINASC

iUPTO NEXT FIELD.

i EVJi.LUATEEXPRESSSION.iCVT BPT TO ASC.

LDX IDCE

JSR STODEV

iOPEN CHANNEL ICE'.

LDY #BPDCH-START iSET RELOCATION.

LDA *DCH

ORA 1$30STA (STADDR),Y

i STm'J ASC OF DCH

iIN THE TEXT.

LDY

LDA

JSR

INY

CPY

BNE

#BPTXT-START

(STADR) ,YOUTCHR

iSET RELOCATION.

iOUTPUT "B-P:"CH.

IBPTXE-START

OUTBP

iEND OF TEXT?

iNO, CONTINUE.

LDX 11

LDA ASB,XBEQ BPDON

JSR OUTCHRINX

BNE BPOUT

BEQ BPDON

;OUTPUT ASC OF BP

iEND OF ASC.

iCONTINUE TILL END.

BNE AGAIN

JSR RESTIO

LDX *DCH

LDA *10AND #1BEQ OPINP

iCHECK 10.

;INPUT.

JSR STODEVBNE TRFER

iOPEN OUTPUT CH.

JSR STIDEV iOPEN INPUT CH.

JSR CHKCmli iUPTO NEXT FIELD.

20

Page 21: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 21/42

1210

12201230

1240;

1250

1260

12701280;

1290; WRITE OUTPUT DATA

1300; -----------------

1310;02ED-209FCC 1320WOUTP

02FO-08 13301340 ;

135013601370;

1380i OUTPUT STRING EXPRESSION

1390 i

02F5-207DD5 1400

1410i

1420

1430

1440i1450WOUTC

1460STRl\D

1470

1480

1490

1500i1510HOUTS

1520

15301540

1550

1560i1570i OUTPUT FLT PNT DATA IN ACCUMULATOR

1580 i1590FLTDT

1600i

1610

1620

1630i

1640

16501660i1670FLTCR

1680

16901700

1710i1720i OUTPUT CHARACTER LOOP

1730i1740HHITE

1750 i

0325-A90D 1760WRITI

0327-C416 17700329-B002 1780

032B-Bl17 1790

032D-20D2FF 1800WRIT2

02EI-A905

02E3-85B7

02E5-8516

02E7-A5Bl

02E9-2901

02EE-F053

02FI-A50702F3-FOID

02F8-28

02F9-100A

02FB-A002

02FD-B14402FF-991600

0302-88

0303-10F8

0305-20F8CD

0308-209FCC030B-20D2D6

030E-84B7

0310-DOll

0312-28

0313-A563

0315-3004

0317-065F

0319-465F

031B-l\.95E

031D-AOOO

031F-85170321-8418

0323-AOOO

LDA #FLN

STA *LNG

STA *SLN

LDA *10AND t,tl

BEQ RINPT

JSR EVAEXPPHP

LDA *DTPBEQ FLTDT

JSR DSCSTR

PLP

BPL vlOUTS

LDY

LDASTADEY

BPL

#2(CAD),YSLN,Y

STRAD

JSR CHKCOM

JSR EVAEXPJSR FLTFIX

STY *LNG

ENE HRITE

PLP

LDA *ACC+5

BHI FLTCR

ASL *ACC+lLSR *ACC+1

LDA #L,ACC

LDY #H,ACC

STA *SADSTY *SAD+l

LDY #0

LDA

CPY

#CRT

*SLN

HRIT2

(SAD) ,Y

OUTCHR

BCSLDA

JSR

21

iDEFAULT LENGTH

iTO FLT PNT LENGTH.

iCHECK 10.

iREAD INPUT.

iEVALUATE EXPRESSION.iSAVE STATUS

iCHARACTER STRING?iNO FLT PNT VARIABLE.

iDISCARD TENP S'l'RING

iGET STATUS

iNOT A CONTANT STRING

iSAVE STRING ADDRESS

iUPTO NEXT FIELD.

iEVALUATE EXPRESSION.

iCONVERT TO INTEGER.iSAVE REQ. LENGTH.

iREADY FOR OUTPUT.

iCLEAR STACK

iCORREC,}: SIGN?

iNO.

iREMOVE SIGN BIT

;FROH ACCUHULATOR.

iSET OUTPUT

iADDRESS TO THEiACCUHLATOR.

iSET CHAR POINTER.

iDEFAULT TO CR.

iMORE THAN ACTUAL LENGTH ?

iYES, USE ·CR.

iUSE INPUT CPAR.

iOUTPUT THIS CHl\R.

Page 22: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 22/42

0330-C8

0331-C4B70333-DOFO

0335-F061

0337-D090

0339-FOA3

033B-422D50033E-5820

0340-206DCF

0343-8517

0345- 8418

0347-A507

0349-85B8

034B-F020

034D-20F8CD

0350-209FCC

0353-20D2D6

0356-980357-AOOO0359-8516035B-9117

035D-20DOD3

0360-980361-A0020363-9117

0365- 85450367-SA

0368- 88

0369-9117

036B-8544

036D-AOOO

036F-I'l.5B1

0371-29020373-F002

0375-84B8

1810 ;

1820

18301840

18501860 ;1870; INBETWEEN JUMP AND CONSTANTS

1880; ----------------------------1890 ;1900AGAIJ

1910TRFEJ1920 ;1930BPTXT1940BPDCH1950BPTXE1960;1970; READ INPUT DATA

1980; ---------------1990 ;

2000RINPT

2010i

2020

20302040i

205020602070;2080i INPUT FLT PNT VARIABLE

2090i

21002110i

2120 i INPUT S'l'RINGVARIABLE

2130;

21402150

21602170 i

21802190220022102220;

22302240;225022602270

22802290

2300

2310

23202330;

2340READI2350;

2360

237023802390 i

2400

INY

CPYBNE

BEQ

*LNGWRIT1FIELD

BNE AGAJJ

BEQ TRFER

.BY 'B-P'

.BY 'X '

.01 =

JSR GETVAR

STA *SAD

STY *SAD+1

LDA *DTPSTA *STP

BEQ REl>,DI

JSR CHKCOHJSR EV1\EXP

JSR FLTFIX

TYALDY #0STA *SLHSTA (SAD},Y

JSR GETSPC

TYALDY #2STA (SAD},Y

STA *CAD+1TXA

DEYS'l'A(SAD},Y

S'l'A*CAD

LDY #0

LDA *10AND #2BEQ READ1

STY *STP

iALL DONE?

iNO.;YES.

;GET VARIABLE ADDR.

iDEFAULT INPUT ADDRESS.

;TO FLT PNT VARIABLE

i SAVE AND CHECK DATl\ TYPE.

iFLT PNT INPUT VARIABLE.

iUPTO NEXT FIELD.

;EVALUATE EXPRESSION.

iCONVERT TO INTEGER.

iSAVE REQ. LLENGTH.;SAVE IN STRING INDEX.

;GET SPACE FOR STRING.

iSAVE ADDRESS OF SPACEiIN STRING INDEX

;AND CURRENT VARIABLE ADDRESS.

iSET CHAR POINTER.

;CHECK 10.

iSPECIAL STRING READ?iNO.

;CHANGE FROM 'FF' TO '00'.

22

Page 23: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 23/42

0377-20CFFF

037A-C90D

037C-D004

037E-A6B8

0380-DOO 9

0382-9144

0384-C8

0385-C416

0387-DOEE

0389-FOOD

038B-98

038C-FOF4

038E-1\000

0390- 84B80392-9117

0394-A8

0395-180396-90EC

0398-AOOO039A-B177039C-C92C039E-DOO 8

03AO-A5B1

03A2-290C

03A4-F09303A6-D08F

03l'~8-2 OCCPF

03AB-60

2410;

2420READ1

2430;2440

2450

2460;

2470

2480

2490;2500READ2

2510;2520READ3

2530

2540

25502560;2570READ4

2580

2590:

2600

26102620

2630

2640

2650

2660;

2670; CHECK FOR MORE FIELDS

2680; ---------------------2690:

2700FIELD27102720

27302740

2750

27602770

2780 ;

2790: TERMINATE ROUTINE2800: -----------------2810 :

28201mOliE2830

2840 :

2850: BASIC ROUTINES USED2860 :2870EVAEXP

2880CHKCOH2890GETVAR

2900GETSPC2910DSCSTR

2920FLTFIX2930BINASC

2940RES'rIO2950STIDEV

2960STODEV

2970INPCHR29800UTCHR

2990

JSR INPCHR

CHP #CRT

BNE READ2

LDX *STP

BNE READ4

S'I'A(CAD),Y

INYCpy *SLN

BNE READ 1

BEQ FIELD

TYABEQ READ2

LDY #0

STY *STP

STA (SI\D),Y

TAY

CLCBCC READ3

LDYLDACHP

#0(NCE) ,Y

# ' ,l\.DONE

*10DA

AND #12

BEQ TRFEJBNE AG1HJ

JSR RESTIORTS

•DE $CC9F

$CDF8$CF6D

$D3DO$D57D

$D6D2$DCE9

$FFCC

$FFC6

$FFC9

$FFCF$FFD2

Dr.• J...I

•DE•DE•DE

.DE•DE

.DE

•DE

.DE

.DE•DE.EN

23

;INPUT A CHAR.

:CARRIAGE RETURN?

;NO.

:YES. STRING ?

:YES. TERMINATE STRING.

;S'l'01i<JHAR INTO INPUT.

;ALL DONE?

;NO.

:YES.

:INTERCEPT NULL STRINGS

:SET RECORDED STRING LENGTH.

;RESET DATA TYPE.

:TRUNCATE STRING IN INDEX.

;CONTINUE READING.

:MORE FIELDS ARE PRESENT:IF THERE IS A COHHA IN;BASIC'S INPUT BUFFER.

:NO, WE QUIT.;vJHATKIND

:GO AGAIN, NO BP:GO AGAIN, BP SET

:RESTORE I/O DEVICE.

:EVALUATE EXPRESSION •

:CHECK FOR COHj\Il'•;GET BASIC VARIABLE •

:GET STRING SPACE •;DISCARD TEMP STRING •

:FLOAT TO INTEGER. CONVERSION

;CONVERT FLT TO ASC •

:RESTORE DEFAULT I/O ADDRESSES.;SET INPUT DEVICE •

i8ET OUTPUTT DEVICE.

;INPUT CHARACTER.:OUTPUT CHARACTER •

Page 24: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 24/42

LABELS------

STADR = 0001 SYSXX = 0011

IO = 00B1 DCH = 00B2

LNG = 00B7 STP = OOB8

DCE = OOOF CRT = OOOD

FLN = 0005 DTP = 0007

SLN = 0016 SAD = 0017

CAD = 0044 ACC = 005E

NCH = 0077 ASB = 0100START = 027A AGAIN = 0298

OUTBP = 02BO BPOUT = 02BC

AGAJJ = 02C9 BPDON = 02CB

OPOUT = 02D6 OPINP = 02DB

TRFER = 02DE HOUTP = 02EDWOUTC = 02FB STRAD = 02FD

{'lOUTS = 0305 FLTDT = 0312

FLTCR = 031B WRITE = 0323

WRIT1 = 0325 VlRIT2 = 032D

AGAIJ = 0337 TRFEJ = 0339

BPTXT = 033B BPDCH = 033E

BPTXE=

0340 RINPT=

0340READI = 036D READ1 = 0377

READ2 = 0382 READ3 = 0384READ4 = 038B FIELD = 0398

ADONE = 03A8 /EVAEXP = CC9F

/CHKCOH = CDF8 /GETVAR = CF6D

/GETSPC = D3DO /DSCSTR = D57D

/FLTFIX = D6D2 /BINASC = DCE9

/RESTIO = FFCC /STIDEV = FFC6

/STODEV = FFC9 /INPCHR = FFCF

/OUTCHR = FFD2

24

Page 25: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 25/42

HEXADECIHl"..Lmjp- - - - - - - - - - - - - - - -

027A A5 11 85 01 A5 12 85 020282 20 F8 CD 20 9F CC 20 D2028A D6 84 Bl 20 F8 CD 20 9F0292 CC 20 D2 D6 84 B2 20 F8029A CD 20 9F CC 20 E9 DC 1\2

02A2 OF 20 C9 FF AO C4 A5 B202AA 09 30 91 01 AO Cl Bl 01

02B2 20 D2 FF C8 CO C6 DO F602BA f..2 01 BD 00 01 FO OA 2002C2 D2 FF E8 DO F5 FO 02 DO02CA CD 20 CC FF A6 B2 A5 Bl02D2 29 01 FO 05 20 C9 FF DO02DA 03 20 C6 FF 20 F8 CD A902E2 05 85 B7 85 16 A5 Bl 2902EA 01 FO 53 20 9F CC 08 A502F2 07 FO ID 20 7D D5 28 1002FA OA AO 02 Bl 44 99 16 000302 88 10 F8 20 F8 CD 20 9F030A CC 20 D2 D6 84 B7 DO 11

0312 28 A5 63 30 04 06 5F 46031A 5F [\9 5E AO 00 85 17 840322 18 AO 00 A9 OD C4 16 BO032A 02 Bl 17 20 D2 FF C8 C40332 B7 DO FO FO 61 DO 90 FO033A A3 42 2D 50 33 20 20 6D0342 CF 85 17 84 18 A5 07 85034A B8 FO 20 20 F8 CD 20 9F0352 CC 20 D2 D6 98 AO 00 85035A 16 91 17 20 DO D3 98 AO0362 02 91 17 85 45 8A 88 91036A 17 85 44 AO 00 A5 Bl 290372 02 FO 02 84 B8 20 CF FF037A C9 OD DO 04 A6 B8 DO 090382 91 44 C8 C4 16 DO EE FO038A OD 98 FO F4 AO 00 84 B80392 91 17 A8 18 90 EC AO 00039A Bl 77 C9 2C DO 08 A5 Bl03A2 29 OC FO 93 DO SF 20 CC03AA FF 60

25

Page 26: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 26/42

60000 REM DATA STATEr.1ENTSOR D/A BUFFER ROUTINE

60001 REM60002 REM TOTAL LENGTH 306 BYTES

60003 REt'l60004 DATA 165, 17, 133, 1, 165, 18, 133, 2

60005 DATA 32, 248, 205, 32, 159, 204, 32, 210

60006 DATA 214, 132, 177, 32, 248, 205, 32, 159

60007 DATA 204, 32, 210, 214, 132, 178, 32, 248

60008 DATA 205, 32, 159, 204, 32, 233, 220, 162

60009 DATA 15, 32, 201, 255, 160, 196, 165, 178

60010 DATA 9, 48, 145, 1, 160, 193, 177, 160011 DATA 32, 210, 255, 200, 192, 198, 208, 246

60012 DATA 162, 1, 189, 0, 1, 240, 10, 32

60013 DATA 210, 255, 232, 208, 245, 240, 2, 208

60014 DATA 205, 32, 204, 255, 166, 178, 165, 177

60015 DATA 41, 1, 240, 5, 32, 201, 255, 208

60016 DATA 3, 32, 198, 255, 32, 248, 205, 169

60017 DATA 5, 133, 183, 133, 22, 165, 177, 41

60018 DATA 1, 240, 83, 32, 159, 204, 8, 165

60019 DATA 7, 240, 29, 32, 125, 213, 40, 1660020 DATA 10, 160, 2, 177, 68, 153, 22, 060021 DATA 136, 16, 248, 32, 248, 205, 32, 15960022 DATA 204, 32, 210, 214, 132, 183, 208, 17

60023 DATA 40, 165, 99, 48, 4, 6, 95, 7060024 DATA 95, 169, 94, 160, 0, 133, 23, 132

60025 DATA 24, 160, 0, 169, 13, 196, 22, 176

60026 DATA 2, 177, 23, 32, 210, 255, 200, 19660027 DATA 183, 208, 240, 240, 97, 208, 144, 24060028 DATA 163, 66, 45, 80, 88, 32, 32, 10960029 DATA 207, 133, 23, 132, 24, 165., 7, 13360030 DATA 184, 240, 32, 32, 248, 205, 32, 15960031 DATA 204, 32, 210, 214, 152, 160, 0, 13360032 DATA 22, 145, 23, 32, 208, 211, 152, 16060033 DATA 2, 145, 23, 133, 69, 138, 136, 14560034 DATA 23, 133, 68, 160, 0, 165, 177, 41

60035 DATA 2, 240, 2, 132, 184, 32, 207, 25560036 DATA 201, 13, 208, 4, 166, 184, 208, 960037 DATA 145, 68, 200, 196, 22, 208, 238, 24060038 DATA 13, 152, 240, 244, 160, 0, 132, 18460039 DATA 145, 23, 168, 24, 144, 236, 160, 060040 DATA 177, 119, 201, 44, 208, 8, 165, 17760041 DATA 41, 12, 240, 147, 208, 143, 32, 20460042 DATA 255, 9660043 END

26

Page 27: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 27/42

100 REN A RA!'1DOHFILE DEHONSTRATION110 REM WHICH NEEDS NO BLOCK-ALLOCATE120 REH BY USING THE SPACE ALLLOCATED130 REM OF ANY PREVIOUS CREATED FILE.

140 REH150 REN THE RI\NDOH UPDATES CAN BE BITS

160 REM OF INFORMATION OF UPTO 254170 REf·}BYTES OF STRING INFORl·1ATION.

180 REH190 REN FLOATING POINT VARIABLES ALHAYS

200 REH ARE ONLY 5 BYTES LONG. THE FIVE210 REM BYTES PET USES.

220 REB230 REM THIS DEMONSTRATION NEEDS THE240 REN D/A BUFFER ROUTINE LOADED AT250 REN XX=634.260 REH270 REM TESTHIG DONE ON DISK DRIVE 1

280 REH

290 REM =======================300 REN

310 REN

320 REN330 REN

340 REH

350 REM =======================360 REH370 REB380 REM CREATE A SEQUENTIAL TEST FILE

390 REM -----------------------------400 REB410 F$="TESTING-TESTING"

420 XX=634:GOSUB1120

430 DK=1:CE=15:CS=2:CR=3:NN=200440 DIHT (40) ,S ( 40)450 A$="I"+CHR${48+DK) :OPENCE,8,CE,A$460 A$="@"+CHR${48+DK)+":"+F$+",U,W"470 OPENCS,8,CS,A$480 A$=" •••":FORI=IT03:A$=A$+A$:NEXT490 FORI=IT027:PRINTICS,A$:NEXT

500 CLOSECS510 REH520 REM FIND TRACK AND SECTOR EXTENTS530 REM FOR CREATED TEST FILE

540 REM -----------------------------550 REH560 L=LEN{F$)

570 A$=CHR${48+DK)+":"+F$+",U,R"580 OPENCS,8,CS,A$590 T=18:S=I:N=0600 PRINT#CE,"Ul:"CS;DK;T;S610 SYSXX,O,CS,I,S$,I:S=ASC{S$)

620 FORI=2T0255STEP32

630 SYSXX,0,CS,I,A$,2,T$,I,S$,I,N$,L

640 IFASC(A$»128ANDF$=N$THEN670

650 NEXT:IFS<255THEN600660 PRINT"FILE "F$" NOT FOUND":END670 N=N+l

J.HOOGSTRAAT

BOX 20, SITE 7, SS 1CALGARY, ALTA. T2H-4N3

PH(403) 239-0900

27

Page 28: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 28/42

680 T(N)=ASC(T$) :S(N)=ASC(S$)

690 PRINTICE,"Ul:"CS;DK;T(N);S(N)

700 GETICS,T$,T$,S$:IFT$<>""THEN670

710 CLOSECS

720 REIvl730 REM OPEN RANDOM FILE WITH THE TEST

740 REM FILE EXTENTS. FILL IT ALL UP

750 REM -------------------------------760 REf4770 PRINT"[cs]"

780 OPENCR,8,CR,"I"790 FORI=lTON:A$=CHR$(I+48)800 FORL=lT05:A$=A$+A$+A$:NEXT

810 PRINTICE,"Ul:"CR;DK;T(I);S(I)

820 SYSXX,1,CR,2,I,-1,A$,NN830 SYSXX,0,CR,2,S,U,A$,NN

840 PRINT"[dn]BLOCK";S:PRINTA$;

850 PRINTICE,"U2:"CR;DK;T(I);S(I)

860 NEXT

870 REH

880 REM UPDATE SOME TEXT IN A BLOCK

890 REM ---------------------------

900 REN910 REM920 INPUT"[dn]BLOCK,POS,TEXT";B,P,B$

930 PRINT"[cs]"

940 FORI=lTON

950 PRINTICE,"Ul:"CR;DK;T(I);S(I)

960 IFI<>BTHEN990970 SYSXX,1,CR,7,P980 SYSXX,1,CR,11+P,B$,LEN(B$)

990 SYSXX,0,CR,2,S,U,A$,NN1000 PRINT"[dn]BLOCK"S;1010 PRINT" LAST UPDATE AT POS";U

1020 PRINTA$;

1030 PRINTICE,"U2:"CR;DK;T(I);S(I)1040 NEXT

1050 GOT0920

1060 REt<11070 REl'1LOAD UP THE D/A BUFFER ROUTINE

1080 REM AT LOCATION XX. THIS ROUTINE

1090 REM A TOTAL RELOCATABLE.

1100 REM ----------------------------1110 REN1120 FORI=lT0306:READA:POKEXX-l+I,A:NEXT1130 RETURN

1140 REN

1150 REM INSERT DATA STATEMENTS1160 REM FOR D/A BUFFER ROUTINE HERE

1170 REM TOTAL LENGTH 306 BYTES

1180 REH

28

Page 29: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 29/42

PET to Heathkit H14 Printer Serial Interface

The following article was submitted by Sheldon H. Deanof Calgary, Alberta. Mr. Dean's interface is a modifiedversion of a serial interface by Harvey B. Herman and CharlesPate that appeared in the March/April, 1980 issue of COMPUTEMagazine. Unlike the circuit in COMPUTE (and also one in anearlier Transactor), Sheldon's frees up the parallel userport by including an onboard oscillator for the UARTclock ••••

This interface provides a 300 baud (bps)asynchronous communication interface between thePET implemented, IEEE-488 bus and the Heathkit H14line printer using the 20mA current loop standard.The interface is consructed using standard TTLdevices. It provides true upper and lower caseASCII without the necessity of a handshake betweenthe PET and the H14 pr inter. The interface plugsdirectly into the IEEE port on the PET and a simplewire pair connects the interface to the H14 printerby a standard DB-25S cable connector.

Sheldon H. Dean

Although Sheldon has designed the interface for his Heathkitprinter, it could undoubtedly be connected to other equipmentthat uses the 20mA current loop convention.

29

Page 30: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 30/42

P IW

IEEnPET }

0107 (C)

40i toFig.2

39

0108 (0)3 38 IC20106 ( B )

37

36

350105 (A)

34

33

32 0104 (4 )

31

ICl 30 0103 (3)

29

28 0102 (2)

27

0101 (1)26

16 25 -20rnA (18 )*

24 ncNRFO (7)

23

22 NOAC (8)20 21

+5 +20mA (19 )*

GNO (12)

12

ATN (11)

DAV (6 )

Figure One * see note 4

Page 31: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 31/42

r-----.----r--------~----~+ 5

t oF i g . l

S R3

I C 6 R 5

F i g u r e T w o

I----r-----u + 5 v o l t sT l I C 7

I C # + 5 v o l t s

1 1 ,34,372 14

3 14

4 145 1 66 4,8

T A B L E O N E

F i g u r e T h r e e

g r o u n d

3 , 1 6 , 2 1 , 3 5 , 3 6 , 3 8 , 3 977

78 , 9

1

T h i s t a b l e l i s t s t h e p o w e r

r e q u i r e m e n t s o f t h e v a r l O U S I C s .

Page 32: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 32/42

C l . 0 0 1 u F m y l a r

C 2 . 1 u F m y l a r

C 3 . 0 0 5 u F m y l a r

C 4 1 0 0 u F , 6 V e l e c t r o l y t i cC 5 3 3 u F , 1 0 V t a n t a l u m e l e c t r o l y t i c

R l 2 2 0 o h m , 1 / 4 w a t t

R 2 1 0 0 0 0 o h m , 1 / 4 w a t t

R 3 2 2 0 0 o h m , 1 / 4 w a t t

R 4 1 0 0 0 o h m , 1 / 4 w a t t

R 5 5 0 0 0 0 o h m , 1 0 t u r n p r e c i s i o n p o t e n t i o m e t e r ( s e e n o t e 1 )

I C l I n t e r s i l I M 6 4 0 2 U A R T o r e q u i v a l e n t ( s e e n o t e 2 )

I C 2 7 4 0 0 Q u a d 2 i n p u t N A N D g a t e

I C 3 7 4 0 2 Q u a d 2 i n p u t N O R g a t e

I C 4 7 4 0 4 H e x I n v e r t e r

1 C 5 7 4 1 2 3 M o n o s t a b l e m u l t i v i b r a t o r

1 C 6 5 5 5 T i m e r

I C 7 7 8 0 5 F i v e v o l t r e g u l a t o r

T l 9 v o l t D C 3 0 0 m A c a l c u l a t o r p o w e r s u p p l y t r a n s f o r m e r

S l 4 0 p i n I e s o c k e t

S 2 , S 3 , S 4 1 4 p i n I C s o c k e t

S 5 1 6 p i n I e s o c k e t

S 6 8 p i n I e s o c k e t

C i n c h 2 5 1 - 1 2 - 1 3 - 1 6 0 e d g e c o n n e c t o r o r e q u i v a l e n t

A m p h e n o l 0 8 - 2 5 S c a b l e c o n n e c t o r o r e q u i v a l e n t

R a d i o S h a c k 2 7 6 - 1 5 3 p r i n t e d c i r c u i t b o a r d o r e q u i v a l e n t

N O T E S :

1 . T h e o u t p u t o f f i g u r e t w o i s a d j u s t e d t o 4 8 0 0 H z u s i n g R 5 . T h i s

p r o v i d e s a d a t a t r a n s f e r r a t e o f 3 0 0 b p s . A f r e q u e n c y c o u n t e r

i s n e c e s s a r y t o a c c u r a t e l y a c c o m p l i s h t h i s .

2 . A n y p i n c o m p a t i b l e U A R T m a y b e u s e d s u c h a s a S 1 8 8 3 o r A Y - 3 - 1 0 1 5 .

3 . T h e c i r c u i t m a y b e i m p l e m e n t e d u s i n g M O S d e v i c e s f o r m o s t g a t e s .

T h i s w i l l r e s u l t i n r e d u c e d p o w e r c o n s u m p t i o n .

4 . P i n 1 8 a n d p i n 1 9 a r e p i n s o f t h e 0 8 - 2 5 S c o n n e c t o r a n d p r o v i d e

t h e - 2 0 r n A a n d + 2 0 r n A s i g n a l s f o r t h e p r i n t e r . A l l o t h e r p i n

a s s i g n m e n t s a r e o n t h e P E T I E E E e d g e c o n n e c t o r .

32

Page 33: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 33/42

Filestatus Henry Troup

There's been quite a lot written about disk files, andtape files, but very little about the PET's logical files.Here are some suggestions and a routine which may have someutility.

When you OPEN a file, you specify a logical file number, adevice number, and (optionally) a secondary address, andfilename. Then the PET does what is necessary. This

information is saved, the number of files open is incrementedand checked, and action is taken to open the file.

The file data is stored in three tables - logical files,devices, and secondary addresses. The tables start at $0251($0242 old ROM), $025B ($024C), and $0265 ($0256) respectively.The count of number of files is at $OOAE ($0262). The filenameis not saved - it's sent to the device.

The secondary address is OR'd with $60, and then stored.If no SA is specified, a value of $FF will be found in thetable.

When a file is closed, the file last opened is swappedinto its place. So if you open files 1,3, and 5i and thenclose 1, the file table contains entries for 5 and 3 (plus adummy copy of 5).

Now, we can write a routine to check on file status. Here itis:

10 REM FIND FILE STATUS15 INPUT"LOGICAL FILE NUMBER "iLF20 NF = PEEK(174) :IF NF = 0 THEN PRINT "NO FILESOPEN" :END

30 PF = O:FOR X=l TO NF:IF PEEK(592+X) = LF THEN PF = X40 NEXTX:IF PF = 0 THEN PRINT "FILE" LF "NOT OPEN":END50 PRINT "LOGICAL FILE"iLF "OPEN"52 PRINT "ON DEVICE"iPEEK(602+PF)55 P = PEEK(612+PF) AND 159 :IF P = 159 THEN P = 060 PRINT "WITH SECONDARY ADDRESS";P

To use this, just open the files, and GOTOIO. If you RUN theprogram, you'll abort all files.

You could use a version of this routine if you're doingdynamic LOADs - files are not affected by the LOAD, and you canfind them.

33

Page 34: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 34/42

c P ~ g~----=----ASIC 4.0 HEr'lORYNAP

Compiled by Jim Butterfield

There are some differences between usage between the 40- and

80-co1umn machines.

Hex0000-00020003

0004OOOS0006

000700080009OOOAOOOBOOOCOOOD-OOOF00100011-0012

0013-001S0016-001E

001F-0022

0023-00270028-0029002A-002B

002C-002D

002E-002F

0030-00310032-00330034-00350036-0037

0038-0039003A-003B003C-003D003E-003F0040-00410042-00430044-00450046-0047

0048-0049

004A

004B-0050

0051-00530054-005D

005E00SF-006200630064

00650066-006B006C

006D

006E-006F

0070-00870077-0078

008S-008C

Decimal0-23

4

5

6

7

89

10111213-1S

1617-18

19-2122-30

31-34

35-3940-41

42-4344-4S

46-47

48-4950-5152-5354-55

56-5758-5960-6162-6364-6566-67

68-6970-71

72-7374

7S-8081-8384-93

9495-9899

100

101102-107108

106

110-111112-135119-120

136-140

DescriptionUSR jumpSearch characterScan-between-quotes flagInput buffer pointer; t of subscripts

Default DIM flag

Type: FF=string, OO=numericType: 80=integer, 00=f1oating pointFlag: DATA scan; LIST quote; memory

Subscript flag; FNX flagO=INPUT; $40=GET; $98=READATN sign/Comparison Evaluation flagDisk status DS$ descriptorCurrent I/O device for prompt-suppressInteger value (for SYS, GOTO etc)

Pointers for descriptor stackDescriptor stack(temp strings)

Utility pointer area

Product area for multiplication

Pointer: Start-of-BasicPointer: Start-of-Variab1es

Pointer: Start-of-Arrays

Pointer: End-of-ArraysPointer: String-storage(moving down)

Utility string pointerPointer: Limit-of-menoryCurrent Easic line number

Previous Basic line numberPointer: Basic statement for CaNTCurrent DATA line numberCurrent DATA addressInput vectorCurrent variable nameCurrent variable addressVariable pointer for FOR/NEXT

Y-save; op-save: Basic pointer save

Comparison symbol accumulatorMisc work area, pointers, etcJump vector for functionsMisc numeric work area

Accuml1: ExponentAccum#l: MantissaAccum#l: SignSeries evaluation constant pointerAccumll hi-order (overflow)Accum#2: Exponent, etc.Sign comparison, Acc#l vs 12

Accuml1 lo-order (rounding)Cassette buff len/Series pointer

CHRGET subroutine; get Basic charBasic pointer (within subrtn)

Random number seed.

34

Page 35: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 35/42

00 8D-00 8F0090-00910092-00930094-00950096009700980099-009A009B009C

0090009E009FOOAO00A100A3-00A400A500A600A700A800A9OOM

OOABOOACOOAOOOAEOOAFOOBO00B100B200B300B400B500B700B9

OOBAOOBB-OOBCOOBOOOBEOOBF00CO-00C100C200C300C4-00C500C600C7-00C800C9-00CA

OOCB-OOCCOOCOOOCEOOCF0000000100020003000400050006-000700080009

141-143144-145146-147148-149150151152153-154155156

157158159160161163-164165166167168169170

171172173174175176177178179180181183185

186187-188189190191192-193194195196-197198199-200201-202

203-204205206207208209210211212213214-215216217

Jiffy clock for TI and TI$Hardware interrupt vectorBRK interrupt vectorNMI interrupt vectorStatus word STWhich key down; 255=no keyShift key: 1 if depressedCorrection clockKeyswitch PIA: STOP and RVS flagsTiming constant for tape

Load=O, Verify=lNumber of characters in keybd bufferScreen reverse flagIEEE output; 255=character pendingEnd-of-line-for-input pointerCursor log (row, column)IEEE output bufferKey image0=f1ash cursorCursor timing countdownCharacter under cursorCursor in blink phase

EOT received from tapeInput from screen/from keyboardX saveHow many open filesInput device, normally 0Output CMO device, normally 3Tape character parityByte received flagLogical Address temporary saveTape buffer character; MLM commandFile name pointer; MLM flag, counterSerial bit countCycle counter

Tape writer countdownTape buffer pointers, 11 and 12Write leader count; read passl/2Write new byte; read error flagWrite start bit; read bit seq errorError log pointers, pass1/20=Scan/1-15=Count/$40=Load/$80=EndWrite leader length; read checksumPointer to screen linePosition of cursor on above lineUtility pointer: tape, scrollTape end addrs/End of current program

Tape timing constantsO=direct cursor, else programmedTape read timer I enabledEOT received from tapeRead character errorI characters in file nameCurrent file logical addressCurrent file secondary addrsCurrent file device numberRight-hand window or line marginPointer: Start of tape bufferLine where cursor livesLast key/checksum/misc.

Page 36: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 36/42

Page 37: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 37/42

PET 4.0 ROM Routines Jim Butterfield,Toronto

The 40-character and BO-character machines are the sameexcept for addresses $EOOO-$E7FF.

This map shows where various routines lie. The first addressis not necessarily the proper entry point for the routine.Similarly, many routines require register setup or data

preparation before calling.

BOOO-D065B066-B093B094-BOBlBOB2-B20CB20D-B32lB322-B34FB350-B392B393-B39FB3AO-B3CCB3CD

B3FF-B41EB4lF-B4B5B4B6-B4E1B4E2-B4FAB4FB-B5A2B5A3-B5D1B5D2B5EC-B621B622-B62FB630-B6DDB6DE-B784B785-B7B6

B7B7-B7C5B7C6-B7EDB7EE-B807B808-B812B8l3-B82FB830-B85CB85DB883-B890B891B894-B8B2B8B3B8C6-B8D5B8D6-B8F5

B8F6-B92FB930-BA87BA88-BA8DBA8E-BAAlBAA2-BBlCBB1D-BB39BB3A-BB4BBB4C-BB79BB7A-BBA3BBA4-BBBDBBBE-BBF4BBF5-BCOl

DescriptionAction addresses for primary keywordsAction addresses for functionsHierarchy and action addresses for operatorsTable of Basic keywordsBasic messages, mostly error messagesSearch the stack for FOR or GOSUB activityOpen up space in memoryTest: stack too deep?Check available memorySend canned error message, then:

Warm start; wait for Basic commandHandle new Basic line inputRebuild chaining of Basic linesReceive line from keyboardCrunch keywords into Basic tokensSearch Basic for given line numberPerform NEW, and;Perform CLRReset Basic execution to startPerform LISTPerform FORExecute Basic statement

Perform RESTOREPerform STOP or ENDPerform CONTPerform RUNPerform GOSUBPerform GOTOPerform RETURN, then:Perform DATA: skip statementScan for next Basic statementScan for next Basic linePerform IF, and perhaps:Perform REM: skip linePerform ON

Accept fixed-point numberPerform LETPerform PRINT#Perf orm cnnPerform PRINTPrint string from memoryPrint single format characterHandle bad input dataPerform GETPerform INPUT#Perform INPUTPrompt and receive input

37

Page 38: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 38/42

BC02-BCF6BCF7-BD18BD19-BD7lBD72-BD97BD98BEE9BEEFBFOO-BFOBBF8C-C046C047-C08S

C086-COBSCOB6-CllDCllE-C12AC12B-ClBFCICO-C2C7C2C8-C2D8C2D9-C2DCC2DD-C2FBC2FC-C4A7C4A8C4BC-C4C8C4C9-C4CE

C4CF-C4DBC4DC-CS09CSOA-CSICCSID-CS8DCS8E-CS9DCS9E-CSAFCSBO-C6lCC6lD-C669C66A-C74EC74F-C78BC78C-C7B4C7BS-C8l0C8ll-C82l

C822-C83SC836-C86lC862-C86CC86D-C896C897-C8BlC8B2-C8B7C8B8-C8COC8Cl-C8DOC8Dl-C8E2C8E3-C920C92l-C92CC92D-C942

C943-C9S9C9SA-C962C963-C97EC97F-C985C986C998-CA7CCA7D-CAB3Cl~B4-CAB8CAB9-CAFICAF2-CBlFCB20CB5E-CBClCBC2-CBEC

Perform READCanned Input error messagesPerform NEXTCheck type mismatchE val ua te e xp re ss ionEvaluate expression within parenthesesCheck parenthesis, commaSyntax error exitVariable name setupSet up function references

Perform OR, ANDP er for m c om par is onsPerform orxSearch for variableCreate new variableSetup array pointer32768 in floating binaryEvaluate integer expressionFind or make arrayPerform FRE, and:Convert fixed-to-floatingPerform POS

Check not DirectPerform DEFCheck FNx syntaxEvaluate FNxPerform STR$Do string vectorScan, set up stringAllocate space for stringGa rb age co lle ct ionConcatenateStore stringDiscard unwanted stringClean descriptor stack

Perform CHR$Perform LEFT$Perform RIGHT$Perform HID$Pull string dataPerform LENSwitch string to numericPerform ASCGet byte parameterPerform VALGet two parameters for POKE or WAITConvert floating-to-fixed

Perform PEEKPerform POKEPerform ~lAITAdd O.SPe rf orm s ub tr act io nPerform additionComplement accum#lO v e rf Low e xi tf.l uliply-a-byteConstantsPerform LOGPerform multiplicationUnpack memory into accum#2

Page 39: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 39/42

CBED-CC09CCO/1-CC17CC18-CC2ECC2F'-CC33CC34CC3DCC45-CCD7CCD8-CCFCCCFD-CD31

CD32-CD41CD42-CD50CD51-CD60CD61-CD6ECD6F-CD8DCD8E-CD90CD91-CDDOCDD1-CE01CE02-CE28CE29-CEB3CEB4-CEE8CEE9-CEF8CF78

CF7F-CF92CF93-DOC6DOC7-D107D10aDl12D14B-D155D156-D183D184-DID6DID7-D220D221-D228D229-D281D282

D289-D2DlD2D2-D2FDD2FE-D32BD32C-D35BD35C-D398D399-D3B5D3B6-D471D472-D716D717-D7ABD7AC-D802D803-D837D838-D872D873-D919D91A-D92ED92F'-D941D942-D976D977-D990D991-D9DlD9D2-Dl\06DI,07-DA30Dl\31-Dl~64DA65-DA7DDl\7E-DAA6Dlill7-DAC6Df,C7-Dl~D3

Dl\D4-DBOC

Test & adjust accumulatorsHandle overflow and underflowHu1tiply by 10]0 in floating binaryDivide by 10P er fo rm d iv ide -b yP er fo rm d iv ide -i ntoUnpack memory into accumllPack accum#l into memory

Move accum#2 to 11Move accum#l to #2Round accum#lGet accum#l signPerform SGNPerform ABSCompare accum#l to memoryFloating-to-fixedPerform INTConvert string to floating-pointGet new ASCII digitConstantsPrint IN, then:

Print Basic line #Convert floating-point to ASCIIConstantsPerform SQRPerform power functionPerform negationConstantsPerform EXPSe ri es e va lua ti onRND constantsPerform RNDPerform COS

Perform SINPerform TANConstantsPerform ATNConstantsCHRGET sub for zero pageBasic cold startMachine Language Monitorf,1Lf.lubroutinesPerform RECORDDisk parameter checks.Dummy disk control messagesPerform CATALOG or DIRECTORYOutputFind spare secondary addressPerform DOPENPerform APPENDGet disk statusPerform HEADERPerform DCLOSESet up disk recordPerform COLLECTPerform BACKUPPerform COpyPerform CONCAT

Insert command string values

Page 40: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 40/42

DDClD-DB39DB3A-DDES

DB66-DB98

DB99-DB9D

DB9E-DBD6

DBD7-DBEO

DBEI-DBF9

DBFA-DC67

DC68-DE29DE2C-DE48

DE49-DE86DE87-DE9C

** EntryEOOOEOA7El16

E202E442E455

E600

**

Perform DSAVEPerform DLOAD

Perform SCPf'.cnCheck Direct command

Query ARE YOU SURE?

Print BAD DISK

Clear DS$ and ST

Assemble disk command string

Parse Basic DOS commandGet Device number

Get file nameGet small variable parameter

points only for EOOO-E7FF **Register/screen initializationInput from keyboardInput from screen

Output characterMain Interrupt entryInterrupt: clock, cursor, keyboardExit from Interrupt

**FOOO-FODl File messages

FOD2 Send 'Talk'FOD5 Send 'Listen'

FOD7 Send IEEE command character

Fl09-F142 Send byte to IEEE

F143-Fl50 Send byte and clear ATN

Fl5l-FI6B Option: timeout or wait

F16C-F16F DEVICE NOT PRESENT

F170-F184 Timeout on read, clear control linesF185-F192 Send canned file message

F193-F19D Send byte, clear control linesFl9E-FlAD Send normal (deferred) IEEE charFlAE-FIBF Drop IEEE device

FICO-F204 Input byte from IEEEF205-F2l4 GET a byteF2l5-F265 INPUT a byteF266-F2AI Output a byter2A2 Abort files

F2A6-F2CO Restore default I/O devices

F2Cl-F2DC Find/setup file data

F2DD-F334 Perform CLOSE

F335-F342 Test STOP key

F343-F348 Action STOP keyF349-F350 Send message if Direct modeF35l-F355 Test if Direct mode

F356-F400 Program load subroutine

F401-F448 Perform LOADF449-F46C Print SEARCHING

F46D-F47C Print LOADING or VERIFYINGF47V-F(A4 Get Load/Save parametersF4A5-F(D2 Send name to IEEE

FLD3-FIF5 Find specific tape header

F4F6-F50C Perform VERIFY

FSOD-F55F Get Open/Close parametersF560-F5E4 Perform OPENF5E5-F618 Find any tape header

F£19-F67A Write tape header

F67D-F694 Get start/end adars from header

Page 41: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 41/42

F695-F6AA Set buffer address

F6AB-F6C2 Set buffer start & end addrs

F6C3-F6CB Perform SYSF6CC-F6DC Set tape write start & end

F6DD-F767 Perform SAVE

F768-F7AE Update clock

F7AF-F7FD Connect input device

F7FE-F84A Connect output device

F84B-F856 Bump tape buffer pointer

F857-F879 Wait for PLAY

F87A-FB8B Test cassette switchF88C-F899 Wait for RECORDF89A Initiate tape read

F8CB Initiate tape write

F8EO-F92A Common tape I/OF92B-F934 Test I/O completeF935-F944 Test STOP keyF945-F975 Tape bit timing adjust

F976-FA9B Read tape bits

FA9C-FBBA Read tape characters

FBBB-FBC3 Reset tape read address

FBC4-FBC8 Flag error into ST

FBC9-FBD7 Reset counters for new byte

FBD8-FBF3 Write a bit to tape

FBF4-FC85 Tape writeFC86-FCBF Write tape leader

FCCO-FCDA Terminate tape; restore interruptFCDB-FCEA Set interrupt vectorFCEB-FCF8 Turn off tape motor

FCF9-FDOA Checksum calculation

FDOB-FDI5 Advance load/save pointerFDI6-FD4B Power-on Reset

FD4C-FD5C Table of interrupt vectors

** Jump table: **FF93-FF9E CONCAT,DOPEN,DCLOSE,RECORD

Ff'9F-FFM HEADER,COLLECT, BACKUP, COpyFFAB-FFB6 APPEND,DSAVE,DLOAD,CATALOG

FFB7-FFBC RENAHE,SCRATCHFFBD Get disk statusFFCO OPEN

FFC3 CLOSE

FFC6 Set input device

FFC9 Set output deviceFFCC Restore default I/O devicesFFCF INPUT a byteFFD2 Output a byteFFDS LOAD

FFD8 SAVE

FFDD VERIFY

Ff'DE SYS

FFEI Test stop key

FFE4 GET byte

FFE7 Abort all files

FFEA Update clock

FFFA-FFFF Hard vectors: NMI, Reset, INT

Page 42: The Transactor V2 10

8/7/2019 The Transactor V2 10

http://slidepdf.com/reader/full/the-transactor-v2-10 42/42

..!r.I.Lln~d~e:..£x~Twr:..!a~n'-!..:s~a~c.=t~o.=.r___u#....~O,--_ ._. . .

Controlling Garbage Collections •••••••• 4Software Review: Eastern House ••••••••• 5More On Screen Print ••••••••••••••••••• 8True ASCII Output •••••••••••••••••••••• 9PET 2040 Disk Buffer I/O Routine ••••••• 12PET to Heathkit Printer Interface •••••• 29Filestatus ••••••••••••••••••••••••••••• 33BASIC 4.0 Memory Map ••••••••••••••••••• 34PET 4.0 ROM Routines ••••••••••••••••••• 37