Audiovox II To The Manual 9c9cba1e 50fc 4181 8920 9730fb00c217

User Manual: Audiovox II to the manual

Open the PDF directly: View PDF PDF.
Page Count: 257

DownloadAudiovox II  To The Manual 9c9cba1e-50fc-4181-8920-9730fb00c217
Open PDF In BrowserView PDF
Apple II Original ROM Information
Source
http://members.buckeye-express.com/marksm/6502/
27 June 2004
The 6502 Firmware Page

This site is mostly about the firmware -- software in ROM -- that came with the
original Apple II, not the II+, IIe, IIc, or IIgs. The original Apple II had 4K of
RAM and 8K of ROM. The ROM contains software, such as the Monitor and Integer
BASIC, appropriate for a SBC.
Red Book refers to the original Apple II Reference Manual dated 1978.
WOZPAK refers to the WOZPAK II, a publication by Call-A.P.P.L.E., an Apple II user
group.
DDJ refers to Dr. Dobbs Journal, a computer magazine.
IA refers to Interface Age, a publication of the SCCS (Southern California
Computer Society).
SYM and AIM refer to early 6502 single board computers.
Contents
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

Apple II ROM (12 KB binary)
Memory map of the Apple II ROMs
Summary of Monitor Commands
Red Book Monitor listing
Red Book Sweet-16 listing
WOZPAK Sweet-16 article by Steve Wozniak
WOZPAK Sweet-16 article by Dick Sedgewick
Red Book Mini-Assembler listing
Red Book Floating point listing
WOZPAK Floating point routines description
DDJ Floating point article
IA Floating point article
SYM Monitor listing
AIM Monitor listing
AIM BASIC Language Reference Manual

-----------------------------------------------------------------------Questions or comments? Email me at
paulrsm@buckeye-express.com
-----------------------------------------------------------------------Updates
*

2000-09-01 -- Added AIM BASIC Language Reference Manual

+-----------------------------------------------------------------------| TOPIC -- Apple II -- Apple II ROM (12 KB binary)
+-----------------------------------------------------------------------File .............
Fork .............
Size (bytes) .....
Created ..........
Modified .........

"a2rom.bin"
DATA
12,288 (12KB) / $00003000
Sunday, December 8, 2002 -- 8:47:53 PM
Sunday, December 8, 2002 -- 8:47:53 PM

D/000000:
D/000010:
D/000020:
D/000030:
D/000040:
D/000050:
D/000060:
D/000070:
D/000080:
D/000090:
D/0000A0:
D/0000B0:
D/0000C0:
D/0000D0:
D/0000E0:
D/0000F0:
D/000100:
D/000110:
D/000120:
D/000130:
D/000140:
D/000150:
D/000160:
D/000170:
D/000180:
D/000190:
D/0001A0:
D/0001B0:
D/0001C0:
D/0001D0:
D/0001E0:
D/0001F0:
D/000200:
D/000210:
D/000220:
D/000230:
D/000240:
D/000250:
D/000260:
D/000270:
D/000280:
D/000290:
D/0002A0:
D/0002B0:
D/0002C0:
D/0002D0:

03AD57C0
03851BA0
F6E61BA5
8C210348
270A0A0A
0D260385
07B0FB8C
03851CB0
26912660
881002A0
C01006A5
DCA981C8
04F027A9
25301012
30D003EE
C9026AB0
26B01A2C
A52669B0
2669FC85
06269019
49F0F002
2690D048
4838ED20
FF690148
54688D20
FF69FE85
E551851D
65528554
51269126
F9D018A5
82848890
A18D7861
05260A0A
038D2203
297FE84A
EE21038D
85538A29
D1C88452
A2808654
900420D8
D0CAD0E5
1BA11AD0
538A290F
C88452AC
80865486
0420C0D0

A9208D26
851CAD26
A2D0C8D0
038E2003
85266885
A527291F
6904C8E9
984AAD24
26253051
C0853060
A51C0AC9
0A498030
18A55129
2A03A97F
26451C25
65532903
D1D02206
12692348
02691F66
EAD1D0F3
A5266950
0269E066
8D220368
B00A6849
68855085
03900449
50AAA9FF
D038A554
451C2530
53B0DA20
5150D981
E1D4C5B4
2729032A
29070D22
AACAA530
25039003
4A4A4A4A
0FAABCEC
A11A8551
65508554
900320D9
1AD002E6
4A4A4A85
AABCECD1
1A8551A2
50855490

AD53C0AD
00841AA5
1B291FD0
29C08526
26270A26
278AC000
2503AABD
2960202E
1024A530
27A9C085
1C497F85
C02890DF
7F253031
18A55129
2A035126
8F303018
F3D0F005
B00269F0
276018A5
69E0182C
49F08526
A9008D20
03488AED
A900E553
038E2103
528C2203
AC2503B0
A555E900
E8D004E6
54655085
A0C01CFF
493118FF
0A8D2203
AD25030A
D0FC8D21
20036086
0FAABCEB
AC2503A2
8655AE27
D018A555
A5514A4A
C960861A
AABCEBD1
2503A200
55AE2703
18A55565

50C0A900
1C911A20
EE608D22
4A4A0526
270A6626
F005A023
EAD08530
D0A51C51
4AB00549
308C2503
1C60A530
A000B0DB
26D01BEE
04F00FB1
9126A551
A5272CEA
691F38B0
852668B0
2769042C
2ED1F013
AD260390
038D2103
21038553
85518555
9818ED22
665338E5
050A2088
8555B126
1DF06BA5
54A55565
FEFAF4EC
A5260AA5
A5274A4A
6D25030A
038A186D
1A841BAA
D1845049
008E2A03
03A55438
65528555
4AD0D3E6
841BAA4A
8450490F
8E2A03A1
A5543865
52855590

[...&..W..S..P...]
[...&............]
[.........)...`."]
[.....!.H)..&JJ.&]
[.&h.'...&'.&'.f&]
[.')..&..'......#]
[i.......%......0]
[.J.$....)`.....Q]
[&%0Q&.&`.$.0J..I]
[..0`....'...0.%.]
[.........I...`.0]
[.I.0.....(......]
[..Q)..'..%01&...]
[*...%0....Q)....]
[&E.%0...*.Q&.&.Q]
[eS)...j..00..',.]
[..".&..,....i.8.]
[.i#H.&i...i..&h.]
[.i.f&i..'`..'i.,]
[.....&..i..,....]
[.&iPI...I..&.&..]
[.i.f&..H......!.]
[.".hH8...H..!..S]
[..hI.i.H...S.Q.U]
[h.P.Th....!...."]
[...I.i..R.".fS8.]
[P....Q...%......]
[.8.TeR.T.U...U.&]
[E.%0Q&.&......k.]
[S.......TeP.T.Ue]
[QP..............]
[......xaI1...&..]
[').*.&...."..'JJ]
[)..".."..%..m%..]
[...0)..J...!...m]
[%....!....`.....]
[JJJJ.S.)......PI]
[.......R.%....*.]
[...Q...T.U.'..T8]
[eP.T.......UeR.U]
[.........QJJJ...]
[.........`.....J]
[JJJ.S.)......PI.]
[......R.%....*..]
[..Q...T.U.'..T8e]
[P.T.......UeR.U.]

D/0002E0:
D/0002F0:
D/000300:
D/000310:
D/000320:
D/000330:
D/000340:
D/000350:
D/000360:
D/000370:
D/000380:
D/000390:
D/0003A0:
D/0003B0:
D/0003C0:
D/0003D0:
D/0003E0:
D/0003F0:
D/000400:
D/000410:
D/000420:
D/000430:
D/000440:
D/000450:
D/000460:
D/000470:
D/000480:
D/000490:
D/0004A0:
D/0004B0:
D/0004C0:
D/0004D0:
D/0004E0:
D/0004F0:
D/000500:
D/000510:
D/000520:
D/000530:
D/000540:
D/000550:
D/000560:
D/000570:
D/000580:
D/000590:
D/0005A0:
D/0005B0:
D/0005C0:
D/0005D0:
D/0005E0:
D/0005F0:
D/000600:
D/000610:
D/000620:
D/000630:
D/000640:
D/000650:

0320D9D0
D002E61B
AFD34820
D24C7DD0
D38A4898
602090D3
AE230360
608E2303
D348AD28
D3F039A2
18A8B11A
A016B14A
4AAAC8B1
0D2092D3
FDFEA900
3D8D2903
843E853F
CD20FAFC
2089F6B0
19CE00C9
3A26E0D7
07307600
A9BE20ED
8CF62B3C
6BE3ECDC
E7673D25
07F5C72C
09DA02F5
DC06F108
06BA1D74
4E00CC38
CC287C00
02C9AAD0
60A002B1
CAD00CA5
89F622D6
0B9142E8
A0D54CB0
E8F0F720
D5A6D860
FCA02420
F00E452E
EAEAEAC1
20DAFDA9
FDA9A920
8DF9038C
4CB0D5A9
850049FF
84068408
09CAD0F6
DAFD9820
D0E4E607
0CE60CA5
0DA50DC5
0BCAD0D5
0D8509A5

CAD0E5A5
A11AD0C9
9AD36820
AD25034A
AA20AFD3
4C10D020
20F9D220
A0322092
03851AAD
00C11AF0
651AAAC8
D01688B1
4AA8E018
C9C0B0F4
853C8D28
65CFB025
C8D00269
A9032002
3334F400
3536213B
03384AA9
A501A600
FDA517A6
A23B0DD1
02F419B0
3B211C2C
771B2800
F76705FC
13FDFD06
00BD0901
19CA0069
60A9DCA0
0CE634A2
3C990B00
0B290DF0
020626B1
20B4FCC6
D586D838
1EF12054
20FAFCA9
FDFCB0F9
852E20BA
3CF0EB48
A020EDFD
EDFDA98D
FA03A94C
0020D0D5
8501A53D
840AA63E
A63EB106
8AD6A500
CAD0DFA6
012045D6
3E90ECA5
608502A5
029108B1

514A4A4A
602090D3
2ED0AE23
2090D320
A8682064
F9D22051
51D3209A
D38D2703
2903851B
02B0310A
B11A6D29
4A608E23
E90190ED
608E2303
031865CE
C4CA48E5
01844A85
FFAE2303
2089F618
3CC93739
396AD302
201BE5A9
16201BE5
02C2004C
001AC000
A23C2BB6
1C67FC08
F747DB06
0F1D2400
B03C01D1
7C0020DF
D44CB0D5
07B53C95
8810F820
142908D0
0202A436
2F10F490
A2FFB54D
D5A20120
1620C9FC
20FDFCA0
FCA03490
202DFF20
A9A820ED
4CEDFDA9
8DF80360
A9FF20D0
85078509
A5009108
C500F013
208AD668
3EA50191
A5002045
00910AE6
0A450C85
0AC501F0

D0D3E61A
8D240320
036020F9
75D0209A
D1AE2303
D3203BD2
D2AE2303
A0282092
A0202092
9003E61B
03A86860
03A005B1
4C68EEA0
201EF120
A8A90885
CB68B01D
4B84CC85
604C6BE3
4C006838
29D80346
2AD40202
AD20EDFD
208EFD20
68EE004C
27D80363
03076BBD
E547D902
F71C5D00
DD0609F0
2089F61C
F02089F6
A434B900
02CA10F9
8EF8A62F
10850D20
00A200B5
C460A954
F5CB95CF
2CF12054
852E20FA
3B20ECFC
F04C26FF
92FDB13C
FD6820DA
8D4CEDFD
A9C3A0D5
D54C3AFF
850BA000
C8D0FBE6
48A50720
2092D6C8
0A840D84
D6060C26
0AD0DAE6
08A50B45
E748A50B

[........QJJJ....]
[........`....$..]
[..H...h....#.`..]
[.L}..%.J....u...]
[..H......h.d..#.]
[`...L......Q..;.]
[.#.`....Q.....#.]
[`.#..2....'..(..]
[.H.(....).......]
[..9.......1.....]
[....e.....m)..h`]
[...J....J`.#....]
[J...J.......Lh..]
[........`.#.....]
[.....<.(..e.....]
[=.).e..%..H..h..]
[.>.?...i..J.K...]
[..........#.`Lk.]
[....34......L.h8]
[....56!;<.79)..F]
[:&...8J.9j..*...]
[.0v.............]
[................]
[..+<.;.....Lh..L]
[k...........'..c]
[.g=%;!.,.<+...k.]
[...,w.(..g...G..]
[.....g...G....].]
[..........$.....]
[...t.....<......]
[N..8...i|.......]
[.(|.`....L...4..]
[......4...<.....]
[`...<........../]
[.....)...)......]
[.."...&....6....]
[..B...../....`.T]
[..L....8...M....]
[.......T....,..T]
[...`............]
[..$.........;...]
[..E.......4..L&.]
[....<..H.-.....<]
[.............h..]
[........L....L..]
[.......L...`....]
[L............L:.]
[..I....=........]
[.......>........]
[.....>......H...]
[...........h....]
[........>.......]
[......E....E...&]
[....>...........]
[....`....E.....E]
[.............H..]

D/000660:
D/000670:
D/000680:
D/000690:
D/0006A0:
D/0006B0:
D/0006C0:
D/0006D0:
D/0006E0:
D/0006F0:
D/000700:
D/000710:
D/000720:
D/000730:
D/000740:
D/000750:
D/000760:
D/000770:
D/000780:
D/000790:
D/0007A0:
D/0007B0:
D/0007C0:
D/0007D0:
D/0007E0:
D/0007F0:
D/000800:
D/000810:
D/000820:
D/000830:
D/000840:
D/000850:
D/000860:
D/000870:
D/000880:
D/000890:
D/0008A0:
D/0008B0:
D/0008C0:
D/0008D0:
D/0008E0:
D/0008F0:
D/000900:
D/000910:
D/000920:
D/000930:
D/000940:
D/000950:
D/000960:
D/000970:
D/000980:
D/000990:
D/0009A0:
D/0009B0:
D/0009C0:
D/0009D0:

20DAFDA5
4CCB02A5
8AD6202D
EDFD840F
850EA007
50A9C469
A9B120ED
4C85D6B0
06840788
A021200E
8403A011
48C8B14A
02D005E6
32D7D0EB
0560EA4C
020AA8B9
D0F9B996
8500A900
D098EAEA
EA4C94D7
C3C3B8B8
7B7B7474
4D4E4949
30312E2E
1E1F1D1D
13141212
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF

0A208AD6
0920DAFD
FFA98D4C
850E208A
460E9023
0020EDFD
FDB9D3D6
B9B8B7B6
98D00EA0
D7850884
200ED785
A868604C
03D00560
A400AD30
46D788F0
96D78500
D738E500
38EDFE02
4C87D7E6
D0EC0000
AEAEA4A4
6D6E6768
45454141
2B2C2929
1B1C1A1A
11111010
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF

A501910A
A508208A
EDFD20DA
D6202DFF
A9A020ED
A9AD20ED
20EDFD88
B5B4B3B2
1A200ED7
09A00820
0484054C
4ED7A401
EA4C2CD7
C0E602D0
D14C4CD7
ADFD024A
8501C8B9
8503A900
02D005E6
F6F6E8E8
9B9B9292
61625C5C
3D3E3A3A
26272425
18191717
0F100E0F
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF

208AD668
D6A50220
FDA9A04C
A500450E
FDA53DC9
FD98D005
10D6A40F
B1A00084
85068407
0ED78502
08D4B14A
AD30C0E6
88F0054C
05E603D0
D0EBADFF
F0044600
96D76500
8502A501
03D00560
DBDBCFCF
8A8A8282
57575252
36373334
22232021
15161415
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF

[...............h]
[L...............]
[...-...L.......L]
[..........-...E.]
[....F..#......=.]
[P..i............]
[................]
[L...............]
[................]
[.!..............]
[...........L...J]
[H..J.h`LN....0..]
[.......`.L,....L]
[2......0........]
[.`.LF....LL.....]
[...........J..F.]
[.....8........e.]
[....8...........]
[....L..........`]
[.L..............]
[................]
[{{ttmnghab\\WWRR]
[MNIIEEAA=>::6734]
[01..+,))&'$%"#.!]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]

D/0009E0:
D/0009F0:
D/000A00:
D/000A10:
D/000A20:
D/000A30:
D/000A40:
D/000A50:
D/000A60:
D/000A70:
D/000A80:
D/000A90:
D/000AA0:
D/000AB0:
D/000AC0:
D/000AD0:
D/000AE0:
D/000AF0:
D/000B00:
D/000B10:
D/000B20:
D/000B30:
D/000B40:
D/000B50:
D/000B60:
D/000B70:
D/000B80:
D/000B90:
D/000BA0:
D/000BB0:
D/000BC0:
D/000BD0:
D/000BE0:
D/000BF0:
D/000C00:
D/000C10:
D/000C20:
D/000C30:
D/000C40:
D/000C50:
D/000C60:
D/000C70:
D/000C80:
D/000C90:
D/000CA0:
D/000CB0:
D/000CC0:
D/000CD0:
D/000CE0:
D/000CF0:
D/000D00:
D/000D10:
D/000D20:
D/000D30:
D/000D40:
D/000D50:

FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF

FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF

FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF

FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF

[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]

D/000D60:
D/000D70:
D/000D80:
D/000D90:
D/000DA0:
D/000DB0:
D/000DC0:
D/000DD0:
D/000DE0:
D/000DF0:
D/000E00:
D/000E10:
D/000E20:
D/000E30:
D/000E40:
D/000E50:
D/000E60:
D/000E70:
D/000E80:
D/000E90:
D/000EA0:
D/000EB0:
D/000EC0:
D/000ED0:
D/000EE0:
D/000EF0:
D/000F00:
D/000F10:
D/000F20:
D/000F30:
D/000F40:
D/000F50:
D/000F60:
D/000F70:
D/000F80:
D/000F90:
D/000FA0:
D/000FB0:
D/000FC0:
D/000FD0:
D/000FE0:
D/000FF0:
D/001000:
D/001010:
D/001020:
D/001030:
D/001040:
D/001050:
D/001060:
D/001070:
D/001080:
D/001090:
D/0010A0:
D/0010B0:
D/0010C0:
D/0010D0:

FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
2000F04C
23A9A085
A00720ED
D002E6E3
E3E5E7B0
CB85E3A5
206DE5A5
A085FA20
201BE520
D0032011
F585E4C9
ED86CFC9
B1CE10FA
D0E924E4

FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
B3E28533
E44CEDFD
FDA9A088
602015E7
EF206DE0
4C85E6A5
E485E2A5
2AE09885
18E084FA
E08A20ED
01D005A6
519004C6
E0C0B004
300320F8

FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
4CEDFD60
A920C524
D0F8A000
2076E5A5
4C3BE0A5
4D85E7D0
E585E3B0
E4202AE0
AA10180A
FDA92520
D84C8EFD
CFE95048
E00030F2
EFB1CE10

FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
8A2920F0
B00CA98D
B1E2E6E2
E2C5E6A5
CA85E2A5
DE2015E7
C786D8A9
AA202AE0
10E9A5E4
1AE0AA30
4884CEA2
B1CEAA88
AA68E901
10AA293F

[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[...L...3L..`.)..]
[#....L.....$....]
[................]
[....`....v......]
[......m.L;......]
[....L...M.......]
[.m..............]
[....*.....*...*.]
[................]
[..........%....0]
[.........L..H...]
[....Q.....PH....]
[..........0..h..]
[..$.0.........)?]

D/0010E0:
D/0010F0:
D/001100:
D/001110:
D/001120:
D/001130:
D/001140:
D/001150:
D/001160:
D/001170:
D/001180:
D/001190:
D/0011A0:
D/0011B0:
D/0011C0:
D/0011D0:
D/0011E0:
D/0011F0:
D/001200:
D/001210:
D/001220:
D/001230:
D/001240:
D/001250:
D/001260:
D/001270:
D/001280:
D/001290:
D/0012A0:
D/0012B0:
D/0012C0:
D/0012D0:
D/0012E0:
D/0012F0:
D/001300:
D/001310:
D/001320:
D/001330:
D/001340:
D/001350:
D/001360:
D/001370:
D/001380:
D/001390:
D/0013A0:
D/0013B0:
D/0013C0:
D/0013D0:
D/0013E0:
D/0013F0:
D/001400:
D/001410:
D/001420:
D/001430:
D/001440:
D/001450:

85E41869
68C95DF0
D5789011
20E4EF95
602018E1
2018E1E8
65CF48C4
FFA865DB
F56891DA
95A90020
E6332051
B57985CF
4EA8B1CE
F65090E5
38E90285
E418E5DA
5185DAB5
C89450B5
28B00256
B1DAC5E4
36E72054
85E6A5E7
E44C7EE7
284C6FE7
CF85DB20
E5206FE7
E633A000
47F82034
0FA00020
20D3EF20
FA24F810
FDA2FF9A
E4A5C869
29F0C9B0
88D0F820
A5CAF1E0
A5E5E5CD
85E7B1CA
A5E3E5CB
88B1E091
95F7E8F0
15E7A5E2
E4A5E385
E2A5E785
16A5E4D0
E6B1E491
20EDFDC8
2075FD8A
20D3EE24
DD0002D0
86C89848
9001E8C8
F0BC9D00
B1FE293F
906F694F
20F07AB5

A020EDFD
A4C928D0
A02B4CE0
784C23E8
955018F5
B55085DA
CAE5CBB0
85DBC8B1
99CC0088
0AE7A002
F3C6338A
E8E820BC
B450C4E4
B4508A91
E4B57985
85E460B5
7985DBE8
4DD57508
5060A8B1
D0EDF64F
E206CE26
65DB85E7
A5E62008
A95585E5
15E784E6
2015E7A0
20CEE3C6
EEA8B126
08E794A0
8EFD46D9
0CA6F6A5
20CEE384
0085E0A9
F0034C83
8AE3A5F1
85E4A5CB
9045A5CA
91E6E6CA
B0E0B5E4
E698D0F8
F7107E00
85E6A5E3
E5D00E20
E3A000A5
02C6E5C6
E690E0A5
B900EB30
A8A9DF99
D930034C
53B1FE0A
A200A1FE
D0F368A8
0260A6C8
4AD0B6BD
C90A9069
A885C8B5

88E0C090
8AF09E20
E32034EE
2034EEF0
784C02E1
65CE48A8
E3A5DA69
DAD9CC00
10F7E860
9478200A
A6D89578
E1B54ED5
9004A083
DA4C23F2
DBE90085
5385CEB5
E8E8A000
48B54FD5
CE85E468
F64DB0D7
CF900D18
88F00906
E7A5E795
205BE2A5
84E7A5CF
1060206C
33602034
2890044A
8884D760
A9BE2006
F7201BE5
F18A85C8
00AA6902
E8A002B1
E5C8C904
E90085E5
F1E085E6
D002E6CB
95CACA10
24F81009
000000A0
85E72075
15E7206D
CAC5E4A5
E4A5E6D0
E685CAA5
F709804C
0002A2FF
B6E24C9A
300688B1
AA4A4940
8A4CF8F2
A9A0E8DD
0002B006
A6FDC8B1
D185F188

EC200CE0
18E19550
D55090F4
E738E901
A014D0D6
B57885DB
FE85DAA9
D00F98F0
EAA080D0
E786D8AA
B55185CE
76B015F6
D0C191DA
B55185DA
E5A000B1
7B85CFB5
947894A0
77900768
A828B0F3
20D7E14C
A5E665DA
E626E710
A006E590
CE85DAA5
1009CA06
EEF0C5FF
EE4A0820
4A4A4A29
FFFFFFFF
E0A00084
A9A020ED
A2202091
85E1A1E0
E099CD00
F0A891E0
A5E4C5CC
A5CBE900
A5E2C5CA
F9B1E0A8
B5F775F5
14D07120
E5A5E285
E5A5E685
CBE5E5B0
02C6E7C6
E785CB60
EDFD98AA
6060A006
EB2A69A0
FE3029C8
11FEC9C0
E6F1A6F1
0002B0FA
693FC91A
FE29E0C9
B1FE0A10

[...i............]
[h.]...(........P]
[.x...+L...4..P..]
[....xL#..4...8..]
[`....P..xL......]
[.....P..e.H..x..]
[e.H........i....]
[..e.............]
[.h.........`....]
[.........x......]
[.3.Q..3....x.Q..]
[.y........N.v...]
[N....P..........]
[.P...P...L#..Q..]
[8.....y.........]
[......`.S...{...]
[Q...y........x..]
[..P.M.u.H.O.w..h]
[(..VP`.....h.(..]
[.......O.M.....L]
[6..T...&......e.]
[....e........&..]
[.L~.............]
[(Lo..U...[......]
[................]
[..o......`.l....]
[.3......3`.4.J..]
[G..4...&(..JJJJ)]
[...........`....]
[......F.........]
[.$..............]
[................]
[...i......i.....]
[).....L.........]
[................]
[................]
[.....E..........]
[................]
[................]
[........$.....u.]
[......~.......q.]
[...........u....]
[...........m....]
[................]
[................]
[...............`]
[.......0...L....]
[.u..........``..]
[...$.0.L..L..*i.]
[....S...0....0).]
[...H.....JI@....]
[......h..L......]
[.....`..........]
[..)?J.......i?..]
[.oiO...i.....)..]
[..z.............]

D/001460:
D/001470:
D/001480:
D/001490:
D/0014A0:
D/0014B0:
D/0014C0:
D/0014D0:
D/0014E0:
D/0014F0:
D/001500:
D/001510:
D/001520:
D/001530:
D/001540:
D/001550:
D/001560:
D/001570:
D/001580:
D/001590:
D/0015A0:
D/0015B0:
D/0015C0:
D/0015D0:
D/0015E0:
D/0015F0:
D/001600:
D/001610:
D/001620:
D/001630:
D/001640:
D/001650:
D/001660:
D/001670:
D/001680:
D/001690:
D/0016A0:
D/0016B0:
D/0016C0:
D/0016D0:
D/0016E0:
D/0016F0:
D/001700:
D/001710:
D/001720:
D/001730:
D/001740:
D/001750:
D/001760:
D/001770:
D/001780:
D/001790:
D/0017A0:
D/0017B0:
D/0017C0:
D/0017D0:

FA88B038
F0B3C97E
FF9458A4
F10AA8A9
3084D005
E8BD0002
201CE4C8
FFB480E8
86FDB4D0
02290F65
F285F286
E468A8A5
0486C9A9
E5900D85
A5F9E8CA
A5FAF00B
10C16001
E6A5CB85
A5E5E54D
CFB019A0
C8A5CEF1
4C85CAA5
0085FB85
E3A0FF84
D1D0F0F1
A86885D0
C8B1E030
A5D16900
68A8A900
A5CC91D0
A54AA44B
034865D0
95786824
D0100FF6
2048A000
E720FFE6
C928D01F
0BA90120
F9B0D324
B980E929
D7B00998
CEB980EA
E0D002E6
A0664CE0
78F00E85
88E86020
CED006C5
2015E724
A5CEF0F3
15E79838
1090206F
2015E718
DD95A060
F3A52409
0020B1E7
2072E750

0A3035B4
B022CA10
C894A8A4
762A85FF
A00E4CE0
9004C9A2
88A6FDB1
B1FE299F
84C918A9
F2488A65
F3C4F1D0
F3B0A9A0
B085F9A5
F3A5F2FD
F00EC9B0
20EDFD24
0A64E810
E7E8A5E7
B026A001
00A5E671
E4C8A5CF
4D85CBA5
FC85FEA9
D8C8B1E0
B1D0C84A
84D1C5CC
FB4940F0
48C4CAE5
8891D088
88A90091
D0ACB1D0
200AE720
D8301DA8
78C8D0F7
B1E01018
95A024D4
A5E0200A
0AE7A900
D41006C9
550A85D7
4820EBF3
85CF20FC
E1B1E060
E3A000B5
CFB1CE48
4AE72015
CFD002F6
CF301BCA
A9FF2008
E5CE2008
E72015E7
A5CE65DA
2034EEA8
07A8C8D0
2015E7A5
EF8884D5

5884FFB4
04A00610
F194D129
D001C8C8
E3C903B0
F00AC9DF
FE880A10
D0ED85F2
0A85F9A2
F3301CAA
DEA4C9C8
00108B85
F2DD63E5
63E585F2
F00285C9
F8100499
00000003
85E5A5E6
B1E4E5CE
E485E690
F1E4B0CA
4A85CCA5
00851D60
3006C940
D0FAB1D0
D0D7C4CD
F7986904
CBB0B384
91D088A5
D0883097
C940B09A
FFE688D0
A900200A
09A90085
0A30B520
1001CA20
E7A5E195
9578F678
04B0D046
68A8B980
A5D69095
E64CD8E6
9477CA30
5085CEB5
C8B1CE85
E7982008
50602082
602015E7
E795A024
E798E5CF
A5CE85DA
2008E7A5
D0034CCB
F5C8D0F5
CF100AA9
86CFA6CE

80E810DA
299480A4
1FA8B997
86FDB1FE
C34AA6C8
F00686C8
CFB45884
85F39848
00C8B900
68C6F9D0
84F1201C
F386F2A2
A5F3FD68
E6F9D0E7
24C93004
0002C8CA
27A5CA85
85E4C54C
C8B1E4E5
03E6E718
6046F8A5
4B85CDA9
A5D04C6B
D06885D8
48C8B1D0
D0D3A000
4865D0A8
CC6885CD
CD91D088
B1E0D0F7
959F9869
FA9865D1
E79578B1
D485D5A2
FFE62008
FFE6B0E6
7824D430
20FFE630
D4A885D6
E929AAC5
B900EA85
6CCE00E6
03955060
A085CFB5
CF6885CE
E795A0C5
E72059E7
A5CFD004
CF30E920
5023A000
A5CF85DB
CF65DB70
EE884CF4
B0F96000
AD20EDFD
201BE5A6

[...8.05.X.......]
[...~."......)...]
[..X........)....]
[....v*..........]
[0.....L......J..]
[................]
[..............X.]
[......)........H]
[................]
[.).e.H.e.0..h...]
[................]
[.h..............]
[..........c....h]
[........c.......]
[............$.0.]
[.......$........]
[..`..d......'...]
[...............L]
[...M.&..........]
[.......q........]
[............`F..]
[L...M...J...K...]
[...........`..Lk]
[........0..@.h..]
[.......J....H...]
[.h..............]
[...0.I@...i.He..]
[..i.H........h..]
[h...............]
[..........0.....]
[.J.K.....@.....i]
[.He...........e.]
[.xh$.0........x.]
[....x...........]
[.H.......0......]
[......$.........]
[.(..........x$.0]
[.........x.x...0]
[...$.......F....]
[...)U...h....)..]
[....H...........]
[.........L..l...]
[.......`.w.0..P`]
[.fL.....P.......]
[x......H.....h..]
[..`.J...........]
[........P`....Y.]
[...$.0..`.......]
[...........$.0..]
[...8........P#..]
[...o............]
[......e......e.p]
[...`.4....L...L.]
[..$...........`.]
[................]
[.r.P............]

D/0017E0:
D/0017F0:
D/001800:
D/001810:
D/001820:
D/001830:
D/001840:
D/001850:
D/001860:
D/001870:
D/001880:
D/001890:
D/0018A0:
D/0018B0:
D/0018C0:
D/0018D0:
D/0018E0:
D/0018F0:
D/001900:
D/001910:
D/001920:
D/001930:
D/001940:
D/001950:
D/001960:
D/001970:
D/001980:
D/001990:
D/0019A0:
D/0019B0:
D/0019C0:
D/0019D0:
D/0019E0:
D/0019F0:
D/001A00:
D/001A10:
D/001A20:
D/001A30:
D/001A40:
D/001A50:
D/001A60:
D/001A70:
D/001A80:
D/001A90:
D/001AA0:
D/001AB0:
D/001AC0:
D/001AD0:
D/001AE0:
D/001AF0:
D/001B00:
D/001B10:
D/001B20:
D/001B30:
D/001B40:
D/001B50:

CF602015
C8A90A85
F22015E7
C8A5CF4C
46D560A0
D68884D4
C910B05E
01A5DC99
E59004A0
69039001
F0A00020
DCA4DD90
46D94CE0
0185DCB9
4C75E8A0
201BE54C
50D93F01
85DAB96F
E8CAA4FB
E72082E7
596F0110
9F01B9AF
F09AE6FB
2015E7A4
01995F01
998F01A5
000000AB
03033F3F
C3FF5500
CFCFCFFF
FFFF5503
03030303
57030303
0303AAFF
17FFFF19
4DC98582
71FF2309
59503BFF
FFFF2130
A4D3B6BC
2803C41D
8C0127FF
E8FFFFE8
F0F0E7E7
F3FFE8E1
E7E7F3FF
FFFFE1E1
E7E8EFEF
E8EEE7E8
E1E8E8FF
BEB3B2B7
CED4C158
CDC1CED9
47CECFA0
48B1B6A0
D4D5D24E

E7A5CE85
F484F560
B55085DA
07F26068
FF84D760
E860A5CA
A8E6FCA5
2001A5DD
37D03BA5
C8A2FF86
79E624D9
01C8C54C
E3A04AA5
2F0185DD
6320C4E3
B3E2C6FB
D0F0B578
0185DB20
B9CF0195
2059E720
12B97F01
01D087C6
A8B55099
FBA5CE99
A900996F
E0999F01
03030303
C0C03C3C
ABAB0303
55C6C6C6
03030303
03030303
03070303
03030303
DF420AF2
2210334A
5B16B6CB
23A36F36
1E03C420
AA3A0150
08004E00
5D354B67
F0F1F3EF
E2EFE7E7
E8E8EFEB
E8E7E7E7
EFEEE7E8
EBE9E8E9
EFEFEEEF
E0E0E0F1
B637D4CF
CDC5CDA0
A0D0C1D2
C5CE44C2
C7CFD3D5
B1B6A0C6

F6A5CF85
2015E7A5
B57885DB
6824D510
20CDEFF0
A4CBD05A
E0990001
99300120
E4A4E585
D99A85E0
104918A0
D0D1C44D
FCF0F7C6
BEFF00B9
A001B1DC
A05BA5FB
D94F01D0
15E7CA20
9FB9BF01
15E7A4FB
85DCB98F
FB60A054
4001B578
BF01A5CF
01A5DC99
A5E199AF
03030303
3C3C3C3C
FFFF55FF
55F0F0CF
03030303
03030303
03030303
03030303
EC876FAD
5B4E534A
FFFFFBFF
23D71C22
00C1BA39
79D8D8A5
3E00A6B0
E0E17604
EFE3E3E5
F2F2F2E7
FFFFE0FF
E8E1E2EE
EEE7F3FB
F2E8E8E8
EEEFEEEE
F2F2F1F3
CFA0CCCF
C6D5CC4C
C5CE53D3
C1C4A0C2
C253C2C1
CFD253C2

F78884F8
CEA4CF10
A5CE91DA
05208EFD
07A92585
A041A5FC
A5E19910
15E7206D
DC84DD18
84E1202E
00A5DC71
D0CDA031
FCA8B91F
0F01A88A
AAC8B1DC
F0C4A8B5
E9B95F01
93E72001
A0002008
A5CEF005
0185DDBE
A5FBC910
4C88F260
99CF01A9
7F01A5DD
01602015
03030303
3C300FC0
FF55CFCF
CF550155
03030303
0300AB03
03030303
03030303
B7E2F854
49666D7A
FF24F64E
1D8AAB23
40A0301E
3CFF165B
00BCC657
0571C91A
E5E7E7EE
F2F2F2E2
FFEFEEEF
F3E2E2E8
FBEEE1EF
E8FFE8E8
EFEEEEEE
F3F1F3F4
CE47D3D9
D4CFCFA0
D4D2C9CE
D2C1CEC3
C4A0D2C5
C1C4A0CE

[.`..............]
[.......`........]
[.....P...x......]
[...L..`hh$......]
[F.`....`......%.]
[.....`.....Z.A..]
[...^............]
[.........0.....m]
[....7.;.........]
[i...............]
[....y.$..I.....q]
[.......L...M...1]
[F.L...J.........]
[..../...........]
[Lu..c...........]
[...L.....[......]
[P.?....x.O...._.]
[...o............]
[................]
[.....Y..........]
[Yo..............]
[.........`.T....]
[......P.@..xL..`]
[................]
[.._....o........]
[.............`..]
[................]
[..??..<<<<<<<0..]
[..U.......U..U..]
[....U...U....U.U]
[..U.............]
[................]
[W...............]
[................]
[.....B....o....T]
[M...".3J[NSJIfmz]
[q.#.[........$.N]
[YP;.#.o6#.."...#]
[..!0.......9@.0.]
[.....:.Py...<..[]
[(.....N.>......W]
[..'.]5Kg..v..q..]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[................]
[.....7.......G..]
[...X.......L....]
[..........S.....]
[G.....D.........]
[H........S......]
[...N......S.....]

D/001B60:
D/001B70:
D/001B80:
D/001B90:
D/001BA0:
D/001BB0:
D/001BC0:
D/001BD0:
D/001BE0:
D/001BF0:
D/001C00:
D/001C10:
D/001C20:
D/001C30:
D/001C40:
D/001C50:
D/001C60:
D/001C70:
D/001C80:
D/001C90:
D/001CA0:
D/001CB0:
D/001CC0:
D/001CD0:
D/001CE0:
D/001CF0:
D/001D00:
D/001D10:
D/001D20:
D/001D30:
D/001D40:
D/001D50:
D/001D60:
D/001D70:
D/001D80:
D/001D90:
D/001DA0:
D/001DB0:
D/001DC0:
D/001DD0:
D/001DE0:
D/001DF0:
D/001E00:
D/001E10:
D/001E20:
D/001E30:
D/001E40:
D/001E50:
D/001E60:
D/001E70:
D/001E80:
D/001E90:
D/001EA0:
D/001EB0:
D/001EC0:
D/001ED0:

C5D854D3
AA20A0C5
C4C94DD3
D9D0C5A0
E8A6CF9A
CEBA86CF
A220A915
C8B90002
84C8B900
A0A5CEC9
50204FC0
B4B3EFB4
7F1D207E
6783B2B0
A4E5A3A1
B3A4AFAE
A9AC0040
A1B4B667
078C07AE
B2AFACAF
B07F0E27
B06407A6
02ADA5B2
7E8C39B4
9D19B2AF
B4B5B0AE
0047A2A1
A467ACAC
8C688CDB
88298480
AEB2A3B3
68830868
758B5107
EEA7B3E4
4F7F0F2F
42AEA5A8
51078809
9CDD9CDE
A5ADAFAC
20AFB4B5
A4EEB5B2
A1AFAC7A
20B1E7E8
D576B009
D560E8A9
4C23E8FF
EEA4C8C9
EE4C64F8
4C22FCA0
DAD007A5
26E7A5E6
E5DA85E6
2015E76C
2034EEC9
C890A585
4C28F898

D4CFD0D0
D2D20DBE
D4D2A0CF
CCC9CEC5
A6CEA08D
2066F384
2091E4E6
C980F0D2
0248B9FF
33D00320
F4A1E4AF
EEA5A8B4
8C330000
E5A3A1B2
B2B4AFAE
F0AFB0F4
89C9479D
B4A1078C
A9ACA867
A3678C07
B4AEA9B2
A967AFB4
67A2B5B3
B8A5AE67
A67F0537
A97F052A
B47F0D30
A1A3F2A7
679B689B
C4195771
710888A3
9D087107
8819B8A4
AEB2EBA5
00510688
B460AEA5
8BFEE4AF
DD9EC3DD
679AADA5
A1F2ACA3
60AEB5B2
7E9A2220
E8B54F85
B1DA20ED
00957895
2015E7A5
30B021C0
46F86020
774CE0E3
DBD0034C
C5DAA5E7
E6CE88D0
CE002034
30B0B1A4
2D602034
AAA06E20

C5C4A0C1
B2B535D2
D6C64CDC
8D3F46D9
D002A099
F1A9FF85
D9A6CEA4
49B0C90A
01A00020
6FE74C01
ADF2AFE4
5C800040
6003BF12
B479B0B3
79B0B3A4
B3A9AC60
17689D0A
07AEA9AC
8C07B4AF
A5ABAFB0
B07F0E28
AFA778B4
AFA7EEB2
B0A5B4B3
B4B5B0AE
B4B5B0AE
ADA9A47F
F4B8A5B4
508C638C
07881471
B3A17108
886075B4
AEB2ECA4
A5B05107
29C20C82
A8B44F7E
ADF2AFE4
CFCACDCB
ADA9A8EE
F7A5AE60
EEAFA3E5
006003BF
DAB57785
FDC84C0F
A0B57738
CFD028A5
28B01D4C
B3F3C918
A07BD0F9
7EE706CE
E5DB900A
E160FFFF
EEC5C890
C84C19F8
EEC928B0
C4E38AA8

D420AAAA
C1CEC745
0DD2C5D4
90034CC3
20C4E386
C80A85D9
C80A85CE
B0F0C8C8
08E76895
E8FFFFFF
AEA1F0A5
608D608B
4783AEA9
A469B0B3
AFAE69B0
8C20B4B3
587B67A2
B667B4A1
ACB0679D
F4AEA9B2
B4AEA9B2
A5AC6B7F
B5B4A5B2
27AFB407
A97F0528
A9E4AEA5
0D23ADA9
004DCC67
7F015107
078C0788
88AEA5AC
AFAE758D
B0F3A2A1
883981C1
578C6A8C
1E358C27
AEA1DCDE
00479AAD
A1AD608C
8C20ACA5
B6A1B3E4
6003BF1F
DBB44E98
EEA9FF85
F54F9550
CE602034
00F82034
B00A8525
2054E2A5
26CF26E6
85E7A5E6
FFFFFFFF
BB852C60
2034EEC5
9BA8A5C8
20C4E3A0

[..T.............]
[..........5....E]
[..M.......L.....]
[.........?F...L.]
[................]
[.....f..........]
[................]
[........I.......]
[.....H........h.]
[....3...o.L.....]
[P.O.............]
[........\..@`.`.]
[...~.3..`...G...]
[g........y...i..]
[........y.....i.]
[...........`....]
[...@..G..h..X{g.]
[...g.........g..]
[.......g......g.]
[.....g..........]
[...'.......(....]
[.d...g....x...k.]
[....g...........]
[~.9....g....'...]
[.......7.......(]
[.......*........]
[.G.....0.....#..]
[.g...........M.g]
[.h..g.h.P.c...Q.]
[.)....Wq...q....]
[....q.....q.....]
[h..h..q..`u...u.]
[u.Q.............]
[..........Q..9..]
[O../.Q..)...W.j.]
[B....`....O~.5.']
[Q...............]
[.............G..]
[....g.........`.]
[...........`....]
[....`...........]
[...z~."..`..`...]
[......O...w...N.]
[.v........L.....]
[.`....x...w8.O.P]
[L#........(..`.4]
[....0.!.(..L...4]
[.Ld.F.`........%]
[L"..wL...{...T..]
[.......L~...&.&.]
[&...............]
[.........`......]
[...l...4......,`]
[.4..0....L...4..]
[....-`.4..(.....]
[L(....n.........]

D/001EE0:
D/001EF0:
D/001F00:
D/001F10:
D/001F20:
D/001F30:
D/001F40:
D/001F50:
D/001F60:
D/001F70:
D/001F80:
D/001F90:
D/001FA0:
D/001FB0:
D/001FC0:
D/001FD0:
D/001FE0:
D/001FF0:
D/002000:
D/002010:
D/002020:
D/002030:
D/002040:
D/002050:
D/002060:
D/002070:
D/002080:
D/002090:
D/0020A0:
D/0020B0:
D/0020C0:
D/0020D0:
D/0020E0:
D/0020F0:
D/002100:
D/002110:
D/002120:
D/002130:
D/002140:
D/002150:
D/002160:
D/002170:
D/002180:
D/002190:
D/0021A0:
D/0021B0:
D/0021C0:
D/0021D0:
D/0021E0:
D/0021F0:
D/002200:
D/002210:
D/002220:
D/002230:
D/002240:
D/002250:

724C61F1
04C5CEB0
2034EEA5
206CEEA5
EE4C34E1
85DA84DB
B550D1DA
E7A54E20
854F95A0
4F88D0F2
2015E7A4
CF854D4C
4DB00884
FFFFFFFF
FF85C8A9
B55060A9
4D4CADE5
36E820B7
A00084A0
B14C49FF
F0EC4CAD
A5E1AC00
A5DC8578
86D8A2FE
D0F3904B
900AA5CC
E691E4E6
E6C54CA5
CCF5DC95
CED002C6
CAA54DE5
A5CFE5CB
D8201EF1
E8F0F790
CED004A5
2CF120FD
843CC884
B44C943E
86D838A2
F120CDFE
6020C4E3
60A9FF85
EDFDA001
EDFDA5DC
9A988D96
0C613010
FD000000
E5DBB01C
C940F0F7
68A000B1
D0F1A9BD
F3A03007
4CB7F1E8
A4DD207D
15E7E6CE
F2D01020

203FF206
D6602015
CE85C860
CE85E6A5
20E4EEB4
1865CE95
C8B578F1
08E7A54F
A011A54F
A5CE2008
CEC44AA5
ADE52015
4AA5CF85
FFFF2071
808D0002
00854A85
D578D001
E54C5BE8
844A844C
914CD14C
E54C79F1
C0C083D0
A5DD8579
38B5D095
CAB5CB95
C5E4A5CD
E4D002E6
E7E54D90
CCE8D0F3
CFC6CEA5
CB90E4B0
B0A6844A
20FDFEA2
87A5CCC5
CFF011A5
FEA6D860
3EA00084
CA10F5A5
FFB54DF5
A201202C
4C3AFFA5
A06046A0
B1DCAAC8
A4DD60C1
9593BFB2
0BDDFBA0
00000000
6884D085
C8C8B1D0
D030054A
4CEDFD91
A5DCA4DD
E8B59FF0
F120C9F1
D002E6CF
82E7206F

CE26CF30
E7B1CE94
2015E7A5
CF85E74C
78B55069
509865CF
DAB0804C
D004C54E
0A186940
E7A5CF95
CFE54B90
E7A4CEC4
4B90E84C
E14CBFEF
602036E7
4CA90885
184C02E1
E080D001
A908854B
D00849FF
2032F04C
EC2C10C0
4CC3E8FF
E6B54EF5
E7F5DB95
E5E59013
E5E6E6D0
E6A2FEB5
A6D860B1
4CD002C6
D02015E7
A5CF854B
FF38B54D
DAA5CDE5
DA85CAA5
203AFF4C
3D843F60
3ED002C6
CB95CFE8
F1A91A20
FCD0034C
6024A010
B1DC201B
007FD1CC
32120FBC
0020C7E7
00A44AA5
D1A0FFC8
4888B1D0
F008A9A4
DAE8B59F
207DF120
1F4CE0F3
A6D84C09
60205BF2
E7500320

FAB0DCD0
9F4C08E7
C891CE60
44E220E4
FEB00188
9578A000
23E82015
6900297F
0A264E26
A04C7AE2
1E844CA5
4CA5CFE5
CBEEFFFF
2003EEA9
E82036E7
4BA91085
20B7E54C
884C0CE0
854DE64D
914CD14C
BEE8A6E0
86508551
FF2015E7
D095DCE8
E5E8F0F5
4C6BE3B1
02E6E7A5
E6954EB5
4C91CEA5
4DC64CC5
A4CEC0CA
4CB7E586
F5CF95DB
DBB0D5A5
DB85CB20
15F1A0CE
B5CA953C
3FC63E60
F0F7201E
CFFEA6D8
A5E8C6FC
19A9A320
E5A9A04C
C7CFCEC5
B0ACBE35
A9A04CED
4B48C4DA
B1D030FB
A868D0DD
20EDFDC8
F0304CD5
C9F1A6D8
3007A5DC
F4E86020
D0152053
82E72059

[rLa..?...&.0....]
[.....`.......L..]
[.4.....`.......`]
[.l.........LD...]
[.L4.....x.Pi....]
[.....e..P.e..x..]
[.P....x....L#...]
[..N....O...Ni.).]
[.O.....O..i@.&N&]
[O............Lz.]
[......J...K...L.]
[..ML........L...]
[M...J...K..L....]
[.......q.L......]
[........`.6...6.]
[.P`...J.L...K...]
[ML...x...L.....L]
[6....L[......L..]
[.....J.L...K.M.M]
[.LI..L.L..I..L.L]
[..L..Ly..2.L....]
[.........,...P.Q]
[...x...yL.......]
[....8.....N.....]
[...K............]
[............Lk..]
[................]
[..L...M.......N.]
[..........`.L...]
[........L...M.L.]
[..M.............]
[.......J...KL...]
[.........8.M....]
[................]
[................]
[,......`.:.L....]
[.<..>...=.?`...<]
[.L.>....>...?.>`]
[..8...M.........]
[.......,........]
[`...L:.....L....]
[`....`F.`$......]
[...............L]
[......`.........]
[........2......5]
[.a0...........L.]
[..........J.KH..]
[....h.........0.]
[.@......H....h..]
[h....0.J........]
[....L........0L.]
[..0......}......]
[L........L..0...]
[...}......L...`.]
[........`.[....S]
[.......o.P.....Y]

D/002260:
D/002270:
D/002280:
D/002290:
D/0022A0:
D/0022B0:
D/0022C0:
D/0022D0:
D/0022E0:
D/0022F0:
D/002300:
D/002310:
D/002320:
D/002330:
D/002340:
D/002350:
D/002360:
D/002370:
D/002380:
D/002390:
D/0023A0:
D/0023B0:
D/0023C0:
D/0023D0:
D/0023E0:
D/0023F0:
D/002400:
D/002410:
D/002420:
D/002430:
D/002440:
D/002450:
D/002460:
D/002470:
D/002480:
D/002490:
D/0024A0:
D/0024B0:
D/0024C0:
D/0024D0:
D/0024E0:
D/0024F0:
D/002500:
D/002510:
D/002520:
D/002530:
D/002540:
D/002550:
D/002560:
D/002570:
D/002580:
D/002590:
D/0025A0:
D/0025B0:
D/0025C0:
D/0025D0:

E756504C
354F9550
995F01A5
01D550D0
01994001
B9D10199
7001B981
0199A001
E8A90048
CF68A000
024C48E4
85DDA550
7890034C
CEA000E8
2903AA20
602075FD
CA10F368
602015E7
85D1A5CE
D3A90120
C6D0A5D2
4C98F320
86D99A20
FEA6D860
24D910D5
A8208EFD
FFFFFFFF
C8B1DA30
8BFEA6D8
F76006F3
38A20494
60A98E85
FA26F9A5
C5F8D0F7
E6F8F075
F820E2F4
46F390BF
F0C52032
FC48CA10
FB26FA26
F0BE86FB
498085F8
E9814AD0
3A853E10
913A8810
F9843B85
8434A017
A531A000
F8AABD00
A544A42E
E644C635
EDFD203A
0002C9A0
93D0D58A
0AE9BEC9
CA10F8C6

36E720C9
10ED4CC9
CF4C66E9
F6B95001
B9510199
D001B961
01998001
B9A10199
B55038E9
91CEE860
E8A901D0
A4514C75
68EEA8B5
E82008E7
1EFBA6D8
8A48BD00
AA602080
A5CF1008
85D02015
08E794A0
A0002008
34EE1869
2EF04C83
FE24D910
86D824A0
9838E521
94A04C23
F8A9FF85
6018A202
2037F424
FBB5F7B4
F8A5F9C9
F8D0EE60
2025F450
A2FA76FF
182084F4
38A203A9
F4E5F820
F8A2FD68
F906F726
86FA86F9
A0176010
14A43FA6
01C898E5
F8201AFC
3A4C95F5
88304BD9
C6342000
FAC542D0
C09DF088
F0D6A434
FFA9A185
F013C8C9
F0D22078
C290C10A
3DF0F410

EF154F10
EF2015E7
99500188
D578D0EF
5001B9C1
01996001
B9910199
A001C8C4
0385CEB5
C985B003
DAE8A578
E8A901D0
5185CEB5
4C04F420
98A00020
02C983D0
E298AA20
98CA2008
E7A5CE85
A5D0D004
E7A5D395
FF6020B1
E82034EE
E086D824
4C2CF2A0
B0F68424
E8A000F0
D5602034
B5F975F5
F9100520
F394F795
C0300CC6
20A4F420
EA700590
E8D0FB60
90032025
00F5F895
E2F438A2
900295F8
F626F5B0
B00D3004
F74CF503
3ED00188
3BD06BA4
201AFC20
20BEFFA4
CCFFD0F8
FE4C95F5
13BDC0F9
C52EF09F
98AA204A
332067FD
A4F09288
FEA90385
0AA2040A
E4A20520

0520C9EF
A4FBA5CE
3051B940
C6FBB941
0199C001
B9710199
9001B9A1
FB90BF60
78E90085
4CC0E4A0
85DCA579
C6B550D5
7985CFB1
34EE86D8
08E794A0
034C03E0
54F38AA8
E794A060
D2A5CF85
C6D130DF
A02022E2
E746D560
86D82095
A04C12F2
004CFFE6
60000000
0420EDFD
EE86D820
95F9CA10
A4F4E6F3
F3CAD0F3
F806FB26
7BF4A5F4
C4A5F90A
2032F465
F48810F5
F8CAD0F7
02B5F5F5
E8D0F826
1C88D0DA
686890B2
FFFFFFFF
CA8A18E5
2FB93D00
D0F82053
3420A7FF
C015D0E8
A53D208E
C543D00C
C63DD0DC
F9A9DE20
20C7FFAD
20A7FFC9
3D2034F6
26422643
34F68434

[.VPL6.....O.....]
[5O.P..L.........]
[._...Lf..P..0Q.@]
[..P...P..x.....A]
[..@..Q..P.......]
[.......a..`..q..]
[p...............]
[...............`]
[...H.P8.....x...]
[.h.....`....L...]
[.LH........x...y]
[...P.QLu......P.]
[x..Lh...Q...y...]
[........L...4...]
[)...............]
[`.u..H.......L..]
[...h.`......T...]
[`..............`]
[................]
[..............0.]
[..............".]
[L...4..i.`...F.`]
[......L...4.....]
[...`.$.....$.L..]
[$.....$.L,...L..]
[.....8.!...$`...]
[......L#........]
[...0.....`.4....]
[....`.....u.....]
[.`...7.$........]
[8...............]
[`........0.....&]
[.&.....`....{...]
[.....%.P.p......]
[...u..v....`.2.e]
[...........%....]
[F...8...........]
[...2......8.....]
[.H.....h.......&]
[.&.&...&.&......]
[..........0.hh..]
[I.....`..L......]
[..J...?.>.......]
[:.>.....;.k./.=.]
[.:.............S]
[..;.:L......4...]
[.4...0K.........]
[.1...4...L...=..]
[......B......C..]
[.D...........=..]
[.D.5...4...J....]
[...:....3.g.....]
[................]
[.......x....=.4.]
[............&B&C]
[....=.......4..4]

D/0025E0:
D/0025F0:
D/002600:
D/002610:
D/002620:
D/002630:
D/002640:
D/002650:
D/002660:
D/002670:
D/002680:
D/002690:
D/0026A0:
D/0026B0:
D/0026C0:
D/0026D0:
D/0026E0:
D/0026F0:
D/002700:
D/002710:
D/002720:
D/002730:
D/002740:
D/002750:
D/002760:
D/002770:
D/002780:
D/002790:
D/0027A0:
D/0027B0:
D/0027C0:
D/0027D0:
D/0027E0:
D/0027F0:
D/002800:
D/002810:
D/002820:
D/002830:
D/002840:
D/002850:
D/002860:
D/002870:
D/002880:
D/002890:
D/0028A0:
D/0028B0:
D/0028C0:
D/0028D0:
D/0028E0:
D/0028F0:
D/002900:
D/002910:
D/002920:
D/002930:
D/002940:
D/002950:

DDB4F9D0
F007C9A4
20A7FFA5
10C9A544
09808544
804C5CF5
A5F81013
E6FAD002
FFFFFFFF
688559BA
A657A559
851F2098
48A000B1
4A4A4AA8
E4F648A5
1E950188
E61F6002
C02FC95B
E7E7E710
9500A501
00D002F6
A000F006
008401A0
1FF72017
0081004C
0038A500
98690085
A000F0E9
0EB11E10
B0EC600A
600AAAB5
D0CF600A
B5003501
851F2066
4A082047
4530252E
C8200EF8
F560A02F
2028F888
29189002
30186903
604A0820
0F60A63A
90096AB0
2079F8D0
03852F98
084A4A09
2082F848
C890F1A2
B900FA85
F869BF20
E003F01C
F9F00320
A52EC9E8
9820DAFD
D0F86038

132034F6
F003A434
3FF001E8
0A0A0535
8434B900
B90002C8
C98ED0F5
E6F960A9
FFFF4C92
E8E8BD00
48A55628
F64C92F6
1E290F0A
B9E1F648
1D4A6068
B11E9500
F9049D0D
D285DD6E
CAB50085
950160A5
0160A100
2066F7A1
00841D60
F7A50181
43F7B500
F5009900
1D60A500
A51E2019
0188651E
AAB50110
001501F0
AAB50035
49FFD0B9
F7A10085
F828A90F
51269126
90F66901
D002A027
10F66048
697F8526
290F8530
47F8B126
A43B2096
10C9A2F0
04A080A9
298FAA98
2088D0FA
B13A20DA
03C00490
2DA900A0
EDFDCAD0
062E900E
EDFDCAD0
B13A90F2
8A4CDAFD
A52FA43B

DDBAF9F0
18882644
8635A203
C920B006
02C9BBF0
C9A0F0F8
24F9100A
0085F985
F5845886
010A0A0A
60204AFF
E61ED002
AA4A511E
60E61ED0
68203FFF
9838651E
9E25AF16
0533E870
00B50185
008100A0
8500A000
00A82066
2026F7A1
004C1FF7
D002D601
00A501F5
75008500
F7A51F20
851E9865
E8600AAA
D8600AAA
0149FFF0
60A21820
1E604CC7
900269E0
602000F8
482000F8
842DA027
4A290309
0A0A0526
0A0A0A0A
2890044A
FD2048F9
0C29874A
00AABDA6
A003E08A
C888D0F2
FDA20120
F268A8B9
05062D26
EC2048F9
BDB3F920
E7608830
2056F9AA
A203A9A0
AA100188

0DBDBAF9
E003D00D
88863DCA
A635F002
04C98DD0
60207DF4
A5FBF006
FA60FFFF
57855608
0A60A458
68851E68
E61FA9F7
F00B861D
02E61FBD
6C1E00B1
851E9002
B247B951
931EE765
0160A500
00841DF6
8401F0ED
F7A10085
0085014C
2066F7A5
D60060A0
01990100
A5017501
19F718B0
1F851F60
B50130E1
B5001501
C4600AAA
66F7A100
F6F6FFFF
852EB126
C42CB011
68C52D90
A9008530
04852768
852660A5
05308530
4A4A4A29
A13AA84A
AABD62F9
F9852E29
F00B4A90
60FFFFFF
4AF9C42F
C0F9852C
2C2A88D0
A42FA206
EDFDBDB9
E720DAFD
E8D001C8
20EDFDCA
653A9001

[......4.........]
[.......4..&D....]
[....?....5....=.]
[...D...5.....5..]
[...D.4..........]
[.L\.........`.}.]
[........$.......]
[......`......`..]
[......L...X.W.V.]
[h.Y..........`.X]
[.W.YH.V(`.J.h..h]
[.....L..........]
[H....)...JQ.....]
[JJJ....H`.......]
[..H..J`hh.?.l...]
[.........8e.....]
[..`......%...G.Q]
[./.[...n.3.p...e]
[.............`..]
[......`.........]
[.....`..........]
[.....f.....f....]
[.......`.&.....L]
[.........L...f..]
[...LC.........`.]
[.8..............]
[.i...`..u.....u.]
[................]
[......e....e...`]
[..`......`....0.]
[`........`......]
[..`....5.I...`..]
[..5.I...`...f...]
[...f.....`L.....]
[J..G.(....i....&]
[E0%.Q&.&`....,..]
[......i.H...h.-.]
[.`./...'.-.'...0]
[.(....`HJ)....'h]
[)...i..&...&.&`.]
[0.i.)..0.....0.0]
[`J..G..&(..JJJJ)]
[.`.:.;....H..:.J]
[..j......).J..b.]
[.y.............)]
[../.).........J.]
[.JJ.........`...]
[...H.:......J../]
[.........h.....,]
[....-.....-&,*..]
[.i........H../..]
[................]
[.........`.0....]
[.....:...V......]
[.....L..........]
[..`8./.;....e:..]

D/002960:
D/002970:
D/002980:
D/002990:
D/0029A0:
D/0029B0:
D/0029C0:
D/0029D0:
D/0029E0:
D/0029F0:
D/002A00:
D/002A10:
D/002A20:
D/002A30:
D/002A40:
D/002A50:
D/002A60:
D/002A70:
D/002A80:
D/002A90:
D/002AA0:
D/002AB0:
D/002AC0:
D/002AD0:
D/002AE0:
D/002AF0:
D/002B00:
D/002B10:
D/002B20:
D/002B30:
D/002B40:
D/002B50:
D/002B60:
D/002B70:
D/002B80:
D/002B90:
D/002BA0:
D/002BB0:
D/002BC0:
D/002BD0:
D/002BE0:
D/002BF0:
D/002C00:
D/002C10:
D/002C20:
D/002C30:
D/002C40:
D/002C50:
D/002C60:
D/002C70:
D/002C80:
D/002C90:
D/002CA0:
D/002CB0:
D/002CC0:
D/002CD0:

C8600420
04900420
04900022
44A90122
04902631
864A859D
1C8A1C23
002919AE
001A5B5B
159C6D9C
D8625A48
00B40884
00AAA2A2
1A1A2626
FFFFFF20
FB953CCA
C960F045
291F4914
203FFF4C
FE032820
DAFA4C65
2F2056F9
8A48A002
F3A52D48
8541A2FB
BD20EDFD
B13A2056
9EEAEA4C
C0A000EA
008548AD
AD50C0AD
20A92885
20A4FBA0
569554E8
6020A4FB
52E554AA
88D0E360
01100D38
60484A29
85280A0A
A8FCA0C0
A4249128
EFA810EC
C62410E8
C625A525
69FD90C0
D0E9A424
6900C523
F0E4A900
A5224820
88686901
8810F930
9128C8C4
01D0F660
E53FE63C
69FEB0F5

54300D80
54330D80
44330DC8
44330D80
879A0021
ACA9ACA3
5D8B1BA1
69A81923
A5692424
A5692953
26629488
74B4286E
74747472
727288C8
D0F86885
D0F8A13A
C94CF05C
C904F002
3C008545
4CFF6885
FF186885
843B1890
18B13AAA
A52C4820
A9A020ED
B54A20DA
F9853A98
0BFB4CFD
EABD64C0
56C0AD54
53C02036
21A91885
10A5504A
D0F7A203
A0100650
A553E555
A000842F
98F50095
03090485
05288528
A90C20A8
E624A524
C98DF05A
A5218524
20C1FB65
F0DA69FD
A5254820
90F0B0CA
8524E625
24FCA528
C523B00D
E1A00020
2190F960
E642D002
D002E63D
A02120DB

04900322
04900420
44001122
04900122
81820000
A8A4D900
9D8A1D23
24531B23
AEAEA8AD
84133411
5444C854
74F4CC4A
4468B232
C4CA2648
2C68852D
F042A42F
C96CF059
B13A993C
68480A0A
3A68853B
4868853A
14182054
88B13A86
8EFDA945
FDBD1EFA
FDE830E8
38B0A220
FAC1D8D9
1004C8D0
C0AD51C0
F8A91485
23A91785
900C18A2
7650CA10
26512652
90068652
A25420AF
0098F501
29682918
60C987D0
FCAD30C0
C521B066
C98AF05A
C624A522
20852860
902CF0DE
24FC209E
A5228525
A525C523
852AA529
482024FC
9EFCB086
3848E901
E643A53C
60A04B20
FCC8C888

54330D80
543B0D80
44330DC8
44330D80
594D9192
D8A4A400
9D8B1DA1
245319A1
29007C00
A56923A0
6844E894
72F2A48A
B2002200
4444A2C8
A208BD10
C920F059
C940F035
008810F8
0A30036C
2082F820
68853BA5
F9AA9848
3B853AB0
8540A900
20EDFDA9
6018A001
4AFF38B0
D0D3AD70
F88860A9
A900F00B
22A90085
254C22FC
FEB55475
FB88D0E5
265338A5
8553E650
FBA250B5
9501E62F
9002697F
12A94020
88D0F560
60C9A0B0
C988D0C9
C525B00B
49C0F028
69FD905C
FCA00068
A0008424
90B6C625
852BA421
B128912A
A424A9A0
D0FC68E9
C53EA53D
DBFCD0F9
D0FD9005

[.`..T0....."T3..]
[....T3......T;..]
[..."D3..D.."D3..]
[D.."D3....."D3..]
[..&1...!....YM..]
[.J..............]
[...#]......#....]
[.)..i..#$S.#$S..]
[..[[.i$$....).|.]
[..m..i)S..4..i#.]
[.bZH&b..TD.ThD..]
[....t.(nt..Jr...]
[....tttrDh.2..".]
[..&&rr....&HDD..]
[......h.,h.-....]
[..<....:.B./...Y]
[.`.E.L.\.l.Y.@.5]
[).I......:.<....]
[.?.L<..EhH...0.l]
[..(.L.h.:h.;....]
[..Le..h.Hh.:h.;.]
[/.V..;.....T...H]
[.H....:...:.;.:.]
[..-H.,H....E.@..]
[.A..............]
[.....J....0.`...]
[.:.V..:.8...J.8.]
[...L..L........p]
[......d.......`.]
[..H.V..T..Q.....]
[.P..S..6...."...]
[..(.!...#...%L".]
[......PJ......Tu]
[V.T.....vP......]
[`......P&Q&R&S8.]
[R.T..S.U...R.S.P]
[...`.../.T....P.]
[...8.........../]
[`HJ)....)h)...i.]
[.(...(.(`.....@.]
[..........0....`]
[.$.(.$.$.!.f`...]
[.......Z...Z....]
[.$...!.$.$.".%..]
[.%.%...e..(`I..(]
[i.....i..,..i..\]
[...$.%H.$......h]
[i..#.....".%...$]
[.....$.%.%.#...%]
[."H.$..(.*.).+.!]
[.hi..#..H.$..(.*]
[...0.........$..]
[.(..!..`8H....h.]
[...`.B...C.<.>.=]
[.?.<...=`.K.....]
[i....!..........]

D/002CE0:
D/002CF0:
D/002D00:
D/002D10:
D/002D20:
D/002D30:
D/002D40:
D/002D50:
D/002D60:
D/002D70:
D/002D80:
D/002D90:
D/002DA0:
D/002DB0:
D/002DC0:
D/002DD0:
D/002DE0:
D/002DF0:
D/002E00:
D/002E10:
D/002E20:
D/002E30:
D/002E40:
D/002E50:
D/002E60:
D/002E70:
D/002E80:
D/002E90:
D/002EA0:
D/002EB0:
D/002EC0:
D/002ED0:
D/002EE0:
D/002EF0:
D/002F00:
D/002F10:
D/002F20:
D/002F30:
D/002F40:
D/002F50:
D/002F60:
D/002F70:
D/002F80:
D/002F90:
D/002FA0:
D/002FB0:
D/002FC0:
D/002FD0:
D/002FE0:
D/002FF0:

A03288D0
FAFC682A
C0452F10
48293F09
4F2C00C0
0CFD202C
A9FF8532
C988F01D
D013A9DC
018AF0F3
900229DF
D05BA43D
4CEDFDA5
07D00320
20BAFC90
FF653C48
E5FD6829
C9A09002
C634F09F
40E640D0
A201B53E
20B4FC90
3C20DAFD
20DAFDA9
FEA91448
E901D0EF
A03FD002
1BD008A9
0609C0A0
4C00E04C
D7FAC634
C9FCA027
FCA01D68
20D6FCD0
A91620C9
F920FDFC
BAFCA035
EDFDA9D2
4848A545
08688548
93FE2089
20C7FF20
D0F820BE
0A263E26
9541E8F0
C849B0C9
48B9E3FF
EFC4ECA9
A7C699B2
837F5DCC

FDAC20C0
A03ACAD0
F8452F85
40912868
10F59128
FC200CFD
BD000220
C998F00A
20EDFD20
CA2035FD
9D0002C9
A63C208E
3C090785
92FDA9A0
E8604A90
A9BD20ED
0F09B0C9
25328435
CAD016C9
02E64160
95429544
F760B13C
A9A020ED
A920EDFD
20D0F820
608AF007
A0FF8432
00853EA2
00F002A9
03E02075
2075FE4C
A200413C
90EEA022
FA602000
FC852E20
A03B20EC
90F020EC
20EDFD20
A646A447
BA8649D8
FED8203A
A7FF8434
FFA4344C
3FCA10F8
F3D006A2
0A90D369
48A531A0
BBA6A406
C9BEC135
B5FC1717

A02CCA60
F56020FD
2FC08060
6C3800E6
AD00C02C
C99BF0F3
EDFD6885
E0F89003
8EFDA533
C995D002
8DD0B220
FD2040F9
3EA53D85
20EDFDB1
EA4A4AA5
FD68484A
BA900269
4820FDFB
BAD0BB85
A434B9FF
CA10F760
D142F01C
FDA9A820
20B4FC90
53F9853A
B53C953A
60A90085
36A0F0A5
FD940095
FE203FFF
43FA4CF8
48A13C20
20EDFEF0
FE6868D0
FAFCA024
FC813C45
FCC52EF0
EDFDA987
28608545
602084FE
FFA9AA85
A0178830
73FFA203
A531D006
00863E86
88C9FAB0
00843160
95070205
8CC396AF
F503FB03

A2084820
FC88AD60
A424B128
4ED002E6
10C06020
60A53248
32BD0002
203AFFE8
20EDFDA2
B128C9E0
9CFCA98D
A000A9AD
3FA53C29
3C20DAFD
3E900249
4A4A4A20
066C3600
68A43560
31A53E91
01853160
B13C9142
2092FDB1
EDFDB142
D9602075
843B6838
CA10F960
3EA238A0
3E290FF0
0160EAEA
6C3A004C
03A94020
EDFE20BA
4DA2100A
6C20FAFC
20FDFCB0
2E852E20
0DA9C520
4CEDFDA5
86468447
202FFB20
332067FD
E8D9CCFF
0A0A0A0A
B53F953D
3FB90002
CD60A9FE
BCB2BEED
F000EB93
17172B1F
59FF86FA

[.2.......,.`..H.]
[..h*.:...`.....`]
[.E/..E/./..`.$.(]
[H)?.@.(hl8..N...]
[O,.....(...,..`.]
[...,........`.2H]
[...2......h.2...]
[.............:..]
[...........3....]
[......5......(..]
[..).............]
[.[.=.<....@.....]
[L...<...>.=.?.<)]
[............<...]
[.....`J..JJ.>..I]
[.e.]
[@.@...A`.4....1`]
[...>.B.D...`.<.B]
[.....`.<.B......]
[<..............B]
[.............`.u]
[...H....S..:.;h8]
[....`....<.:...`]
[.?.....2`...>.8.]
[......>.6...>)..]
[.............`..]
[L..L...u..?.l:.L]
[...4.u.LC.L...@.]
[...'..A&?....1...?.=]
[.A........>.?...]
[.I.....i.....`..]
[H...H.1...1`....]
[................]
[.......5......+.]
[..].........Y...]

Brought to you by:
dtcdumpfile 1.0.0 (Apple Macintosh File Hex Dumper) Sunday, July 6, 1997

+-----------------------------------------------------------------------| TOPIC -- Apple II -- Memory map of the Apple II ROMs
+-----------------------------------------------------------------------Memory map of the Apple II ROMs
*

$F800-$FFFF

Monitor. Handles screen I/O and keyboard input. Also has a disassembler, memory
dump, memory move, memory compare, step and trace functions, lo-res graphics
routines, multiply and divide routines, and more. This monitor has the cleanest
code of all the Apple II monitors. Every one after this had to patch the monitor
to add functions while still remaining (mostly) compatible. Complete source code
is in the manual.
•

$F689-F7FC

Sweet-16 interpreter. Sweet-16 code has been benchmarked to be about half the size
of pure 6502 code but 5-8 times slower. The renumber routine in the Programmer's
Aid #1 is written in Sweet-16, where small size was much more important than
speed. Complete source code is in the manual.
•

$F500-F63C and $F666-F668

Mini-assembler. This lets you type in assembly code, one line at a time, and it
will assemble the proper bytes. No labels or equates are supported--it is a MINI
assembler. Complete source code is in the manual.
•

$F425-F4FB and $F63D-F65D

Floating point routines. Woz's first plans for his 6502 BASIC included floating
point, but he abandoned them when he realized he could finish faster by going
integer only. He put these routines in the ROMs but they are not called from
anywhere. Complete source code is in the manual.
•

$E000-F424

Integer BASIC by Woz (Steve Wozniak, creator of the Apple II). "That BASIC, which
we shipped with the first Apple II's, was never assembled--ever. There was one
handwritten copy, all handwritten, all hand assembled." Woz, October 1984.
•

$D800-DFFF

Empty ROM socket. There was at least one third party ROM add-on.
•

$D000-D7FF

Programmer's Aid #1--missing from the original Apple II, this is a ROM add-on
Apple sold that contains Integer BASIC utilities such as high-resolution graphics
support, renumber, append, tape verify, music, and a RAM test. Complete source
code is in the manual.

+-----------------------------------------------------------------------| TOPIC -- Apple II -- Summary of Monitor Commands
+-----------------------------------------------------------------------Summary of Apple II Monitor Commands
Examining Memory.
*
{adrs}
Examines the value contained in one location.
*
{adrs1}.{adrs2}
Displays the values contained in all locations between {adrs1} and {adrs2}.
*
[RETURN]
Displays the values in up to eight locations following the last opened location.
Changing the Contents of Memory.
*
{adrs}:{val} {val} ...
Stores the values in consecutive memory locations starting at {adrs}.
*
:{val} {val}
Stores values in memory starting at the next changeable location.
Moving and Comparing.
*
{dest}<{start}.{end}M
Copies the values in the range {start}.{end} into the range beginning at {dest}.
(M=move)
*
{dest}<{start}.{end}V
Compares the values in the range {start}.{end} to those in the range beginning at
{dest}. (V=verify)
Saving and Loading via Cassette Tape.
*
{start}.{end}W
Writes the values in the memory range {start}.{end} onto tape, preceded by a tensecond leader.
*
{start}.{end}R
Reads values from tape, storing them in memory beginning at {start} and stopping
at {end}. Prints "ERR" if an error occurs.
Running and Listing Programs.
*
{adrs}G
Transfers control to the machine language program beginning at {adrs}. (G=go)
*
{adrs}L
Disassembles and displays 20 instructions, starting at {adrs}. Subsequent L's will
display 20 more instructions each. (L=list)
Miscellaneous.
*
{adrs}S
Disassemble, display, and execute the instruction at {adrs}, and display the
contents of the 6502's internal registers. Subsequent S's will display and execute
successive instructions. (S=step)

*
{adrs}T
Step infinitely. The TRACE command stops only when it executes a BRK instruction
or when you press RESET. (T=trace)
*
Contrl-E
Displays the contents of the 6502's registers. (E=examine)
*
I
Set Inverse display mode.
*
N
Set Normal display mode. Also useful as a delimiter for putting multiple commands
on one line.
*
Control-B
Enter the language currently installed in the Apple's ROM (cold start at $E000).
*
Control-C
Reenter the language currently installed in the Apple's ROM (warm start at $E003).
*
{val1}+{val2}
Add the two values and print the result.
*
{val2}-{val1}
Subtract the second value from the first and print the result.
*
{slot} Control-P
Divert output to the device whose interface card in in slot number {slot}. If
{slot}=0, then route output to the Apple's screen.
*
{slot} Control-K
Accept input from the device whose interface card is in slot number {slot}. If
{slot}=0, then accept input from the Apple's keyboard.
*
Control-Y
Jump to the machine language subroutine at location $03F8. This lets you add your
own commands to the Monitor.
The Mini-Assembler.
*
F666G
Invoke the Mini-Assembler.
*
${command}
Execute a Monitor command from the Mini-Assembler.
*
FF69G
Leave the Mini-Assembler.

+-----------------------------------------------------------------------| TOPIC -- Apple II -- Red Book Monitor listing
+-----------------------------------------------------------------------1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

***************************
*
*
*
APPLE II
*
*
SYSTEM MONITOR
*
*
*
*
COPYRIGHT 1977 BY
*
*
APPLE COMPUTER, INC. *
*
*
*
ALL RIGHTS RESERVED
*
*
*
*
S. WOZNIAK
*
*
A. BAUM
*
*
*
***************************
; TITLE "APPLE II SYSTEM MONITOR"
LOC0
EQU
$00
LOC1
EQU
$01
WNDLFT
EQU
$20
WNDWDTH EQU
$21
WNDTOP
EQU
$22
WNDBTM
EQU
$23
CH
EQU
$24
CV
EQU
$25
GBASL
EQU
$26
GBASH
EQU
$27
BASL
EQU
$28
BASH
EQU
$29
BAS2L
EQU
$2A
BAS2H
EQU
$2B
H2
EQU
$2C
LMNEM
EQU
$2C
RTNL
EQU
$2C
V2
EQU
$2D
RMNEM
EQU
$2D
RTNH
EQU
$2D
MASK
EQU
$2E
CHKSUM
EQU
$2E
FORMAT
EQU
$2E
LASTIN
EQU
$2F
LENGTH
EQU
$2F
SIGN
EQU
$2F
COLOR
EQU
$30
MODE
EQU
$31
INVFLG
EQU
$32
PROMPT
EQU
$33
YSAV
EQU
$34
YSAV1
EQU
$35
CSWL
EQU
$36
CSWH
EQU
$37
KSWL
EQU
$38
KSWH
EQU
$39
PCL
EQU
$3A
PCH
EQU
$3B
XQT
EQU
$3C
A1L
EQU
$3C
A1H
EQU
$3D

F800:
F801:
F802:
F805:
F806:
F808:
F80A:
F80C:
F80E:
F810:
F812:
F814:
F816:
F818:
F819:
F81C:
F81E:

4A
08
20
28
A9
90
69
85
B1
45
25
51
91
60
20
C4
B0

47 F8
0F
02
E0
2E
26
30
2E
26
26
00 F8
2C
11

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

A2L
A2H
A3L
A3H
A4L
A4H
A5L
A5H
ACC
XREG
YREG
STATUS
SPNT
RNDL
RNDH
ACL
ACH
XTNDL
XTNDH
AUXL
AUXH
PICK
IN
USRADR
NMI
IRQLOC
IOADR
KBD
KBDSTRB
TAPEOUT
SPKR
TXTCLR
TXTSET
MIXCLR
MIXSET
LOWSCR
HISCR
LORES
HIRES
TAPEIN
PADDL0
PTRIG
BASIC
BASIC2
PLOT

RTMASK
PLOT1

HLINE
HLINE1

EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
ORG
LSR
PHP
JSR
PLP
LDA
BCC
ADC
STA
LDA
EOR
AND
EOR
STA
RTS
JSR
CPY
BCS

$3E
$3F
$40
$41
$42
$43
$44
$45
$45
$46
$47
$48
$49
$4E
$4F
$50
$51
$52
$53
$54
$55
$95
$0200
$03F8
$03FB
$03FE
$C000
$C000
$C010
$C020
$C030
$C050
$C051
$C052
$C053
$C054
$C055
$C056
$C057
$C060
$C064
$C070
$E000
$E003
$F800
GBASCALC
#$0F
RTMASK
#$E0
MASK
(GBASL),Y
COLOR
MASK
(GBASL),Y
(GBASL),Y
PLOT
H2
RTS1

;ROM START ADDRESS
;Y-COORD/2
;SAVE LSB IN CARRY
;CALC BASE ADR IN GBASL,H
;RESTORE LSB FROM CARRY
;MASK $0F IF EVEN
;MASK $F0 IF ODD
;DATA
; EOR COLOR
; AND MASK
;
EOR DATA
;
TO DATA
;PLOT SQUARE
;DONE?
; YES, RETURN

F820:
F821:
F824:
F826:
F828:
F829:
F82C:
F82D:
F82F:
F831:
F832:
F834:
F836:
F838:

C8
20
90
69
48
20
68
C5
90
60
A0
D0
A0
84

F83A:
F83C:
F83E:
F840:
F843:
F844:
F846:
F847:
F848:
F849:
F84B:
F84D:
F84F:
F850:
F852:
F854:
F856:
F858:
F859:
F85A:
F85C:
F85E:
F85F:
F861:
F862:
F864:
F866:
F868:
F869:
F86A:
F86B:
F86C:
F86E:
F870:
F871:
F872:
F873:
F876:
F878:
F879:
F87B:
F87C:
F87D:
F87E:
F87F:
F881:
F882:

A0
A9
85
20
88
10
60
48
4A
29
09
85
68
29
90
69
85
0A
0A
05
85
60
A5
18
69
29
85
0A
0A
0A
0A
05
85
60
4A
08
20
B1
28
90
4A
4A
4A
4A
29
60
A6

0E F8
F6
01
00 F8
2D
F5
2F
02
27
2D
27
00
30
28 F8
F6

03
04
27
18
02
7F
26
26
26
30
03
0F
30

30
30

47 F8
26
04

0F
3A

119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

VLINEZ
VLINE

RTS1
CLRSCR
CLRTOP
CLRSC2

INY
JSR
BCC
ADC
PHA
JSR
PLA
CMP
BCC
RTS
LDY
BNE
LDY
STY

LDY
LDA
STA
JSR
DEY
BPL
RTS
GBASCALC PHA
LSR
AND
ORA
STA
PLA
AND
BCC
ADC
GBCALC
STA
ASL
ASL
ORA
STA
RTS
NXTCOL
LDA
CLC
ADC
SETCOL
AND
STA
ASL
ASL
ASL
ASL
ORA
STA
RTS
SCRN
LSR
PHP
JSR
LDA
PLP
SCRN2
BCC
LSR
LSR
LSR
LSR
RTMSKZ
AND
RTS
INSDS1
LDX
CLRSC3

PLOT

; NO, INC INDEX (X-COORD)
;PLOT NEXT SQUARE
;ALWAYS TAKEN
;NEXT Y-COORD
; SAVE ON STACK
; PLOT SQUARE

V2
VLINEZ

;DONE?
; NO, LOOP

#$2F
CLRSC2
#$27
V2

;MAX Y, FULL SCRN CLR
;ALWAYS TAKEN
;MAX Y, TOP SCREEN CLR
;STORE AS BOTTOM COORD
; FOR VLINE CALLS
;RIGHTMOST X-COORD (COLUMN)
;TOP COORD FOR VLINE CALLS
;CLEAR COLOR (BLACK)
;DRAW VLINE
;NEXT LEFTMOST X-COORD
;LOOP UNTIL DONE

PLOT1
HLINE1
#$01

#$27
#$00
COLOR
VLINE
CLRSC3

;FOR INPUT 000DEFGH
#$03
#$04
GBASH

;

GENERATE GBASH=000001FG

;

AND GBASL=HDEDE000

#$18
GBCALC
#$7F
GBASL
GBASL
GBASL
COLOR

;INCREMENT COLOR BY 3

#$03
#$0F
COLOR

;SETS COLOR=17*A MOD 16
;BOTH HALF BYTES OF COLOR EQUAL

COLOR
COLOR

GBASCALC
(GBASL),Y
RTMSKZ

;READ SCREEN Y-COORD/2
;SAVE LSB (CARRY)
;CALC BASE ADDRESS
;GET BYTE
;RESTORE LSB FROM CARRY
;IF EVEN, USE LO H
;SHIFT HIGH HALF BYTE DOWN

#$0F

;MASK 4-BITS

PCL

;PRINT PCL,H

F884:
F886:
F889:
F88C:
F88E:
F88F:
F890:
F892:
F893:
F895:
F897:
F899:
F89B:
F89C:
F89D:
F8A0:
F8A3:
F8A5:
F8A7:
F8A9:
F8AA:
F8AD:
F8AF:

A4
20
20
A1
A8
4A
90
6A
B0
C9
F0
29
4A
AA
BD
20
D0
A0
A9
AA
BD
85
29

3B
96 FD
48 F9
3A

F8B1:
F8B3:
F8B4:
F8B6:
F8B7:
F8B8:
F8BA:
F8BC:
F8BE:
F8BF:
F8C1:
F8C2:
F8C3:
F8C5:
F8C6:
F8C8:
F8C9:
F8CA:
F8CC:
F8CD:
F8D0:
F8D3:
F8D4:
F8D6:
F8D9:
F8DB:
F8DE:
F8E0:
F8E1:
F8E3:
F8E5:
F8E7:
F8E9:
F8EA:
F8EB:
F8EE:
F8F0:
F8F3:

85
98
29
AA
98
A0
E0
F0
4A
90
4A
4A
09
88
D0
C8
88
D0
60
FF
20
48
B1
20
A2
20
C4
C8
90
A2
C0
90
68
A8
B9
85
B9
85

2F

09
10
A2
0C
87
62 F9
79 F8
04
80
00
A6 F9
2E
03

8F
03
8A
0B
08
20
FA
F2
FF FF
82 F8
3A
DA FD
01
4A F9
2F
F1
03
04
F2
C0 F9
2C
00 FA
2D

181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242

INSDS2

IEVEN

ERR
GETFMT

MNNDX1
MNNDX2

MNNDX3

INSTDSP
PRNTOP
PRNTBL

LDY
JSR
JSR
LDA
TAY
LSR
BCC
ROR
BCS
CMP
BEQ
AND
LSR
TAX
LDA
JSR
BNE
LDY
LDA
TAX
LDA
STA
AND

PCH
PRYX2
PRBLNK
(PCL,X)

STA
TYA
AND
TAX
TYA
LDY
CPX
BEQ
LSR
BCC
LSR
LSR
ORA
DEY
BNE
INY
DEY
BNE
RTS
DFB
JSR
PHA
LDA
JSR
LDX
JSR
CPY
INY
BCC
LDX
CPY
BCC
PLA
TAY
LDA
STA
LDA
STA

LENGTH

;FOLLOWED BY A BLANK
;GET OP CODE
;EVEN/ODD TEST

IEVEN
ERR
#$A2
ERR
#$87

;BIT 1 TEST
;XXXXXX11 INVALID OP
;OPCODE $89 INVALID
;MASK BITS
;LSB INTO CARRY FOR L/R TEST

FMT1,X
SCRN2
GETFMT
#$80
#$00

;GET FORMAT INDEX BYTE
;R/L H-BYTE ON CARRY

FMT2,X
FORMAT
#$03

;INDEX INTO PRINT FORMAT TABLE
;SAVE FOR ADR FIELD FORMATTING
;MASK FOR 2-BIT LENGTH
; (P=1 BYTE, 1=2 BYTE, 2=3 BYTE)

#$8F
#$03
#$8A
MNNDX3
MNNDX3
#$20
MNNDX2

;SUBSTITUTE $80 FOR INVALID OPS
;SET PRINT FORMAT INDEX TO 0

;OPCODE
;MASK FOR 1XXX1010 TEST
; SAVE IT
;OPCODE TO A AGAIN

;FORM INDEX INTO MNEMONIC TABLE
;1)
;2)
;3)
;4)
;5)

1XXX1010->00101XXX
XXXYYY01->00111XXX
XXXYYY10->00110XXX
XXXYY100->00100XXX
XXXXX000->000XXXXX

MNNDX1
$FF,$FF,$FF
INSDS1
;GEN FMT, LEN BYTES
;SAVE MNEMONIC TABLE INDEX
(PCL),Y
PRBYTE
#$01
;PRINT 2 BLANKS
PRBL2
LENGTH
;PRINT INST (1-3 BYTES)
;IN A 12 CHR FIELD
PRNTOP
#$03
;CHAR COUNT FOR MNEMONIC PRINT
#$04
PRNTBL
;RECOVER MNEMONIC INDEX
MNEML,Y
LMNEM
MNEMR,Y
RMNEM

;FETCH 3-CHAR MNEMONIC
; (PACKED IN 2-BYTES)

F8F5:
F8F7:
F8F9:
F8FB:
F8FD:
F8FE:
F8FF:
F901:
F903:
F906:
F907:
F909:
F90C:
F90E:
F910:
F912:
F914:
F916:
F918:
F91B:
F91E:
F921:
F923:
F926:
F927:
F929:
F92A:
F92B:
F92D:
F930:
F932:
F934:
F936:
F938:
F93B:
F93C:
F93D:
F93F:
F940:
F941:
F944:
F945:
F948:
F94A:
F94C:
F94F:
F950:
F952:
F953:
F954:
F956:
F958:
F959:
F95B:
F95C:
F95E:
F960:
F961:

A9
A0
06
26
2A
88
D0
69
20
CA
D0
20
A4
A2
E0
F0
06
90
BD
20
BD
F0
20
CA
D0
60
88
30
20
A5
C9
B1
90
20
AA
E8
D0
C8
98
20
8A
4C
A2
A9
20
CA
D0
60
38
A5
A4
AA
10
88
65
90
C8
60

00
05
2D
2C
F8
BF
ED FD
EC
48
2F
06
03
1C
2E
0E
B3
ED
B9
03
ED

F9

F9
FD
F9
FD

E7
E7
DA FD
2E
E8
3A
F2
56 F9
01
DA FD
DA FD
03
A0
ED FD
F8
2F
3B
01
3A
01

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304

PRMN1

LDA
LDY
PRMN2
ASL
ROL
ROL
DEY
BNE
ADC
JSR
DEX
BNE
JSR
LDY
LDX
PRADR1
CPX
BEQ
PRADR2
ASL
BCC
LDA
JSR
LDA
BEQ
JSR
PRADR3
DEX
BNE
RTS
PRADR4
DEY
BMI
JSR
PRADR5
LDA
CMP
LDA
BCC
RELADR
JSR
TAX
INX
BNE
INY
PRNTYX
TYA
PRNTAX
JSR
PRNTX
TXA
JMP
PRBLNK
LDX
PRBL2
LDA
PRBL3
JSR
DEX
BNE
RTS
PCADJ
SEC
PCADJ2
LDA
PCADJ3
LDY
TAX
BPL
DEY
PCADJ4
ADC
BCC
INY
RTS2
RTS
* FMT1 BYTES:
* IF Y=0
* IF Y=1
*

#$00
#$05
RMNEM
LMNEM
PRMN2
#$BF
COUT
PRMN1
PRBLNK
LENGTH
#$06
#$03
PRADR5
FORMAT
PRADR3
CHAR1-1,X
COUT
CHAR2-1,X
PRADR3
COUT

;SHIFT 5 BITS OF
; CHARACTER INTO A
;
(CLEARS CARRY)
;ADD "?" OFFSET
;OUTPUT A CHAR OF MNEM
;OUTPUT 3 BLANKS
;CNT FOR 6 FORMAT BITS
;IF X=3 THEN ADDR.

PRADR1
PRADR2
PRBYTE
FORMAT
#$E8
(PCL),Y
PRADR4
PCADJ3

;HANDLE REL ADR MODE
;SPECIAL (PRINT TARGET,
; NOT OFFSET)
;PCL,PCH+OFFSET+1 TO A,Y

PRNTYX

;+1 TO Y,X

PRBYTE

;OUTPUT TARGET ADR
; OF BRANCH AND RETURN

PRBYTE
#$03
#$A0
COUT
PRBL2
LENGTH
PCH
PCADJ4
PCL
RTS2

;BLANK COUNT
;LOAD A SPACE
;OUTPUT A BLANK
;LOOP UNTIL COUNT=0
;0=1-BYTE, 1=2-BYTE
; 2=3-BYTE
;TEST DISPLACEMENT SIGN
; (FOR REL BRANCH)
;EXTEND NEG BY DEC PCH
;PCL+LENGTH(OR DISPL)+1 TO A
; CARRY INTO Y (PCH)

XXXXXXY0 INSTRS
THEN LEFT HALF BYTE
THEN RIGHT HALF BYTE
(X=INDEX)

F962:
F965:
F967:
F96A:
F96C:
F96F:
F971:
F974:
F976:
F979:
F97B:
F97E:
F980:
F983:
F985:
F988:
F98A:
F98D:
F98F:
F992:
F994:
F997:
F999:
F99C:
F99E:
F9A1:
F9A2:
F9A5:
F9A6:
F9A7:
F9A8:
F9A9:
F9AA:
F9AB:
F9AC:
F9AD:
F9AE:
F9AF:
F9B0:
F9B1:
F9B2:
F9B3:
F9B4:
F9B7:
F9BA:
F9BD:

F9C0:
F9C3:
F9C6:
F9C9:
F9CC:
F9CF:
F9D2:
F9D5:

04
30
80
03
54
80
90
54
0D
90
20
0D
04
22
33
44
11
33
C8
01
44
80
90
44
0D
90
26
9A
00
21
81
82
00
00
59
4D
91
92
86
4A
85
9D
AC
A3
D9
A4

1C
23
1B
8A
9D
A1
19
A8

20
0D
04
22
33
04
04
33
80
04
54
80
90
44
0D
00
22
0D
44
22
33
04
01
33
80

DFB

$04,$20,$54,$30,$0D

306

DFB

$80,$04,$90,$03,$22

0D

307

DFB

$54,$33,$0D,$80,$04

20

308

DFB

$90,$04,$20,$54,$33

04

309

DFB

$0D,$80,$04,$90,$04

3B

310

DFB

$20,$54,$3B,$0D,$80

00

311

DFB

$04,$90,$00,$22,$44

C8

312

DFB

$33,$0D,$C8,$44,$00

44

313

DFB

$11,$22,$44,$33,$0D

A9

314

DFB

$C8,$44,$A9,$01,$22

0D

315

DFB

$44,$33,$0D,$80,$04

22

316

DFB

$90,$01,$22,$44,$33

04

317

DFB

$0D,$80,$04,$90

31 87

318

DFB

$26,$31,$87,$9A ;$ZZXXXY01 INSTR'S
$00
$21
$81
$82
$00
$00
$59
$4D
$91
$92
$86
$4A
$85
$9D
",),#($"

$D9,$00,$D8,$A4,$A4,$00

A9
A8
00
A4

8A
5D
A1
1D
8B
00
AE
19

54

305

90

AC
A4
D8
00

1C
8B
9D
23
1D
29
69
23

FMT1

319
320
321
322
323
324
325
326
327
328
329
330
331
332
333

FMT2

CHAR1

DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
ASC

;ERR
;IMM
;Z-PAGE
;ABS
;IMPLIED
;ACCUMULATOR
;(ZPAG,X)
;(ZPAG),Y
;ZPAG,X
;ABS,X
;ABS,Y
;(ABS)
;ZPAG,Y
;RELATIVE

334

CHAR2

DFB

335
336
337
338
339
340
341
342
343

*CHAR2: "Y",0,"X$$",0
* MNEML IS OF FORM:
* (A) XXXXX000
* (B) XXXYY100
* (C) 1XXX1010
* (D) XXXYYY10
* (E) XXXYYY01
*
(X=INDEX)
MNEML
DFB
$1C,$8A,$1C,$23,$5D,$8B

344

DFB

$1B,$A1,$9D,$8A,$1D,$23

345

DFB

$9D,$8B,$1D,$A1,$00,$29

346

DFB

$19,$AE,$69,$A8,$19,$23

F9D8:
F9DB:
F9DE:
F9E0:
F9E3:
F9E6:
F9E8:
F9EB:
F9EE:
F9F0:
F9F3:
F9F6:
F9F8:
F9FB:
F9FE:
FA00:
FA03:
FA06:
FA09:
FA0C:
FA0F:
FA12:
FA15:
FA18:
FA1B:
FA1E:
FA20:
FA23:
FA26:
FA28:
FA2B:
FA2E:
FA30:
FA33:
FA36:
FA38:
FA3B:
FA3E:
FA40:
FA43:
FA46:
FA47:
FA49:
FA4A:
FA4C:
FA4E:
FA51:
FA53:
FA54:
FA56:
FA58:
FA5A:
FA5C:
FA5E:
FA60:
FA62:
FA64:
FA66:
FA68:
FA6A:
FA6C:
FA6E:

24
23
19
00
5B
24
AE
AD
7C
15
9C
29
84
11
23
D8
48
94
44
68
94
08
B4
74
4A
A4
00
A2
74
44
32
22
1A
26
88
C4
48
A2
FF
20
68
85
68
85
A2
BD
95
CA
D0
A1
F0
A4
C9
F0
C9
F0
C9
F0
C9
F0
C9
F0

53
24
A1
1A
A5
24
AE
29
00
9C
A5
53
13
A5
A0
62
26
88
C8
44
00
84
28
F4
72
8A
AA
74
72
68
B2
00
1A
72
C8
CA
44
C8
FF
D0

1B
53
5B
69
A8
00
6D
69
34
69
5A
62
54
54
E8
B4
74
6E
CC
F2
A2
74
B2
00
26
72
26
44
FF
F8

2C
2D
08
10 FB
3C
F8
3A
42
2F
20
59
60
45
4C
5C
6C
59
40
35

347

DFB

$24,$53,$1B,$23,$24,$53

348
349

DFB
DFB

$19,$A1
;(A) FORMAT ABOVE
$00,$1A,$5B,$5B,$A5,$69

350
351

DFB
DFB

$24,$24
;(B) FORMAT
$AE,$AE,$A8,$AD,$29,$00

352
353

DFB
DFB

$7C,$00
;(C) FORMAT
$15,$9C,$6D,$9C,$A5,$69

354
355

DFB
DFB

$29,$53
;(D) FORMAT
$84,$13,$34,$11,$A5,$69

DFB
DFB

$23,$A0
;(E) FORMAT
$D8,$62,$5A,$48,$26,$62

358

DFB

$94,$88,$54,$44,$C8,$54

359

DFB

$68,$44,$E8,$94,$00,$B4

360

DFB

$08,$84,$74,$B4,$28,$6E

361

DFB

$74,$F4,$CC,$4A,$72,$F2

362
363

DFB
DFB

$A4,$8A
;(A) FORMAT
$00,$AA,$A2,$A2,$74,$74

364
365

DFB
DFB

$74,$72
;(B) FORMAT
$44,$68,$B2,$32,$B2,$00

366
367

DFB
DFB

$22,$00
;(C) FORMAT
$1A,$1A,$26,$26,$72,$72

368
369

DFB
DFB

$88,$C8
;(D) FORMAT
$C4,$CA,$26,$48,$44,$44

370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394

DFB
DFB
JSR
PLA
STA
PLA
STA
LDX
LDA
STA
DEX
BNE
LDA
BEQ
LDY
CMP
BEQ
CMP
BEQ
CMP
BEQ
CMP
BEQ
CMP
BEQ

$A2,$C8
;(E) FORMAT
$FF,$FF,$FF
INSTDSP
;DISASSEMBLE ONE INST
; AT (PCL,H)
RTNL
;ADJUST TO USER
; STACK. SAVE
RTNH
; RTN ADR.
#$08
INITBL-1,X ;INIT XEQ AREA
XQT,X

356
357

MNEMR

STEP

XQINIT

XQINIT
(PCL,X)
XBRK
LENGTH
#$20
XJSR
#$60
XRTS
#$4C
XJMP
#$6C
XJMPAT
#$40
XRTI

;USER OPCODE BYTE
;SPECIAL IF BREAK
;LEN FROM DISASSEMBLY
;HANDLE JSR, RTS, JMP,
; JMP (), RTI SPECIAL

FA70:
FA72:
FA74:
FA76:
FA78:
FA7A:
FA7D:
FA7E:
FA80:
FA83:
FA86:
FA88:
FA89:
FA8A:
FA8B:
FA8C:
FA8D:
FA8F:
FA92:
FA93:
FA96:
FA97:
FA99:
FA9A:
FA9C:
FA9F:
FAA2:
FAA5:
FAA6:
FAA7:
FAA9:
FAAA:
FAAC:
FAAD:
FAAF:
FAB1:
FAB4:
FAB6:
FAB7:
FAB9:
FABA:
FABD:
FABE:
FABF:
FAC0:
FAC1:
FAC2:
FAC4:
FAC5:
FAC7:
FAC8:
FAC9:
FACB:
FACD:
FACF:
FAD1:
FAD3:
FAD4:
FAD6:
FAD7:
FADA:
FADC:

29
49
C9
F0
B1
99
88
10
20
4C
85
68
48
0A
0A
0A
30
6C
28
20
68
85
68
85
20
20
4C
18
68
85
68
85
68
85
A5
20
84
18
90
18
20
AA
98
48
8A
48
A0
18
B1
AA
88
B1
86
85
B0
A5
48
A5
48
20
A9
85

1F
14
04
02
3A
3C 00
F8
3F FF
3C 00
45

03
FE 03
4C FF
3A
3B
82 F8
DA FA
65 FF
48
3A
3B
2F
56 F9
3B
14
54 F9

02
3A
3A
3B
3A
F3
2D
2C
8E FD
45
40

395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456

XQ1
XQ2

IRQ

BREAK

XBRK
XRTI
XRTS
PCINC2
PCINC3

XJSR

XJMP
XJMPAT

NEWPCL
RTNJMP

REGDSP
RGDSP1

AND
EOR
CMP
BEQ
LDA
STA
DEY
BPL
JSR
JMP
STA
PLA
PHA
ASL
ASL
ASL
BMI
JMP
PLP
JSR
PLA
STA
PLA
STA
JSR
JSR
JMP
CLC
PLA
STA
PLA
STA
PLA
STA
LDA
JSR
STY
CLC
BCC
CLC
JSR
TAX
TYA
PHA
TXA
PHA
LDY
CLC
LDA
TAX
DEY
LDA
STX
STA
BCS
LDA
PHA
LDA
PHA
JSR
LDA
STA

#$1F
#$14
#$04
XQ2
(PCL),Y
XQT,Y
XQ1
RESTORE
XQT
ACC

;COPY USER INST TO XEQ AREA
; WITH TRAILING NOPS
;CHANGE REL BRANCH
; DISP TO 4 FOR
; JMP TO BRANCH OR
; NBRANCH FROM XEQ.
;RESTORE USER REG CONTENTS.
;XEQ USER OP FROM RAM
; (RETURN TO NBRANCH)
;**IRQ HANDLER

BREAK
(IRQLOC)

;TEST FOR BREAK
;USER ROUTINE VECTOR IN RAM

SAV1

;SAVE REG'S ON BREAK
; INCLUDING PC

PCL
PCH
INSDS1
RGDSP1
MON
STATUS
PCL
PCH
LENGTH
PCADJ3
PCH

;PRINT USER PC.
; AND REG'S
;GO TO MONITOR
;SIMULATE RTI BY EXPECTING
; STATUS FROM STACK, THEN RTS
;RTS SIMULATION
; EXTRACT PC FROM STACK
; AND UPDATE PC BY 1 (LEN=0)
;UPDATE PC BY LEN

NEWPCL
PCADJ2

;UPDATE PC AND PUSH
; ONTO STACH FOR
; JSR SIMULATE

#$02
(PCL),Y
(PCL),Y
PCH
PCL
XJMP
RTNH

;LOAD PC FOR JMP,
; (JMP) SIMULATE.

RTNL
CROUT
#ACC
A3L

;DISPLAY USER REG
; CONTENTS WITH
; LABELS

FADE:
FAE0:
FAE2:
FAE4:
FAE6:
FAE9:
FAEC:
FAEF:
FAF1:
FAF4:
FAF6:
FAF9:
FAFA:
FAFC:
FAFD:
FAFE:
FB00:
FB02:
FB05:
FB07:
FB08:
FB09:
FB0B:
FB0E:
FB0F:
FB11:
FB12:
FB13:
FB16:
FB19:
FB1A:
FB1B:
FB1C:
FB1D:
FB1E:
FB21:
FB23:
FB24:
FB25:
FB28:
FB2A:
FB2B:
FB2D:
FB2E:
FB2F:
FB31:
FB33:
FB36:
FB39:
FB3C:
FB3E:
FB40:
FB43:
FB46:
FB49:
FB4B:
FB4D:
FB4F:
FB51:
FB53:
FB55:
FB57:

A9
85
A2
A9
20
BD
20
A9
20
B5
20
E8
30
60
18
A0
B1
20
85
98
38
B0
20
38
B0
EA
EA
4C
4C
C1
D8
D9
D0
D3
AD
A0
EA
EA
BD
10
C8
D0
88
60
A9
85
AD
AD
AD
A9
F0
AD
AD
20
A9
85
A9
85
A9
85
A9
85

00
41
FB
A0
ED
1E
ED
BD
ED
4A
DA

FD
FA
FD
FD
FD

E8
01
3A
56 F9
3A
A2
4A FF
9E
0B FB
FD FA

70 C0
00
64 C0
04
F8
00
48
56
54
51
00
0B
50
53
36
14
22
00
20
28
21
18
23

C0
C0
C0
C0
C0
F8

457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518

RDSP1

BRANCH

NBRNCH
INITBL

RTBL

PREAD

PREAD2

RTS2D
INIT

SETTXT
SETGR

SETWND

LDA
STA
LDX
LDA
JSR
LDA
JSR
LDA
JSR
LDA
JSR
INX
BMI
RTS
CLC
LDY
LDA
JSR
STA
TYA
SEC
BCS
JSR
SEC
BCS
NOP
NOP
JMP
JMP
DFB
DFB
DFB
DFB
DFB
LDA
LDY
NOP
NOP
LDA
BPL
INY
BNE
DEY
RTS
LDA
STA
LDA
LDA
LDA
LDA
BEQ
LDA
LDA
JSR
LDA
STA
LDA
STA
LDA
STA
LDA
STA

#ACC/256
A3H
#$FB
#$A0
COUT
RTBL-$FB,X
COUT
#$BD
COUT
ACC+5,X
PRBYTE
RDSP1
#$01
(PCL),Y
PCADJ3
PCL
PCINC2
SAVE
PCINC3
NBRNCH
BRANCH
$C1
$D8
$D9
$D0
$D3
PTRIG
#$00

;BRANCH TAKEN,
; ADD LEN+2 TO PC

;NORMAL RETURN AFTER
; XEQ USER OF
;GO UPDATE PC
;DUMMY FILL FOR
; XEQ AREA

;TRIGGER PADDLES
;INIT COUNT
;COMPENSATE FOR 1ST COUNT

PADDL0,X
RTS2D

;COUNT Y-REG EVERY
; 12 USEC

PREAD2

;

#$00
STATUS
LORES
LOWSCR
TXTSET
#$00
SETWND
TXTCLR
MIXSET
CLRTOP
#$14
WNDTOP
#$00
WNDLFT
#$28
WNDWDTH
#$18
WNDBTM

;CLR STATUS FOR DEBUG
; SOFTWARE

EXIT AT 255 MAX

;INIT VIDEO MODE
;SET FOR TEXT MODE
; FULL SCREEN WINDOW
;SET FOR GRAPHICS MODE
; LOWER 4 LINES AS
; TEXT WINDOW
;SET FOR 40 COL WINDOW
; TOP IN A-REG,
; BTTM AT LINE 24

;

VTAB TO ROW 23

FB59:
FB5B:
FB5D:
FB60:
FB63:
FB65:
FB67:
FB68:
FB6A:
FB6B:
FB6D:
FB6F:
FB71:
FB73:
FB74:
FB76:
FB78:
FB79:
FB7A:
FB7B:
FB7D:
FB7E:
FB80:
FB81:
FB84:
FB86:
FB88:
FB8A:
FB8C:
FB8E:
FB8F:
FB91:
FB93:
FB94:
FB96:
FB98:
FB9A:
FB9C:
FB9E:
FBA0:
FBA1:
FBA3:
FBA4:
FBA6:
FBA8:
FBAA:
FBAD:
FBAF:
FBB1:
FBB3:
FBB4:
FBB5:
FBB7:
FBB9:
FBBA:
FBBC:
FBBE:
FBC0:
FBC1:
FBC2:
FBC3:
FBC5:

A9
85
4C
20
A0
A5
4A
90
18
A2
B5
75
95
E8
D0
A2
76
50
CA
10
88
D0
60
20
A0
06
26
26
26
38
A5
E5
AA
A5
E5
90
86
85
E6
88
D0
60
A0
84
A2
20
A2
B5
10
38
98
F5
95
98
F5
95
E6
60
48
4A
29
09

17
25
22 FC
A4 FB
10
50
0C
FE
54
56
54
F7
03

FB
E5
A4 FB
10
50
51
52
53
52
54
53
55
06
52
53
50
E3
00
2F
54
AF FB
50
01
0D
00
00
01
01
2F

03
04

519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580

TABV
MULPM
MUL
MUL2

MUL3

MUL4
MUL5

DIVPM
DIV
DIV2

DIV3
MD1

MD3

MDRTS
BASCALC

LDA
STA
JMP
JSR
LDY
LDA
LSR
BCC
CLC
LDX
LDA
ADC
STA
INX
BNE
LDX
DFB
DFB
DEX
BPL
DEY
BNE
RTS
JSR
LDY
ASL
ROL
ROL
ROL
SEC
LDA
SBC
TAX
LDA
SBC
BCC
STX
STA
INC
DEY
BNE
RTS
LDY
STY
LDX
JSR
LDX
LDA
BPL
SEC
TYA
SBC
STA
TYA
SBC
STA
INC
RTS
PHA
LSR
AND
ORA

#$17
CV
VTAB
MD1
#$10
ACL
MUL4
#$FE
XTNDL+2,X
AUXL+2,X
XTNDL+2,X

;VTABS TO ROW IN A-REG
;ABS VAL OF AC AUX
;INDEX FOR 16 BITS
;ACX * AUX + XTND
; TO AC, XTND
;IF NO CARRY,
; NO PARTIAL PROD.
;ADD MPLCND (AUX)
; TO PARTIAL PROD
; (XTND)

MUL3
#$03
$76
$50
MUL5
MUL2
MD1
#$10
ACL
ACH
XTNDL
XTNDH
XTNDL
AUXL

;ABS VAL OF AC, AUX.
;INDEX FOR 16 BITS
;XTND/AUX
; TO AC.
;MOD TO XTND.

XTNDH
AUXH
DIV3
XTNDL
XTNDH
ACL
DIV2
#$00
SIGN
#AUXL
MD3
#ACL
LOC1,X
MDRTS

;ABS VAL OF AC, AUX
; WITH RESULT SIGN
; IN LSB OF SIGN.

LOC0,X
LOC0,X

;COMPL SPECIFIED REG
; IF NEG.

;X SPECIFIES AC OR AUX

LOC1,X
LOC1,X
SIGN

#$03
#$04

;CALC BASE ADR IN BASL,H
; FOR GIVEN LINE NO
; 0<=LINE NO.<=$17
;ARG=000ABCDE, GENERATE

FBC7:
FBC9:
FBCA:
FBCC:
FBCE:
FBD0:
FBD2:
FBD3:
FBD4:
FBD6:
FBD8:
FBD9:
FBDB:
FBDD:
FBDF:
FBE2:
FBE4:
FBE6:
FBE9:
FBEC:
FBED:
FBEF:
FBF0:
FBF2:
FBF4:
FBF6:
FBF8:
FBFA:
FBFC:
FBFD:
FBFF:
FC01:
FC02:
FC04:
FC06:
FC08:
FC0A:
FC0C:
FC0E:
FC10:
FC12:
FC14:
FC16:
FC18:
FC1A:
FC1C:
FC1E:
FC20:
FC22:
FC24:
FC27:
FC29:
FC2B:
FC2C:
FC2E:
FC30:
FC32:
FC34:
FC36:
FC38:
FC3A:
FC3C:

85
68
29
90
69
85
0A
0A
05
85
60
C9
D0
A9
20
A0
A9
20
AD
88
D0
60
A4
91
E6
A5
C5
B0
60
C9
B0
A8
10
C9
F0
C9
F0
C9
D0
C6
10
A5
85
C6
A5
C5
B0
C6
A5
20
65
85
60
49
F0
69
90
F0
69
90
F0
69

29
18
02
7F
28
28
28
87
12
40
A8 FC
C0
0C
A8 FC
30 C0
F5
24
28
24
24
21
66
A0
EF
EC
8D
5A
8A
5A
88
C9
24
E8
21
24
24
22
25
0B
25
25
C1 FB
20
28
C0
28
FD
C0
DA
FD
2C
DE
FD

581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642

BSCLC2

BELL1

BELL2

RTS2B
STOADV
ADVANCE

RTS3
VIDOUT

BS

UP

VTAB
VTABZ
RTS4
ESC1

STA
PLA
AND
BCC
ADC
STA
ASL
ASL
ORA
STA
RTS
CMP
BNE
LDA
JSR
LDY
LDA
JSR
LDA
DEY
BNE
RTS
LDY
STA
INC
LDA
CMP
BCS
RTS
CMP
BCS
TAY
BPL
CMP
BEQ
CMP
BEQ
CMP
BNE
DEC
BPL
LDA
STA
DEC
LDA
CMP
BCS
DEC
LDA
JSR
ADC
STA
RTS
EOR
BEQ
ADC
BCC
BEQ
ADC
BCC
BEQ
ADC

BASH
#$18
BSCLC2
#$7F
BASL

;
;
;

BASH=000001CD
AND
BASL=EABAB000

BASL
BASL
#$87
RTS2B
#$40
WAIT
#$C0
#$0C
WAIT
SPKR

;BELL CHAR? (CNTRL-G)
; NO, RETURN
;DELAY .01 SECONDS
;TOGGLE SPEAKER AT
; 1 KHZ FOR .1 SEC.

BELL2
CH
(BASL),Y
CH
CH
WNDWDTH
CR
#$A0
STOADV
STOADV
#$8D
CR
#$8A
LF
#$88
BELL1
CH
RTS3
WNDWDTH
CH
CH
WNDTOP
CV
RTS4
CV
CV
BASCALC
WNDLFT
BASL
#$C0
HOME
#$FD
ADVANCE
BS
#$FD
LF
UP
#$FD

;CURSOR H INDEX TO Y-REG
;STORE CHAR IN LINE
;INCREMENT CURSOR H INDEX
; (MOVE RIGHT)
;BEYOND WINDOW WIDTH?
; YES CR TO NEXT LINE
; NO,RETURN
;CONTROL CHAR?
; NO,OUTPUT IT.
;INVERSE VIDEO?
; YES, OUTPUT IT.
;CR?
; YES.
;LINE FEED?
; IF SO, DO IT.
;BACK SPACE? (CNTRL-H)
; NO, CHECK FOR BELL.
;DECREMENT CURSOR H INDEX
;IF POS, OK. ELSE MOVE UP
;SET CH TO WNDWDTH-1
;(RIGHTMOST SCREEN POS)
;CURSOR V INDEX
;IF TOP LINE THEN RETURN
;DEC CURSOR V-INDEX
;GET CURSOR V-INDEX
;GENERATE BASE ADR
;ADD WINDOW LEFT INDEX
;TO BASL
;ESC?
; IF SO, DO HOME AND CLEAR
;ESC-A OR B CHECK
; A, ADVANCE
; B, BACKSPACE
;ESC-C OR D CHECK
; C, DOWN
; D, GO UP
;ESC-E OR F CHECK

FC3E:
FC40:
FC42:
FC44:
FC46:
FC47:
FC4A:
FC4D:
FC4F:
FC50:
FC52:
FC54:
FC56:
FC58:
FC5A:
FC5C:
FC5E:
FC60:
FC62:
FC64:
FC66:
FC68:
FC6A:
FC6C:
FC6E:
FC70:
FC72:
FC73:
FC76:
FC78:
FC7A:
FC7C:
FC7E:
FC80:
FC81:
FC82:
FC84:
FC86:
FC88:
FC89:
FC8C:
FC8E:
FC90:
FC91:
FC93:
FC95:
FC97:
FC9A:
FC9C:
FC9E:
FCA0:
FCA2:
FCA3:
FCA5:
FCA7:
FCA8:
FCA9:
FCAA:
FCAC:
FCAE:
FCAF:
FCB1:

90
D0
A4
A5
48
20
20
A0
68
69
C5
90
B0
A5
85
A0
84
F0
A9
85
E6
A5
C5
90
C6
A5
48
20
A5
85
A5
85
A4
88
68
69
C5
B0
48
20
B1
91
88
10
30
A0
20
B0
A4
A9
91
C8
C4
90
60
38
48
E9
D0
68
E9
D0

5C
E9
24
25
24 FC
9E FC
00
00
23
F0
CA
22
25
00
24
E4
00
24
25
25
23
B6
25
22
24 FC
28
2A
29
2B
21
01
23
0D
24 FC
28
2A
F9
E1
00
9E FC
86
24
A0
28
21
F9

01
FC
01
F6

643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704

CLREOP
CLEOP1

HOME

CR
LF

SCROLL
SCRL1

SCRL2

SCRL3
CLREOL
CLEOLZ
CLEOL2

WAIT
WAIT2
WAIT3

BCC
BNE
LDY
LDA
PHA
JSR
JSR
LDY
PLA
ADC
CMP
BCC
BCS
LDA
STA
LDY
STY
BEQ
LDA
STA
INC
LDA
CMP
BCC
DEC
LDA
PHA
JSR
LDA
STA
LDA
STA
LDY
DEY
PLA
ADC
CMP
BCS
PHA
JSR
LDA
STA
DEY
BPL
BMI
LDY
JSR
BCS
LDY
LDA
STA
INY
CPY
BCC
RTS
SEC
PHA
SBC
BNE
PLA
SBC
BNE

CLREOL
RTS4
CH
CV
VTABZ
CLEOLZ
#$00
#$00
WNDBTM
CLEOP1
VTAB
WNDTOP
CV
#$00
CH
CLEOP1
#$00
CH
CV
CV
WNDBTM
VTABZ
CV
WNDTOP

; E, CLEAR TO END OF LINE
; NOT F, RETURN
;CURSOR H TO Y INDEX
;CURSOR V TO A-REGISTER
;SAVE CURRENT LINE ON STK
;CALC BASE ADDRESS
;CLEAR TO EOL, SET CARRY
;CLEAR FROM H INDEX=0 FOR REST
;INCREMENT CURRENT LINE
;(CARRY IS SET)
;DONE TO BOTTOM OF WINDOW?
; NO, KEEP CLEARING LINES
; YES, TAB TO CURRENT LINE
;INIT CURSOR V
; AND H-INDICES
;THEN CLEAR TO END OF PAGE
;CURSOR TO LEFT OF INDEX
;(RET CURSOR H=0)
;INCR CURSOR V(DOWN 1 LINE)
;OFF SCREEN?
; NO, SET BASE ADDR
;DECR CURSOR V (BACK TO BOTTOM)
;START AT TOP OF SCRL WNDW

VTABZ
BASL
BAS2L
BASH
BAS2H
WNDWDTH

;GENERATE BASE ADR
;COPY BASL,H
; TO BAS2L,H

#$01
WNDBTM
SCRL3

;INCR LINE NUMBER
;DONE?
; YES, FINISH

VTABZ
(BASL),Y
(BAS2L),Y

;FORM BASL,H (BASE ADDR)
;MOVE A CHR UP ON LINE

SCRL2
SCRL1
#$00
CLEOLZ
VTAB
CH
#$A0
(BASL),Y

;INIT Y TO RIGHTMOST INDEX
; OF SCROLLING WINDOW

;NEXT CHAR OF LINE
;NEXT LINE (ALWAYS TAKEN)
;CLEAR BOTTOM LINE
;GET BASE ADDR FOR BOTTOM LINE
;CARRY IS SET
;CURSOR H INDEX
;STORE BLANKS FROM 'HERE'
; TO END OF LINES (WNDWDTH)

WNDWDTH
CLEOL2

#$01
WAIT3
#$01
WAIT2

;1.0204 USEC
;(13+27/2*A+5/2*A*A)

FCB3:
FCB4:
FCB6:
FCB8:
FCBA:
FCBC:
FCBE:
FCC0:
FCC2:
FCC4:
FCC6:
FCC8:
FCC9:
FCCB:
FCCE:
FCD0:
FCD2:
FCD4:
FCD6:
FCD9:
FCDA:
FCDB:
FCDC:
FCDE:
FCE0:
FCE2:
FCE3:
FCE5:
FCE8:
FCEA:
FCEB:
FCEC:
FCEE:
FCEF:
FCF2:
FCF3:
FCF4:
FCF6:
FCF7:
FCF9:
FCFA:
FCFD:
FCFE:
FD01:
FD03:
FD05:
FD07:
FD09:
FD0B:
FD0C:
FD0E:
FD10:
FD11:
FD13:
FD15:
FD17:
FD18:
FD1B:
FD1D:
FD1F:
FD21:
FD24:

60
E6
D0
E6
A5
C5
A5
E5
E6
D0
E6
60
A0
20
D0
69
B0
A0
20
C8
C8
88
D0
90
A0
88
D0
AC
A0
CA
60
A2
48
20
68
2A
A0
CA
D0
60
20
88
AD
45
10
45
85
C0
60
A4
B1
48
29
09
91
68
6C
E6
D0
E6
2C
10

42
02
43
3C
3E
3D
3F
3C
02
3D
4B
DB FC
F9
FE
F5
21
DB FC

FD
05
32
FD
20 C0
2C
08
FA FC
3A
F5
FD FC
60 C0
2F
F8
2F
2F
80
24
28
3F
40
28
38 00
4E
02
4F
00 C0
F5

705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766

NXTA4
NXTA1

RTS4B
HEADR

WRBIT
ZERDLY

ONEDLY
WRTAPE

RDBYTE
RDBYT2

RD2BIT
RDBIT

RDKEY

KEYIN
KEYIN2

RTS
INC
BNE
INC
LDA
CMP
LDA
SBC
INC
BNE
INC
RTS
LDY
JSR
BNE
ADC
BCS
LDY
JSR
INY
INY
DEY
BNE
BCC
LDY
DEY
BNE
LDY
LDY
DEX
RTS
LDX
PHA
JSR
PLA
ROL
LDY
DEX
BNE
RTS
JSR
DEY
LDA
EOR
BPL
EOR
STA
CPY
RTS
LDY
LDA
PHA
AND
ORA
STA
PLA
JMP
INC
BNE
INC
BIT
BPL

A4L
NXTA1
A4H
A1L
A2L
A1H
A2H
A1L
RTS4B
A1H

;INCR 2-BYTE A4
; AND A1

#$4B
ZERDLY
HEADR
#$FE
HEADR
#$21
ZERDLY

;WRITE A*256 'LONG 1'
; HALF CYCLES
; (650 USEC EACH)

ZERDLY
WRTAPE
#$32

;INCR 2-BYTE A1.
;

AND COMPARE TO A2

;

(CARRY SET IF >=)

;THEN A 'SHORT 0'
; (400 USEC)
;WRITE TWO HALF CYCLES
; OF 250 USEC ('0')
; OR 500 USEC ('0')
;Y IS COUNT FOR
; TIMING LOOP

ONEDLY
TAPEOUT
#$2C
#$08
RD2BIT

;8 BITS TO READ
;READ TWO TRANSITIONS
; (FIND EDGE)

#$3A

;NEXT BIT
;COUNT FOR SAMPLES

RDBYT2
RDBIT
TAPEIN
LASTIN
RDBIT
LASTIN
LASTIN
#$80
CH
(BASL),Y

;DECR Y UNTIL
; TAPE TRANSITION

;SET CARRY ON Y
;SET SCREEN TO FLASH

#$3F
#$40
(BASL),Y
(KSWL)
RNDL
KEYIN2
RNDH
KBD
KEYIN

;GO TO USER KEY-IN
;INCR RND NUMBER
;KEY DOWN?
; LOOP

FD26:
FD28:
FD2B:
FD2E:
FD2F:
FD32:
FD35:
FD38:
FD3A:
FD3C:
FD3D:
FD3F:
FD40:
FD42:
FD44:
FD47:
FD4A:
FD4B:
FD4D:
FD50:
FD52:
FD54:
FD56:
FD58:
FD5A:
FD5C:
FD5F:
FD60:
FD62:
FD64:
FD67:
FD6A:
FD6C:
FD6F:
FD71:
FD72:
FD74:
FD75:
FD78:
FD7A:
FD7C:
FD7E:
FD80:
FD82:
FD84:
FD87:
FD89:
FD8B:
FD8E:
FD90:
FD92:
FD94:
FD96:
FD99:
FD9C:
FD9E:
FDA0:
FDA3:
FDA5:
FDA7:
FDA9:
FDAB:

91
AD
2C
60
20
20
20
C9
F0
60
A5
48
A9
85
BD
20
68
85
BD
C9
F0
C9
F0
E0
90
20
E8
D0
A9
20
20
A5
20
A2
8A
F0
CA
20
C9
D0
B1
C9
90
29
9D
C9
D0
20
A9
D0
A4
A6
20
20
A0
A9
4C
A5
09
85
A5
85

28
00 C0
10 C0
0C FD
2C FC
0C FD
9B
F3
32
FF
32
00 02
ED FD
32
00 02
88
1D
98
0A
F8
03
3A FF
13
DC
ED FD
8E FD
33
ED FD
01
F3
35
95
02
28
E0
02
DF
00
8D
B2
9C
8D
5B
3D
3C
8E
40
00
AD
ED
3C
07
3E
3D
3F

FD

02
FC

FD
F9
FD

767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828

ESC
RDCHAR

NOTCR

NOTCR1
CANCEL
GETLNZ
GETLN
BCKSPC
NXTCHAR

CAPTST
ADDINP

CROUT
PRA1
PRYX2

XAM8

STA
LDA
BIT
RTS
JSR
JSR
JSR
CMP
BEQ
RTS
LDA
PHA
LDA
STA
LDA
JSR
PLA
STA
LDA
CMP
BEQ
CMP
BEQ
CPX
BCC
JSR
INX
BNE
LDA
JSR
JSR
LDA
JSR
LDX
TXA
BEQ
DEX
JSR
CMP
BNE
LDA
CMP
BCC
AND
STA
CMP
BNE
JSR
LDA
BNE
LDY
LDX
JSR
JSR
LDY
LDA
JMP
LDA
ORA
STA
LDA
STA

(BASL),Y
KBD
KBDSTRB

;REPLACE FLASHING SCREEN
;GET KEYCODE
;CLR KEY STROBE

RDKEY
ESC1
RDKEY
#$9B
ESC

;GET KEYCODE
; HANDLE ESC FUNC.
;READ KEY
;ESC?
; YES, DON'T RETURN

INVFLG
#$FF
INVFLG
IN,X
COUT
INVFLG
IN,X
#$88
BCKSPC
#$98
CANCEL
#$F8
NOTCR1
BELL
NXTCHAR
#$DC
COUT
CROUT
PROMPT
COUT
#$01
GETLNZ
RDCHAR
#PICK
CAPTST
(BASL),Y
#$E0
ADDINP
#$DF
IN,X
#$8D
NOTCR
CLREOL
#$8D
COUT
A1H
A1L
CROUT
PRNTYX
#$00
#$AD
COUT
A1L
#$07
A2L
A1H
A2H

;ECHO USER LINE
; NON INVERSE

;CHECK FOR EDIT KEYS
; BS, CTRL-X
;MARGIN?
; YES, SOUND BELL
;ADVANCE INPUT INDEX
;BACKSLASH AFTER CANCELLED LINE
;OUTPUT CR
;OUTPUT PROMPT CHAR
;INIT INPUT INDEX
; WILL BACKSPACE TO 0

;USE SCREEN CHAR
; FOR CTRL-U
;CONVERT TO CAPS
;ADD TO INPUT BUF
;CLR TO EOL IF CR
;PRINT CR,A1 IN HEX

;PRINT '-'
;SET TO FINISH AT
; MOD 8=7

FDAD:
FDAF:
FDB1:
FDB3:
FDB6:
FDB8:
FDBB:
FDBD:
FDC0:
FDC3:
FDC5:
FDC6:
FDC7:
FDC9:
FDCA:
FDCB:
FDCD:
FDCF:
FDD1:
FDD3:
FDD4:
FDD6:
FDD9:
FDDA:
FDDB:
FDDC:
FDDD:
FDDE:
FDDF:
FDE2:
FDE3:
FDE5:
FDE7:
FDE9:
FDEB:
FDED:
FDF0:
FDF2:
FDF4:
FDF6:
FDF8:
FDF9:
FDFC:
FDFD:
FDFF:
FE00:
FE02:
FE04:
FE05:
FE07:
FE09:
FE0B:
FE0D:
FE0F:
FE11:
FE13:
FE15:
FE17:
FE18:
FE1A:
FE1D:
FE1F:

A5
29
D0
20
A9
20
B1
20
20
90
60
4A
90
4A
4A
A5
90
49
65
48
A9
20
68
48
4A
4A
4A
4A
20
68
29
09
C9
90
69
6C
C9
90
25
84
48
20
68
A4
60
C6
F0
CA
D0
C9
D0
85
A5
91
E6
D0
E6
60
A4
B9
85
60

3C
07
03
92
A0
ED
3C
DA
BA
E8

FD
FD
FD
FC

EA
3E
02
FF
3C
BD
ED FD

E5 FD
0F
B0
BA
02
06
36 00
A0
02
32
35
FD FB
35
34
9F
16
BA
BB
31
3E
40
40
02
41
34
FF 01
31

829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890

MODSCHK
XAM
DATAOUT

RTS4C
XAMPM

ADD

PRBYTE

PRHEX
PRHEXZ

COUT
COUT1
COUTZ

BL1
BLANK

STOR

RTS5
SETMODE
SETMDZ

LDA
AND
BNE
JSR
LDA
JSR
LDA
JSR
JSR
BCC
RTS
LSR
BCC
LSR
LSR
LDA
BCC
EOR
ADC
PHA
LDA
JSR
PLA
PHA
LSR
LSR
LSR
LSR
JSR
PLA
AND
ORA
CMP
BCC
ADC
JMP
CMP
BCC
AND
STY
PHA
JSR
PLA
LDY
RTS
DEC
BEQ
DEX
BNE
CMP
BNE
STA
LDA
STA
INC
BNE
INC
RTS
LDY
LDA
STA
RTS

A1L
#$07
DATAOUT
PRA1
#$A0
COUT
(A1L),Y
PRBYTE
NXTA1
MODSCHK
XAM
A2L
ADD
#$FF
A1L
#$BD
COUT

;OUTPUT BLANK
;OUTPUT BYTE IN HEX
;CHECK IF TIME TO,
; PRINT ADDR
;DETERMINE IF MON
; MODE IS XAM
; ADD, OR SUB

;SUB: FORM 2'S COMPLEMENT

;PRINT '=', THEN RESULT
;PRINT BYTE AS 2 HEX
; DIGITS, DESTROYS A-REG

PRHEXZ
#$0F
#$B0
#$BA
COUT
#$06
(CSWL)
#$A0
COUTZ
INVFLG
YSAV1
VIDOUT
YSAV1
YSAV
XAM8
SETMDZ
#$BA
XAMPM
MODE
A2L
(A3L),Y
A3L
RTS5
A3H
YSAV
IN-1,Y
MODE

;PRINT HEX DIG IN A-REG
; LSB'S

;VECTOR TO USER OUTPUT ROUTINE
;DON'T OUTPUT CTRL'S INVERSE
;MASK WITH INVERSE FLAG
;SAV Y-REG
;SAV A-REG
;OUTPUT A-REG AS ASCII
;RESTORE A-REG
; AND Y-REG
; THEN RETURN
;BLANK TO MON
;AFTER BLANK
;DATA STORE MODE?
; NO, XAM, ADD, OR SUB
;KEEP IN STORE MODE
;STORE AS LOW BYTE AS (A3)
;INCR A3, RETURN
;SAVE CONVERTED ':', '+',
; '-', '.' AS MODE.

FE20:
FE22:
FE24:
FE26:
FE28:
FE29:
FE2B:
FE2C:
FE2E:
FE30:
FE33:
FE35:
FE36:
FE38:
FE3A:
FE3C:
FE3F:
FE41:
FE44:
FE46:
FE49:
FE4B:
FE4E:
FE50:
FE53:
FE55:
FE58:
FE5B:
FE5D:
FE5E:
FE61:
FE63:
FE64:
FE67:
FE6A:
FE6C:
FE6E:
FE6F:
FE70:
FE72:
FE74:
FE75:
FE76:
FE78:
FE7A:
FE7C:
FE7D:
FE7F:
FE80:
FE82:
FE84:
FE86:
FE88:
FE89:
FE8B:
FE8D:
FE8F:
FE91:
FE93:
FE95:
FE97:
FE99:

A2
B5
95
95
CA
10
60
B1
91
20
90
60
B1
D1
F0
20
B1
20
A9
20
A9
20
B1
20
A9
20
20
90
60
20
A9
48
20
20
85
84
68
38
E9
D0
60
8A
F0
B5
95
CA
10
60
A0
D0
A0
84
60
A9
85
A2
A0
D0
A9
85
A2
A0

01
3E
42
44
F7
3C
42
B4 FC
F7
3C
42
1C
92
3C
DA
A0
ED
A8
ED
42
DA
A9
ED
B4
D9

FD
FD
FD
FD
FD
FD
FC

75 FE
14
D0 F8
53 F9
3A
3B
01
EF
07
3C
3A
F9
3F
02
FF
32
00
3E
38
1B
08
00
3E
36
F0

891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952

LT
LT2

MOVE

VFY

VFYOK
LIST
LIST2

A1PC
A1PCLP

A1PCRTS
SETINV
SETNORM
SETIFLG
SETKBD
INPORT
INPRT
SETVID
OUTPORT
OUTPRT

LDX
LDA
STA
STA
DEX
BPL
RTS
LDA
STA
JSR
BCC
RTS
LDA
CMP
BEQ
JSR
LDA
JSR
LDA
JSR
LDA
JSR
LDA
JSR
LDA
JSR
JSR
BCC
RTS
JSR
LDA
PHA
JSR
JSR
STA
STY
PLA
SEC
SBC
BNE
RTS
TXA
BEQ
LDA
STA
DEX
BPL
RTS
LDY
BNE
LDY
STY
RTS
LDA
STA
LDX
LDY
BNE
LDA
STA
LDX
LDY

#$01
A2L,X
A4L,X
A5L,X

;COPY A2 (2 BYTES) TO
; A4 AND A5

LT2
(A1L),Y
(A4L),Y
NXTA4
MOVE

;MOVE (A1 TO A2) TO
; (A4)

(A1L),Y
(A4L),Y
VFYOK
PRA1
(A1L),Y
PRBYTE
#$A0
COUT
#$A8
COUT
(A4L),Y
PRBYTE
#$A9
COUT
NXTA4
VFY

;VERIFY (A1 TO A2) WITH
; (A4)

A1PC
#$14

;MOVE A1 (2 BYTES) TO
; PC IF SPEC'D AND
; DISEMBLE 20 INSTRS

INSTDSP
PCADJ
PCL
PCH
#$01
LIST2
A1PCRTS
A1L,X
PCL,X

;ADJUST PC EACH INSTR

;NEXT OF 20 INSTRS
;IF USER SPEC'D ADR
; COPY FROM A1 TO PC

A1PCLP
#$3F
SETIFLG
#$FF
INVFLG

;SET FOR INVERSE VID
; VIA COUT1
;SET FOR NORMAL VID

#$00
A2L
#KSWL
#KEYIN
IOPRT
#$00
A2L
#CSWL
#COUT1

;SIMULATE PORT #0 INPUT
; SPECIFIED (KEYIN ROUTINE)

;SIMULATE PORT #0 OUTPUT
; SPECIFIED (COUT1 ROUTINE)

FE9B:
FE9D:
FE9F:
FEA1:
FEA3:
FEA5:
FEA7:
FEA9:
FEAB:
FEAD:
FEAE:
FEAF:
FEB0:
FEB3:
FEB6:
FEB9:
FEBC:
FEBF:
FEC2:
FEC4:
FEC7:
FECA:
FECD:
FECF:
FED2:
FED4:
FED6:
FED8:
FED9:
FEDB:
FEDE:
FEE1:
FEE3:
FEE4:
FEE6:
FEE8:
FEEB:
FEED:
FEEF:
FEF0:
FEF3:
FEF5:
FEF6:
FEF9:
FEFA:
FEFB:
FEFD:
FF00:
FF02:
FF05:
FF07:
FF0A:
FF0C:
FF0F:
FF11:
FF14:
FF16:
FF19:
FF1B:
FF1D:
FF1F:
FF22:

A5
29
F0
09
A0
F0
A9
94
95
60
EA
EA
4C
4C
20
20
6C
4C
C6
20
4C
4C
A9
20
A0
A2
41
48
A1
20
20
A0
68
90
A0
20
F0
A2
0A
20
D0
60
20
68
68
D0
20
A9
20
85
20
A0
20
B0
20
A0
20
81
45
85
20
A0

3E
0F
06
C0
00
02
FD
00
01

00
03
75
3F
3A
D7
34
75
43
F8
40
C9
27
00
3C

E0
E0
FE
FF
00
FA
FE
FA
03
FC

3C
ED FE
BA FC
1D
EE
22
ED FE
4D
10
D6 FC
FA
00 FE
6C
FA
16
C9
2E
FA
24
FD
F9
FD
3B
EC
3C
2E
2E
BA
35

FC
FC
FC
FC
FC
FC

FC

953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014

IOPRT

IOPRT1
IOPRT2

XBASIC
BASCONT
GO
REGZ
TRACE
STEPZ
USR
WRITE
WR1

WRBYTE
WRBYT2

CRMON

READ

RD2

RD3

LDA
AND
BEQ
ORA
LDY
BEQ
LDA
STY
STA
RTS
NOP
NOP
JMP
JMP
JSR
JSR
JMP
JMP
DEC
JSR
JMP
JMP
LDA
JSR
LDY
LDX
EOR
PHA
LDA
JSR
JSR
LDY
PLA
BCC
LDY
JSR
BEQ
LDX
ASL
JSR
BNE
RTS
JSR
PLA
PLA
BNE
JSR
LDA
JSR
STA
JSR
LDY
JSR
BCS
JSR
LDY
JSR
STA
EOR
STA
JSR
LDY

A2L
;SET RAM IN/OUT VECTORS
#$0F
IOPRT1
#IOADR/256
#$00
IOPRT2
#COUT1/256
LOC0,X
LOC1,X

BASIC
BASIC2
A1PC
RESTORE
(PCL)
REGDSP
YSAV
A1PC
STEP
USRADR
#$40
HEADR
#$27
#$00
(A1L,X)

;TO BASIC WITH SCRATCH
;CONTINUE BASIC
;ADR TO PC IF SPEC'D
;RESTORE META REGS
;GO TO USER SUBR
;TO REG DISPLAY
;ADR TO PC IF SPEC'D
;TAKE ONE STEP
;TO USR SUBR AT USRADR
;WRITE 10-SEC HEADER

(A1L,X)
WRBYTE
NXTA1
#$1D
WR1
#$22
WRBYTE
BELL
#$10
WRBIT
WRBYT2
BL1
MONZ
RD2BIT
#$16
HEADR
CHKSUM
RD2BIT
#$24
RDBIT
RD2
RDBIT
#$3B
RDBYTE
(A1L,X)
CHKSUM
CHKSUM
NXTA1
#$35

;HANDLE A CR AS BLANK
; THEN POP STACK
; AND RTN TO MON
;FIND TAPEIN EDGE
;DELAY 3.5 SECONDS
;INIT CHKSUM=$FF
;FIND TAPEIN EDGE
;LOOK FOR SYNC BIT
; (SHORT 0)
; LOOP UNTIL FOUND
;SKIP SECOND SYNC H-CYCLE
;INDEX FOR 0/1 TEST
;READ A BYTE
;STORE AT (A1)
;UPDATE RUNNING CHKSUM
;INC A1, COMPARE TO A2
;COMPENSATE 0/1 INDEX

FF24:
FF26:
FF29:
FF2B:
FF2D:
FF2F:
FF32:
FF34:
FF37:
FF3A:
FF3C:
FF3F:
FF41:
FF42:
FF44:
FF46:
FF48:
FF49:
FF4A:
FF4C:
FF4E:
FF50:
FF51:
FF52:
FF54:
FF55:
FF57:
FF58:
FF59:
FF5C:
FF5F:
FF62:
FF65:
FF66:
FF69:
FF6B:
FF6D:
FF70:
FF73:
FF76:
FF78:
FF7A:
FF7B:
FF7D:
FF80:
FF82:
FF85:
FF87:
FF8A:
FF8C:
FF8D:
FF8E:
FF8F:
FF90:
FF91:
FF93:
FF95:
FF96:
FF98:
FF9A:
FF9C:
FF9E:

90
20
C5
F0
A9
20
A9
20
20
A9
4C
A5
48
A5
A6
A4
28
60
85
86
84
08
68
85
BA
86
D8
60
20
20
20
20
D8
20
A9
85
20
20
20
84
A0
88
30
D9
D0
20
A4
4C
A2
0A
0A
0A
0A
0A
26
26
CA
10
A5
D0
B5
95

F0
EC
2E
0D
C5
ED
D2
ED
ED
87
ED
48

FC

FD
FD
FD
FD

45
46
47
45
46
47
48
49
84
2F
93
89

FE
FB
FE
FE

3A
AA
33
67
C7
A7
34
17

FF
FD
FF
FF

E8
CC FF
F8
BE FF
34
73 FF
03

3E
3F
F8
31
06
3F
3D

1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076

PRERR

BELL
RESTORE
RESTR1

SAVE
SAV1

RESET

MON
MONZ

NXTITM
CHRSRCH

DIG

NXTBIT

NXTBAS

BCC
JSR
CMP
BEQ
LDA
JSR
LDA
JSR
JSR
LDA
JMP
LDA
PHA
LDA
LDX
LDY
PLP
RTS
STA
STX
STY
PHP
PLA
STA
TSX
STX
CLD
RTS
JSR
JSR
JSR
JSR
CLD
JSR
LDA
STA
JSR
JSR
JSR
STY
LDY
DEY
BMI
CMP
BNE
JSR
LDY
JMP
LDX
ASL
ASL
ASL
ASL
ASL
ROL
ROL
DEX
BPL
LDA
BNE
LDA
STA

RD3
RDBYTE
CHKSUM
BELL
#$C5
COUT
#$D2
COUT
COUT
#$87
COUT
STATUS
ACC
XREG
YREG
ACC
XREG
YREG

;LOOP UNTIL DONE
;READ CHKSUM BYTE
;GOOD, SOUND BELL AND RETURN
;PRINT "ERR", THEN BELL

;OUTPUT BELL AND RETURN
;RESTORE 6502 REG CONTENTS
; USED BY DEBUG SOFTWARE

;SAVE 6502 REG CONTENTS

STATUS
SPNT
SETNORM
INIT
SETVID
SETKBD
BELL
#$AA
PROMPT
GETLNZ
ZMODE
GETNUM
YSAV
#$17
MON
CHRTBL,Y
CHRSRCH
TOSUB
YSAV
NXTITM
#$03

;SET SCREEN MODE
; AND INIT KBD/SCREEN
; AS I/O DEV'S
;MUST SET HEX MODE!
;'*' PROMPT FOR MON
;READ A LINE
;CLEAR MON MODE, SCAN IDX
;GET ITEM, NON-HEX
; CHAR IN A-REG
; X-REG=0 IF NO HEX INPUT
;NOT FOUND, GO TO MON
;FIND CMND CHAR IN TEL
;FOUND, CALL CORRESPONDING
; SUBROUTINE

;GOT HEX DIG,
; SHIFT INTO A2
A2L
A2H
NXTBIT
MODE
NXTBS2
A2H,X
A1H,X

;LEAVE X=$FF IF DIG
;IF MODE IS ZERO
; THEN COPY A2 TO
; A1 AND A3

FFA0:
FFA2:
FFA3:
FFA5:
FFA7:
FFA9:
FFAB:
FFAD:
FFB0:
FFB1:
FFB3:
FFB5:
FFB7:
FFB9:
FFBB:
FFBD:
FFBE:
FFC0:
FFC1:
FFC4:
FFC5:
FFC7:
FFC9:
FFCB:
FFCC:
FFCD:
FFCE:
FFCF:
FFD0:
FFD1:
FFD2:
FFD3:
FFD4:
FFD5:
FFD6:
FFD7:
FFD8:
FFD9:
FFDA:
FFDB:
FFDC:
FFDD:
FFDE:
FFDF:
FFE0:
FFE1:
FFE2:
FFE3:
FFE4:
FFE5:
FFE6:
FFE7:
FFE8:
FFE9:
FFEA:
FFEB:
FFEC:
FFED:
FFEE:
FFEF:
FFF0:
FFF1:

95
E8
F0
D0
A2
86
86
B9
C8
49
C9
90
69
C9
B0
60
A9
48
B9
48
A5
A0
84
60
BC
B2
BE
ED
EF
C4
EC
A9
BB
A6
A4
06
95
07
02
05
F0
00
EB
93
A7
C6
99
B2
C9
BE
C1
35
8C
C3
96
AF
17
17
2B
1F
83
7F

41
F3
06
00
3E
3F
00 02
B0
0A
D3
88
FA
CD
FE
E3 FF
31
00
31

1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138

NXTBS2
GETNUM
NXTCHR

TOSUB

ZMODE
CHRTBL

SUBTBL

STA
INX
BEQ
BNE
LDX
STX
STX
LDA
INY
EOR
CMP
BCC
ADC
CMP
BCS
RTS
LDA
PHA
LDA
PHA
LDA
LDY
STY
RTS
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB

A3H,X
NXTBAS
NXTCHR
#$00
A2L
A2H
IN,Y
#$B0
#$0A
DIG
#$88
#$FA
DIG
#GO/256
SUBTBL,Y
MODE
#$00
MODE
$BC
$B2
$BE
$ED
$EF
$C4
$EC
$A9
$BB
$A6
$A4
$06
$95
$07
$02
$05
$F0
$00
$EB
$93
$A7
$C6
$99
BASCONT-1
USR-1
REGZ-1
TRACE-1
VFY-1
INPRT-1
STEPZ-1
OUTPRT-1
XBASIC-1
SETMODE-1
SETMODE-1
MOVE-1
LT-1
SETNORM-1
SETINV-1

;CLEAR A2
;GET CHAR

;IF HEX DIG, THEN

;PUSH HIGH-ORDER
; SUBR ADR ON STK
;PUSH LOW-ORDER
; SUBR ADR ON STK
;CLR MODE, OLD MODE
; TO A-REG
; GO TO SUBR VIA RTS
;F("CTRL-C")
;F("CTRL-Y")
;F("CTRL-E")
;F("T")
;F("V")
;F("CTRL-K")
;F("S")
;F("CTRL-P")
;F("CTRL-B")
;F("-")
;F("+")
;F("M") (F=EX-OR $B0+$89)
;F("<")
;F("N")
;F("I")
;F("L")
;F("W")
;F("G")
;F("R")
;F(":")
;F(".")
;F("CR")
;F(BLANK)

FFF2:
FFF3:
FFF4:
FFF5:
FFF6:
FFF7:
FFF8:
FFF9:
FFFA:
FFFB:
FFFC:
FFFD:
FFFE:
FFFF:

5D
CC
B5
FC
17
17
F5
03
FB
03
59
FF
86
FA

1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153 XQTNZ

DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
EQU

LIST-1
WRITE-1
GO-1
READ-1
SETMODE-1
SETMODE-1
CRMON-1
BLANK-1
NMI
NMI/256
RESET
RESET/256
IRQ
IRQ/256
$3C

;NMI VECTOR
;RESET VECTOR
;IRQ VECTOR

+-----------------------------------------------------------------------| TOPIC -- Apple II -- Red Book Sweet-16 listing
+------------------------------------------------------------------------

F689:
F68C:
F68D:
F68F:
F690:
F692:
F695:
F698:
F69A:
F69C:
F69E:
F6A0:
F6A1:
F6A3:
F6A5:
F6A7:
F6A8:
F6A9:
F6AA:
F6AC:
F6AE:
F6B0:
F6B1:
F6B2:
F6B3:
F6B4:
F6B7:
F6B8:
F6B9:
F6BB:
F6BD:
F6BF:
F6C2:
F6C3:

20
68
85
68
85
20
4C
E6
D0
E6
A9
48
A0
B1
29
0A
AA
4A
51
F0
86
4A
4A
4A
A8
B9
48
60
E6
D0
E6
BD
48
A5

4A FF
1E
1F
98 F6
92 F6
1E
02
1F
F7
00
1E
0F

1E
0B
1D

E1 F6
1E
02
1F
E4 F6
1D

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

***********************
*
*
*
APPLE-II PSEUDO
*
* MACHINE INTERPRETER *
*
*
*
COPYRIGHT 1977
*
* APPLE COMPUTER INC *
*
*
* ALL RIGHTS RESERVED *
*
S. WOZNIAK
*
*
*
***********************
R0L
R0H
R14H
R15L
R15H
SW16PAG
SAVE
RESTORE
SW16

SW16B
SW16C
SW16D

TOBR
TOBR2

EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
ORG
JSR
PLA
STA
PLA
STA
JSR
JMP
INC
BNE
INC
LDA
PHA
LDY
LDA
AND
ASL
TAX
LSR
EOR
BEQ
STX
LSR
LSR
LSR
TAY
LDA
PHA
RTS
INC
BNE
INC
LDA
PHA
LDA

$0
$1
$1D
$1E
$1F
$F7
$FF4A
$FF3F
$F689
SAVE
R15L
R15H
SW16C
SW16B
R15L
SW16D
R15H
#SW16PAG
#$0
(R15L),Y
#$F

(R15L),Y
TOBR
R14H

; TITLE "SWEET16 INTERPRETER"

;PRESERVE 6502 REG CONTENTS
;INIT SWEET16 PC
;FROM RETURN
; ADDRESS
;INTERPRET AND EXECUTE
;ONE SWEET16 INSTR.
;INCR SWEET16 PC FOR FETCH
;PUSH ON STACK FOR RTS
;FETCH INSTR
;MASK REG SPECIFICATION
;DOUBLE FOR TWO BYTE REGISTERS
;TO X REG FOR INDEXING
;NOW HAVE OPCODE
;IF ZERO THEN NON-REG OP
;INDICATE'PRIOR RESULT REG'
;OPCODE*2 TO LSB'S

OPTBL-2,Y
R15L
TOBR2
R15H
BRTBL,X
R14H

;TO Y REG FOR INDEXING
;LOW ORDER ADR BYTE
;ONTO STACK
;GOTO REG-OP ROUTINE
;INCR PC
;LOW ORDER ADR BYTE
;ONTO STACK FOR NON-REG OP
;'PRIOR RESULT REG' INDEX

F6C5:
F6C6:
F6C7:
F6C8:
F6C9:
F6CC:
F6CF:
F6D1:
F6D3:
F6D4:
F6D6:
F6D8:
F6D9:
F6DA:
F6DC:
F6DE:
F6E0:
F6E2:
F6E3:
F6E4:
F6E5:
F6E6:
F6E7:
F6E8:
F6E9:
F6EA:
F6EB:
F6EC:
F6ED:
F6EE:
F6EF:
F6F0:
F6F1:
F6F2:
F6F3:
F6F4:
F6F5:
F6F6:
F6F7:
F6F8:
F6F9:
F6FA:
F6FB:
F6FC:
F6FD:
F6FE:
F6FF:
F700:
F701:
F702:
F703:
F705:

4A
60
68
68
20
6C
B1
95
88
B1
95
98
38
65
85
90
E6
60
02
F9
04
9D
0D
9E
25
AF
16
B2
47
B9
51
C0
2F
C9
5B
D2
85
DD
6E
05
33
E8
70
93
1E
E7
65
E7
E7
E7
10
B5

F707:
F709:
F70B:
F70D:
F70E:
F710:
F712:
F714:
F716:

85
B5
85
60
A5
95
A5
95
60

3F FF
1E 00
1E
01
1E
00
1E
1E
02
1F

CA
00
00
01
01
00
00
01
01

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

RTNZ

SETZ

SET2
OPTBL
BRTBL

SET
LD
BK

ST

LSR
RTS
PLA
PLA
JSR
JMP
LDA
STA
DEY
LDA
STA
TYA
SEC
ADC
STA
BCC
INC
RTS
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
DFB
BPL
LDA
EQU
STA
LDA
STA
RTS
LDA
STA
LDA
STA
RTS

;PREPARE CARRY FOR BC, BNC.
;GOTO NON-REG OP ROUTINE
;POP RETURN ADDRESS
RESTORE
(R15L)
(R15L),Y
R0H,X

;RESTORE 6502 REG CONTENTS
;RETURN TO 6502 CODE VIA PC
;HIGH-ORDER BYTE OF CONSTANT

(R15L),Y
R0L,X

;LOW-ORDER BYTE OF CONSTANT

R15L
R15L
SET2
R15H

;ADD 2 TO PC

SET-1
RTN-1
LD-1
BR-1
ST-1
BNC-1
LDAT-1
BC-1
STAT-1
BP-1
LDDAT-1
BM-1
STDAT-1
BZ-1
POP-1
BNZ-1
STPAT-1
BM1-1
ADD-1
BNM1-1
SUB-1
BK-1
POPD-1
RS-1
CPR-1
BS-1
INR-1
NUL-1
DCR-1
NUL-1
NUL-1
NUL-1
SETZ
R0L,X
*-1
R0L
R0H,X
R0H

;1X
;0
;2X
;1
;3X
;2
;4X
;3
;5X
;4
;6X
;5
;7X
;6
;8X
;7
;9X
;8
;AX
;9
;BX
;A
;CX
;B
;DX
;C
;EX
;D
;FX
;E
;UNUSED
;F
;ALWAYS TAKEN

R0L
R0L,X
R0H
R0H,X

;Y-REG CONTAINS 1

;MOVE RX TO R0

;MOVE R0 TO RX

F717:
F719:
F71B:
F71D:
F71F:
F721:
F723:
F725:
F726:
F728:
F72A:
F72C:
F72E:
F730:
F732:
F734:
F737:
F739:
F73A:
F73D:
F73F:
F741:
F743:
F745:
F747:
F748:
F74B:
F74D:
F74F:
F752:
F755:
F757:
F759:
F75C:
F75F:
F761:
F763:
F766:
F768:
F76A:
F76C:
F76E:
F76F:
F771:
F772:
F774:
F776:
F779:
F77B:
F77D:
F780:
F781:
F783:
F785:
F786:
F788:
F78A:
F78C:
F78E:
F790:
F792:
F794:

A5
81
A0
84
F6
D0
F6
60
A1
85
A0
84
F0
A0
F0
20
A1
A8
20
A1
85
84
A0
84
60
20
A1
85
4C
20
A5
81
4C
20
A5
81
4C
B5
D0
D6
D6
60
A0
38
A5
F5
99
A5
F5
99
98
69
85
60
A5
75
85
A5
75
A0
F0
A5

00
00
00
1D
00
02
01
00
00
00
01
ED
00
06
66 F7
00
66 F7
00
00
01
00
1D
26
00
01
1F
17
01
00
1F
66
00
00
43
00
02
01
00

F7
F7
F7
F7
F7
F7

00
00
00
00 00
01
01
01 00
00
1D
00
00
00
01
01
00
E9
1E

119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

STAT
STAT2
STAT3
INR
INR2
LDAT

POP
POPD
POP2

POP3
LDDAT

STDAT

STPAT

DCR
DCR2
SUB
CPR

SUB2

ADD

BS

LDA
STA
LDY
STY
INC
BNE
INC
RTS
LDA
STA
LDY
STY
BEQ
LDY
BEQ
JSR
LDA
TAY
JSR
LDA
STA
STY
LDY
STY
RTS
JSR
LDA
STA
JMP
JSR
LDA
STA
JMP
JSR
LDA
STA
JMP
LDA
BNE
DEC
DEC
RTS
LDY
SEC
LDA
SBC
STA
LDA
SBC
STA
TYA
ADC
STA
RTS
LDA
ADC
STA
LDA
ADC
LDY
BEQ
LDA

R0L
(R0L,X)
#$0
R14H
R0L,X
INR2
R0H,X
(R0L,X)
R0L
#$0
R0H
STAT3
#$0
POP2
DCR
(R0L,X)
DCR
(R0L,X)
R0L
R0H
#$0
R14H

;STORE BYTE INDIRECT
;INDICATE R0 IS RESULT NEG
;INCR RX
;LOAD INDIRECT (RX)
;TO R0
;ZERO HIGH-ORDER R0 BYTE
;ALWAYS TAKEN
;HIGH ORDER BYTE = 0
;ALWAYS TAKEN
;DECR RX
;POP HIGH ORDER BYTE @RX
;SAVE IN Y-REG
;DECR RX
;LOW-ORDER BYTE
;TO R0
;INDICATE R0 AS LAST RESULT REG

LDAT
(R0L,X)
R0H
INR
STAT
R0H
(R0L,X)
INR
DCR
R0L
(R0L,X)
POP3
R0L,X
DCR2
R0H,X
R0L,X

;LOW-ORDER BYTE TO R0, INCR RX
;HIGH-ORDER BYTE TO R0

#$0

;RESULT TO R0
;NOTE Y-REG = 13*2 FOR CPR

R0L
R0L,X
R0L,Y
R0H
R0H,X
R0H,Y
#$0
R14H
R0L
R0L,X
R0L
R0H
R0H,X
#$0
SUB2
R15L

;INCR RX
;STORE INDIRECT LOW-ORDER
;BYTE AND INCR RX. THEN
;STORE HIGH-ORDER BYTE.
;INCR RX AND RETURN
;DECR RX
;STORE R0 LOW BYTE @RX
;INDICATE R0 AS LAST RSLT REG
;DECR RX

;R0-RX TO RY

;LAST RESULT REG*2
;CARRY TO LSB

;R0+RX TO R0
;R0 FOR RESULT
;FINISH ADD
;NOTE X-REG IS 12*2!

F796:
F799:
F79B:
F79E:
F79F:
F7A1:
F7A3:
F7A5:
F7A6:
F7A8:
F7AA:
F7AB:
F7AD:
F7AF:
F7B0:
F7B2:
F7B3:
F7B4:
F7B5:
F7B7:
F7B9:
F7BA:
F7BB:
F7BC:
F7BE:
F7C0:
F7C1:
F7C2:
F7C3:
F7C5:
F7C7:
F7C9:
F7CA:
F7CB:
F7CC:
F7CE:
F7D0:
F7D2:
F7D3:
F7D4:
F7D5:
F7D7:
F7D9:
F7DB:
F7DD:
F7DE:
F7DF:
F7E0:
F7E2:
F7E4:
F7E6:
F7E8:
F7E9:
F7EB:
F7EE:
F7F0:
F7F2:
F7F5:
F7F7:
F7F9:
F7FA:

20
A5
20
18
B0
B1
10
88
65
85
98
65
85
60
B0
60
0A
AA
B5
10
60
0A
AA
B5
30
60
0A
AA
B5
15
F0
60
0A
AA
B5
15
D0
60
0A
AA
B5
35
49
F0
60
0A
AA
B5
35
49
D0
60
A2
20
A1
85
20
A1
85
60
4C

19 F7
1F
19 F7
0E
1E
01
1E
1E
1F
1F
EC

01
E8

01
E1

00
01
D8

00
01
CF

00
01
FF
C4

00
01
FF
B9
18
66 F7
00
1F
66 F7
00
1E
C7 F6

181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241

BR
BNC
BR1
BR2

BNC2
BC
BP

BM

BZ

BNZ

BM1

BNM1

NUL
RS

RTN

JSR
LDA
JSR
CLC
BCS
LDA
BPL
DEY
ADC
STA
TYA
ADC
STA
RTS
BCS
RTS
ASL
TAX
LDA
BPL
RTS
ASL
TAX
LDA
BMI
RTS
ASL
TAX
LDA
ORA
BEQ
RTS
ASL
TAX
LDA
ORA
BNE
RTS
ASL
TAX
LDA
AND
EOR
BEQ
RTS
ASL
TAX
LDA
AND
EOR
BNE
RTS
LDX
JSR
LDA
STA
JSR
LDA
STA
RTS
JMP

STAT2
R15H
STAT2

;PUSH LOW PC BYTE VIA R12

BNC2
(R15L),Y
BR2

;NO CARRY TEST
;DISPLACEMENT BYTE

R15L
R15L

;ADD TO PC

;PUSH HIGH-ORDER PC BYTE

R15H
R15H
BR

R0H,X
BR1

;DOUBLE RESULT-REG INDEX
;TO X REG FOR INDEXING
;TEST FOR PLUS
;BRANCH IF SO
;DOUBLE RESULT-REG INDEX

R0H,X
BR1

;TEST FOR MINUS
;DOUBLE RESULT-REG INDEX

R0L,X
R0H,X
BR1

;TEST FOR ZERO
;(BOTH BYTES)
;BRANCH IF SO
;DOUBLE RESULT-REG INDEX

R0L,X
R0H,X
BR1

;TEST FOR NON-ZERO
;(BOTH BYTES)
;BRANCH IF SO
;DOUBLE RESULT-REG INDEX

R0L,X
R0H,X
#$FF
BR1

;CHECK BOTH BYTES
;FOR $FF (MINUS 1)
;BRANCH IF SO
;DOUBLE RESULT-REG INDEX

R0L,X
R0H,X
#$FF
BR1
#$18
DCR
(R0L,X)
R15H
DCR
(R0L,X)
R15L
RTNZ

;CHECK BOTH BYTES FOR NO $FF
;BRANCH IF NOT MINUS 1
;12*2 FOR R12 AS STACK POINTER
;DECR STACK POINTER
;POP HIGH RETURN ADDRESS TO PC
;SAME FOR LOW-ORDER BYTE

+-----------------------------------------------------------------------| TOPIC -- Apple II -- WOZPAK Sweet-16 article by Steve Wozniak
+-----------------------------------------------------------------------SWEET 16: A Pseudo 16 Bit Microprocessor
by Steve Wozniak
Description:
-----------While writing APPLE BASIC for a 6502 microprocessor, I repeatedly
encountered a variant of MURPHY'S LAW. Briefly stated, any routine
operating on 16-bit data will require at least twice the code that
it should. Programs making extensive use of 16-bit pointers (such
as compilers, editors, and assemblers) are included in this
category. In my case, even the addition of a few double-byte
instructions to the 6502 would have only slightly alleviated the
problem. What I really needed was a 6502/RCA 1800 hybrid - an
abundance of 16-bit registers and excellent pointer capability.
My solution was to implement a non-existant (meta) 16-bit
processor in software, interpreter style, which I call SWEET 16.
SWEET 16 is based on sixteen 16-bit registers (R0-15), which are
actually 32 memory locations. R0 doubles as the SWEET 16
accumulator (ACC), R15 as the program counter (PC), and R14 as the
status register. R13 holds compare instruction results and R12 is
the subroutine return stack pointer if SWEET 16 subroutines are
used. All other SWEET 16 registers are at the user's unrestricted
disposal.
SWEET 16 instructions fall into register and non-register categories.
The register ops specify one of the sixteen registers to be used as
either a data element or a pointer to data in memory, depending
on the specific instruction. For example INR R5 uses R5 as data
and ST @R7 uses R7 as a pointer to data in memory. Except for the
SET instruction, register ops take one byte of code each. The
non-register ops are primarily 6502 style branches with the second
byte specifying a +/-127 byte displacement relative to the address
of the following instruction. Providing that the prior register op
result meets a specified branch condition, the displacement is
added to the SWEET 16 PC, effecting a branch.
SWEET 16 is intended as a 6502 enhancement package, not a stand
alone processor. A 6502 program switches to SWEET 16 mode with a
subroutine call and subsequent code is interpreted as SWEET 16
instructions. The nonregister op RTN returns the user program to
6502 mode after restoring the internal register contents
(A, X, Y, P, and S). The following example illustrates how to use
SWEET 16.
300
303
305
307

B9
C9
D0
20

00 02
CD
09
89 F6

LDA
CMP
BNE
JSR

IN,Y
#"M"
NOMOVE
SW16

;get a char
;"M" for move
;No. Skip move
;Yes, call SWEET 16

30A
30B
30C
30D
30F
310
312
314

41
52
F3
07 FB
00
C9 C5
D0 13
C8

NOTE:

MLOOP

NOMOVE

LD
ST
DCR
BNZ
RTN
CMP
BEQ
INY

@R1
@R2
R3
MLOOP
#"E"
EXIT

;R1 holds source
;R2 holds dest. addr.
;Decr. length
;Loop until done
;Return to 6502 mode.
;"E" char?
;Yes, exit
;No, cont.

Registers A, X, Y, P, and S are not disturbed by SWEET 16.

Instruction Descriptions:
------------------------The SWEET 16 opcode listing is short and uncomplicated. Excepting
relative branch displacements, hand assembly is trivial. All
register opcodes are formed by combining two Hex digits, one for the
opcode and one to specify a register. For example, opcodes 15 and
45 both specify register R5 while codes 23, 27, and 29 are all ST
ops. Most register ops are assigned in complementary pairs to
facilitate remembering them. Therefore, LD ans ST are opcodes 2N
and 3N respectively, while LD @ and ST @ are codes 4N and 5N.
Opcodes 0 to C (Hex) are assigned to the thirteen non-register ops.
Except for RTN (opcode 0), BK (0A), and RS (0B), the non register
ops are 6502 style branches. The second byte of a branch instruction
contains a +/-127 byte displacement value (in two's complement form)
relative to the address of the instruction immediately following
the branch.
If a specified branch condition is met by the prior register op
result, the displacement is added to the PC effecting a branch.
Except for the BR (Branch always) and BS (Branch to a Subroutine),
the branch opcodes are assigned in complementary pairs, rendering
them easily remembered for hand coding. For example, Branch if Plus
and Branch if Minus are opcodes 4 and 5 while Branch if Zero and
Branch if NonZero are opcodes 6 and 7.
SWEET 16 Opcode Summary:
-----------------------Register OPS1n
2n
3n
4n
5n
6n
7n
8n
9n
An
Bn
Cn
Dn

SET
LD
ST
LD
ST
LDD
STD
POP
STP
ADD
SUB
POPD
CPR

Rn
Rn
Rn
@Rn
@Rn
@Rn
@Rn
@Rn
@Rn
Rn
Rn
@Rn
Rn

Constant (Set)
(Load)
(Store)
(Load Indirect)
(Store Indirect)
(Load Double Indirect)
(Store Double Indirect)
(Pop Indirect)
(Store POP Indirect)
(Add)
(Sub)
(Pop Double Indirect)
(Compare)

En
Fn

INR
DCR

Rn
Rn

(Increment)
(Decrement)

Non-register OPS00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F

RTN
BR
BNC
BC
BP
BM
BZ
BNZ
BM1
BNM1
BK
RS
BS

ea
ea
ea
ea
ea
ea
ea
ea
ea
ea

(Return to 6502 mode)
(Branch always)
(Branch if No Carry)
(Branch if Carry)
(Branch if Plus)
(Branch if Minus)
(Branch if Zero)
(Branch if NonZero)
(Branch if Minus 1)
(Branch if Not Minus 1)
(Break)
(Return from Subroutine)
(Branch to Subroutine)
(Unassigned)
(Unassigned)
(Unassigned)

Register Instructions:
---------------------SET:
SET Rn,Constant

[ 1n Low High ]

The 2-byte constant is loaded into Rn (n=0 to F, Hex) and
branch conditions set accordingly. The carry is cleared.
EXAMPLE:
15 34 A0

SET

R5

$A034

;R5 now contains $A034

LOAD:
LD Rn

[ 2n ]

The ACC (R0) is loaded from Rn and branch conditions set
according to the data transferred. The carry is cleared and
contents of Rn are not disturbed.
EXAMPLE:
15 34 A0
25

SET
LD

R5
R5

$A034

;ACC now contains $A034

STORE:
ST Rn

[ 3n ]

The ACC is stored into Rn and branch conditions set according
to the data transferred. The carry is cleared and the ACC
contents are not disturbed.

EXAMPLE:
25
36

LD
ST

R5
R6

;Copy the contents
;of R5 to R6

LOAD INDIRECT:
LD @Rn

[ 4n ]

The low-order ACC byte is loaded from the memory location
whose address resides in Rn and the high-order ACC byte is
cleared. Branch conditions reflect the final ACC contents
which will always be positive and never minus 1. The carry
is cleared. After the transfer, Rn is incremented by 1.
EXAMPLE
15 34 A0
45

SET
LD

R5
@R5

$A034

;ACC is loaded from memory
;location $A034
;R5 is incr to $A035

STORE INDIRECT:
ST @Rn

[ 5n ]

The low-order ACC byte is stored into the memory location
whose address resides in Rn. Branch conditions reflect the
2-byte ACC contents. The carry is cleared. After the transfer
Rn is incremented by 1.
EXAMPLE:
15 34 A0
16 22 90
45
56

SET
SET
LD
ST

R5
R6
@R5
@R6

$A034
$9022

;Load pointers R5, R6 with
;$A034 and $9022
;Move byte from $A034 to $9022
;Both ptrs are incremented

LOAD DOUBLE-BYTE INDIRECT:
LDD @Rn

[ 6n ]

The low order ACC byte is loaded from memory location whose
address resides in Rn, and Rn is then incremented by 1. The
high order ACC byte is loaded from the memory location whose
address resides in the incremented Rn, and Rn is again
incremented by 1. Branch conditions reflect the final ACC
contents. The carry is cleared.
EXAMPLE:
15 34 A0
65

SET
LDD

R5
@R6

$A034

;The low-order ACC byte is loaded
;from $A034, high-order from
;$A035, R5 is incr to $A036

STORE DOUBLE-BYTE INDIRECT:
STD @Rn

[ 7n ]

The low-order ACC byte is stored into memory location
whose address resides in Rn, and Rn is the incremented
by 1. The high-order ACC byte is stored into the memory
location whose address resides in the incremented Rn, and Rn
is again incremented by 1. Branch conditions reflect the ACC
contents which are not disturbed. The carry is cleared.
EXAMPLE:
15 34 A0
16 22 90
65
76

SET
SET
LDD
STD

R5
R6
@R5
@R6

$A034
$9022

;Load pointers R5, R6
;with $A034 and $9022
;Move double byte from
;$A034-35 to $9022-23.
;Both pointers incremented by 2.

POP INDIRECT:
POP @Rn

[ 8n ]

The low-order ACC byte is loaded from the memory location
whose address resides in Rn after Rn is decremented by 1,
and the high order ACC byte is cleared. Branch conditions
reflect the final 2-byte ACC contents which will always be
positive and never minus one. The carry is cleared. Because
Rn is decremented prior to loading the ACC, single byte
stacks may be implemented with the ST @Rn and POP @Rn ops
(Rn is the stack pointer).
EXAMPLE:
15
10
55
10
55
10
55
85
85
85

34 A0
04 00
05 00
06 00

SET
SET
ST
SET
ST
SET
ST
POP
POP
POP

R5
R0
@R5
R0
@R5
R0
@R5
@R5
@R5
@R5

$A034
4
5
6

;Init stack pointer
;Load 4 into ACC
;Push 4 onto stack
;Load 5 into ACC
;Push 5 onto stack
;Load 6 into ACC
;Push 6 onto stack
;Pop 6 off stack into ACC
;Pop 5 off stack
;Pop 4 off stack

STORE POP INDIRECT:
STP @Rn

[ 9n ]

The low-order ACC byte is stored into the memory location
whose address resides in Rn after Rn is decremented by 1.
Branch conditions will reflect the 2-byte ACC contents which
are not modified. STP @Rn and POP @Rn are used together to
move data blocks beginning at the greatest address and
working down. Additionally, single-byte stacks may be
implemented with the STP @Rn ops.

EXAMPLE:
14 34 A0
15 22 90
84
95
84
95

SET
SET
POP
STP
POP
STP

R4
R5
@R4
@R5
@R4
@R5

$A034
$9022

;Init pointers
;Move byte from
;$A033 to $9021
;Move byte from
;$A032 to $9020

ADD:
ADD Rn

[ An ]

The contents of Rn are added to the contents of ACC (R0),
and the low-order 16 bits of the sum restored in ACC. the
17th sum bit becomes the carry and the other branch
conditions reflect the final ACC contents.
EXAMPLE:
10 34 76
11 27 42
A1
A0

SET
SET
ADD
ADD

R0
R1
R1
R0

$7634
$4227

;Init R0 (ACC) and R1
;Add R1 (sum=B85B, C clear)
;Double ACC (R0) to $70B6
;with carry set.

SUBTRACT:
SUB Rn

[ Bn ]

The contents of Rn are subtracted from the ACC contents by
performing a two's complement addition:
ACC = ACC + Rn + 1
The low order 16 bits of the subtraction are restored in the
ACC, the 17th sum bit becomes the carry and other branch
conditions reflect the final ACC contents. If the 16-bit
unsigned ACC contents are greater than or equal to the 16-bit
unsigned Rn contents, then the carry is set, otherwise it is
cleared. Rn is not disturbed.
EXAMPLE:
10 34 76
11 27 42
B1

SET
SET
SUB

R0
R1
R1

B0

SUB

R0

$7634
$4227

;Init R0 (ACC)
;and R1
;subtract R1
;(diff=$340D with c set)
;clears ACC. (R0)

POP DOUBLE-BYTE INDIRECT:
POPD @Rn

[ Cn ]

Rn is decremented by 1 and the high-order ACC byte is loaded

from the memory location whose address now resides in Rn. Rn is
again decremented by 1 and the low-order ACC byte is loaded from
the corresponding memory location. Branch conditions reflect the
final ACC contents. The carry is cleared. Because Rn is
decremented prior to loading each of the ACC halves, double-byte
stacks may be implemented with the STD @Rn and POPD @Rn ops
(Rn is the stack pointer).
EXAMPLE:
15 34 A0
10 12 AA
75
10 34 BB
75
C5
C5

SET
SET
STD
SET
STD
POPD
POPD

R5
R0
@R5
R0
@R5
@R5
@R5

$A034
$AA12
$BB34

;Init stack pointer
;Load $AA12 into ACC
;Push $AA12 onto stack
;Load $BB34 into ACC
;Push $BB34 onto stack
;Pop $BB34 off stack
;Pop $AA12 off stack

COMPARE:
CPR Rn

[ Dn ]

The ACC (R0) contents are compared to Rn by performing the
bit binary subtraction ACC-Rn and storing the low order 16
difference bits in R13 for subsequent branch tests. If the
bit unsigned ACC contents are greater than or equal to the
bit unsigned Rn contents, then the carry is set, otherwise
is cleared. No other registers, including ACC and Rn, are
disturbed.

16
16
16
it

EXAMPLE:
15 34 A0
16 BF A0
B0
75

R5
R6
R0
@R5

LD
CPR
BNC

R5
R6
LOOP1

LOOP1

SET
SET
SUB
STD

25
D6
02 FA

$A034
$A0BF

;Pointer to memory
;Limit address
;Zero data
;clear 2 locations
;increment R5 by 2
;Compare pointer R5
;to limit R6
;loop if C clear

INCREMENT:
INR Rn

[ En ]

The contents of Rn are incremented by 1. The carry is cleared
and other branch conditions reflect the incremented value.
EXAMPLE:
15 34 A0
B0
55
E5
55

SET
SUB
ST
INR
ST

R5
R0
@R5
R5
@R5

$A034

;(Pointer)
;Zero to R0
;Clr Location $A034
;Incr R5 to $A036
;Clrs location $A036
;(not $A035)

DECREMENT:
DCR Rn

[ Fn ]

The contents of Rn are decremented by 1. The carry is cleared
and other branch conditions reflect the decremented value.
EXAMPLE:
15 34 A0
14 09 00
B0
55
F4
07 FC

(Clear 9 bytes beginning at location A034)

LOOP2

SET
SET
SUB
ST
DCR
BNZ

R5
$A034
R4
9
R0
@R5
R4
LOOP2

;Init pointer
;Init counter
;Zero ACC
;Clear a mem byte
;Decrement count
;Loop until Zero

Non-Register Instructions:
-------------------------RETURN TO 6502 MODE:
RTN 00
Control is returned to the 6502 and program execution continues
at the location immediately following the RTN instruction. the
6502 registers and status conditions are restored to their
original contents (prior to entering SWEET 16 mode).
BRANCH ALWAYS:
BR ea

[ 01 d ]

An effective address (ea) is calculated by adding the signed
displacement byte (d) to the PC. The PC contains the address
of the instruction immediately following the BR, or the address
of the BR op plus 2. The displacement is a signed two's
complement value from -128 to +127. Branch conditions are not
changed.
NOTE: The effective address calculation is identical to that
for 6502 relative branches. The Hex add & Subtract features of
the APPLE ][ monitor may be used to calculate displacements.
d = $80
d = $81

ea = PC + 2 - 128
ea = PC + 2 - 127

d = $FF
d = $00
d = $01

ea = PC + 2 - 1
ea = PC + 2 + 0
ea = PC + 2 + 1

d = $7E
d = $7F

ea = PC + 2 + 126
ea = PC + 2 + 127

EXAMPLE:

$300:

01 50

BR $352

BRANCH IF NO CARRY:
BNC ea

[ 02 d ]

A branch to the effective address is taken only is the carry is
clear, otherwise execution resumes as normal with the next
instruction. Branch conditions are not changed.
BRANCH IF CARRY SET:
BC ea

[ 03 d ]

A branch is effected only if the carry is set. Branch conditions
are not changed.
BRANCH IF PLUS:
BP ea

[ 04 d ]

A branch is effected only if the prior 'result' (or most
recently transferred dat) was positive. Branch conditions are
not changed.
EXAMPLE: (Clear mem from A034 to A03F)
15 34 A0
14 3F A0
B0
55

LOOP3

24
D5
04 FA

SET
SET
SUB
ST

R5
R4
R0
@R5

LD
CPR
BP

R4
R5
LOOP3

$A034
$A03F

;Init pointer
;Init limit
;Clear mem byte
;Increment R5
;Compare limit
;to pointer
;Loop until done

BRANCH IF MINUS:
BM ea

[ 05 d ]

A branch is effected only if prior 'result' was minus (negative,
MSB = 1). Branch conditions are not changed.
BRANCH IF ZERO:
BZ ea

[ 06 d ]

A Branch is effected only if the prior 'result' was zero. Branch
conditions are not changed.
BRANCH IF NONZERO
BNZ ea

[ 07 d ]

A branch is effected only if the priot 'result' was non-zero
Branch conditions are not changed.

BRANCH IF MINUS ONE
BM1 ea

[ 08 d ]

A branch is effected only if the prior 'result' was minus one
($FFFF Hex). Branch conditions are not changed.
BRANCH IF NOT MINUS ONE
BNM1 ea

[ 09 d ]

A branch effected only if the prior 'result' was not minus 1.
Branch conditions are not changed.
BREAK:
BK

[ 0A ]

A 6502 BRK (break) instruction is executed. SWEET 16 may be
re-entered non destructively at SW16d after correcting the
stack pointer to its value prior to executing the BRK.
RETURN FROM SWEET 16 SUBROUTINE:
RS

[ 0B ]

RS terminates execution of a SWEET 16 subroutine and returns to the
SWEET 16 calling program which resumes execution (in SWEET 16 mode).
R12, which is the SWEET 16 subroutine return stack pointer, is
decremented twice. Branch conditions are not changed.
BRANCH TO SWEET 16 SUBROUTINE:
BS ea

[ 0c d ]

A branch to the effective address (PC + 2 + d) is taken and
execution is resumed in SWEET 16 mode. The current PC is pushed
onto a SWEET 16 subroutine return address stack whose pointer is
R12, and R12 is incremented by 2. The carry is cleared and branch
conditions set to indicate the current ACC contents.
EXAMPLE: (Calling a 'memory move' subroutine to move A034-A03B
to 3000-3007)
15
14
16
0C
45
56
24
D5
04
0B

34 A0
3B A0
00 30
15

FA

MOVE

SET
SET
SET
BS
LD
ST
LD
CPR
BP
RS

R5
$A034
R4
$A03B
R6
$3000
MOVE
@R5
@R6
R4
R5
MOVE

;Init
;Init
;Init
;Call
;Move
;byte

pointer 1
limit 1
pointer 2
move subroutine
one

;Test if done
;Return

Theory of Operation:
-------------------SWEET 16 execution mode begins with a subroutine call to SW16. All
6502 registers are saved at this time, to be restored when a SWEET
16 RTN instruction returns control to the 6502. If you can tolerate
indefinate 6502 register contents upon exit, approximately 30 usec
may be saved by entering at SW16 + 3. Because this might cause an
inadvertant switch from Hex to Decimal mode, it is advisable to enter
at SW16 the first time through.
After saving the 6502 registers, SWEET 16 initializes its PC (R15)
with the subroutine return address off the 6502 stack. SWEET 16's
PC points to the location preceding the next instruction to be
executed. Following the subroutine call are 1-,2-, and 3-byte
SWEET 16 instructions, stored in ascending memory like 6502
instructions. the main loop at SW16B repeatedly calls the 'execute
instruction' routine to execute it.
Subroutine SW16C increments the PC (R15) and fetches the next opcode,
which is either a register op of the form OP REG with OP between 1
and 15 or a non-register op of the form 0 OP with OP between 0 and 13.
Assuming a register op, the register specification is doubled to
account for the 3 byte SWEET 16 registers and placed in the X-reg
for indexing. Then the instruction type is determined. Register ops
place the doubled register specification in the high order byte of
R14 indicating the 'prior result register' to subsequent branch
instructions. Non-register ops treat the register specifcation
(right-hand half-byte) as their opcode, increment the SWEET 16 PC
to point at the displacement byte of branch instructions, load the
A-reg with the 'prior result register' index for branch condition
testing, and clear the Y-reg.
When is an RTS really a JSR?
---------------------------Each instruction type has a corresponding subroutine. The subroutine
entry points are stored in a table which is directly indexed into by
the opcode. By assigning all the entries to a common page, only a
single byte to address need be stored per routine. The 6502 indirect
jump might have been used as follows to transfer control to the
appropriate subroutine.
LDA
STA
LDA
STA
JMP

#ADRH
IND+1
OPTBL,X
IND
(IND)

;High-order byte.
;Low-order byte.

To save code, the subroutine entry address (minus 1) is pushed onto
the stack, high-order byte first. A 6502 RTS (return from subroutine)
is used to pop the address off the stack and into the 6502 PC (after
incrementing by 1). The net result is that the desired subroutine is
reached by executing a subroutine return instruction!
Opcode Subroutines:
------------------The register op routines make use of the 6502 'zero page indexed by X'
and 'indexed by X direct' addressing modes to access the specified
registers and indirect data. The 'result' of most register ops is left
in the specified register and can be sensed by subsequent branch
instructions, since the register specification is saved in the highorder byte of R14. This specification is changed to indicate R0 (ACC)
for ADD and SUB instructions and R13 for the CPR (compare) instruction.
Normally the high-order R14 byte holds the 'prior result register'
index times 2 to account for the 2-byte SWEET 16 registers and the
LSB is zero. If ADD, SUB, or CPR instructions generate carries, then
this index is incremented, setting the LSB.
The SET instruction increments the PC twice, picking up data bytes in
the specified register. In accordance with 6502 convention, the
low-order data byte precedes the high-order byte.
Most SWEET 16 non-register ops are relative branches. The corresponding
subroutines determine whether or not the 'prior result' meets the
specified branch condition and if so, update the SWEET 16 PC by adding
the displacement value (-128 to +127 bytes).
The RTN op restores the 6502 register contents, pops the subroutine
return stack and jumps indirect through the SWEET 16 PC. This transfers
control to the 6502 at the instruction immediately following the
RTN instruction.
The BK op actually executes a 6502 break instruction (BRK), transferring
control to the interrupt handler.
Any number of subroutine levels may be implemented within SWEET 16 code
via the BS (Branch to Subroutine) and RS (Return from Subroutine)
instructions. The user must initialize and otherwise not disturb R12 if
the SWEET 16 subroutine capability is used since it is utilized as the
automatic return stack pointer.
Memory Allocation:
-----------------The only storage that must be allocated for SWEET 16 variables are 32
consecutive locations in page zero for the SWEET 16 registers, four
locations to save the 6502 register contents, and a few levels of the
6502 subroutine return address stack. if you don't need to preserve the
6502 register contents, delete the SAVE and RESTORE subroutines and the
corresponding subroutine calls. This will free the four page zero
locations ASAV, XSAV, YSAV, and PSAV.

User Modifications:
------------------You may wish to add some of your own instructions to this implementation of
SWEET 16. If you use the unassigned opcodes $0E and $0F, remember that
SWEET 16 treats these as 2-byte instructions. You may wish to handle the
break instruction as a SWEET 16 call, saving two bytes of code each time
you transfer into SWEET 16 mode. Or you may wish to use the SWEET 16
BK (break) op as a 'CHAROUT' call in the interrupt handler. You can perform
absolute jumps within SWEET 16 by loading the ACC (R0) with the address
you wish to jump to (minus 1) and executing a ST R15 instruction.

+-----------------------------------------------------------------------| TOPIC -- Apple II -- WOZPAK Sweet-16 article by Dick Sedgewick
+-----------------------------------------------------------------------SWEET 16 - INTRODUCTION
by Dick Sedgewick
Sweet 16 is probably the least used and least understood seed
in the Apple ][.
In exactly the same sense that Integer and Applesoft Basics
are languages, SWEET 16 is a language. Compared to the
Basics, however, it would be classed as low level with a
strong likeness to conventional 6502 Assembly language.
To use SWEET 16, you must learn the language - and to quote
"WOZ", "The opcode list is short and uncomplicated". "WOZ"
(Steve Wozniak), of course is Mr. Apple, and the creator of
SWEET 16.
SWEET 16 is ROM based in every Apple ][ from $F689 to $F7FC.
It has it's own set of opcodes and instruction sets, and uses
the SAVE and RESTORE routines from the Apple Monitor to
preserve the 6502 registers when in use, allowing SWEET 16 to
be used as a subroutine.
It uses the first 32 locations on zero page to set up its 16
double byte registers, and is therefore not compatible with
Applesoft Basic without some additional efforts.
The original article, "SWEET 16: The 6502 Dream Machine",
first appeared in Byte Magazine, November 1977 and later in
the original "WOZ PAK". The article is included here and
again as test material to help understand the use and
implementation of SWEET 16.
Examples of the use of SWEET 16 are found in the Programmer's
Aid #1, in the Renumber, Append, and Relocate programs. The
Programmer's Aid Operating Manual contains complete source
assembly listings, indexed on page 65.
The demonstration program is written to be introductory and
simple, consisting of three parts:
1. Integer Basic Program
2. Machine Language Subroutine
3. SWEET 16 Subroutine
The task of the program will be to move data. Parameters of
the move will be entered in the Integer Basic Program.
The "CALL 768" ($300) at line 120, enters a 6502 machine
language subroutine having the single purpose of entering
SWEET 16 and subsequently returning to BASIC (addresses $300,

$301, $302, and $312 respectively). The SWEET 16 subroutine
of course performs the move, and is entered at Hex locations
$303 to $311 (see listing Number 3).
After the move, the screen will display three lines of data,
each 8 bytes long, and await entry of a new set of parameters.
The three lines of data displayed on the screen are as
follows:
Line 1: The first 8 bytes of data starting at $800, which
is the fixed source data to be moved (in this
case, the string A$).
Line 2: The first 8 bytes of data starting at the hex
address entered as the destination of the
move (high order byte only).
Line 3: The first 8 bytes of data starting at $0000 (the
first four SWEET 16 registers).
The display of 8 bytes of data was chosen to simplify the
illustration of what goes on.
Integer Basic has its own way of recording the string A$.
Because the name chosen for the string "A$" is stored in 2
bytes, a total of five housekeeping bytes precede the data
entered as A$, leaving only three additional bytes available
for display. Integer Basic also adds a housekeeping byte at
the end of a string, known as the "string terminator".
Consequently, for convenience purposes of the display, and to
see the string terminator as the 8th byte, the string data
entered via the keyboard should be limited to two characters,
and will appear as the 6th and 7th bytes. Additionally,
parameters to be entered include the number of bytes to be
moved. A useful range for this demonstration would be 1-8
inclusive, but of course 1-255 will work.
Finally, the starting address of the destination of the move
must be entered. Again, for simplicity, only the high-order
byte is entered, and the program allows a choice between
Decimal 9 and high-order byte of program pointer 1, to avoid
unnecessary problems (in this demonstration enter a decimal
number between 9 and 144 for a 48K APPLE).
The 8 bytes of data displayed starting at $00 will enable one
to observe the condition of the SWEET 16 registers after a
move has been accomplished, and thereby understand how the
SWEET 16 program works.
From the article "SWEET 16: A 6502 Dream Machine", remember
that SWEET 16 can establish 16 double byte registers starting
at $00. This means that SWEET 16 can use the first 32
addresses on zero page.
The "events" occurring in this demonstration program can be

studied in the first four SWEET 16 registers. Therefore, the
8 byte display starting at $0000 is large enough for this
purpose.
These four registers are established as R0, R1, R2, R3:
R0
R1
R2
R3
.
.
.
R14
R15

$0000
$0002
$0004
$0006

&
&
&
&

0001
0003
0005
0007

-SWEET 16 accumulator
-Source address
-Destination address
-Number of bytes to move

$001C
$001E

&
&

001D
001F

-Prior result register
-SWEET 16 Program counter

Additionally, an examination of registers R14 and R15 will
extend and understanding of SWEET 16, as fully explained in
the "WOZ" text. Notice that the high order byte of R14,
(located at $1D) contains $06, and is the doubled register
specification (3X2=$06). R15, the SWEET 16 program counter
contains the address of the next operation as it did for each
step during execution of the program, which was $0312 when
execution ended and the 6502 code resumed.
To try a sample run, enter the Integer Basic program as shown
in Listing #1. Of course, REM statements can be omitted, and
line 10 is only helpful if the machine code is to be stored
on disk. Listing #2 must also be entered starting at $300.
NOTE: A 6502 disassembly does not look like listing #3, but
the SOURCEROR disassembler would create a correct disassembly.
Enter "RUN" and hit RETURN
Enter "12" and hit RETURN (A$ - A$ string data)
Enter "18" and hit RETURN (high-order byte of destination)
The display should appear as follows:
$0800-C1 40 00 10 08 B1 B2 1E
$0A00-C1 40 00 10 08 B1 B2 1E
$0000-1E 00 08 08 08 0A 00 00

(SOURCE)
(Dest.)
(SWEET 16)

NOTE: The 8 bytes stored at $0A00 are identical to the 8
bytes starting at $0800, indicating that an accurate move of 8
bytes length has been made. They are moved one byte at a
time starting with token C1 and ending with token 1E. If
moving less than 8 bytes, the data following the moved data
would be whatever existed at those locations before the move.
The bytes have the following significance:
A Token$
C1
40
---------

00
----

10
08
--------

B1
B2
---------

1E
--

|
VN

|
DSP

|
NVA

|
DATA

|
DATA

String
Terminator

The SWEET 16 registers are as shown:
low
high
$0000 1E
00
---------|
register
R0
(acc)

low
high
08
08
---------|
register
R1
(source)

low
high
08
0A
---------|
register
R2
(dest)

low
high
00
00
---------|
register
R3
(#bytes)

The low order byte of R0, the SWEET 16 accumulator, has $1E
in it, the last byte moved (the 8th).
The low order byte of the source register R1 started as $00
and was incremented eight times, once for each byte of moved
data.
The high order byte of the destination register R2 contains
$0A, which was entered at 10 (the variable) and poked into
the SWEET 16 code. The low-order byte of R2 was incremented
exactly like R1.
Finally, register R3, the register that stores the number of
bytes to be moved, has been poked to 8 (the variable B) and
decremented eight times as each byte got moved, ending up
$0000.
By entering character strings and varying the number of bytes
to be moved, the SWEET 16 registers can be observed and the
contents predicted.
Working with this demonstration program, and study of the
text material will enable you to write SWEET 16 programs that
perform additional 16 bit manipulations. The unassigned
opcodes mentioned in the "WOZ Dream Machine" article should
present a most interesting opportunity to "play".
SWEET 16 as a language - or tool - opens a new direction to
Apple ][ owners without spending a dime, and it's been there
all the time.
"Apple-ites" who desire to learn machine language programming,
can use SWEET 16 as a starting point. With this text
material to use, and less opcodes to learn, a user can
quickly be effective.
Listing #1
>List

10
20
30

PRINT "[D]BLOAD SWEET": REM CTRL D
CALL - 936: DIM A $ (10)
INPUT "ENTER STRING A $ " , A $

40
50
60
70
80
90
100
110
120
130
140
150
160
170

INPUT "ENTER # BYTES " , B
IF NOT B THEN 40 : REM AT LEAST 1
POKE 778 , B : REM POKE LENGTH
INPUT "ENTER DESTINATION " , A
IF A > PEEK (203) - 1 THEN 70
IF A < PEEK (205) + 1 THEN 70
POKE 776 , A : REM POKE DESTINATION
M = 8 : GOSUB 160 : REM DISPLAY
CALL 768 : REM GOTO $0300
M = A : GOSUB 160 : REM DISPLAY
M = O : GOSUB 160 : REM DISPLAY
PRINT : PRINT : GOTO 30
POKE 60 , 0 : POKE 61 , M
CALL -605 : RETURN : REM XAM8 IN MONITOR

Listing #2
300:20 89 F6 11 00 08 12 00 00 13 00 00 41 52
F3 07 FB 00 60
Listing #3
SWEET 16
$300
$303
$306

20
11
12

89
00
00

F6
08
00

$309

13

00

00

$30C
$30D
$30E
$30F
$311
$312

41
52
F3
07
00
60

JSR
SET
SET
A
SET
B
LD
ST
DCR
BNZ
RTN
RTS

$F689
R1 source address
R2 destination address
R3

length

@R1
@R2
R3
$30C

Data will be poked from the Integer Basic program:
"A"
"B"

from Line 100
from Line 60

+-----------------------------------------------------------------------| TOPIC -- Apple II -- Red Book Mini-Assembler listing
+------------------------------------------------------------------------

F500:
F502:
F503:
F505:
F507:
F509:
F50B:
F50C:

E9
4A
D0
A4
A6
D0
88
CA

81
14
3F
3E
01

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

***********************
*
*
*
APPLE-II
*
*
MINI-ASSEMBLER
*
*
*
* COPYRIGHT 1977 BY *
* APPLE COMPUTER INC. *
*
*
* ALL RIGHTS RESERVED *
*
*
*
S. WOZNIAK
*
*
A. BAUM
*
***********************
FORMAT
LENGTH
MODE
PROMPT
YSAV
L
PCL
PCH
A1H
A2L
A2H
A4L
A4H
FMT
IN
INSDS2
INSTDSP
PRBL2
PCADJ
CHAR1
CHAR2
MNEML
MNEMR
CURSUP
GETLNZ
COUT
BL1
A1PCLP
BELL
GETNUM
TOSUB
ZMODE
CHRTBL
REL

REL2

EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
ORG
SBC
LSR
BNE
LDY
LDX
BNE
DEY
DEX

$2E
$2F
$31
$33
$34
$35
$3A
$3B
$3D
$3E
$3F
$42
$43
$44
$200
$F88E
$F8D0
$F94A
$F953
$F9B4
$F9BA
$F9C0
$FA00
$FC1A
$FD67
$FDED
$FE00
$FE78
$FF3A
$FFA7
$FFBE
$FFC7
$FFCC
$F500
#$81
ERR3
A2H
A2L
REL2

; TITLE "APPLE-II MINI-ASSEMBLER"

;IS FMT COMPATIBLE
;WITH RELATIVE MODE?
; NO.
;DOUBLE DECREMENT

F50D:
F50E:
F50F:
F511:
F513:
F515:
F516:
F517:
F519:
F51B:
F51D:
F520:
F522:
F523:
F525:
F528:
F52B:
F52E:
F531:
F533:
F535:
F538:
F53B:
F53D:
F540:
F542:
F544:
F545:
F547:
F54A:
F54C:
F54E:
F550:
F552:
F554:
F556:
F559:
F55C:
F55E:
F561:
F562:
F565:
F567:
F569:
F56C:
F56E:
F570:
F572:
F574:
F576:
F578:
F57A:
F57C:
F57E:
F580:
F582:
F584:
F586:
F588:
F589:
F58A:
F58D:

8A
18
E5
85
10
C8
98
E5
D0
A4
B9
91
88
10
20
20
20
20
84
85
4C
20
A4
20
84
A0
88
30
D9
D0
C0
D0
A5
A0
C6
20
4C
A5
20
AA
BD
C5
D0
BD
C5
D0
A5
A4
C0
F0
C5
F0
C6
D0
E6
C6
F0
A4
98
AA
20
A9

3A
3E
01
3B
6B
2F
3D 00
3A
F8
1A
1A
D0
53
3B
3A
95
BE
34
A7
34
17
4B
CC
F8
15
E8
31
00
34
00
95
3D
8E

FC
FC
F8
F9
F5
FF
FF

FF

FE
F5
F8

00 FA
42
13
C0 F9
43
0C
44
2E
9D
88
2E
9F
3D
DC
44
35
D6
34
4A F9
DE

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

TXA
CLC
SBC
STA
BPL
INY
REL3
TYA
SBC
ERR3
BNE
FINDOP
LDY
FNDOP2
LDA
STA
DEY
BPL
JSR
JSR
JSR
JSR
STY
STA
JMP
FAKEMON3 JSR
LDY
FAKEMON JSR
STY
LDY
FAKEMON2 DEY
BMI
CMP
BNE
CPY
BNE
LDA
LDY
DEC
JSR
JMP
TRYNEXT LDA
JSR
TAX
LDA
CMP
BNE
LDA
CMP
BNE
LDA
LDY
CPY
BEQ
NREL
CMP
BEQ
NEXTOP
DEC
BNE
INC
DEC
BEQ
ERR
LDY
ERR2
TYA
TAX
JSR
LDA

PCL
A2L
REL3
PCH
ERR
LENGTH
A1H,Y
(PCL),Y
FNDOP2
CURSUP
CURSUP
INSTDSP
PCADJ
PCH
PCL
NXTLINE
TOSUB
YSAV
GETNUM
YSAV
#$17
RESETZ
CHRTBL,Y
FAKEMON2
#$15
FAKEMON3
MODE
#$0
YSAV
BL1
NXTLINE
A1H
INSDS2

;FORM ADDR-PC-2

;ERROR IF >1-BYTE BRANCH
;MOVE INST TO (PC)

;RESTORE CURSOR
;TYPE FORMATTED LINE
;UPDATE PC
;GET NEXT LINE
;GO TO DELIM HANDLER
;RESTORE Y-INDEX
;READ PARAM
;SAVE Y-INDEX
;INIT DELIMITER INDEX
;CHECK NEXT DELIM
;ERR IF UNRECOGNIZED DELIM
;COMPARE WITH DELIM TABLE
;NO MATCH
;MATCH, IS IT CR?
;NO, HANDLE IT IN MONITOR

;HANDLE CR OUTSIDE MONITOR
;GET TRIAL OPCODE
;GET FMT+LENGTH FOR OPCODE

MNEMR,X
A4L
NEXTOP
MNEML,X
A4H
NEXTOP
FMT
FORMAT
#$9D
REL
FORMAT
FINDOP
A1H
TRYNEXT
FMT
L
TRYNEXT
YSAV

;GET LOWER MNEMONIC BYTE
;MATCH?
;NO, TRY NEXT OPCODE.
;GET UPPER MNEMONIC BYTE
;MATCH?
;NO, TRY NEXT OPCODE

PRBL2
#$DE

;PRINT ^ UNDER LAST READ
;CHAR TO INDICATE ERROR

;GET TRIAL FORMAT
;TRIAL FORMAT RELATIVE?
;YES.
;SAME FORMAT?
;YES.
;NO, TRY NEXT OPCODE
;NO MORE, TRY WITH LEN=2
;WAS L=2 ALREADY?
;NO.
;YES, UNRECOGNIZED INST.

F58F:
F592:
F595:
F597:
F599:
F59C:
F59F:
F5A2:
F5A4:
F5A6:
F5A7:
F5A9:
F5AB:
F5AC:
F5AF:
F5B1:
F5B3:
F5B4:
F5B6:
F5B9:
F5BB:
F5BD:
F5C0:
F5C1:
F5C3:
F5C5:
F5C7:
F5C8:
F5C9:
F5CB:
F5CC:
F5CE:
F5D0:
F5D1:
F5D3:
F5D5:
F5D7:
F5D9:
F5DB:
F5DE:
F5E0:
F5E3:
F5E5:
F5E8:
F5EB:
F5ED:
F5F0:
F5F2:
F5F4:
F5F6:
F5F8:
F5F9:
F5FA:
F5FC:
F5FE:
F600:
F603:
F605:
F607:
F608:
F60A:
F60C:

20
20
A9
85
20
20
AD
C9
F0
C8
C9
F0
88
20
C9
D0
8A
F0
20
A9
85
20
0A
E9
C9
90
0A
0A
A2
0A
26
26
CA
10
C6
F0
10
A2
20
84
DD
D0
20
DD
F0
BD
F0
C9
F0
A4
18
88
26
E0
D0
20
A5
F0
E8
86
A2
88

ED
3A
A1
33
67
C7
00
A0
13

FD
FF
FD
FF
02

A4
92
A7 FF
93
D5
D2
78 FE
03
3D
34 F6
BE
C2
C1
04
42
43
F8
3D
F4
E4
05
34
34
B4
13
34
BA
0D
BA
07
A4
03
34

F6
F9
F6
F9
F9

44
03
0D
A7 FF
3F
01
35
03

119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

RESETZ
NXTLINE

ERR4

SPACE
NXTMN
NXTM

NXTM2

FORM1
FORM2

FORM3
FORM4
FORM5

FORM6

JSR
JSR
LDA
STA
JSR
JSR
LDA
CMP
BEQ
INY
CMP
BEQ
DEY
JSR
CMP
BNE
TXA
BEQ
JSR
LDA
STA
JSR
ASL
SBC
CMP
BCC
ASL
ASL
LDX
ASL
ROL
ROL
DEX
BPL
DEC
BEQ
BPL
LDX
JSR
STY
CMP
BNE
JSR
CMP
BEQ
LDA
BEQ
CMP
BEQ
LDY
CLC
DEY
ROL
CPX
BNE
JSR
LDA
BEQ
INX
STX
LDX
DEY

COUT
BELL
#$A1
PROMPT
GETLNZ
ZMODE
IN
#$A0
SPACE

;POSITION.

#$A4
FAKEMON

;ASCII '$' IN COL 1?
;YES, SIMULATE MONITOR
;NO, BACKUP A CHAR
;GET A NUMBER
;':' TERMINATOR?
;NO, ERR.

GETNUM
#$93
ERR2

;'!'
;INITIALIZE PROMPT
;GET LINE.
;INIT SCREEN STUFF
;GET CHAR
;ASCII BLANK?
;YES

ERR2
A1PCLP
#$3
A1H
GETNSP

;NO ADR PRECEDING COLON.
;MOVE ADR TO PCL, PCH.
;COUNT OF CHARS IN MNEMONIC

#$BE
#$C2
ERR2

;SUBTRACT OFFSET
;LEGAL CHAR?
;NO.
;COMPRESS-LEFT JUSTIFY

#$4

;GET FIRST MNEM CHAR.

;DO 5 TRIPLE WORD SHIFTS

A4L
A4H
NXTM2
A1H
NXTM2
NXTMN
#$5
GETNSP
YSAV
CHAR1,X
FORM3
GETNSP
CHAR2,X
FORM5
CHAR2,X
FORM4
#$A4
FORM4
YSAV
FMT
#$3
FORM7
GETNUM
A2H
FORM6
L
#$3

;DONE WITH 3 CHARS?
;YES, BUT DO 1 MORE SHIFT
;NO
;5 CHARS IN ADDR MODE
;GET FIRST CHAR OF ADDR
;FIRST CHAR MATCH PATTERN?
;NO
;YES, GET SECOND CHAR
;MATCHES SECOND HALF?
;YES.
;NO, IS SECOND HALF ZERO?
;YES.
;NO,SECOND HALF OPTIONAL?
;YES.
;CLEAR BIT-NO MATCH
;BACK UP 1 CHAR
;FORM FORMAT BYTE
;TIME TO CHECK FOR ADDR.
;NO
;YES
;HIGH-ORDER BYTE ZERO
;NO, INCR FOR 2-BYTE
;STORE LENGTH
;RELOAD FORMAT INDEX
;BACKUP A CHAR

F60D:
F60F:
F610:
F612:
F614:
F615:
F616:
F618:
F61A:
F61C:
F61E:
F620:
F622:
F624:
F626:
F629:
F62B:
F62D:
F62F:
F631:
F634:
F637:
F638:
F63A:
F63C:

86
CA
10
A5
0A
0A
05
C9
B0
A6
F0
09
85
84
B9
C9
F0
C9
D0
4C
B9
C8
C9
F0
60

3D
C9
44
35
20
06
35
02
80
44
34
00 02
BB
04
8D
80
5C F5
00 02
A0
F8

F666: 4C 92 F5

181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207

FORM7

FORM8

FORM9
GETNSP

MINIASM

STX
DEX
BPL
LDA
ASL
ASL
ORA
CMP
BCS
LDX
BEQ
ORA
STA
STY
LDA
CMP
BEQ
CMP
BNE
JMP
LDA
INY
CMP
BEQ
RTS
ORG
JMP

A1H
FORM2
FMT
L
#$20
FORM8
L
FORM8
#$80
FMT
YSAV
IN,Y
#$BB
FORM9
#$8D
ERR4
TRYNEXT
IN,Y
#$A0
GETNSP
$F666
RESETZ

;SAVE INDEX
;DONE WITH FORMAT CHECK?
;NO.
;YES, PUT LENGTH
;IN LOW BITS

;ADD "$" IF NONZERO LENGTH
;AND DON'T ALREADY HAVE IT

;GET NEXT NONBLANK
;';' START OF COMMENT?
;YES
;CARRIAGE RETURN?
;NO, ERR.

;GET NEXT NON BLANK CHAR

+-----------------------------------------------------------------------| TOPIC -- Apple II -- Red Book Floating point listing
+-----------------------------------------------------------------------Apple II Reference Manual (Red Book), January 1978, pages 94-95.

F425:
F426:
F428:
F42A:
F42C:
F42E:
F42F:
F431:
F432:
F434:
F437:
F439:
F43B:
F43E:
F440:
F441:
F443:
F445:
F447:
F449:
F44B:
F44D:
F44E:
F450:
F451:
F453:
F455:
F457:
F459:
F45B:
F45D:
F45F:

18
A2
B5
75
95
CA
10
60
06
20
24
10
20
E6
38
A2
94
B5
B4
94
95
CA
D0
60
A9
85
A5
C9
30
C6
06
26

02
F9
F5
F9
F7
F3
37 F4
F9
05
A4 F4
F3
04
FB
F7
F3
F7
F3
F3
8E
F8
F9
C0
0C
F8
FB
FA

***********************
*
*
* APPLE-II FLOATING *
*
POINT ROUTINES
*
*
*
* COPYRIGHT 1977 BY *
* APPLE COMPUTER INC. *
*
*
* ALL RIGHTS RESERVED *
*
*
*
S. WOZNIAK
*
*
*
***********************
TITLE "FLOATING POINT ROUTINES"
SIGN
EPZ $F3
X2
EPZ $F4
M2
EPZ $F5
X1
EPZ $F8
M1
EPZ $F9
E
EPZ $FC
OVLOC
EQU $3F5
ORG $F425
ADD
CLC
CLEAR CARRY
LDX #$2
INDEX FOR 3-BYTE ADD.
ADD1
LDA M1,X
ADC M2,X
ADD A BYTE OF MANT2 TO MANT1
STA M1,X
DEX
INDEX TO NEXT MORE SIGNIF. BYTE.
BPL ADD1
LOOP UNTIL DONE.
RTS
RETURN
MD1
ASL SIGN
CLEAR LSB OF SIGN.
JSR ABSWAP
ABS VAL OF M1, THEN SWAP WITH M2
ABSWAP
BIT M1
MANT1 NEGATIVE?
BPL ABSWAP1 NO, SWAP WITH MANT2 AND RETURN.
JSR FCOMPL
YES, COMPLEMENT IT.
INC SIGN
INCR SIGN, COMPLEMENTING LSB.
ABSWAP1
SEC
SET CARRY FOR RETURN TO MUL/DIV.
SWAP
LDX #$4
INDEX FOR 4 BYTE SWAP.
SWAP1
STY E-1,X
LDA X1-1,X
SWAP A BYTE OF EXP/MANT1 WITH
LDY X2-1,X
EXP/MANT2 AND LEAVE A COPY OF
STY X1-1,X
MANT1 IN E (3 BYTES). E+3 USED
STA X2-1,X
DEX
ADVANCE INDEX TO NEXT BYTE
BNE SWAP1
LOOP UNTIL DONE.
RTS
RETURN
FLOAT
LDA #$8E
INIT EXP1 TO 14,
STA X1
THEN NORMALIZE TO FLOAT.
NORM1
LDA M1
HIGH-ORDER MANT1 BYTE.
CMP #$C0
UPPER TWO BITS UNEQUAL?
BMI RTS1
YES, RETURN WITH MANT1 NORMALIZED
DEC X1
DECREMENT EXP1.
ASL M1+2
ROL M1+1
SHIFT MANT1 (3 BYTES) LEFT.

F461:
F463:
F465:
F467:
F468:
F46B:
F46E:
F470:
F472:
F474:
F477:
F479:
F47B:

26
A5
D0
60
20
20
A5
C5
D0
20
50
70
90

F9
F8
EE

F47D:
F47F:
F480:
F482:
F484:
F486:
F488:
F489:
F48B:
F48C:
F48F:
F491:
F494:
F495:
F498:
F49A:
F49D:
F49E:
F4A0:
F4A2:
F4A4:
F4A5:
F4A7:
F4A9:
F4AB:
F4AD:
F4AE:
F4B0:
F4B2:
F4B5:
F4B7:
F4BA:
F4BB:
F4BD:
F4BF:
F4C1:
F4C2:
F4C3:
F4C5:
F4C7:
F4C8:
F4CA:
F4CC:
F4CD:
F4CF:
F4D1:
F4D3:
F4D5:

A5
0A
E6
F0
A2
76
E8
D0
60
20
65
20
18
20
90
20
88
10
46
90
38
A2
A9
F5
95
CA
D0
F0
20
E5
20
38
A2
B5
F5
48
CA
10
A2
68
90
95
E8
D0
26
26
26
06

F9

A4 F4
7B F4
F4
F8
F7
25 F4
EA
05
C4

F8
75
FA
FF
FB
32 F4
F8
E2 F4
84 F4
03
25 F4
F5
F3
BF
03
00
F8
F8
F7
C5
32 F4
F8
E2 F4
02
F5
FC
F8
FD
02
F8
F8
FB
FA
F9
F7

ROL M1
LDA X1
EXP1 ZERO?
BNE NORM1
NO, CONTINUE NORMALIZING.
RTS1
RTS
RETURN.
FSUB
JSR FCOMPL
CMPL MANT1,CLEARS CARRY UNLESS 0
SWPALGN
JSR ALGNSWP RIGHT SHIFT MANT1 OR SWAP WITH
FADD
LDA X2
CMP X1
COMPARE EXP1 WITH EXP2.
BNE SWPALGN IF #,SWAP ADDENDS OR ALIGN MANTS.
JSR ADD
ADD ALIGNED MANTISSAS.
ADDEND
BVC NORM
NO OVERFLOW, NORMALIZE RESULT.
BVS RTLOG
OV: SHIFT M1 RIGHT, CARRY INTO SIGN
ALGNSWP
BCC SWAP
SWAP IF CARRY CLEAR,
*
ELSE SHIFT RIGHT ARITH.
RTAR
LDA M1
SIGN OF MANT1 INTO CARRY FOR
ASL
RIGHT ARITH SHIFT.
RTLOG
INC X1
INCR X1 TO ADJUST FOR RIGHT SHIFT
BEQ OVFL
EXP1 OUT OF RANGE.
RTLOG1
LDX #$FA
INDEX FOR 6:BYTE RIGHT SHIFT.
ROR1
ROR E+3,X
INX
NEXT BYTE OF SHIFT.
BNE ROR1
LOOP UNTIL DONE.
RTS
RETURN.
FMUL
JSR MD1
ABS VAL OF MANT1, MANT2
ADC X1
ADD EXP1 TO EXP2 FOR PRODUCT EXP
JSR MD2
CHECK PROD. EXP AND PREP. FOR MUL
CLC
CLEAR CARRY FOR FIRST BIT.
MUL1
JSR RTLOG1
M1 AND E RIGHT (PROD AND MPLIER)
BCC MUL2
IF CARRY CLEAR, SKIP PARTIAL PROD
JSR ADD
ADD MULTIPLICAND TO PRODUCT.
MUL2
DEY
NEXT MUL ITERATION.
BPL MUL1
LOOP UNTIL DONE.
MDEND
LSR SIGN
TEST SIGN LSB.
NORMX
BCC NORM
IF EVEN,NORMALIZE PROD,ELSE COMP
FCOMPL
SEC
SET CARRY FOR SUBTRACT.
LDX #$3
INDEX FOR 3 BYTE SUBTRACT.
COMPL1
LDA #$0
CLEAR A.
SBC X1,X
SUBTRACT BYTE OF EXP1.
STA X1,X
RESTORE IT.
DEX
NEXT MORE SIGNIFICANT BYTE.
BNE COMPL1
LOOP UNTIL DONE.
BEQ ADDEND
NORMALIZE (OR SHIFT RT IF OVFL).
FDIV
JSR MD1
TAKE ABS VAL OF MANT1, MANT2.
SBC X1
SUBTRACT EXP1 FROM EXP2.
JSR MD2
SAVE AS QUOTIENT EXP.
DIV1
SEC
SET CARRY FOR SUBTRACT.
LDX #$2
INDEX FOR 3-BYTE SUBTRACTION.
DIV2
LDA M2,X
SBC E,X
SUBTRACT A BYTE OF E FROM MANT2.
PHA
SAVE ON STACK.
DEX
NEXT MORE SIGNIFICANT BYTE.
BPL DIV2
LOOP UNTIL DONE.
LDX #$FD
INDEX FOR 3-BYTE CONDITIONAL MOVE
DIV3
PLA
PULL BYTE OF DIFFERENCE OFF STACK
BCC DIV4
IF M20 OK
ERROR ARG<=0
MOVE ARG TO EXP/MANT2
HOLD EXPONENT
SET EXPONENT 2 TO 0 ($80)
COMPLIMENT SIGN BIT OF ORIGINAL EXPONENT
SET EXPONENT INTO MANTISSA 1 FOR FLOAT
CLEAR MSB OF MANTISSA 1
CONVERT TO FLOATING POINT
4 BYTE TRANSFERS
COPY MANTISSA TO Z
SAVE EXPONENT IN SEXP
LOAD EXP/MANT1 WITH SQRT(2)

Z-SQRT(2)
4 BYTE TRANSFER
SAVE EXP/MANT1 AS T
LOAD EXP/MANT1 WITH Z
LOAD EXP/MANT2 WITH SQRT(2)

1D3D
1D3F
1D40
1D42
1D45
1D47
1D49
1D4B
1D4C
1D4E
1D51
1D53
1D55
1D57
1D59
1D5A
1D5C
1D5F
1D62
1D64
1D67
1D69
1D6A
1D6C
1D6F
1D71
1D74
1D76
1D77
1D79
1D7C
1D7E
1D81
1D83
1D84
1D86
1D89
1D8B
1D8D
1D8F
1D90
1D92
1D95
1D97
1D9A
1D9C
1D9D
1D9F
1DA2
1DA4
1DA6
1DA8
1DA9
1DAB
1DAE
1DB0
1DB3
1DB5
1DB6
1DB8
1DBB

95
CA
10
20
A2
B5
95
CA
10
20
A2
B5
95
95
CA
10
20
20
A2
BD
95
CA
10
20
A2
BD
95
CA
10
20
A2
BD
95
CA
10
20
A2
B5
95
CA
10
20
A2
BD
95
CA
10
20
A2
B5
95
CA
10
20
A2
BD
95
CA
10
20
60

04
F0
50 1F
03
14
04
F9
9D 1F
03
08
14
04
F7
77 1F
1C 1F
03
E1 1D
08
F8
4A 1F
03
DD 1D
04
F8
9D 1F
03
D9 1D
04
F8
50 1F
03
14
04
F9
77 1F
03
E5 1D
04
F8
50 1F
03
18
04
F9
50 1F
03
D5 1D
04

TM2

MIT

MIC

M2MB

M2A1

M2T

M2MHL

LDEXP

MLE2

F8
77 1F
*

STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
STA
DEX
BPL
JSR
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
RTS

X2,X
SAVET
FADD
=3
T,X
X2,X
TM2
FDIV
=3
X1,X
T,X
X2,X
MIT
FMUL
SWAP
=3
C,X
X1,X
MIC
FSUB
=3
MB,X
X2,X
M2MB
FDIV
=3
A1,X
X2,X
M2A1
FADD
=3
T,X
X2,X
M2T
FMUL
=3
MHLF,X
X2,X
M2MHL
FADD
=3
SEXP,X
X2,X
LDEXP
FADD
=3
LE2,X
X2,X
MLE2
FMUL

Z+SQRT(2)
4 BYTE TRANSFER
LOAD T INTO EXP/MANT2
T=(Z-SQRT(2))/(Z+SQRT(2))
4 BYTE TRANSFER
COPY EXP/MANT1 TO T AND
LOAD EXP/MANT2 WITH T
T*T
MOVE T*T TO EXP/MANT2
4 BYTE TRANSFER
LOAD EXP/MANT1 WITH C
T*T-C
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH MB
MB/(T*T-C)
LOAD EXP/MANT2 WITH A1
MB/(T*T-C)+A1
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH T
(MB/(T*T-C)+A1)*T
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH MHLF (.5)
+.5
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH ORIGINAL EXPONENT
+EXPN
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH LN(2)
*LN(2)
RETURN RESULT IN MANT/EXP1

1DBC
1DBF
1DC1
1DC4
1DC6
1DC7
1DC9
1DCC

20
A2
BD
95
CA
10
20
60

00 1D
03
CD 1D
04

1DCD

7E
2D
80
02
7F
B9
80
80
81
86
80
08
7F
00

6F
ED
5A
7A
58
0C
52
40
AB
49
6A
66
40
00

1DD1
1DD5
1DD9
1DDD
1DE1
1DE5

F8
77 1F

1E00

1E00
1E02
1E05
1E07
1E08
1E0A
1E0D
1E0F
1E11
1E13
1E14
1E16
1E19
1E1B
1E1D
1E1E
1E20
1E22
1E24
1E26
1E27
1E29
1E2B
1E2D
1E2F
1E31
1E33
1E35
1E37
1E38
1E3A

A2
BD
95
CA
10
20
A2
B5
95
CA
10
20
A5
85
38
E9
A5
E9
10
18
A5
69
A5
69
10
A9
A2
95
CA
10
60

03
D8 1E
04
F8
77 1F
03
08
10

*
COMMON LOG OF MANT/EXP1 RESULT IN MANT/EXP1
*
LOG10 JSR LOG
COMPUTE NATURAL LOG
LDX =3
L10
LDA LN10,X
STA X2,X
LOAD EXP/MANT2 WITH 1/LN(10)
DEX
BPL L10
JSR FMUL
LOG10(X)=LN(X)/LN(10)
RTS
*
LN10
DCM 0.4342945
R22

DCM 1.4142136

SQRT(2)

LE2

DCM 0.69314718

LOG BASE E OF 2

A1

DCM 1.2920074

MB

DCM -2.6398577

C

DCM 1.6567626

MHLF

DCM 0.5

*
*
*
*
EXP

FSA

F9
E8 1F
0A
1C
7C
09
00
15
0A
78
09
00
0B
00
03
08

ZERO

FB
*

ORG $1E00

STARTING LOCATION FOR EXP

EXP OF MANT/EXP1 RESULT IN MANT/EXP1
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDA
STA
SEC
SBC
LDA
SBC
BPL
CLC
LDA
ADC
LDA
ADC
BPL
LDA
LDX
STA
DEX
BPL
RTS

=3
L2E,X
X2,X
EXP+2
FMUL
=3
X1,X
Z,X
FSA
FIX
M1+1
INT
=124
M1
=0
OVFLW
M1+1
=120
M1
=0
CONTIN
=0
=3
X1,X

4 BYTE TRANSFER
LOAD EXP/MANT2 WITH LOG BASE 2 OF E
LOG2(3)*X
4 BYTE TRANSFER
STORE EXP/MANT1 IN Z
SAVE Z=LN(2)*X
CONVERT CONTENTS OF EXP/MANT1 TO AN INTEGER
SAVE RESULT AS INT
SET CARRY FOR SUBTRACTION
INT-124
OVERFLOW INT>=124
CLEAR CARRY FOR ADD
ADD 120 TO INT
IF RESULT POSITIVE CONTINUE
INT<-120 SET RESULT TO ZERO AND RETURN
4 BYTE MOVE
SET EXP/MANT1 TO ZERO

ZERO
RETURN

1E3B

00

1E3C
1E3F
1E41
1E43
1E45
1E46
1E48
1E4B
1E4D
1E4F
1E51
1E53
1E54
1E56
1E59
1E5B
1E5E
1E60
1E62
1E64
1E65
1E67
1E6A
1E6C
1E6F
1E71
1E72
1E74
1E77
1E79
1E7B
1E7D
1E80
1E82
1E84
1E86
1E87
1E89
1E8C
1E8F
1E91
1E93
1E95
1E96
1E98
1E9B
1E9D
1EA0
1EA2
1EA3
1EA5
1EA8
1EAB
1EAD
1EAF
1EB1
1EB2
1EB4
1EB7
1EB9

20
A2
B5
95
CA
10
20
A2
B5
95
95
CA
10
20
A2
BD
95
B5
95
CA
10
20
A2
BD
95
CA
10
20
A2
B5
95
BD
95
B5
95
CA
10
20
20
A2
B5
95
CA
10
20
A2
BD
95
CA
10
20
20
A2
B5
95
CA
10
20
A2
B5

2C 1F
03
10
04
F9
4A 1F
03
08
10
04
F7
77 1F
03
DC 1E
04
08
18
F4
50 1F
03
E0 1E
04
F8
9D 1F
03
08
14
E4 1E
08
18
04
F0
77 1F
1C 1F
03
14
08
F9
4A 1F
03
E8 1E
04
F8
50 1F
1C 1F
03
10
08
F9
4A 1F
03
10

OVFLW BRK
*
CONTIN JSR FLOAT
LDX =3
ENTD
LDA Z,X
STA X2,X
DEX
BPL ENTD
JSR FSUB
LDX =3
ZSAV
LDA X1,X
STA Z,X
STA X2,X
DEX
BPL ZSAV
JSR FMUL
LDX =3
LA2
LDA A2,X
STA X2,X
LDA X1,X
STA SEXP,X
DEX
BPL LA2
JSR FADD
LDX =3
LB2
LDA B2,X
STA X2,X
DEX
BPL LB2
JSR FDIV
LDX =3
DLOAD LDA X1,X
STA T,X
LDA C2,X
STA X1,X
LDA SEXP,X
STA X2,X
DEX
BPL DLOAD
JSR FMUL
JSR SWAP
LDX =3
LTMP
LDA T,X
STA X1,X
DEX
BPL LTMP
JSR FSUB
LDX =3
LDD
LDA D,X
STA X2,X
DEX
BPL LDD
JSR FADD
JSR SWAP
LDX =3
LFA
LDA Z,X
STA X1,X
DEX
BPL LFA
JSR FSUB
LDX =3
LF3
LDA Z,X

OVERFLOW
FLOAT INT
LOAD EXP/MANT2 WITH Z
Z*Z-FLOAT(INT)
4 BYTE MOVE
SAVE EXP/MANT1 IN Z
COPY EXP/MANT1 TO EXP/MANT2
Z*Z
4 BYTE MOVE
LOAD EXP/MANT2 WITH A2
SAVE EXP/MANT1 AS SEXP
Z*Z+A2
4 BYTE MOVE
LOAD EXP/MANT2 WITH B2
T=B/(Z*Z+A2)
4 BYTE MOVE
SAVE EXP/MANT1 AS T
LOAD EXP/MANT1 WITH C2
LOAD EXP/MANT2 WITH SEXP
Z*Z*C2
MOVE EXP/MANT1 TO EXP/MANT2
4 BYTE TRANSFER
LOAD EXP/MANT1 WITH T
C2*Z*Z-B2/(Z*Z+A2)
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH D
D+C2*Z*Z-B2/(Z*Z+A2)
MOVE EXP/MANT1 TO EXP/MANT2
4 BYTE TRANSFER
LOAD EXP/MANT1 WITH Z
-Z+D+C2*Z*Z-B2/(Z*Z+A2)
4 BYTE TRANSFER

1EBB
1EBD
1EBE
1EC0
1EC3
1EC5
1EC8
1ECA
1ECB
1ECD
1ED0
1ED1
1ED3
1ED5
1ED7
1ED8
1EDC
1EE0
1EE4
1EE8

95
CA
10
20
A2
BD
95
CA
10
20
38
A5
65
85
60
80
55
86
6A
89
3F
7B
FA
83
A3

1F00
1F00
1F01
1F03
1F05
1F07
1F09
1F0A
1F0C
1F0D
1F0F
1F12
1F14
1F16
1F19
1F1B

18
A2
B5
75
95
CA
10
60
06
20
24
10
20
E6
38

1F1C
1F1E
1F20
1F22
1F24
1F26
1F28
1F29
1F2B

A2
94
B5
B4
94
95
CA
D0
60

04
F9
9D 1F
03
E5 1D
04

L2E

STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
SEC
LDA
ADC
STA
RTS
DCM

A2

DCM 87.417497202

B2

DCM 617.9722695

C2

DCM .03465735903

D

DCM 9.9545957821

LD12

F8
50 1F
1C
08
08
5C
1E
57
E1
4D
1D
46
70
4F
03

02
09
05
09
F7
03
12 1F
09
05
8F 1F
03

04
0B
07
03
07
03
F3

*
*
*
*

X2,X
LF3
FDIV
=3
MHLF,X
X2,X

LOAD EXP/MANT2 WITH Z
Z/(**** )
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH .5

LD12
FADD

+Z/(***)+.5
ADD INT TO EXPONENT WITH CARRY SET
INT
TO MULTIPLY BY
X1
2**(INT+1)
X1
RETURN RESULT TO EXPONENT
RETURN ANS=(.5+Z/(-Z+D+C2*Z*Z-B2/(Z*Z+A2))*2**(INT+1)
1.4426950409
LOG BASE 2 OF E

BASIC FLOATING POINT ROUTINES

ORG $1F00
START OF BASIC FLOATING POINT ROUTINES
CLC
CLEAR CARRY
LDX =$02
INDEX FOR 3-BYTE ADD
ADD1
LDA M1,X
ADC M2,X
ADD A BYTE OF MANT2 TO MANT1
STA M1,X
DEX
ADVANCE INDEX TO NEXT MORE SIGNIF.BYTE
BPL ADD1
LOOP UNTIL DONE.
RTS
RETURN
MD1
ASL SIGN
CLEAR LSB OF SIGN
JSR ABSWAP ABS VAL OF MANT1, THEN SWAP MANT2
ABSWAP BIT M1
MANT1 NEG?
BPL ABSWP1 NO,SWAP WITH MANT2 AND RETURN
JSR FCOMPL YES, COMPLIMENT IT.
INC SIGN
INCR SIGN, COMPLEMENTING LSB
ABSWP1 SEC
SET CARRY FOR RETURN TO MUL/DIV
*
*
SWAP EXP/MANT1 WITH EXP/MANT2
*
SWAP
LDX =$04
INDEX FOR 4-BYTE SWAP.
SWAP1 STY E-1,X
LDA X1-1,X SWAP A BYTE OF EXP/MANT1 WITH
LDY X2-1,X EXP/MANT2 AND LEAVEA COPY OF
STY X1-1,X MANT1 IN E(3BYTES). E+3 USED.
STA X2-1,X
DEX
ADVANCE INDEX TO NEXT BYTE
BNE SWAP1
LOOP UNTIL DONE.
RTS
*
*
*
*
CONVERT 16 BIT INTEGER IN M1(HIGH) AND M1+1(LOW) TO F.P.
*
RESULT IN EXP/MANT1. EXP/MANT2 UNEFFECTED
ADD

1F2C
1F2E
1F30
1F32
1F34
1F36
1F38
1F3A
1F3C
1F3E
1F40
1F41
1F43
1F45
1F47
1F49

A9
85
A9
85
F0
C6
06
26
26
A5
0A
45
30
A5
D0
60

8E
08
00
0B
08
08
0B
0A
09
09

1F4A
1F4D

20 8F 1F
20 5D 1F

1F50
1F52
1F54
1F56
1F59
1F5B
1F5D
1F5F
1F61
1F62
1F64
1F66
1F68
1F6A
1F6C
1F6D
1F6F
1F71
1F73
1F74
1F76

A5
C5
D0
20
50
70
90
A5
0A
E6
F0
A2
A9
B0
0A
56
15
95
E8
D0
60

04
08
F7
00 1F
E3
05
BD
09

1F77
1F7A
1F7C
1F7F
1F80
1F83
1F85
1F88
1F89
1F8B

20
65
20
18
20
90
20
88
10
46

0D 1F
08
CD 1F

09
04
08
ED

08
7E
FA
80
01
0F
0F
0F
F2

66 1F
03
00 1F
F5
03

*
*
FLOAT

NORM1

NORM

LDA
STA
LDA
STA
BEQ
DEC
ASL
ROL
ROL
LDA
ASL
EOR
BMI
LDA
BNE
RTS

=$8E
X1
=0
M1+2
NORM
X1
M1+2
M1+1
M1
M1
M1
RTS1
X1
NORM1

SET EXPN TO 14 DEC
CLEAR LOW ORDER BYTE
NORMALIZE RESULT
DECREMENT EXP1
SHIFT MANT1 (3 BYTES) LEFT
HIGH ORDER MANT1 BYTE
UPPER TWO BITS UNEQUAL?
YES,RETURN WITH MANT1 NORMALIZED
EXP1 ZERO?
NO, CONTINUE NORMALIZING
RETURN

RTS1
*
*
*
EXP/MANT2-EXP/MANT1 RESULT IN EXP/MANT1
*
FSUB
JSR FCOMPL CMPL MANT1 CLEARS CARRY UNLESS ZERO
SWPALG JSR ALGNSW RIGHT SHIFT MANT1 OR SWAP WITH MANT2 ON CARRY
*
*
ADD EXP/MANT1 AND EXP/MANT2 RESULT IN EXP/MANT1
*
FADD
LDA X2
CMP X1
COMPARE EXP1 WITH EXP2
BNE SWPALG IF UNEQUAL, SWAP ADDENDS OR ALIGN MANTISSAS
JSR ADD
ADD ALIGNED MANTISSAS
ADDEND BVC NORM
NO OVERFLOW, NORMALIZE RESULTS
BVS RTLOG
OV: SHIFT MANT1 RIGHT. NOTE CARRY IS CORRECT SIGN
ALGNSW BCC SWAP
SWAP IF CARRY CLEAR, ELSE SHIFT RIGHT ARITH.
RTAR
LDA M1
SIGN OF MANT1 INTO CARRY FOR
ASL
RIGHT ARITH SHIFT
RTLOG INC X1
INCR EXP1 TO COMPENSATE FOR RT SHIFT
BEQ OVFL
EXP1 OUT OF RANGE.
RTLOG1 LDX =$FA
INDEX FOR 6 BYTE RIGHT SHIFT
ROR1
LDA =$80
BCS ROR2
ASL
ROR2
LSR E+3,X
SIMULATE ROR E+3,X
ORA E+3,X
STA E+3,X
INX
NEXT BYTE OF SHIFT
BNE ROR1
LOOP UNTIL DONE
RTS
RETURN
*
*
*
EXP/MANT1 X EXP/MANT2 RESULT IN EXP/MANT1
*
FMUL
JSR MD1
ABS. VAL OF MANT1, MANT2
ADC X1
ADD EXP1 TO EXP2 FOR PRODUCT EXPONENT
JSR MD2
CHECK PRODUCT EXP AND PREPARE FOR MUL
CLC
CLEAR CARRY
MUL1
JSR RTLOG1 MANT1 AND E RIGHT.(PRODUCT AND MPLIER)
BCC MUL2
IF CARRY CLEAR, SKIP PARTIAL PRODUCT
JSR ADD
ADD MULTIPLICAN TO PRODUCT
MUL2
DEY
NEXT MUL ITERATION
BPL MUL1
LOOP UNTIL DONE
MDEND LSR SIGN
TEST SIGN (EVEN/ODD)

1F8D
1F8F
1F90
1F92
1F94
1F96
1F98
1F99
1F9B

90
38
A2
A9
F5
95
CA
D0
F0

AF

1F9D
1FA0
1FA2
1FA5
1FA6
1FA8
1FAA
1FAC
1FAD
1FAE
1FB0
1FB2
1FB3
1FB5
1FB7
1FB8
1FBA
1FBC
1FBE
1FC0
1FC2
1FC4
1FC6
1FC8
1FC9
1FCB
1FCD
1FCF
1FD1
1FD3
1FD5
1FD7
1FD8
1FD9
1FDB
1FDD
1FDF
1FE1
1FE2
1FE4

20
E5
20
38
A2
B5
F5
48
CA
10
A2
68
90
95
E8
D0
26
26
26
06
26
26
B0
88
D0
F0
86
86
86
B0
30
68
68
90
49
85
A0
60
10
00

0D 1F
08
CD 1F

1FE5
1FE8
1FEA
1FEC

20
A5
C9
D0

5F 1F
08
8E
F7

03
00
08
08
F7
BC

02
05
0C
F8
FD
02
08
F8
0B
0A
09
07
06
05
1C
DA
BE
0B
0A
09
0D
04
B2
80
08
17
F7

NORMX BCC NORM
IF EXEN, NORMALIZE PRODUCT, ELSE COMPLEMENT
FCOMPL SEC
SET CARRY FOR SUBTRACT
LDX =$03
INDEX FOR 3 BYTE SUBTRACTION
COMPL1 LDA =$00
CLEAR A
SBC X1,X
SUBTRACT BYTE OF EXP1
STA X1,X
RESTORE IT
DEX
NEXT MORE SIGNIFICANT BYTE
BNE COMPL1 LOOP UNTIL DONE
BEQ ADDEND NORMALIZE (OR SHIFT RIGHT IF OVERFLOW)
*
*
*
EXP/MANT2 / EXP/MANT1 RESULT IN EXP/MANT1
*
FDIV
JSR MD1
TAKE ABS VAL OF MANT1, MANT2
SBC X1
SUBTRACT EXP1 FROM EXP2
JSR MD2
SAVE AS QUOTIENT EXP
DIV1
SEC
SET CARRY FOR SUBTRACT
LDX =$02
INDEX FOR 3-BYTE INSTRUCTION
DIV2
LDA M2,X
SBC E,X
SUBTRACT A BYTE OF E FROM MANT2
PHA
SAVE ON STACK
DEX
NEXT MORE SIGNIF BYTE
BPL DIV2
LOOP UNTIL DONE
LDX =$FD
INDEX FOR 3-BYTE CONDITIONAL MOVE
DIV3
PLA
PULL A BYTE OF DIFFERENCE OFF STACK
BCC DIV4
IF MANT2|<--THREE BYTE MANTISSA
--->|
|
(TWOS COMPLEMENT REPRESENTATION)
|
|<---FOUR-BYTE FLOATING POINT OPERAND
---->|
The exponent byte is a binary scaling factor for the
Mantissa. The exponent is a standard two's complement representation except that the sign bit is complemented and runs from +128 to +127. For example:
$00 is -128
$01 is -127
*
*
$7F is -1
$80 is 0
$81 is -1
*
*
$FF is 127
The mantissa is standard two's complement representation with the sign bit in the most significant bit of
the high order byte. The assumed decimal point is between bits 6 and 7 of the most significant byte. Thus the
normalized mantissa ranges in absolute value from 1 to
2. Except when the exponent has a value of +128 the
mantissa is normalized to retain maximum precision.
The mantissa is normalized if the upper two bits of the
high-order mantissa byte are unequal. Thus a normalized mantissa is of the following form:
01.xxxxxx positive mantissa (high byte)
10.xxxxxx negative mantissa (high byte)
Assumed binary point
Some sample floating point numbers in hex
83
80
7C
00
FC
7F
83

50
40
66
00
99
80
B0

00
00
66
00
99
00
00

00
00
66
00
9A
00
00

10.
1.
.1
0.
-.1
-1.
-10.

The routines are all entered using a JSR instruction.
Base page locations $004-$007 are referred to as
exp/mant2 while $0008-000b are referred to as exp/

mant1 and act as floating point registers. On entry to
the subroutines these registers contain the numbers to
be operated upon and contain the result on return, The
function of the registers is given before each entry point
in the source listing. There are three error traps which
will cause a software interrupts. ERROT (1D06) is
encountered if the argument in the log routine is less
than or equal to zero. OVFLW (1E3B) will be executed if
the argument of EXP is too large. Overflow detected by
the basic floating point routines will cause OVFL (1FE4)
to be executed. The routines do not give underflow
errors, but set the number to zero if underflow occurs.
Readers of Dr. Dobbs's journal should note that when
these routines were published in that journal the math
function LOG contained an error which prevented the
correct result from being given if the argument was less
than 1. This error has been correted in the present listing and marked with "MOD 9/76."
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
APPROXIMATE
34
35
36
37
38 0003

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

SEPTEMBER 11, 1976
BASIC FLOATING POINT ROUTINES
FOR 6502 MICROPROCESSOR
BY R. RANKIN AND S. WOZNIAK
CONSISTING OF:
NATURAL LOG
COMMON LOG
EXPONENTIAL (E**X)
FLOAT
FIX
FADD
FSUB
FMUL
FDIV
FLOATING POINT REPRESENTATION (4-BYTES)
EXPONENT BYTE 1
MANTISSA BYTES 2-4
MANTISSA:
TWO'S COMPLIMENT REPRESENTATION WITH SIGN IN
MSB OF HIGH-ORDER BYTE. MANTISSA IS NORMALIZED WITH AN
ASSUMED DECIMAL POINT BETWEEN BITS 5 AND 6 OF THE HIGH-ORDER
BYTE. THUS THE MANTISSA IS IN THE RANGE 1. TO 2. EXCEPT
WHEN THE NUMBER IS LESS THAN 2**(-128).
EXPONENT:
THE EXPONENT REPRESENTS POWERS OF TWO. THE
REPRESENTATION IS 2'S COMPLIMENT EXCEPT THAT THE SIGN
BIT (BIT 7) IS COMPLIMENTED. THIS ALLOWS DIRECT COMPARISON
OF EXPONENTS FOR SIZE SINCE THEY ARE STORED IN INCREASING
NUMERICAL SEQUENCE RANGING FROM $00 (-128) TO $FF (+127)
($ MEANS NUMBER IS HEXADECIMAL).
REPRESENTATION OF DECIMAL NUMBERS:
THE PRESENT FLOATING
POINT REPRESENTATION ALLOWS DECIMAL NUMBERS IN THE
RANGE OF 10**(-38) THROUGH 10**(38) WITH 6 TO 7 SIGNIFICANT
DIGITS.
ORG 3

SET BASE PAGE ADRESSES

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

0003
0004
0005
0008
0009
000C
0010
0014
0018
001C

EA
EA
00 00 00
EA
00 00 00

00

1D00

1D00
1D02
1D04
1D06

A5 09
F0 02
10 01
00

1D07
1D0A
1D0C
1D0E
1D10
1D12
1D14
1D16
1D18
1D19
1D1B
1D1E
1D20
1D22
1D24
1D26
1D28
1D2B
1D2D
1D2E
1D30
1D33
1D35
1D37
1D39
1D3B
1D3D
1D40
1D42
1D43
1D45
1D48
1D4A
1D4C
1D4E
1D4F
1D51
1D54
1D56
1D58
1D5A
1D5C

20
A2
A5
A0
84
49
85
10
CA
86
20
A2
B5
95
B5
95
BD
95
CA
10
20
A2
B5
95
B5
95
BD
95
CA
10
20
A2
B5
95
CA
10
20
A2
B5
95
95
CA

1C 1F
00
04
80
04
80
0A
01
09
2C 1F
03
04
10
08
18
D4 1D
08
F0
4A 1F
03
08
14
10
08
D4 1D
04
F0
50 1F
03
14
04
F9
9D 1F
03
08
14
04

SIGN
X2
M2
X1
M1
E
Z
T
SEXP
INT
*
*
*
*
LOG
ERROR
*
CONT

SEXP1

SAVET

TM2

MIT

NOP
NOP
BSS
NOP
BSS
BSS
BSS
BSS
BSS
BSS

3
3
4
4
4
4
1

ORG $1D00

EXPONENT
MANTISSA
EXPONENT
MANTISSA
SCRATCH

2
2
1
1

STARTING LOCATION FOR LOG

NATURAL LOG OF MANT/EXP1 WITH RESULT IN MANT/EXP1
LDA M1
BEQ ERROR
BPL CONT
BRK
JSR
LDX
LDA
LDY
STY
EOR
STA
BPL
DEX
STX
JSR
LDX
LDA
STA
LDA
STA
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
LDA
STA
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
STA
DEX

SWAP
=0
X2
=$80
X2
=$80
M1+1
*+3
M1
FLOAT
=3
X2,X
Z,X
X1,X
SEXP,X
R22,X
X1,X
SEXP1
FSUB
=3
X1,X
T,X
Z,X
X1,X
R22,X
X2,X
SAVET
FADD
=3
T,X
X2,X
TM2
FDIV
=3
X1,X
T,X
X2,X

IF ARG>0 OK
ERROR ARG<=0
MOVE ARG TO EXP/MANT2
MOD 9/76: LOAD X FOR LATER
HOLD EXPONENT
SET EXPONENT 2 TO 0 ($80)
COMPLIMENT SIGN BIT OF ORIGINAL EXPONENT
SET EXPONENT INTO MANTISSA 1 FOR FLOAT
MOD 9/76: IS EXPONENT ZERO?
MOD 9/76: YES SET X TO $FF
MOD 9/76: SET UPPER BYTE OF EXPONENT
CONVERT TO FLOATING POINT
4 BYTE TRANSFERS
COPY MANTISSA TO Z
SAVE EXPONENT IN SEXP
LOAD EXP/MANT1 WITH SQRT(2)

Z-SQRT(2)
4 BYTE TRANSFER
SAVE EXP/MANT1 AS T
LOAD EXP/MANT1 WITH Z
LOAD EXP/MANT2 WITH SQRT(2)

Z+SQRT(2)
4 BYTE TRANSFER
LOAD T INTO EXP/MANT2
T=(Z-SQRT(2))/(Z+SQRT(2))
4 BYTE TRANSFER
COPY EXP/MANT1 TO T AND
LOAD EXP/MANT2 WITH T

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159

1D5D
1D5F
1D62
1D65
1D67
1D6A
1D6C
1D6D
1D6F
1D72
1D74
1D77
1D79
1D7A
1D7C
1D7F
1D81
1D84
1D86
1D87
1D89
1D8C
1D8E
1D90
1D92
1D93
1D95
1D98
1D9A
1D9D
1D9F
1DA0
1DA2
1DA5
1DA7
1DA9
1DAB
1DAC
1DAE
1DB1
1DB3
1DB6
1DB8
1DB9
1DBB
1DBE

160

1DD4

10
20
20
A2
BD
95
CA
10
20
A2
BD
95
CA
10
20
A2
BD
95
CA
10
20
A2
B5
95
CA
10
20
A2
BD
95
CA
10
20
A2
B5
95
CA
10
20
A2
BD
95
CA
10
20
60

F7
77 1F
1C 1F
03
E4 1D
08
F8
4A 1F
03
E0 1D
04
F8
9D 1F
03
DC 1D
04
F8
50 1F
03
14
04
F9
77 1F
03
E8 1D
04
F8
50 1F
03
18
04
F9
50 1F
03
D8 1D
04

MIC

M2MB

M2A1

M2T

M2MHL

LDEXP

MLE2

F8
77 1F

1DBF
1DC2
1DC4
1DC7
1DC9
1DCA
1DCC
1DCF

20
A2
BD
95
CA
10
20
60

00 1D
03
D0 1D
04

1DD0

7E
2D
80
82

6F
ED
5A
7A

F8
77 1F

BPL
JSR
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
RTS

MIT
FMUL
SWAP
=3
C,X
X1,X
MIC
FSUB
=3
MB,X
X2,X
M2MB
FDIV
=3
A1,X
X2,X
M2A1
FADD
=3
T,X
X2,X
M2T
FMUL
=3
MHLF,X
X2,X
M2MHL
FADD
=3
SEXP,X
X2,X
LDEXP
FADD
=3
LE2,X
X2,X
MLE2
FMUL

T*T
MOVE T*T TO EXP/MANT2
4 BYTE TRANSFER
LOAD EXP/MANT1 WITH C
T*T-C
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH MB
MB/(T*T-C)
LOAD EXP/MANT2 WITH A1
MB/(T*T-C)+A1
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH T
(MB/(T*T-C)+A1)*T
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH MHLF (.5)
+.5
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH ORIGINAL EXPONENT
+EXPN
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH LN(2)
*LN(2)
RETURN RESULT IN MANT/EXP1

*
*
COMMON LOG OF MANT/EXP1 RESULT IN MANT/EXP1
*
LOG10 JSR LOG
COMPUTE NATURAL LOG
LDX =3
L10
LDA LN10,X
STA X2,X
LOAD EXP/MANT2 WITH 1/LN(10)
DEX
BPL L10
JSR FMUL
LOG10(X)=LN(X)/LN(10)
RTS
*
LN10
DCM 0.4342945
R22

DCM

1.4142136

SQRT(2)

161

1DD8

162

1DDC

163

1DE0

164

1DE4

165

1DE8

166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217

7F
B9
80
B0
81
86
80
08
7F
00

58
0C
52
40
AB
49
6A
66
40
00

DCM

0.69314718

A1

DCM

1.2920074

MB

DCM

-2.6398577

C

DCM

1.6567626

MHLF

DCM

0.5

*

1E00

1E00
1E02
1E05
1E07
1E08
1E0A
1E0D
1E0F
1E11
1E13
1E14
1E16
1E19
1E1B
1E1D
1E1E
1E20
1E22
1E24
1E26
1E27
1E29
1E2B
1E2D
1E2F
1E31
1E33
1E35
1E37
1E38
1E3A

LE2

A2
BD
95
CA
10
20
A2
B5
95
CA
10
20
A5
85
38
E9
A5
E9
10
18
A5
69
A5
69
10
A9
A2
95
CA
10
60

1E3B

00

1E3C
1E3F
1E41
1E43
1E45
1E46
1E48
1E4B
1E4D
1E4F
1E51
1E53
1E54

20
A2
B5
95
CA
10
20
A2
B5
95
95
CA
10

03
D8 1E
04
F8
77 1F
03
08
10

*
*
*
EXP

FSA

F9
E8 1F
0A
1C
7C
09
00
15
0A
78
09
00
0B
00
03
08
FB

2C 1F
03
10
04
F9
4A 1F
03
08
10
04
F7

ZERO

ORG $1E00

LOG BASE E OF 2

STARTING LOCATION FOR EXP

EXP OF MANT/EXP1 RESULT IN MANT/EXP1
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDA
STA
SEC
SBC
LDA
SBC
BPL
CLC
LDA
ADC
LDA
ADC
BPL
LDA
LDX
STA
DEX
BPL
RTS

=3
L2E,X
X2,X
EXP+2
FMUL
=3
X1,X
Z,X
FSA
FIX
M1+1
INT
=124
M1
=0
OVFLW
M1+1
=120
M1
=0
CONTIN
=0
=3
X1,X
ZERO

*
OVFLW BRK
*
CONTIN JSR FLOAT
LDX =3
ENTD
LDA Z,X
STA X2,X
DEX
BPL ENTD
JSR FSUB
LDX =3
ZSAV
LDA X1,X
STA Z,X
STA X2,X
DEX
BPL ZSAV

4 BYTE TRANSFER
LOAD EXP/MANT2 WITH LOG BASE 2 OF E
LOG2(3)*X
4 BYTE TRANSFER
STORE EXP/MANT1 IN Z
SAVE Z=LN(2)*X
CONVERT CONTENTS OF EXP/MANT1 TO AN INTEGER
SAVE RESULT AS INT
SET CARRY FOR SUBTRACTION
INT-124
OVERFLOW INT>=124
CLEAR CARRY FOR ADD
ADD 120 TO INT
IF RESULT POSITIVE CONTINUE
INT<-120 SET RESULT TO ZERO AND RETURN
4 BYTE MOVE
SET EXP/MANT1 TO ZERO
RETURN
OVERFLOW
FLOAT INT
LOAD EXP/MANT2 WITH Z
Z*Z-FLOAT(INT)
4 BYTE MOVE
SAVE EXP/MANT1 IN Z
COPY EXP/MANT1 TO EXP/MANT2

218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278

1E56
1E59
1E5B
1E5E
1E60
1E62
1E64
1E65
1E67
1E6A
1E6C
1E6F
1E71
1E72
1E74
1E77
1E79
1E7B
1E7D
1E80
1E82
1E84
1E86
1E87
1E89
1E8C
1E8F
1E91
1E93
1E95
1E96
1E98
1E9B
1E9D
1EA0
1EA2
1EA3
1EA5
1EA8
1EAB
1EAD
1EAF
1EB1
1EB2
1EB4
1EB7
1EB9
1EBB
1EBD
1EBE
1EC0
1EC3
1EC5
1EC8
1ECA
1ECB
1ECD
1ED0
1ED1
1ED3
1ED5

20
A2
BD
95
B5
95
CA
10
20
A2
BD
95
CA
10
20
A2
B5
95
BD
95
B5
95
CA
10
20
20
A2
B5
95
CA
10
20
A2
BD
95
CA
10
20
20
A2
B5
95
CA
10
20
A2
B5
95
CA
10
20
A2
BD
95
CA
10
20
38
A5
65
85

77 1F
03
DC 1E
04
08
18
F4
50 1F
03
E0 1E
04
F8
9D 1F
03
08
14
E4 1E
08
18
04
F0
77 1F
1C 1F
03
14
08
F9
4A 1F
03
E8 1E
04
F8
50 1F
1C 1F
03
10
08
F9
4A 1F
03
10
04
F9
9D 1F
03
E8 1D
04
F8
50 1F
1C
08
08

LA2

LB2

DLOAD

LTMP

LDD

LFA

LF3

LD12

JSR
LDX
LDA
STA
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
LDA
STA
LDA
STA
DEX
BPL
JSR
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
LDX
LDA
STA
DEX
BPL
JSR
SEC
LDA
ADC
STA

FMUL
=3
A2,X
X2,X
X1,X
SEXP,X
LA2
FADD
=3
B2,X
X2,X
LB2
FDIV
=3
X1,X
T,X
C2,X
X1,X
SEXP,X
X2,X
DLOAD
FMUL
SWAP
=3
T,X
X1,X
LTMP
FSUB
=3
D,X
X2,X
LDD
FADD
SWAP
=3
Z,X
X1,X
LFA
FSUB
=3
Z,X
X2,X
LF3
FDIV
=3
MHLF,X
X2,X
LD12
FADD
INT
X1
X1

Z*Z
4 BYTE MOVE
LOAD EXP/MANT2 WITH A2
SAVE EXP/MANT1 AS SEXP
Z*Z+A2
4 BYTE MOVE
LOAD EXP/MANT2 WITH B2
T=B/(Z*Z+A2)
4 BYTE MOVE
SAVE EXP/MANT1 AS T
LOAD EXP/MANT1 WITH C2
LOAD EXP/MANT2 WITH SEXP
Z*Z*C2
MOVE EXP/MANT1 TO EXP/MANT2
4 BYTE TRANSFER
LOAD EXP/MANT1 WITH T
C2*Z*Z-B2/(Z*Z+A2)
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH D
D+C2*Z*Z-B2/(Z*Z+A2)
MOVE EXP/MANT1 TO EXP/MANT2
4 BYTE TRANSFER
LOAD EXP/MANT1 WITH Z
-Z+D+C2*Z*Z-B2/(Z*Z+A2)
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH Z
Z/(**** )
4 BYTE TRANSFER
LOAD EXP/MANT2 WITH .5
+Z/(***)+.5
ADD INT TO EXPONENT WITH CARRY SET
TO MULTIPLY BY
2**(INT+1)
RETURN RESULT TO EXPONENT

279 1ED7 60
RTS
RETURN ANS=(.5+Z/(-Z+D+C2*Z*ZB2/(Z*Z+A2))*2**(INT+1)
280 1ED8 80 5C
L2E
DCM 1.4426950409
LOG BASE 2 OF E
55 1E
281 1EDC 86 57
A2
DCM 87.417497202
6A E1
282 1EE0 89 4D
B2
DCM 617.9722695
3F 1D
283 1EE4 7B 46
C2
DCM .03465735903
4A 70
284 1EE8 83 4F
D
DCM 9.9545957821
A3 03
285
*
286
*
287
*
BASIC FLOATING POINT ROUTINES
288
*
289 1F00
ORG $1F00
START OF BASIC FLOATING POINT ROUTINES
290 1F00 18
ADD
CLC
CLEAR CARRY
291 1F01 A2 02
LDX =$02
INDEX FOR 3-BYTE ADD
292 1F03 B5 09
ADD1
LDA M1,X
293 1F05 75 05
ADC M2,X
ADD A BYTE OF MANT2 TO MANT1
294 1F07 95 09
STA M1,X
295 1F09 CA
DEX
ADVANCE INDEX TO NEXT MORE SIGNIF.BYTE
296 1F0A 10 F7
BPL ADD1
LOOP UNTIL DONE.
297 1F0C 60
RTS
RETURN
298 1F0D 06 03
MD1
ASL SIGN
CLEAR LSB OF SIGN
299 1F0F 20 12 1F
JSR ABSWAP
ABS VAL OF MANT1, THEN SWAP MANT2
300 1F12 24 09
ABSWAP BIT M1
MANT1 NEG?
301 1F14 10 05
BPL ABSWP1
NO,SWAP WITH MANT2 AND RETURN
302 1F16 20 8F 1F
JSR FCOMPL
YES, COMPLIMENT IT.
303 1F19 E6 03
INC SIGN
INCR SIGN, COMPLEMENTING LSB
304 1F1B 38
ABSWP1 SEC
SET CARRY FOR RETURN TO MUL/DIV
305
*
306
*
SWAP EXP/MANT1 WITH EXP/MANT2
307
*
308 1F1C A2 04
SWAP
LDX =$04
INDEX FOR 4-BYTE SWAP.
309 1F1E 94 0B
SWAP1 STY E-1,X
310 1F20 B5 07
LDA X1-1,X
SWAP A BYTE OF EXP/MANT1 WITH
311 1F22 B4 03
LDY X2-1,X
EXP/MANT2 AND LEAVEA COPY OF
312 1F24 94 07
STY X1-1,X
MANT1 IN E(3BYTES). E+3 USED.
313 1F26 95 03
STA X2-1,X
314 1F28 CA
DEX
ADVANCE INDEX TO NEXT BYTE
315 1F29 D0 F3
BNE SWAP1
LOOP UNTIL DONE.
316 1F2B 60
RTS
317
*
318
*
319
*
320
*
CONVERT 16 BIT INTEGER IN M1(HIGH) AND M1+1(LOW) TO F.P.
321
*
RESULT IN EXP/MANT1. EXP/MANT2 UNEFFECTED
322
*
323
*
324 1F2C A9 8E
FLOAT LDA =$8E
325 1F2E 85 08
STA X1
SET EXPN TO 14 DEC
326 1F30 A9 00
LDA =0
CLEAR LOW ORDER BYTE
327 1F32 85 0B
STA M1+2
328 1F34 F0 08
BEQ NORM
NORMALIZE RESULT
329 1F36 C6 08
NORM1 DEC X1
DECREMENT EXP1
330 1F38 06 0B
ASL M1+2
331 1F3A 26 0A
ROL M1+1
SHIFT MANT1 (3 BYTES) LEFT
332 1F3C 26 09
ROL M1
333 1F3E A5 09
NORM
LDA M1
HIGH ORDER MANT1 BYTE
334 1F40 0A
ASL
UPPER TWO BITS UNEQUAL?

335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
SIGN
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395

1F41
1F43
1F45
1F47
1F49

45
30
A5
D0
60

09
04
08
ED

1F4A
1F4D

20 8F 1F
20 5D 1F

1F50
1F52
1F54
1F56
1F59
1F5B

A5
C5
D0
20
50
70

04
08
F7
00 1F
E3
05

1F5D
1F5F
1F61
1F62
1F64
1F66
1F68
1F6A
1F6C
1F6D
1F6F
1F71
1F73
1F74
1F76

90
A5
0A
E6
F0
A2
A9
B0
0A
56
15
95
E8
D0
60

BD
09

1F77
1F7A
1F7C
1F7F
1F80
1F83
1F85
1F88
1F89
1F8B
1F8D
1F8F
1F90
1F92
1F94
1F96
1F98
1F99
1F9B

20
65
20
18
20
90
20
88
10
46
90
38
A2
A9
F5
95
CA
D0
F0

0D 1F
08
CD 1F

08
7E
FA
80
01
0F
0F
0F
F2

66 1F
03
00 1F
F5
03
AF
03
00
08
08
F7
BC

EOR
BMI
LDA
BNE
RTS

M1
RTS1
X1
NORM1

YES,RETURN WITH MANT1 NORMALIZED
EXP1 ZERO?
NO, CONTINUE NORMALIZING
RETURN

RTS1
*
*
*
EXP/MANT2-EXP/MANT1 RESULT IN EXP/MANT1
*
FSUB
JSR FCOMPL
CMPL MANT1 CLEARS CARRY UNLESS ZERO
SWPALG JSR ALGNSW
RIGHT SHIFT MANT1 OR SWAP WITH MANT2 ON CARRY
*
*
ADD EXP/MANT1 AND EXP/MANT2 RESULT IN EXP/MANT1
*
FADD
LDA X2
CMP X1
COMPARE EXP1 WITH EXP2
BNE SWPALG
IF UNEQUAL, SWAP ADDENDS OR ALIGN MANTISSAS
JSR ADD
ADD ALIGNED MANTISSAS
ADDEND BVC NORM
NO OVERFLOW, NORMALIZE RESULTS
BVS RTLOG
OV: SHIFT MANT1 RIGHT. NOTE CARRY IS CORRECT
ALGNSW BCC SWAP
SWAP IF CARRY CLEAR, ELSE SHIFT RIGHT ARITH.
RTAR
LDA M1
SIGN OF MANT1 INTO CARRY FOR
ASL
RIGHT ARITH SHIFT
RTLOG INC X1
INCR EXP1 TO COMPENSATE FOR RT SHIFT
BEQ OVFL
EXP1 OUT OF RANGE.
RTLOG1 LDX =$FA
INDEX FOR 6 BYTE RIGHT SHIFT
ROR1
LDA =$80
BCS ROR2
ASL
ROR2
LSR E+3,X
SIMULATE ROR E+3,X
ORA E+3,X
STA E+3,X
INX
NEXT BYTE OF SHIFT
BNE ROR1
LOOP UNTIL DONE
RTS
RETURN
*
*
*
EXP/MANT1 X EXP/MANT2 RESULT IN EXP/MANT1
*
FMUL
JSR MD1
ABS. VAL OF MANT1, MANT2
ADC X1
ADD EXP1 TO EXP2 FOR PRODUCT EXPONENT
JSR MD2
CHECK PRODUCT EXP AND PREPARE FOR MUL
CLC
CLEAR CARRY
MUL1
JSR RTLOG1
MANT1 AND E RIGHT.(PRODUCT AND MPLIER)
BCC MUL2
IF CARRY CLEAR, SKIP PARTIAL PRODUCT
JSR ADD
ADD MULTIPLICAN TO PRODUCT
MUL2
DEY
NEXT MUL ITERATION
BPL MUL1
LOOP UNTIL DONE
MDEND LSR SIGN
TEST SIGN (EVEN/ODD)
NORMX BCC NORM
IF EXEN, NORMALIZE PRODUCT, ELSE COMPLEMENT
FCOMPL SEC
SET CARRY FOR SUBTRACT
LDX =$03
INDEX FOR 3 BYTE SUBTRACTION
COMPL1 LDA =$00
CLEAR A
SBC X1,X
SUBTRACT BYTE OF EXP1
STA X1,X
RESTORE IT
DEX
NEXT MORE SIGNIFICANT BYTE
BNE COMPL1
LOOP UNTIL DONE
BEQ ADDEND
NORMALIZE (OR SHIFT RIGHT IF OVERFLOW)
*
*
*
EXP/MANT2 / EXP/MANT1 RESULT IN EXP/MANT1

396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447

1F9D
1FA0
1FA2
1FA5
1FA6
1FA8
1FAA
1FAC
1FAD
1FAE
1FB0
1FB2
1FB3
1FB5
1FB7
1FB8
1FBA
1FBC
1FBE
1FC0
1FC2
1FC4
1FC6
1FC8
1FC9
1FCB
1FCD
1FCF
1FD1
1FD3
1FD5
1FD7
1FD8
1FD9
1FDB
1FDD
1FDF
1FE1
1FE2
1FE4

20
E5
20
38
A2
B5
F5
48
CA
10
A2
68
90
95
E8
D0
26
26
26
06
26
26
B0
88
D0
F0
86
86
86
B0
30
68
68
90
49
85
A0
60
10
00

0D 1F
08
CD 1F

1FE5
1FE8
1FEA
1FEC
1FEE

20
A5
C9
D0
60

5F 1F
08
8E
F7

*
FDIV
DIV1

02
05
0C

DIV2

F8
FD
DIV3

02
08

DIV4

F8
0B
0A
09
07
06
05
1C
DA
BE
0B
0A
09
0D
04

MD2

B2
80
08
17

MD3

F7

JSR
SBC
JSR
SEC
LDX
LDA
SBC
PHA
DEX
BPL
LDX
PLA
BCC
STA
INX
BNE
ROL
ROL
ROL
ASL
ROL
ROL
BCS
DEY
BNE
BEQ
STX
STX
STX
BCS
BMI
PLA
PLA
BCC
EOR
STA
LDY
RTS
BPL
BRK

MD1
X1
MD2

TAKE ABS VAL OF MANT1, MANT2
SUBTRACT EXP1 FROM EXP2
SAVE AS QUOTIENT EXP
SET CARRY FOR SUBTRACT
INDEX FOR 3-BYTE INSTRUCTION

=$02
M2,X
E,X
DIV2
=$FD
DIV4
M2+3,X
DIV3
M1+2
M1+1
M1
M2+2
M2+1
M2
OVFL

SUBTRACT A BYTE OF E FROM MANT2
SAVE ON STACK
NEXT MORE SIGNIF BYTE
LOOP UNTIL DONE
INDEX FOR 3-BYTE CONDITIONAL MOVE
PULL A BYTE OF DIFFERENCE OFF STACK
IF MANT2'
M1
SEC
RTS
OBCMIN JSR OUTBYT
COMINB JSR COMMA
INBYTE JSR INCHR
JSR ASCNIB
BCS OUT4
ASL A
ASL A
ASL A
ASL A
STA SCR3
JSR INCHR
JSR ASCNIB
BCS OUT2
ORA SCR3
GOOD
CLC
RTS
OUT4
CMP #':'
BNE OUT1
JSR INCHR
BNE GOOD
OUT1
CLV
BVC CRCHK
OUT2
BIT CRCHK
CRCHK CMP #$0D

;SPACE?
;FWD ARROW?
;OUT BYTE, OUT COMMA, IN BYTE
;OUT COMMA, IN BYTE

;COLON ?
;CARRIAGE RETURN?

;CHECK FOR C/R

0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425
0426

8206
8207
8208
820A
820D
8210
8213
8216
8219
821C
821D
821F
8220
8223
8225
8228
822B
822E
8231
8233
8235
8237
8239
823B
823E
8241
8244
8246
8248
824A
824D
824F
8251
8254
8257
8258
825A
825D
8260
8262
8265
8267
826A
826C
826F
8271
8272
8275
8277
8279
827B
827D
827F
8281
8283
8285
8287
8289
828B
828C
828D
828F

38
60
A2
0E
2E
2E
2E
2E
2E
CA
D0
60
20
A9
8D
8D
20
20
C9
F0
C9
D0
A2
8E
EE
AE
E0
D0
F0
20
B0
A2
0E
2E
CA
D0
0D
8D
A9
8D
D0
2C
F0
EE
C9
18
4C
C9
F0
C9
90
C9
B0
C9
B0
C9
90
C9
38
60
E9
29

10
4A
4B
4C
4D
4E
4F

A6
A6
A6
A6
A6
A6

EB
88
00
49
33
08
1B
2C
04
2D
11
FF
33
49
49
03
E3
1D
75
18
04
4A
4B
F7
4A
4A
FF
33
C7
33
03
49
0D

81
A6
A6
82
8A

A6
A6
A6

82
A6
A6
A6
A6
A6
A6
A6

B8 81
0D
19
30
0C
47
08
41
08
3A
06
30
37
0F

SEC
RTS
PSHOVE LDX
PRM10 ASL
ROL
ROL
ROL
ROL
ROL
DEX
BNE
RTS
PARM
JSR
LDA
STA
STA
PM1
JSR
PARFIL JSR
CMP
BEQ
CMP
BNE
M21
LDX
STX
INC
LDX
CPX
BNE
BEQ
M22
JSR
BCS
LDX
M23
ASL
ROL
DEX
BNE
ORA
STA
LDA
STA
BNE
M24
BIT
BEQ
INC
M25
CMP
CLC
JMP
ASCNIB CMP
BEQ
CMP
BCC
CMP
BCS
CMP
BCS
CMP
BCC
M26
CMP
SEC
RTS
M27
SBC
M28
AND

#$10
P3L
P3H
P2L
P2H
P1L
P1H

;PUSH PARMS DOWN

PRM10
SAVER
#0
PARNR
SCR3
PSHOVE
INCHR
#','
M21
#'-'
M22
#$FF
SCR3
PARNR
PARNR
#$03
PM1
M24
ASCNIB
M24
#4
P3L
P3H

;GET PARMS - RETURN ON C/R OR ERR

;VALID DELIMETERS - ,

M23
P3L
P3L
#$FF
SCR3
PARFIL
SCR3
M25
PARNR
#$0D
RESXAF
#$0D
M29
#'0'
M26
#'G'
M26
#'A'
M27
#':'
M28
#'0'

;C/R?

;CARRY SET - NON HEX
#$37
#$0F

0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484
0485
0486
0487
0488

8291
8292
8293
8296
8298
829B
829C
829F
82A1
82A4
82A6
82A7
82AA
82AC
82AF
82B1
82B2
82B4
82B6
82B8
82BA
82BD
82BE
82C0
82C2
82C4
82C6
82C8
82CA
82CD
82CF
82D2
82D4
82D6
82D9
82DA
82DD
82DE
82DF
82E0
82E3
82E6
82E8
82EB
82EC
82ED
82EE
82F1
82F4
82F5
82F6
82F9
82FA
82FB
82FC
82FD
82FE
82FF
8300
8303
8304
8307

18
60
EE
D0
EE
60
AE
86
AE
86
60
AE
86
AE
86
60
E6
D0
E6
D0
2C
60
A5
D0
A5
F0
C6
C6
20
A5
CD
D0
A5
CD
B8
4C
08
48
18
6D
8D
90
EE
68
28
60
AD
AE
48
8A
20
68
48
48
4A
4A
4A
4A
20
68
20
68

4A A6
03
4B A6

M29
INCP3

4D A6
FF
4C A6
FE

P2SCR

4B A6
FF
4A A6
FE

P3SCR

FE
14
FF
10
BD 82

INCCMP

FE
06
FF
F2
FF
FE
88 81
FF
4B A6
05
FE
4A A6
BE 81

WRAP
EXWRAP
DECCMP

M32
COMPAR

EXITCP
CHKSAD

36 A6
36 A6
03
37 A6

59 A6
5A A6

M33
OUTPC
OUTXAH

FA 82
OUTBYT

44 8A
44 8A

CLC
RTS
INC
BNE
INC
RTS
LDX
STX
LDX
STX
RTS
LDX
STX
LDX
STX
RTS
INC
BNE
INC
BNE
BIT
RTS
LDA
BNE
LDA
BEQ
DEC
DEC
JSR
LDA
CMP
BNE
LDA
CMP
CLV
JMP
PHP
PHA
CLC
ADC
STA
BCC
INC
PLA
PLP
RTS
LDA
LDX
PHA
TXA
JSR
PLA
PHA
PHA
LSR
LSR
LSR
LSR
JSR
PLA
JSR
PLA

P3L
*+5
P3H

;INCREMENT P3 (16 BITS)

P2H
$FF
P2L
$FE

;MOVE P2 TO FE,FF

P3H
$FF
P3L
$FE

;MOVE P3 TO FE,FF

$FE
COMPAR
$FF
COMPAR
EXWRAP

;INCREM FE,FF, COMPARE TO P3

$FE
M32
$FF
WRAP
$FF
$FE
SAVER
$FF
P3H
EXITCP
$FE
P3L

;DECREM FE,FF AND COMPARE TO P3

;TEST TO WRAP AROUND

;COMPARE FE,FF TO P3

RESXF
;16 BIT CKSUM IN SCR6,7
SCR6
SCR6
M33
SCR7

PCLR
PCHR

;OUTPUT PC

OUTBYT
;OUTPUT 2 HEX DIGS FROM A
A
A
A
A
NBASOC
NBASOC

0489
0490
0491
0492
0493
0494
0495
0496
0497
0498
0499
0500
0501
0502
0503
0504
0505
0506
0507
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517
0518
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528
0529
0530
0531
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549
0550

8308
8309
830B
830D
830F
8311
8313
8315
8316
8319
831B
831D
8320
8322
8325
8328
832B
832E
8330
8333
8336
8337
833A
833B
833D
833F
8342
8343
8345
8348
8349
834A
834D
834E
8350
8353
8355
8358
8359
835A
835D
8360
8362
8365
8368
836B
836E
836F
8371
8374
8377
8379
837C
837E
8381
8383
8386
8386
8386
8386
8389
838B

60
29
C9
B0
69
90
69
60
20
A6
A5
4C
A9
4C
20
AD
4C
A9
8D
8D
60
20
48
A9
D0
20
48
A9
20
68
60
20
48
A9
20
A9
20
68
60
AE
20
A9
8D
8D
0E
2E
CA
D0
20
20
B0
EE
D0
EE
D0
4C

0F
0A
04
30
02
36
4D
FF
FE
F4
3F
47
3A
36
FA
00
36
37

83
82
8A
83
A6
82
A6
A6

EE 82
2C
06
42 83
20
47 8A
FA 82
0D
47 8A
0A
47 8A
56
88
FF
39
38
38
39
F7
03
86
0A
38
03
39
EE
BE

A6
81
A6
A6
A6
A6
89
83
A6
A6
81

20 92 83
90 06
20 92 83

RTS
NIBASC AND #$0F
;NIBBLE IN A TO ASCII IN A
CMP #$0A
;LINE FEED
BCS NIBALF
ADC #$30
BCC EXITNB
NIBALF ADC #$36
EXITNB RTS
CRLFSZ JSR CRLF
;PRINT CRLF, FF, FE
LDX $FF
LDA $FE
JMP OUTXAH
OUTQM LDA #'?'
JMP OUTCHR
OCMCK JSR COMMA
;OUT COMMA, CKSUM LO
LDA SCR6
JMP OUTBYT
ZERCK LDA #0
;INIT CHECKSUM
STA SCR6
STA SCR7
RTS
OPCCOM JSR OUTPC
;PC OUT, COMMA OUT
COMMA PHA
;COMMA OUT
LDA #','
BNE SPCP3
SPC2
JSR SPACE
;2 SPACES OUT
SPACE PHA
;1 SPACE OUT
LDA #$20
;SPACE
SPCP3 JSR OUTCHR
PLA
RTS
OBCRLF JSR OUTBYT
;BYTE OUT, CRLF OUT
CRLF
PHA
LDA #$0D
JSR OUTCHR
LDA #$0A
;LINE FEED
JSR OUTCHR
PLA
RTS
DELAY LDX TV
;DELAY DEPENDS ON TV
DL1
JSR SAVER
LDA #$FF
STA SCR9
STA SCR8
DLY1
ASL SCR8
;(SCR9,8)=FFFF-2**X
ROL SCR9
DEX
BNE DLY1
DLY2
JSR IJSCNV
;SCAN DISPLAY
JSR INSTAT
;SEE IF KEY DOWN
BCS DLY0
INC SCR8
;SCAN 2**X+1 TIMES
BNE *+5
INC SCR9
BNE DLY2
DLY0
JMP RESXF
; INSTAT - SEE IF KEY DOWN, RESULT IN CARRY
; KEYSTAT, TSTAT RETURN IMMEDIATELY W/STATUS
; INSTAT WAITS FOR RELEASE
INSTAT JSR INJISV
BCC INST2
INST1 JSR INJISV

0551
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602
0603
0604
0605
0606
0607
0608
0609
0610
0611
0612

838E
8390
8391
8392
8395
8395
8395
8395
8395
8395
8395
8395
8397
8399
839C
839E
83A1
83A4
83A7
83AA
83AC
83AF
83B2
83B4
83B7
83BA
83BD
83BF
83C1
83C2
83C3
83C6
83C8
83CA
83CB
83CD
83CF
83D2
83D5
83D5
83D8
83DB
83DE
83E1
83E4
83E6
83E9
83EB
83ED
83F0
83F2
83F3
83F5
83F7
83FA
83FD
8400
8401
8404
8405
8408
8409

B0 FB
38
60
6C 67 A6

C9
D0
20
A9
20
20
20
20
B0
8D
20
B0
8D
AD
8D
90
D0
18
60
20
D0
A0
C8
C0
F0
20
B9

52
5A
4D
50
47
42
EE
D6
13
34
D9
0B
59
34
5A
09
02

20
20
20
B9
20
B0
99
90
F0
20
F0
60
C9
D0
20
20
AE
9A
AD
48
AD
48
AD

47
42
3F
5A
D3
05
5A
DF
D4
CB
D8

83
8A
83
82
81
A6
81
A6
A6
A6

CB 81
FA
00
06
CA
4D 83
99 8F
8A
83
83
A6
81
A6
81

47
20
4D 83
9C 8B
5B A6
5A A6
59 A6
5C A6

BCS INST1
SEC
INST2 RTS
INJISV JMP (INSVEC+1)
;
;
; *** EXECUTE BLOCKS BEGIN HERE
;
BZPARM =*
; ZERO PARM COMMANDS
;
REGZ
CMP #'R'
;DISP REGISTERS
BNE GOZ
;PC,S,F,A,X,Y
RGBACK JSR CRLF
LDA #'P'
JSR OUTCHR
JSR SPACE
JSR OUTPC
JSR COMINB
BCS NH3
STA SCR4
JSR INBYTE
BCS NH3
STA PCLR
LDA SCR4
STA PCHR
BCC M34
NH3
BNE NOTCR
EXITRG CLC
EXRGP1 RTS
NOTCR JSR ADVCK
BNE EXRGP1
M34
LDY #0
M35
INY
CPY #6
BEQ RGBACK
JSR CRLF
LDA RGNAM-1,Y
;GET REG NAME
; OUTPUT 3 SPACES TO LINE UP DISPLAY
JSR OUTCHR
JSR SPACE
JSR SPC2
LDA PCHR,Y
JSR OBCMIN
BCS M36
STA PCHR,Y
BCC M35
M36
BEQ EXITRG
JSR ADVCK
BEQ M35
RTS
GOZ
CMP #'G'
BNE LPZB
JSR CRLF
GO1ENT JSR NACCES
;WRITE PROT MONITOR RAM
LDX SR
;RESTORE REGS
TXS
LDA PCHR
PHA
LDA PCLR
NR10
PHA
LDA FR

0613
0614
0615
0616
0617
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636
0637
0638
0639
0640
0641
0642
0643
0644
0645
0646
0647
0648
0649
0650
0651
0652
0653
0654
0655
0656
0657
0658
0659
0660
0661
0662
0663
0664
0665
0666
0667
0668
0669
0670
0671
0672
0673
0674

840C
840D
8410
8413
8416
8417
8419
841B
841E
8421
8424
8426
8429
842C
842F
8431
8433
8436
8438
843A
843D
843F
8440
8443
8446
8449
844B
844D
8450
8452
8454
8457
8459
845B
845D
845F
8461
8464
8466
8468
846A
846D
8470
8473
8475
8478
847A
847D
847F
8482
8484
8487
8489
848B
848E
8491
8493
8495
8497
849A
849C
849F

48
AC
AE
AD
40
C9
F0
4C
20
20
A9
8D
20
20
C9
D0
20
B0
D0
AD
F0
38
4C
8D
20
B0
85
20
B0
85
20
B0
A0
91
D1
F0
AD
29
C9
F0
EE
20
CE
D0
20
B0
CD
D0
20
B0
CD
F0
D0
20
AD
29
C9
F0
AD
69
8D
D0

5F A6
5E A6
5D A6
11
03
A7
88
4D
00
52
2E
1B
3B
F9
A1
56
09
52
01
B8
3D
A1
43
FF
A1
D7
FE
A1
35
00
FE
FE
0C
52
0F
0F
03
52
B2
3D
DF
D9
14
37
0C
D9
0A
36
A0
03
D9
52
F0
F0
92
52
10
52
88

84
81
83
A6
83
8A
84
A6
81
A6
84
84
84

A6

A6
82
A6
81
A6
81
A6
81
A6

A6
A6

PHA
LDY
LDX
LDA
RTI
LPZB
CMP
BEQ
JMP
JSR
JSR
LDA
STA
LPZ
JSR
LP1
JSR
CMP
BNE
JSR
BCS
BNE
LDA
BEQ
SEC
JMP
NUREC STA
JSR
BCS
STA
JSR
BCS
STA
MORED JSR
BCS
LDY
STA
CMP
BEQ
LDA
AND
CMP
BEQ
INC
LPGD
JSR
DEC
BNE
JSR
BCS
CMP
BNE
JSR
BCS
CMP
BEQ
BNE
BADDY JSR
TAPERR LDA
AND
CMP
BEQ
LDA
ADC
STA
BNE

YR
XR
AR
#$11
*+5
DEPZ
SAVER
CRLF
#0
ERCNT
ZERCK
INCHR
#$3B
LP1
LDBYTE
TAPERR
NUREC
ERCNT
*+3
RESXAF
SCRD
LDBYTE
TAPERR
$FF
LDBYTE
LPZ
$FE
LDBYTE
TAPERR
#0
($FE),Y
($FE),Y
LPGD
ERCNT
#$0F
#$0F
*+5
ERCNT
INCCMP
SCRD
MORED
INBYTE
TAPERR
SCR7
BADDY
INBYTE
TAPERR
SCR6
LPZ
TAPERR
INBYTE
ERCNT
#$F0
#$F0
LPZ
ERCNT
#$10
ERCNT
LPZ

;LOAD PAPER TAPE

;SEMI COLON

;ERRORS ?

;(ALWAYS)

0675
0676
0677
0678
0679
0680
0681
0682
0683
0684
0685
0686
0687
0688
0689
0690
0691
0692
0693
0694
0695
0696
0697
0698
0699
0700
0701
0702
0703
0704
0705
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718
0719
0720
0721
0722
0723
0724
0725
0726
0727
0728
0729
0730
0731
0732
0733
0734
0735
0736

84A1
84A4
84A7
84A9
84AB
84AE
84B0
84B2
84B5
84B7
84B9
84BB
84BE
84C0
84C3
84C6
84C8
84CA
84CC
84CF
84D1
84D3
84D5
84D7
84DA
84DA
84DA
84DA
84DA
84DC
84DE
84E1
84E4
84E6
84E8
84EB
84EE
84F0
84F2
84F4
84F6
84F9
84FC
84FD
84FF
8501
8503
8505
8507
8509
850C
850E
850F
8510
8512
8514
8517
851A
851D
851F
8521
8524

20
4C
C9
D0
4C
C9
D0
4C
C9
D0
A5
8D
A5
8D
4C
C9
D0
A0
4C
C9
D0
A0
D0
6C

D9
DD
44
03
E1
4D
03
17
56
0D
FE
4A
FF
4B
9A
12
05
00
78
13
04
80
F5
6D

C9
D0
20
20
A0
A2
20
20
B0
91
D1
F0
20
20
CA
D0
F0
F0
C9
D0
70
20
10
18
60
C9
D0
20
20
20
A0
B1
20
B0

44
32
A7
16
00
08
42
D9
11
FE
FE
03
20
B2

81
82
84
85

A6
A6
85

8C

A6

82
83
83
81

83
82

E9
E0
0B
20
4C
F0
42 83
EB
4D
65
A7
16
3A
00
FE
D3
11

82
83
83
81

LDBYTE JSR INBYTE
JMP CHKSAD
DEPZ
CMP #'D'
;DEPOSIT, 0 PARM - USE (OLD)
BNE MEMZ
JMP NEWLN
MEMZ
CMP #'M'
;MEM, 0 PARM - USE (OLD)
BNE VERZ
JMP NEWLOC
VERZ
CMP #'V'
;VERIFY, 0 PARM - USE (OLD)
BNE L1ZB
; ... DO 8 BYTES (LIKE VER 1 PARM)
LDA $FE
STA P3L
LDA $FF
STA P3H
JMP VER1+4
L1ZB
CMP #$12
;LOAD KIM, ZERO PARM
BNE L2ZB
LDY #0
;MODE = KIM
L1J
JMP LENTRY
;GO TO CASSETTE ROUTINE
L2ZB
CMP #$13
;LOAD HS, ZERO PARM
BNE EZPARM
LDY #$80
;MODE - HS
BNE L1J
;(ALWAYS)
EZPARM JMP (URCVEC+1) ;ELSE UNREC COMMAND
B1PARM =*
;
; 1 PARAMETER COMMAND EXEC BLOCKS
;
DEP1
CMP #'D'
;DEPOSIT, 1 PARM
BNE MEM1
JSR P3SCR
NEWLN JSR CRLFSZ
LDY #0
LDX #8
DEPBYT JSR SPACE
JSR INBYTE
BCS NH41
STA ($FE),Y
CMP ($FE),Y
;VERIFY
BEQ DEPN
JSR OUTQM
;TYPE "?" IF NG
DEPN
JSR INCCMP
DEX
BNE DEPBYT
BEQ NEWLN
NH41
BEQ DEPEC
CMP #$20
;SPACE = FWD
BNE DEPES
BVS DEPN
JSR SPACE
BPL DEPN
DEPEC CLC
RTS
MEM1
CMP #'M'
;MEMORY, 1 PARM
BNE GO1
JSR P3SCR
NEWLOC JSR CRLFSZ
JSR COMMA
LDY #0
LDA ($FE),Y
JSR OBCMIN
BCS NH42

0737
0738
0739
0740
0741
0742
0743
0744
0745
0746
0747
0748
0749
0750
0751
0752
0753
0754
0755
0756
0757
0758
0759
0760
0761
0762
0763
0764
0765
0766
0767
0768
0769
0770
0771
0772
0773
0774
0775
0776
0777
0778
0779
0780
0781
0782
0783
0784
0785
0786
0787
0788
0789
0790
0791
0792
0793
0794
0795
0796
0797
0798

8526
8528
852A
852C
852E
8531
8534
8535
8537
8539
853B
853D
853F
8541
8543
8545
8547
8549
854B
854D
854F
8551
8553
8554
8555
8558
8559
855B
855D
855E
8560
8562
8564
8566
8567
8569
856B
856C
856E
8570
8572
8574
8575
8577
8578
8579
857B
857D
8580
8583
8585
8586
8588
8589
858B
858C
858F
8590
8593
8596
8598
859A

A0
91
D1
F0
20
20
18
90
F0
50
C9
F0
C9
F0
C9
F0
C9
F0
C9
F0
C9
F0
38
60
20
18
90
A5
18
69
85
90
E6
18
90
A5
38
E9
85
B0
C6
18
90
18
60
C9
D0
20
20
A2
9A
A9
48
A9
48
AD
48
AD
4C
C9
D0
AD

00
FE
FE
03
20 83
B2 82
E0
3E
04
3C
D8
20
EE
3E
EA
2B
10
3C
06
2D
16
BE 82
BC
FE
08
FE
02
FF
AE
FE
08
FE
02
FF
A0
47
19
4D 83
9C 8B
FF
7F
FF
4B A6
4A A6
08 84
56
1A
4A A6

LDY
STA
CMP
BEQ
JSR
NXTLOC JSR
CLC
BCC
NH42
BEQ
BVC
CMP
BEQ
CMP
BEQ
CMP
BEQ
CMP
BEQ
CMP
BEQ
CMP
BEQ
DEPES SEC
RTS
PRVLOC JSR
CLC
BCC
LOCP8 LDA
CLC
ADC
STA
BCC
INC
M42
CLC
BCC
LOCM8 LDA
SEC
SBC
STA
BCS
DEC
M43
CLC
BCC
EXITM1 CLC
RTS
GO1
CMP
BNE
JSR
JSR
LDX
TXS
LDA
PHA
LDA
PHA
LDA
PHA
LDA
JMP
VER1
CMP
BNE
LDA

#$00
($FE),Y
($FE),Y
NXTLOC
OUTQM
INCCMP
NEWLOC
EXITM1
*+6
#'<'
NEWLOC
#$20
NXTLOC
#'>'
NXTLOC
#'+'
LOCP8
#'<'
PRVLOC
#'-'
LOCM8

;VERIFY MEM
;TYPE ? AND CONTINUE

;SPACE ?

DECCMP

;BACK ONE BYT

NEWLOC
$FE

;GO FWD 8 BYTES

#$08
$FE
M42
$FF
NEWLOC
$FE

;GO BACKWD 8 BYTES

#$08
$FE
M43
$FF
NEWLOC
#'G'
VER1
CRLF
NACCES
#$FF

;GO, 1 PARM (RTRN ADDR ON STK)
; ... PARM IS ADDR TO GO TO
;WRITE PROT MONITR RAM
;PUSH RETURN ADDR

#$7F
#$FF
P3H
P3L
NR10
#'V'
JUMP1
P3L

;VERIFY, 1 PARM (8 BYTES, CKSUM)

0799
0800
0801
0802
0803
0804
0805
0806
0807
0808
0809
0810
0811
0812
0813
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827
0828
0829
0830
0831
0832
0833
0834
0835
0836
0837
0838
0839
0840
0841
0842
0843
0844
0845
0846
0847
0848
0849
0850
0851
0852
0853
0854
0855
0856
0857
0858
0859
0860

859D
85A0
85A1
85A3
85A6
85A9
85AC
85AE
85B1
85B4
85B6
85B8
85BB
85BD
85BF
85C2
85C3
85C4
85C6
85C7
85C9
85CA
85CC
85CD
85D0
85D1
85D4
85D7
85D9
85DB
85DD
85E0
85E2
85E4
85E5
85E6
85E9
85EC
85EF
85F1
85F3
85F5
85F7
85F9
85FB
85FE
8600
8602
8603
8606
8607
8608
860A
860C
860F
8611
8614
8615
8616
8619
8619
8619

8D
18
69
8D
AD
8D
69
8D
4C
C9
D0
AD
C9
B0
20
0A
A8
A2
9A
A9
48
A9
48
B9
48
B9
4C
C9
D0
A0
AD
C9
D0
38
60
20
20
4C
C9
D0
A0
D0
C9
D0
AD
29
C9
2A
4E
2A
0A
29
49
8D
A9
8D
18
60
4C

4C A6
07
4A
4B
4D
00
4B
40
4A
1F
4A
08
26
9C

A6
A6
A6
A6
86
A6
8B

FF
7F
FF
21 A6
20 A6
08 84
12
14
00
4A A6
FF
02
08
08
78
13
04
80
E6
57
1B
4A
11
08

82
82
8C

A6

4B A6
0F
0F
01 AC
0F
03 AC
27 88

STA P2L
CLC
ADC #$07
STA P3L
LDA P3H
STA P2H
ADC #0
STA P3H
JMP VER2+4
JUMP1 CMP #'J'
;JUMP (JUMP TABLE IN SYS RAM)
BNE L11B
LDA P3L
CMP #8
;0-7 ONLY VALID
BCS JUM2
JSR NACCES
;WRITE PROT SYS RAM
ASL A
TAY
LDX #$FF
;INIT STK PTR
TXS
LDA #$7F
;PUSH COLD RETURN
PHA
LDA #$FF
PHA
LDA JTABLE+1,Y ;GET ADDR FROM TABLE
PHA
;PUSH ON STACK
LDA JTABLE,Y
JMP NR10
;LOAD UP USER REG'S AND RTI
L11B
CMP #$12
;LOAD KIM FMT, 1 PARM
BNE L21B
LDY #0
;MODE = KIM
L11C
LDA P3L
CMP #$FF
;ID MUST NOT BE FF
BNE *+4
SEC
JUM2
RTS
JSR PSHOVE
;FIX PARM POSITION
L11D
JSR PSHOVE
JMP LENTRY
L21B
CMP #$13
;LOAD TAPE, HS FMT, 1 PARM
BNE WPR1B
LDY #$80
;MODE = HS
BNE L11C
WPR1B CMP #'W'
;WRITE PROT USER RAM
BNE E1PARM
LDA P3L
; FIRST DIG IS 1K ABOVE 0,
AND #$11
; SECOND IS 2K ABOVE 0
CMP #8
; THIRD IS 3K ABOVE 0.
ROL A
LSR P3H
ROL A
ASL A
AND #$0F
EOR #$0F
;0 IS PROTECT
STA OR3A
LDA #$0F
STA DDR3A
CLC
RTS
E1PARM JMP CALC3
B2PARM =*
;
; 2 PARAMETER EXEC BLOCKS

0861
0862
0863
0864
0865
0866
0867
0868
0869
0870
0871
0872
0873
0874
0875
0876
0877
0878
0879
0880
0881
0882
0883
0884
0885
0886
0887
0888
0889
0890
0891
0892
0893
0894
0895
0896
0897
0898
0899
0900
0901
0902
0903
0904
0905
0906
0907
0908
0909
0910
0911
0912
0913
0914
0915
0916
0917
0918
0919
0920
0921
0922

8619
8619
861B
861D
8620
8623
8625
8627
8628
862B
862D
862E
862F
8631
8633
8636
8639
863C
863E
8640
8643
8646
8649
864B
864E
8650
8652
8655
8658
865B
865D
865F
8661
8662
8664
8667
866A
866C
866D
866E
8671
8673
8675
8676
8678
867B
867E
8681
8684
8687
8688
868A
868C
868F
8691
8693
8695
8698
869A
869C
869D
86A0

C9
D0
20
AD
A0
91
88
AD
91
18
60
C9
D0
AD
8D
4C
C9
D0
20
20
20
A2
20
A0
B1
20
20
20
70
F0
B0
CA
D0
20
20
90
18
60
20
E0
F0
E8
10
20
20
20
AE
20
60
C9
D0
AD
C9
D0
A0
4C
C9
D0
18
20
20

10
12
A7 82
4D A6
01
FE

;
STD2

4C A6
FE
4D
09
4C
4E
08
56
48
9C
2E
16
08
42
00
FE
DD
FA
B2
11
02
0D

MEM2
A6
A6
88

VER2

82
83
83

VADDR

83

V2

82
82
82

E7
25 83
86 83
DA
BE 82
08
03
F6
25
4D
42
37
F4

V1

83
83
83
A6
82

12
0C
4C A6
FF
F4
00
E9 85
1C
75
88 81
9C 82

L12B

SP2B

CMP
BNE
JSR
LDA
LDY
STA
DEY
LDA
STA
CLC
RTS
CMP
BNE
LDA
STA
JMP
CMP
BNE
JSR
JSR
JSR
LDX
JSR
LDY
LDA
JSR
JSR
JSR
BVS
BEQ
BCS
DEX
BNE
JSR
JSR
BCC
CLC
RTS
JSR
CPX
BEQ
INX
BPL
JSR
JSR
JSR
LDX
JSR
RTS
CMP
BNE
LDA
CMP
BNE
LDY
JMP
CMP
BNE
CLC
JSR
JSR

#$10
MEM2
P3SCR
P2H
#1
($FE),Y

;STORE DOUBLE BYTE

P2L
($FE),Y
#'M'
VER2
P2L
P1L
MEM3C
#'V'
L12B
P2SCR
ZERCK
CRLFSZ
#8
SPACE
#0
($FE),Y
CHKSAD
OUTBYT
INCCMP
V1
*+4
V1

;CONTINUE MEM SEARCH W/OLD PTR

;VERIFY MEM W/CHKSUMS , 2 PARM

V2
OCMCK
INSTAT
VADDR
DECCMP
#8
*+5
V1
OCMCK
CRLF
SPACE
SCR7
OUTXAH
#$12
SP2B
P2L
#$FF
L12B-1
#0
L11D
#$1C
E2PARM
SAVER
P2SCR

;LOAD KIM FMT TAPE, 2 PARMS
;ID MUST BE FF
;ERR
;MODE = HS
;SAVE PAPER TAPE, 2 PARMS

0923
0924
0925
0926
0927
0928
0929
0930
0931
0932
0933
0934
0935
0936
0937
0938
0939
0940
0941
0942
0943
0944
0945
0946
0947
0948
0949
0950
0951
0952
0953
0954
0955
0956
0957
0958
0959
0960
0961
0962
0963
0964
0965
0966
0967
0968
0969
0970
0971
0972
0973
0974
0975
0976
0977
0978
0979
0980
0981
0982
0983
0984

86A3
86A6
86A8
86AB
86AE
86B1
86B3
86B6
86B8
86BA
86BD
86BF
86C2
86C5
86C8
86CA
86CD
86CF
86D2
86D4
86D6
86D9
86DC
86DE
86E1
86E3
86E6
86E8
86EB
86EE
86F1
86F2
86F4
86F7
86FA
86FD
8700
8701
8703
8704
8707
8709
870B
870C
870E
870F
8710
8711
8714
8714
8714
8714
8714
8716
8718
871B
871D
8720
8723
8725
8727
8729

20
B0
4C
20
CD
90
AD
B0
69
8D
A9
20
AD
20
A5
20
A5
20
A0
B1
20
20
B0
20
70
CE
D0
AE
AD
20
18
90
20
4C
20
AD
38
E5
48
AD
E5
F0
68
A9
60
68
60
4C

FA
03
C4
4D
58
05
58
02
01
3D
3B
47
3D
F4
FF
F4
FE
F4
00
FE
F4
86
CA
B2
C5
3D
EA
37
36
F4

C9
D0
20
A9
8D
AD
A0
91
D1
F0

46
21
9C 82
00
52 A6
4E A6
00
FE
FE
03

AF
DD
FA
2E
4A

86

SP2C

81
83
A6

SPEXIT
SP2D

A6
A6

SP2E
SP2F

8A
A6
86
86
86
MORED2
86
83
82
A6
A6
A6
82
82
82
83
A6

SVBYTE
DIFFZ
DIFFL

FE
4B A6
FF
04
FF
DIFF1
27 88

JSR
BCS
JMP
JSR
CMP
BCC
LDA
BCS
ADC
STA
LDA
JSR
LDA
JSR
LDA
JSR
LDA
JSR
LDY
LDA
JSR
JSR
BCS
JSR
BVS
DEC
BNE
LDX
LDA
JSR
CLC
BCC
JSR
JMP
JSR
LDA
SEC
SBC
PHA
LDA
SBC
BEQ
PLA
LDA
RTS
PLA
RTS
JMP
=*

DIFFZ
SP2D
RESALL
CRLF
MAXRC
SP2E
MAXRC
SP2F
#1
RC
#$3B
OUTCHR
RC
SVBYTE
$FF
SVBYTE
$FE
SVBYTE
#$00
($FE),Y
SVBYTE
INSTAT
SPEXIT
INCCMP
SPEXIT
RC
MORED2
SCR7
SCR6
OUTXAH

;SEMI COLON

;STOP IF KEY DEPRESSED

SP2C
CHKSAD
OUTBYT
ZERCK
P3L
$FE
P3H
$FF
DIFF1
#$FF

E2PARM
CALC3
;MAY BE CALC OR EXEC
B3PARM
;
; 3 PARAMETER COMMAND EXECUTE BLOCKS
;
FILL3 CMP #'F'
;FILL MEM
BNE BLK3
JSR P2SCR
LDA #0
STA ERCNT
;ZERO ERROR COUNT
LDA P1L
F1
LDY #0
STA ($FE),Y
CMP ($FE),Y
;VERIFY
BEQ F3

0985
0986
0987
0988
0989
0990
0991
0992
0993
0994
0995
0996
0997
0998
0999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046

872B
872E
8731
8733
8735
8737
8739
873B
873D
8740
8742
8745
8748
874B
874D
8750
8752
8754
8756
8758
875A
875C
875E
8761
8763
8765
8767
876A
876C
876E
8770
8772
8774
8775
8778
877A
877C
877F
8781
8782
8784
8786
8788
878A
878C
878E
8791
8794
8797
879A
879D
87A0
87A2
87A4
87A6
87A8
87AB
87AD
87AF
87B2
87B3
87B5

20
20
70
F0
90
B0
C9
F0
4C
A9
8D
20
AD
85
AD
85
C5
D0
A5
C5
F0
B0
20
E6
D0
E6
20
70
F0
90
B0
A5
18
6D
85
A5
6D
85
38
A5
E5
85
A5
E5
85
20
AD
8D
AD
8D
20
A5
D0
C6
C6
20
70
B0
AD
38
D0
18

C1
B2
7C
EE
EC
76
42
03
CD
00
52
9C
4E
FC
4F
FD
FF
06
FC
FE
53
14
B7
FC
02
FD
B2
43
F0
EE
3D
FC

87
82

F3

F2
BLK3
87
A6
82
A6
A6

87

BLP

82

B2

4A A6
FC
FD
4B A6
FD
FC
FE
FC
FD
FF
FD
A7
4C
4A
4D
4B
B7
FC
02
FD
FC
BE
02
EE
52
01

82
A6
A6
A6
A6
87

BLP1

82
A6

B1

JSR
JSR
BVS
BEQ
BCC
BCS
CMP
BEQ
JMP
LDA
STA
JSR
LDA
STA
LDA
STA
CMP
BNE
LDA
CMP
BEQ
BCS
JSR
INC
BNE
INC
JSR
BVS
BEQ
BCC
BCS
LDA
CLC
ADC
STA
LDA
ADC
STA
SEC
LDA
SBC
STA
LDA
SBC
STA
JSR
LDA
STA
LDA
STA
JSR
LDA
BNE
DEC
DEC
JSR
BVS
BCS
LDA
SEC
BNE
CLC

BRTT
INCCMP
B1
F1
F1
B1
#'B'
*+5
S13B
#0
ERCNT
P2SCR
P1L
$FC
P1H
$FD
$FF
*+8
$FC
$FE
B1
B2
BMOVE
$FC
*+4
$FD
INCCMP
B1
BLP
BLP
B1
$FC

;INC ERCNT (UP TO FF)

;(ALWAYS)
;BLOCK MOVE (OVERLAP OKAY)

;WHICH DIRECTION TO MOVE?

;16 BITS EQUAL THEN FINISHED
;MOVE DEC'NG
;MOVE INC'NG

;CALC VALS FOR MOVE DEC'NG

P3L
$FC
$FD
P3H
$FD
$FC
$FE
$FC
$FD
$FF
$FD
P3SCR
P2L
P3L
P2H
P3H
BMOVE
$FC
*+4
$FD
$FC
DECCMP
B1
BLP1
ERCNT
*+3

;MOVE DEC'NG

;FINISHED, TEST ERCNT

1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108

87B6
87B7
87B9
87BB
87BD
87BF
87C1
87C4
87C6
87C8
87C9
87CC
87CD
87CF
87D1
87D3
87D6
87D8
87D9
87DA
87DC
87DE
87DF
87E0
87E3
87E6
87E8
87EA
87EC
87EE
87F0
87F2
87F5
87F7
87F9
87FC
87FE
8801
8803
8805
8808
880B
880D
880F
8811
8814
8816
8818
881A
881B
881C
881F
8821
8823
8825
8826
8827
8829
882B
882E
8831
8832

60
A0
B1
91
D1
F0
AC
C0
F0
C8
8C
60
C9
D0
A0
AD
D0
38
60
C9
D0
38
60
20
4C
C9
D0
A0
D0
C9
D0
AD
C9
D0
20
A0
4C
C9
D0
20
AD
A0
D1
F0
20
70
F0
90
18
60
20
90
C9
F0
38
60
C9
D0
20
20
18
AD

00
FE
FC
FC
0B
52 A6
FF
04
52 A6
1D
15
00
4E A6
02
FF
02
93
87
1E
04
80
E5
13
0F
4E
FF
E5
93
80
78
4D
22
9C
4E
00
FE
0B
B2
04
F0
EE

82
8E

A6
82
8C
82
A6

82

17 85
05
47
EC
43
26
4D 83
42 83
4E A6

RTS
LDY
LDA
STA
CMP
BEQ
BRTT
LDY
CPY
BEQ
INY
STY
BRT
RTS
S13B
CMP
BNE
LDY
S13C
LDA
BNE
SEC
RTS
CMP
BNE
S1NG
SEC
RTS
JSR
JMP
S23B
CMP
BNE
LDY
BNE
L23P
CMP
BNE
LDA
CMP
BNE
JSR
LDY
JMP
MEM3
CMP
BNE
JSR
MEM3C LDA
LDY
CMP
BEQ
MEM3D JSR
BVS
BEQ
BCC
MEM3EX CLC
RTS
MEM3E JSR
BCC
CMP
BEQ
SEC
MEM3F RTS
CALC3 CMP
BNE
C1
JSR
JSR
CLC
LDA
BMOVE

#0
($FE),Y
($FC),Y
($FC),Y
BRT
ERCNT
#$FF
*+6

;MOVE 1 BYT + VER

;INC ERCNT, DONT PASS FF

ERCNT
#$1D
S23B
#$0
P1L
*+4

;SAVE KIM FMT TAPE, 3 PARMS

#$FF
*+4

;ID MUST NOT = FF

INCP3
SENTRY
#$1E
L23P
#$80
S13C
#$13
MEM3
P1L
#$FF
S1NG
INCP3
#$80
LENTRY
#'M'
CALC3
P2SCR
P1L
#0
($FE),Y
MEM3E
INCCMP
MEM3EX
MEM3C
MEM3C

;USE END ADDR + 1

NEWLOC
MEM3F
#'G'
MEM3D
#'C'
EXE3
CRLF
SPACE
P1L

;MODE = KIM
;ID MUST NOT = 0

;SAVE HS FMT TAPE, 3 PARMS
;MODE = HS
;(ALWAYS)
;LOAD HS, 3 PARMS
;ID MUST BE FF
;ERROR RETURN
;USE END ADDR + 1
;MODE = HS
;MEM 3 SEARCH - BYTE

;FOUND SEARCH BYTE?
;NO, INC BUFFER ADDR

;SEARCHED TO BOUND
;FOUND SEARCH BYTE
;ENTERED G?

;CALCULATE, 1, 2 OR 3 PARMS
;RESULT = P1+P2+P3

1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170

8835
8838
8839
883C
883F
8840
8841
8842
8845
8846
8847
884A
884B
884C
884F
8850
8851
8853
8855
8855
8858
8858
885B
885D
8860
8863
8866
8869
886C
886F
8872
8875
8877
887A
887C
887D
887E
8881
8883
8885
8887
8889
888B
888D
8890
8892
8895
8896
8899
889C
889F
88A2
88A5
88A6
88A9
88AC
88AF
88AF
88AF
88AF
88B2
88B5

6D
A8
AD
6D
AA
38
98
ED
A8
8A
ED
AA
98
20
18
60
C9
D0

4C A6
4F A6
4D A6

4A A6
4B A6
F4 82
45
57

AD 62 A6
CD
F0
8D
AD
8D
AD
8D
AD
8D
AD
85
AD
85
18
60
20
A0
B1
F0
E6
D0
E6
2C
10
20
18
4C
AD
8D
AD
8D
18
20
4C
6C

73
15
3B
61
3A
72
61
73
62
4B
FB
4A
FA

A6
A6
A6
A6
A6
A6
A6
A6
A6
A6

88 81
00
FA
12
FA
02
FB
53 A6
03
47 8A
B8
3A
61
3B
62

81
A6
A6
A6
A6

1B 8A
B8 81
6D A6

20 88 81
20 CF 88
C9 FE

ADC P2L
TAY
LDA P1H
ADC P2H
TAX
SEC
TYA
SBC P3L
TAY
TXA
SBC P3H
TAX
TYA
JSR OUTXAH
CLC
RTS
EXE3
CMP #'E'
;EXECUTE FROM RAM, 1-3 PARMS
BNE E3PARM
; SEE IF VECTOR ALREADY MOVED
LDA INVEC+2
;INVEC MOVED TO SCRA, SCRB
; HI BYTE OF EXEVEC MUST BE DIFFERENT FROM INVEC
CMP EXEVEC+1
;$FA, $FB USED AS RAM PTR
BEQ PTRIN
STA SCRA+1
;SAVE INVEC IN SCRA,B
LDA INVEC+1
STA SCRA
LDA EXEVEC
;PUT ADDR OF RIN IN INVEC
STA INVEC+1
LDA EXEVEC+1
STA INVEC+2
PTRIN LDA P3H
;INIT RAM PTR IN $FA, $FB
STA $FB
LDA P3L
STA $FA
CLC
RTS
RIN
JSR SAVER
;GET INPUT FROM RAM
LDY #$0
;RAM PTR IN $FA, $FB
LDA ($FA),Y
BEQ RESTIV
;IF 00 BYTE, RESTORE INVEC
INC $FA
BNE *+4
INC $FB
BIT TECHO
;ECHO CHARS IN ?
BPL *+5
JSR OUTCHR
CLC
JMP RESXAF
RESTIV LDA SCRA
;RESTORE INVEC
STA INVEC+1
LDA SCRA+1
STA INVEC+2
CLC
JSR INCHR
JMP RESXAF
E3PARM JMP (URCVEC+1) ;... ELSE UNREC CMD
; ***
; *** HEX KEYBOARD I/O
; ***
GETKEY JSR SAVER
;FIND KEY
JSR GK
CMP #$FE

1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232

88B7
88B9
88BC
88BD
88BE
88BF
88C0
88C1
88C4
88C7
88C8
88C9
88CC
88CF
88D1
88D4
88D7
88D9
88DC
88DE
88DF
88E0
88E1
88E4
88E7
88E9
88EC
88EF
88F1
88F2
88F3
88F4
88F6
88F8
88FA
88FD
88FF
8900
8903
8906
8908
890B
890D
890F
8912
8915
8918
891B
891D
891E
8920
8921
8923
8926
8929
892B
892C
892E
8931
8933
8936
8939

D0
20
8A
0A
0A
0A
0A
8D
20
8A
18
6D
4C
A9
8D
20
F0
20
F0
48
8A
48
20
20
D0
20
20
D0
68
AA
68
C9
D0
A9
8D
D0
60
20
6C
A9
20
A2
A0
BD
8C
8E
8D
A0
88
D0
CA
10
20
AD
49
60
29
8D
A9
20
AD
29

13
CF 88

3E A6
CF 88
3E
B8
00
55
03
FB
2C
F6

A6
81

72
23
FB
9B
23
F3

89
89

A6
89
89

89
89

FF
07
19
55 A6
D5
C1
70
09
A5
05
00
40
00
02
00
10

89
A6
89
A6
A4
A4
A4

FD
EA
A3 89
00 A4
7F
3F
3F A6
05
A5 89
02 A4
07

BNE
JSR
TXA
ASL
ASL
ASL
ASL
STA
JSR
TXA
CLC
ADC
EXITGK JMP
GK
LDA
STA
GK1
JSR
BEQ
JSR
BEQ
PHA
TXA
PHA
JSR
GK2
JSR
BNE
JSR
JSR
BNE
PLA
TAX
PLA
CMP
BNE
LDA
STA
BNE
EXITG RTS
HDOUT JSR
IJSCNV JMP
SCAND LDA
JSR
LDX
SC1
LDY
LDA
STY
STX
STA
LDY
SC2
DEY
BNE
DEX
BPL
KEYQ
JSR
H8926 LDA
EOR
RTS
LRNKEY AND
STA
LDA
JSR
LDA
AND

EXITGK
GK
A
A
A
A
SCRE
GK
SCRE
RESXAF
#0
KSHFL
IJSCNV
GK1
LRNKEY
GK1

BEEP
KEYQ
GK2
NOBEEP
KEYQ
GK2

;SCAN KB
;WHAT KEY IS IT?

;Z=1 IF KEY DOWN
;DELAY (DEBOUNCE) W/O BEEP

#$FF
EXITG
#$19
KSHFL
GK1

;IF SHIFT, SET FLAG + GET NEXT KEY

OUTDSP
(SCNVEC+1)
#$9
CONFIG
#5
#0
DISBUF,X
PADA
PBDA
PADA
#$10

;CHAR OUT, SCAN KB
;SCAN DISPLAY FROM DISBUF

SC2
SC1
KSCONF
PADA
#$7F
#$3F
SCRF
#$05
CONFIG
PBDA
#$07

; KEY DOWN ? (YES THEN Z=1)

;DETERMINE WHAT KEY IS DOWN

1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294

893B
893D
893F
8942
8944
8946
8948
894A
894B
894C
894D
894E
894F
8950
8951
8954
8956
8959
895B
895C
895E
895F
8960
8961
8962
8965
8966
8969
896A
896D
896E
8970
8971
8972
8975
8977
897A
897C
897E
8981
8984
8986
8989
898C
898D
898F
8992
8995
8997
8998
899A
899B
899E
89A0
89A3
89A5
89A8
89AA
89AB
89AE
89B1
89B4

49
D0
2C
30
C9
90
A9
0A
0A
0A
0A
0A
0A
18
6D
A2
DD
F0
CA
10
E8
60
8A
18
6D
AA
BD
60
20
18
F0
38
60
20
A9
20
A2
A9
8D
20
A9
8D
20
CA
D0
20
4C
A0
88
D0
60
20
A9
4C
A9
20
A0
AA
BD
99
BD
99

07
05
00 A4
1A
04
02
03

3F A6
19
D6 8B
05

LK1
LK2

LK3

F8
NOKEY
FOUND
55 A6
EF 8B
23 89

KYSTAT

01
88
0D
A5
70
08
02
95
06
02
95

81
89

BEEP
BEEPP3
BEEPP5
BE1

A4
89
A4
89

ED
A3 89
C4 81
1A
FD

BE2
BE3

88 81
01
77 89
01
88 81
01

NOBEEP

C8
02
C6
00

CON1

8B
A4
8B
A4

KSCONF
CONFIG

EOR
BNE
BIT
BMI
CMP
BCC
LDA
ASL
ASL
ASL
ASL
ASL
ASL
CLC
ADC
LDX
CMP
BEQ
DEX
BPL
INX
RTS
TXA
CLC
ADC
TAX
LDA
RTS
JSR
CLC
BEQ
SEC
RTS
JSR
LDA
JSR
LDX
LDA
STA
JSR
LDA
STA
JSR
DEX
BNE
JSR
JMP
LDY
DEY
BNE
RTS
JSR
LDA
JMP
LDA
JSR
LDY
TAX
LDA
STA
LDA
STA

#$07
LK1
PADA
NOKEY
#$04
LK2
#$03
A
A
A
A
A
A
SCRF
#$19
SYM,X
FOUND
LK3

KSHFL
ASCII,X
KEYQ

;KEY DOWN? RETURN IN CARRY

*+3
SAVER
#$0D
CONFIG
#$70
#8
PBDA
BE2
#6
PBDA
BE2

;DELAY (BOUNCE) W/BEEP
;DURATION CONSTANT

BE1
KSCONF
RESALL
#$1A
BE3
SAVER
#$01
BEEPP5
#$1
SAVER
#$01
VALSP2,X
PBDA,Y
VALS,X
PADA,Y

;DELAY W/O BEEP
;(BNE BEEPP5, $FF)
;CONFIGURE FOR KEYBOARD
;CONFIGURE I/O FROM TABLE VAL

1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356

89B7
89B8
89B9
89BB
89BE
89C1
89C4
89C6
89C8
89CA
89CD
89D0
89D2
89D4
89D7
89D9
89DC
89DE
89E0
89E3
89E5
89E6
89E8
89EA
89ED
89EF
89F1
89F3
89F4
89F7
89FA
89FB
89FD
89FF
8A00
8A03
8A06
8A07
8A08
8A09
8A0B
8A0E
8A11
8A12
8A14
8A15
8A16
8A17
8A1A
8A1B
8A1B
8A1B
8A1B
8A1B
8A1E
8A21
8A23
8A25
8A27
8A29
8A2B
8A2D

CA
88
10
4C
20
20
29
C9
D0
4C
20
C9
D0
AD
09
8D
D0
A2
DD
F0
CA
D0
F0
BD
C9
F0
A2
48
BD
9D
E8
E0
D0
68
8D
4C
48
8A
48
A2
BD
9D
CA
10
68
AA
68
8D
60

20
20
29
C9
90
C9
B0
29
C9

F0
C4
AF
88
7F
07
03
75
06
2C
0A
45
80
45
25
3A
EE
05

81
88
81

89
8A

HKEY
OUTDSP

NBELL

A6
A6
8B

F8
19
28 8C
F0
12
00
41 A6
40 A6

OUD1
OUD2

GETSGS

OUD3

05
F5
45 A6
C4 81

1E
00 A6
01 A6
F7

00 A6

88 81
41 8A
7F
61
06
7B
02
DF
0F

EXITOD
TEXT

TXTMOV

DEX
DEY
BPL
JMP
JSR
JSR
AND
CMP
BNE
JMP
JSR
CMP
BNE
LDA
ORA
STA
BNE
LDX
CMP
BEQ
DEX
BNE
BEQ
LDA
CMP
BEQ
LDX
PHA
LDA
STA
INX
CPX
BNE
PLA
STA
JMP
PHA
TXA
PHA
LDX
LDA
STA
DEX
BPL
PLA
TAX
PLA
STA
RTS

CON1
RESALL
GETKEY
SAVER
#$7F
#$07
NBELL
BEEPP3
TEXT
#$2C
OUD1
RDIG
#$80
RDIG
EXITOD
#$3A
ASCIM1,X
GETSGS
OUD2
EXITOD
SEGSM1,X
#$F0
EXITOD
#0
DISBUF+1,X
DISBUF,X

;GET KEY FROM KB AND ECHO ON KB
;DISPLAY OUT
;BELL?
;YES - BEEP
;PUSH INTO SCOPE BUFFER
;COMMA?
;TURN ON DECIMAL PT

;GET CORR SEG CODE FROM TABLE

;SHOVE DOWN DISPLAY BUFFER

#5
OUD3
RDIG
RESALL
;UPDATE SCOPE BUFFER
;SAVE X
#$1E
SCPBUF,X
SCPBUF+1,X

;PUSH DOWN 32 CHARS

TXTMOV
;RESTORE X
SCPBUF

;
;***
;*** TERMINAL I/O
;***
INCHR JSR SAVER
JSR INJINV
AND #$7F
CMP #$61
BCC INRT1
CMP #$7B
BCS INRT1
AND #$DF
INRT1 CMP #$0F

;RESTORE CHR
;STORE CHR IN EMPTY SLOT

;INPUT CHAR
;DROP PARITY
;ALPHA?

;CVRT TO UPPER CASE
;CTL O ?

1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418

8A2F
8A31
8A34
8A36
8A39
8A3A
8A3C
8A3E
8A41
8A44
8A47
8A4A
8A4D
8A4F
8A52
8A55
8A58
8A5B
8A5D
8A5F
8A62
8A65
8A66
8A68
8A6A
8A6D
8A70
8A73
8A74
8A76
8A79
8A7B
8A7E
8A81
8A83
8A84
8A86
8A87
8A89
8A8C
8A8D
8A8F
8A90
8A92
8A95
8A96
8A99
8A9B
8A9D
8AA0
8AA2
8AA5
8AA8
8AAA
8AAD
8AAF
8AB1
8AB3
8AB4
8AB7
8ABA
8ABC

D0
AD
49
8D
18
90
C9
4C
6C
20
20
2C
70
20
4C
6C
20
A9
85
AD
2D
38
E9
90
20
AD
2D
38
E9
2C
10
20
4C
A0
88
D0
EA
66
20
48
B5
68
90
20
18
20
A5
49
4C
85
20
20
A9
8D
A5
A2
49
38
20
20
A0
88

0B
53 A6
40
53 A6
E2
0D
B8
61
09
88
53
03
55
C4
64
88
00
F9
02
54

81
A6
83
81
A6
8A
81
A6
81
A4
A6

40
F5
E9 8A
02 A4
54 A6
40
53 A6
06
D4 8A
87 8A
07
FD
F9
E9 8A

INRT2
INJINV
NBASOC
OUTCHR

INJOUV
INTCHR
LOOK

TIN

DMY1
TLP1
SAVE

00
D8
E9 8A
D4
F9
FF
B8
F9
88
E9
30
03
F9
0B
FF

8A
81

TOUT

81
8A
A4

D4 8A
E6 8A
06

OUTC
PHAKE

BNE
LDA
EOR
STA
CLC
BCC
CMP
JMP
JMP
JSR
JSR
BIT
BVS
JSR
JMP
JMP
JSR
LDA
STA
LDA
AND
SEC
SBC
BCC
JSR
LDA
AND
SEC
SBC
BIT
BPL
JSR
JMP
LDY
DEY
BNE
NOP
ROR
JSR
PHA
LDA
PLA
BCC
JSR
CLC
JSR
LDA
EOR
JMP
STA
JSR
JSR
LDA
STA
LDA
LDX
EOR
SEC
JSR
JSR
LDY
DEY

INRT2
TECHO
#$40
TECHO
INCHR+3
#$0D
RESXAF
(INVEC+1)
NIBASC
SAVER
TECHO
*+5
INJOUV
RESALL
(OUTVEC+1)
SAVER
#0
$F9
PBDA
TOUTFL
#$40
LOOK
DLYH
PBDA
TOUTFL
#$40
TECHO
DMY1
OUT
SAVE
#7

;TOGGLE CTL O BIT
;GET GET ANOTHER CHAR
;CARRIAGE RETURN?
;NIBBLE TO ASCII, OUTCHR
;LOOK AT CTRL O FLAG

;IN TERMINAL CHAR
;FIND LEADING EDGE

;TERMINAL BIT

;OR BITS 7,7 (TTY,CRT)
;ECHO BIT?

TLP1
$F9
DLYH

;TIMING

0,X
TIN
DLYH
OUT
$F9
#$FF
RESXAF
$F9
SAVER
DLYH
#$30
PBDA+1
$F9
#$0B
#$FF
OUT
DLYF
#$06

;TERMINAL CHR OUT
;DELAY 1/2 BIT TIME
;SET FOR OUTPUT
;DATA DIRECTION
;RECOVER CHR DATA
;START BIT,8DATA, 3STOPS
;INVERT DATA
;START BIT
;OUTPUT BIT FROM CARRY
;WAIT FULL BIT TIME

1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480

8ABD
8ABF
8AC0
8AC1
8AC2
8AC4
8AC6
8AC8
8ACA
8ACC
8ACE
8AD1
8AD4
8AD5
8AD8
8ADA
8ADC
8ADE
8AE1
8AE4
8AE5
8AE6
8AE6
8AE9
8AEA
8AEB
8AEC
8AED
8AEE
8AF1
8AF3
8AF4
8AF6
8AF7
8AF9
8AFA
8AFB
8AFC
8AFD
8AFE
8AFF
8B01
8B02
8B05
8B06
8B08
8B0B
8B0D
8B10
8B12
8B15
8B18
8B1B
8B1D
8B20
8B23
8B24
8B25
8B27
8B28
8B2A
8B2B

D0
EA
4A
CA
D0
A5
C9
F0
C9
D0
20
4C
48
AD
29
90
09
2D
8D
68
60

FD

20
08
48
8A
48
98
AE
A0
88
D0
CA
D0
A8
68
AA
68
28
60
A9
A8
AD
0A
B0
20
90
20
B0
8C
BD
CD
B0
BD
8D
60
E8
10
C8
A2
CA
D0

E9 8A

F0
F9
0D
04
0A
03
32 8B
C4 81
02 A4
0F
02
30
54 A6
02 A4

51 A6
03
FD
F8

00
02 A4
FA
27
FB
27
FB
51
63
51
07
69
51
EE
1C
FD

8B
8B
A6
8C
A6
8C
A6

BNE
NOP
LSR
DEX
BNE
LDA
CMP
BEQ
CMP
BNE
GOPAD JSR
LEAVE JMP
OUT
PHA
LDA
AND
BCC
ORA
OUTONE AND
STA
PLA
RTS
;
DLYF
JSR
DLYH
PHP
PHA
TXA
PHA
TYA
LDX
DLYX
LDY
DLYY
DEY
BNE
DEX
BNE
TAY
PLA
TAX
PLA
PLP
RTS
BAUD
LDA
TAY
SEEK
LDA
ASL
BCS
CLEAR JSR
BCC
SET
JSR
BCS
STY
DEAF
LDA
CMP
BCS
LDA
STA
RTS
AGAIN INX
BPL
INK
INY
LDX
INK1
DEX
BNE

PHAKE
A
OUTC
$F9
#$0D
GOPAD
#$0A
LEAVE
PAD
RESALL
PBDA
#$0F
OUTONE
#$30
TOUTFL
PBDA

DLYH

;CARRIAGE RETURN?
;YES-PAD IT
;PAD LINE FEED TOO

;TERMINAL BIT OUT

;MASK OUTPUT

;DELAY FULL
;DELAY HALF

SDBYT
#3
DLYY
DLYX

#0
PBDA
A
SEEK
INK
CLEAR
INK
SET
SDBYT
DECPTS,X
SDBYT
AGAIN
STDVAL,X
SDBYT
DEAF
#$1C
INK1

;DETERMINE BAUD RATE ON PB7

;LOAD CLOSEST STD VALUE

1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542

8B2D
8B30
8B31
8B32
8B35
8B38
8B39
8B3B
8B3C
8B3F
8B42
8B45
8B46
8B48
8B49
8B4A
8B4A
8B4A
8B4A
8B4A
8B4C
8B4D
8B4F
8B52
8B54
8B55
8B56
8B59
8B5B
8B5E
8B61
8B62
8B64
8B66
8B69
8B6C
8B6F
8B71
8B74
8B76
8B79
8B7C
8B7E
8B7F
8B80
8B83
8B86
8B89
8B8C
8B8E
8B91
8B94
8B96
8B99
8B9C
8B9F
8BA2
8BA4
8BA5
8BA7
8BAA
8BAC

AD
0A
60
AE
20
CA
D0
60
20
AD
2D
38
E9
60
FF

A2
9A
A9
8D
A9
48
28
20
A2
BD
9D
CA
10
A9
20
20
20
D0
2C
10
20
20
A2
9A
D8
20
4C
20
AD
09
8D
AD
09
8D
4C
20
AD
29
18
90
20
A9
8D

02 A4
50 A6
E6 8A

PAD
PAD1

FA
A3 89
02 A4
54 A6
40

FF
CC
0C A0
04
86 8B
5F
A0 8F
20 A6
F7
07
47
A3
26
0B
02
F6
B7
FF
FF
86
03
88
01
01
01
03
01
03
C4
88
01
FE

8A
89
89
A4
8B
8A

8B
80
81
AC
AC
AC
AC
81
81
AC

E7
86 8B
D5
51 A6

TSTAT

LDA
ASL
RTS
LDX
JSR
DEX
BNE
RTS
JSR
LDA
AND
SEC
SBC
RTS
.DB

PBDA
A
PADBIT
DLYF

;PAD CARRIAGE RETURN OR LF
;WITH EXTRA STOP BITS

PAD1
KSCONF
PBDA
TOUTFL

;SEE IF BREAK KEY DOWN

#$40

$FF
; ***
; *** RESET - TURN OFF
; ***
;
RESET LDX #$FF
TXS
LDA #$CC
STA PCR1
LDA #4
PHA
PLP
JSR ACCESS
DFTXFR LDX #$5F
LDA DFTBLK,X
STA RAM,X
DEX
BPL DFTXFR+2
NEWDEV LDA #7
JSR OUTCHR
SWITCH JSR KSCONF
SWLP
JSR KEYQ+3
BNE MONENT
BIT PBDA
BPL SWLP
JSR VECSW
JSR BAUD
MONENT LDX #$FF
TXS
CLD
JSR ACCESS
JMP WARM
ACCESS JSR SAVER
LDA OR3A
ORA #1
ACC1
STA OR3A
LDA DDR3A
ORA #1
STA DDR3A
JMP RESALL
NACCES JSR SAVER
LDA OR3A
AND #$FE
CLC
BCC ACC1
TTY
JSR ACCESS
LDA #$D5
STA SDBYT

;NOT USED
POR, INIT SYS RAM, ENTER MONITOR

;INIT STACK PTR
;DISABLE POR, TAPE OFF
;INIT F, DISABLE IRQ DURING DFTXFR
;UN WRITE PROT SYS RAM
;INIT SYS RAM (EXCPT SCPBUF)

;CHANGE DEVC/BAUD RATE
;BEEP
;KEYBOARD OR TERMINAL?

;SWITCH VECTORS
;MONITOR ENTRY
;UNWRITE PROT MONITOR RAM
;UN WRITE PROT SYS RAM

;WRITE PROT SYS RAM

;UN WRITE PROT RAM
;110 BAUD

1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604

8BAF
8BB2
8BB4
8BB7
8BBA
8BBC
8BBF
8BC2
8BC3
8BC5
8BC6
8BC6
8BC6
8BC6
8BC6
8BCA
8BCE
8BD2
8BD6
8BD6
8BD6
8BD6
8BD7
8BD8
8BD9
8BDA
8BDB
8BDC
8BDD
8BDE
8BDF
8BE0
8BE1
8BE2
8BE3
8BE4
8BE5
8BE6
8BE7
8BE8
8BE9
8BEA
8BEB
8BEC
8BED
8BEE
8BEF
8BEF
8BEF
8BF0
8BF1
8BF2
8BF3
8BF4
8BF5
8BF6
8BF7
8BF8
8BF9
8BFA
8BFB
8BFC

AD
09
8D
20
A2
BD
9D
CA
10
60

00
00
00
00

01
41
81
C1
02
42
82
C2
04
44
84
C4
08
48
88
C8
10
50
90
D0
20
60
A0
00
40
30
31
32
33
34
35
36
37
38
39
41
42
43
44

54
40
54
86
08
6F
60

A6
A6
8B
8C
A6

F7

80
7F
FF
00

08
00
00
07

VECSW
SWLP2

LDA
ORA
STA
JSR
LDX
LDA
STA
DEX
BPL
RTS

TOUTFL
#$40
TOUTFL
ACCESS
#$8
TRMTBL,X
INVEC,X

;UN WRITE PROT RAM

SWLP2

;
;***
;*** TABLES (I/O CONFIGURATIONS, KEY CODES, ASCII CODES)
;***
37 VALS
.DB $00,$80,$08,$37 ;KB SENSE, A=1
30
.DB $00,$7F,$00,$30 ;KB LRN, A=5
3F
.DB $00,$FF,$00,$3F ;SCAN DSP, A=9
3F
.DB $00,$00,$07,$3F ;BEEP, A=D
VALSP2 =VALS+2
SYM
=*
;KEY CODES RETURNED BY LRNKEY
TABLE =*
.DB $01
;0/U0
.DB $41
;1/U1
.DB $81
;2/U2
.DB $C1
;3/U3
.DB $02
;4/U4
.DB $42
;5/U5
.DB $82
;6/U6
.DB $C2
;7/U7
.DB $04
;8/JMP
.DB $44
;9/VER
.DB $84
;A/ASCII
.DB $C4
;B/BLK MOV
.DB $08
;C/CALC
.DB $48
;D/DEP
.DB $88
;E/EXEC
.DB $C8
;F/FILL
.DB $10
;CR/SD
.DB $50
;-/+
.DB $90
;>/<
.DB $D0
;SHIFT
.DB $20
;GO/LP
.DB $60
;REG/SP
.DB $A0
;MEM/WP
.DB $00
;L2/L1
.DB $40
;S2/S1
ASCIM1 =*-1
ASCII =*
;ASCII CODES AND HASH CODES
.DB $30
;ZERO
.DB $31
;ONE
.DB $32
;TWO
.DB $33
;THREE
.DB $34
;FOUR
.DB $35
;FIVE
.DB $36
;SIX
.DB $37
;SEVEN
.DB $38
;EIGHT
.DB $39
;NINE
.DB $41
;A
.DB $42
;B
.DB $43
;C
.DB $44
;D

1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666

8BFD
8BFE
8BFF
8C00
8C01
8C02
8C03
8C04
8C05
8C06
8C07
8C08
8C08
8C09
8C0A
8C0B
8C0C
8C0D
8C0E
8C0F
8C10
8C11
8C12
8C13
8C14
8C15
8C16
8C17
8C18
8C19
8C1A
8C1B
8C1C
8C1D
8C1E
8C1F
8C20
8C21
8C22
8C23
8C24
8C25
8C26
8C27
8C28
8C29
8C29
8C29
8C2A
8C2B
8C2C
8C2D
8C2E
8C2F
8C30
8C31
8C32
8C33
8C34
8C35
8C36
8C37

45
46
0D
2D
3E
FF
47
52
4D
13
1E
14
15
16
17
18
19
1A
1B
4A
56
FE
42
43
44
45
46
10
2B
3C
00
11
1C
57
12
1D
2E
20
3F
50
07
53
58
59
3F
06
5B
4F
66
6D
7D
07
7F
67
77
7C
39
5E
79

.DB $45
;E
.DB $46
;F
.DB $0D
;CR
.DB $2D
;DASH
.DB $3E
;>
.DB $FF
;SHIFT
.DB $47
;G
.DB $52
;R
.DB $4D
;M
.DB $13
;L2
.DB $1E
;S2
; KB UPPER CASE
.DB $14
;U0
.DB $15
;U1
.DB $16
;U2
.DB $17
;U3
.DB $18
;U4
.DB $19
;U5
.DB $1A
;U6
.DB $1B
;U7
.DB $4A
;J
.DB $56
;V
.DB $FE
;ASCII
.DB $42
;B
.DB $43
;C
.DB $44
;D
.DB $45
;E
.DB $46
;F
.DB $10
;SD
.DB $2B
;+
.DB $3C
;<
.DB $00
;SHIFT
.DB $11
;LP
.DB $1C
;SP
.DB $57
;W
.DB $12
;L1
.DB $1D
;S1
.DB $2E
;.
.DB $20
;BLANK
.DB $3F
;?
.DB $50
;P
.DB $07
;BELL
.DB $53
;S
.DB $58
;X
.DB $59
;Y
; SEGMENT CODES FOR ON-BOARD DISPLAY
SEGSM1 =*-1
.DB $3F
;ZERO
.DB $06
;ONE
.DB $5B
;TWO
.DB $4F
;THREE
.DB $66
;FOUR
.DB $6D
;FIVE
.DB $7D
;SIX
.DB $07
;SEVEN
.DB $7F
;EIGHT
.DB $67
;NINE
.DB $77
;A
.DB $7C
;B
.DB $39
;C
.DB $5E
;D
.DB $79
;E

1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728

8C38
8C39
8C3A
8C3B
8C3C
8C3D
8C3E
8C3F
8C40
8C41
8C42
8C43
8C44
8C45
8C46
8C47
8C48
8C49
8C4A
8C4B
8C4C
8C4D
8C4E
8C4F
8C50
8C51
8C52
8C53
8C54
8C55
8C56
8C57
8C58
8C59
8C5A
8C5B
8C5C
8C5D
8C5E
8C5F
8C60
8C61
8C62
8C63
8C69
8C69
8C6F
8C6F
8C6F
8C72
8C75
8C78
8C78
8C78
8C78
8C78
8C78
8C78
8C78
8C78
8C78
8C78

71
F0
40
70
00
6F
50
54
38
6D
01
08
09
30
36
5C
63
03
1E
72
77
7C
39
5E
79
71
6D
76
46
00
38
6D
1C
38
6D
80
00
53
73
49
6D
64
6E
973D1F100800DECPTS

.DB $71
;F
.DB $F0
;CR
.DB $40
;DASH
.DB $70
;>
.DB $00
;SHIFT
.DB $6F
;G
.DB $50
;R
.DB $54
;M
.DB $38
;L2
.DB $6D
;S2
.DB $01
;U0
.DB $08
;U1
.DB $09
;U2
.DB $30
;U3
.DB $36
;U4
.DB $5C
;U5
.DB $63
;U6
.DB $03
;U7
.DB $1E
;J
.DB $72
;V
.DB $77
;A
.DB $7C
;B
.DB $39
;C
.DB $5E
;D
.DB $79
;E
.DB $71
;F
.DB $6D
;SD
.DB $76
;+
.DB $46
;<
.DB $00
;SHIFT
.DB $38
;LP
.DB $6D
;SP
.DB $1C
;W
.DB $38
;L1
.DB $6D
;S1
.DB $80
;.
.DB $00
;SPACE
.DB $53
;?
.DB $73
;P
.DB $49
;BELL
.DB $6D
;S
.DB $64
;X
.DB $6E
;Y
.DB $97,$3D,$1F,$10,$08,$00 ; TO DETERMINE BAUD RATE
.MSFIRST
D54C24100601STDVAL .DW $D54C,$2410,$0601 ;STD VALS FOR BAUD RATES
.LSFIRST
; 110,300,600,1200,2400,4800 BAUD
4C 58 8A
TRMTBL JMP INTCHR
4C A0 8A
JMP TOUT
4C 3C 8B
JMP TSTAT
;
;****** VERSION 2 4/13/79 "SY1.1"
;****** COPYRIGHT 1978 SYNERTEK SYSTEMS CORPORATION
;******
BDRY
=$F8
;0/1 BDRY FOR READ TIMING
OLD
=$F9
;HOLD PREV INPUT LEVEL IN GETTR
CHAR
=$FC
;CHAR ASSY AND DISASSY
MODE
=$FD
;BIT7=1 IS HS, 0 IS KIM
;... BIT6=1 - IGNORE DATA
BUFADL =$FE
;RUNNING BUFFER ADR

1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790

8C78
8C78
8C78
8C78
8C78
8C78
8C78
8C78
8C78
8C78
8C78
A64A
A64A
A64B
A64C
A64D
A64E
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
A64F
8C78
8C78
8C7B
8C7E
8C81
8C83
8C85
8C87
8C89
8C8B
8C8B
8C8D

BUFADH =$FF
;TAPDEL =$A630
;KMBDRY =$A631
;HSBDRY =$A632
;TAPET1 =$A635
;TAPET2 =$A63C
;SCR6
=$A636
;SCR7
=$8637
;SCR8
=$A638
;SCR9
=$A639

;HI SPEED TAPE DELAY
;KIM READ BDRY
;HS READ BDRY
;HS FIRST 1/2 BIT
;HS SECOND 1/2 BIT
;SCR6
;SCR7
;SCR8
;SCR9

EAL
EAH
SAL
SAH
ID

*=$A64A
.BLOCK 1
.BLOCK 1
.BLOCK 1
.BLOCK 1
.BLOCK 1

;P3L
;P3H
;P2L
;P2H
;P1L

EOT
SYN
TPBIT
FRAME
CHECK
LSTCHR
NONHEX

= $04
= $16
=%1000
=$FF
=$CC
=$2F
=$FF

;BIT 3 IS ENABLE/DISABLE TO DECODER
;ERROR MSG # FOR FRAME ERROR
;ERROR # FOR CHECKSUM ERROR
;LAST CHAR NOT '/'
;NON HEX CHAR IN KIM REC

;ACCESS
;P2SCR
;ZERCK
;CONFIG

=$8BB6
=$829C
=$832E
=$89A5

- END ADDR +1 (LO)
- (HI)
- START ADDR (LO)
- (HI)
- ID

;UNRITE PROTECT SYSTEM RAM
;MOVE P2 TO $FF,$FE IN PAGE ZERO
;MOVE ZERO TO CHECK SUM
;CONFIGURE I/O

; I/O - TAPE ON/OFF IS CB2 ON VIA 1 (A000)
;
TAPE IN IS PB6 ON VIA 1 (A000)
;
TAPE OUT IS CODE 7 TO DISPLAY DECODER, THRU 6532,
;
PB0-PB3 (A400)
VIAACR
VIAPCR
TPOUT
TAPOUT
DDROUT
TAPIN
DDRIN
TIMER
TIM8
DDRDIG
DIG

=$A00B
=$A00C
=$A402
=TPOUT
=$A403
=$A000
=$A002
=$A406
=$A415
=$A401
=$A400

;CONTROL CB2 TAPE ON/OFF, POR

;6532 TIMER READ
;6532 TIMER SET (8US)

; LOADT ENTER W/ID IN PARM 2, MODE IN [Y]
20
20
20
C9
F0
C9
D0
F0

A9 8D
52 8D
E1 8D
2A
06
16
F2
F3

06 FD
6A

*=$8C78
LOADT JSR START
LOADT2 JSR SYNC
LOADT4 JSR RDCHTX
CMP #'*'
BEQ LOAD11
CMP #SYN
BNE LOADT2
BEQ LOADT4
LOAD11 ASL MODE
ROR A

;INITIALIZE
;GET IN SYNC
;START OF DATA?
;NO - SYN?
;IF NOT, RESTART SYNC SEARCH
;IF YES, KEEP LOOKING FOR *
;GET MODE IN A, CLEAR BIT6

1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852

8C8E
8C90
8C93
8C96
8C99
8C9B
8C9E
8CA0
8CA2
8CA4
8CA6
8CA6
8CA8
8CAA
8CAD
8CAD
8CAD
8CAD
8CAD
8CB0
8CB3
8CB5
8CB7
8CBA
8CBD
8CC0
8CC0
8CC0
8CC0
8CC2
8CC4
8CC4
8CC7
8CC9
8CCC
8CCE
8CCE
8CD0
8CD2
8CD5
8CD8
8CDB
8CDE
8CDE
8CDE
8CDE
8CE1
8CE3
8CE6
8CE8
8CEA
8CED
8CEF
8CF2
8CF4
8CF6
8CF8
8CFA
8CFC
8CFE
8D00
8D03

85
20
8D
CD
F0
AD
C9
F0
C9
F0

FD
26
00
4E
29
4E
00
22
FF
07

STA
JSR
STA
CMP
BEQ
LDA
CMP
BEQ
CMP
BEQ

8E
A4
A6
A6

24 FD
30 16
4C 7B 8C

20
20
24
10
20
20
4C

74
74
FD
52
74
74
DE

8E
8E
8E
8E
8C

MODE
RDBYTX
DIG
ID
LOADT5
ID
#0
LOADT5
#$FF
LOADT6

BIT MODE
BMI HWRONG
JMP LOADT2

;READ ID
;DISPLAY
;COMPARE
;LOAD IF
;COMPARE

BYTE ON TAPE
ON LED (NOT DECODED)
WITH REQUESTED ID
EQUAL
WITH 0

;IF 0, LOAD ANYWAY
;COMPARE WITH FF
;IF FF, USE REQUEST SA TO LOAD
;UNWANTED RECORD, KIM OR HS?
;IF KIM, RESTART SEARCH

; SA (&EA IF USED) COME FROM REQUEST. DISCARD TAPE VALUES
;
(BUFAD ALREADY SET TO SA BY 'START')
;
LOADT6 JSR RDCHK
;GET SAL FROM TAPE
JSR RDCHK
;GET SAH FROM TAPE
BIT MODE
;HS OR KIM?
BPL LOADT7
;IF KIM, START READING DATA
JSR RDCHK
;HS, GET EAH, EAL FROM TAPE
JSR RDCHK
; ... BUT IGNORE
JMP LT7H
;START READING HS DATA
; SA ( & EA IF USED) COME FROM TAPE. SA REPLACES BUFAD

A9 C0
85 FD

HWRONG LDA #$C0
STA MODE

20
85
20
85

74 8E
FE
74 8E
FF

24
10
20
8D
20
8D

FD
37
74
4A
74
4B

LOADT5 JSR RDCHK
;GET SAL FROM TAPE
STA BUFADL
;PUT IN BUF START L
JSR RDCHK
;SAME FOR SAH
STA BUFADH
;(SAL - H STILL HAVE REQUEST VALUE)
BIT MODE
;HS OR KIM?
BPL LOADT7
;IF KIM, START READING RECORD
JSR RDCHK
;HS. GET & SAVE EAL,EAH
STA EAL
JSR RDCHK
STA EAH

8E
A6
8E
A6

;READ THRU TO GE TO NEXT REC
;BUT DON'T CHECK CKSUM, NO FRAME ERR

; READ HS DATA
20
A6
EC
D0
A6
EC
F0
20
24
70
A0
91
E6
D0
E6
4C

E5
FE
4A
07
FF
4B
14
77
FD
04
00
FE
FE
E0
FF
DE

8D

LT7H

A6
A6
8E

LT7HA

LT7HC
8C

JSR
LDX
CPX
BNE
LDX
CPX
BEQ
JSR
BIT
BVS
LDY
STA
INC
BNE
INC
JMP

RDBYTH
BUFADL
EAL
LT7HA
BUFADH
EAH
LT7HB
CHKT
MODE
LT7HC
#0
(BUFADL),Y
BUFADL
LT7H
BUFADH
LT7H

;GET NEXT BYTE
;CHECK FOR END OF DATA + 1

;NOT END, UPDATE CHECKSUM
;WRONG RECORD?
;IF SO, DONT STORE BYTE
;STORE BYTE
;BUMP BUFFER ADDR
;CARRY

1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914

8D03
8D05
8D07
8D09
8D09
8D09
8D09
8D0C
8D0E
8D11
8D13
8D15
8D17
8D19
8D1B
8D1E
8D1E
8D1E
8D1E
8D1E
8D21
8D24
8D26
8D29
8D2C
8D2E
8D30
8D30
8D32
8D34
8D34
8D36
8D38
8D38
8D3A
8D3C
8D3C
8D3E
8D3E
8D3F
8D41
8D41
8D42
8D42
8D44
8D46
8D48
8D4B
8D4B
8D4C
8D4D
8D4E
8D50
8D52
8D55
8D57
8D5A
8D5C
8D5F
8D62
8D64
8D66

C9 2F
D0 29
F0 15

LT7HB

CMP #'/'
BNE LCERR
BEQ LT8A

;EA, MUST BE "/"
;LAST CHAR NOT '/'
;(ALWAYS)

; READ KIM DATA
20
B0
20
A0
91
E6
D0
E6
4C

2A 8E
26
77 8E
00
FE
FE
F0
FF
09 8D

LOADT7 JSR
BCS
JSR
LDY
STA
INC
BNE
INC
JMP

RDBYT
LDT7A
CHKT
#0
(BUFADL),Y
BUFADL
LOADT7
BUFADH
LOADT7

;NONHEX OR LAST CHAR
;UPDATE CHECKSUM (PACKED BYTE)
;STORE BYTE
;BUMP BUFFER ADR
;CARRY?

; TEST CHECKSUM & FINISH
20
CD
D0
20
CD
D0
F0

26
36
16
26
37
0E
11

8E
A6
8E
A6

LOADT8 =*
LT8A
JSR
CMP
BNE
JSR
CMP
BNE
BEQ

RDBYTX
SCR6
CKERR
RDBYTX
SCR7
CKERR
OKEXIT

;CHECK SUM

;CHECK SUM ERROR
;(ALWAYS)

A9 2F
D0 0A

LCERR

LDA #LSTCHR
BNE NGEXIT

;LAST CHAR IS NOT '/'
;(ALWAYS)

C9 2F
F0 E6

LDT7A

CMP #'/'
BEQ LOADT8
LDA #NONHEX
BNE NGEXIT

;LAST OR NONHEX?
;LAST
;FRAMING ERROR
;KIM ONLY, NON HEX CHAR READ
;(ALWAYS)

LDA #CHECK

;CHECKSUM ERROR

FRERR
NHERR

A9 FF
D0 02
A9 CC

CKERR

38
B0 01

NGEXIT SEC
BCS EXIT

;ERROR INDICATOR TO MONITOR IS CARRY
;(ALWAYS)

18

OKEXIT CLC

;NO ERROR

24
50
A0
4C
68
68
38
A2
D0
AD
29
8D
A9
8D
AD
24
10
AD

FD
08
80
78 8C

CC
69
02
BF
02
00
0B
31
FD
03
32

A0
A0
A0
A6
A6

EXIT

BIT
BVC
LDY
JMP

USRREQ PLA
PLA
SEC
EX10
LDX
BNE
SYNC
LDA
AND
STA
LDA
STA
LDA
BIT
BPL
LDA

MODE
EX10
#$80
LOADT

;READING WRONG REC?
;RESTART SEARCH
;USER REQUESTS EXIT

#$CC
STCC
DDRIN
#$BF
DDRIN
#0
VIAACR
KMBDRY
MODE
SY100
HSBDRY

;STOP TAPE, RETURN
;CHANGE DATA DIRECTION

;SET UP BOUNDARY

1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976

8D69
8D6B
8D6D
8D70
8D72
8D74
8D76
8D78
8D7B
8D7E
8D80
8D83
8D85
8D87
8D89
8D8B
8D8D
8D90
8D92
8D94
8D95
8D97
8D9A
8D9B
8D9E
8D9F
8D9F
8D9F
8D9F
8DA1
8DA3
8DA6
8DA8
8DA9
8DA9
8DAB
8DAE
8DB0
8DB3
8DB6
8DB9
8DBB
8DBE
8DBF
8DBF
8DBF
8DBF
8DBF
8DC1
8DC3
8DC6
8DC8
8DCA
8DCA
8DCC
8DCF
8DD1
8DD3
8DD5
8DD7
8DDA
8DDD

85
A9
8D
A5
09
85
A9
8D
2C
10
20
66
A5
C9
D0
A2
20
C9
D0
CA
D0
8E
CA
8E
60

F8
6D
00
FD
40
FD
7F
01
00
CB
9F
FC
FC
16
EB
0A
E1
16
E2

SY100

24
10
20
B0
60

FD
69
CA 8D
22

SYNBIT BIT
BPL
JSR
BCS
RTS

MODE
RDBITK
GETTR
GETTR

;KIM OR HS?
;KIM
;HS
;IF SHORT, GET NEXT TRANS
;BIT IS ZERO

84
20
A9
20
20
20
A2
8E
60

FD
86
09
A5
2E
9C
EC
0C

START

MODE
ACCESS
#9
CONFIG
ZERCK
P2SCR
#$EC
VIAPCR

;MODE PARM PASSED IN [Y]
;FIX BASIC WARM START BUG

A4

A4
A4
8D

8D

F6
00 A4
01 A4

8B

STA BDRY
LDA #$6D
STA DIG
;INDICATE NO SYNC ON LEDS
LDA MODE
;TURN ON OUT OF SYNC MODE
ORA #$40
;BIT6
STA MODE
SYNC5 LDA #$7F
;TEST FOR CR DOWN ON HKB
STA DDRDIG
BIT DIG
BPL USRREQ
;CR KEY DOWN - EXIT (ERRORS)
JSR SYNBIT
ROR CHAR
LDA CHAR
CMP #SYN
BNE SYNC5
SYNC10 LDX #10
;NOW MAKE SURE CAN GET 10 SYNS
JSR RDCHTX
CMP #SYN
BNE SYNC5
DEX
BNE SYNC10+2
STX DIG
;TURN OFF DISPLAY
DEX
;X=$FF
STX DDRDIG
RTS
;SYNBIT - GET BIT IN SYN SEARCH. IF HS, ENTER WITH
; TIMER STARTED BY PREV BIT, BIT RETURNED IN CARRY.

89
83
82
A0

STCC

STY
JSR
LDA
JSR
JSR
JSR
LDX
STX
RTS

;PARTIAL I/O CONFIGURATION
;ZERO THE CHECK SUM
;MOVE SA TO FE,FF IN PAGE ZERO
;TAPE ON

; GETTR - GET TRANSITION TIME FROM 6532 CLOCK
; DESTROYS A,Y
A9
85
AD
29
D0

00
F9
00 A0
40
F9

KGETTR LDA
STA
KG100 LDA
AND
BNE

#0
OLD
TAPIN
#$40
KG100

A0
AD
29
C5
F0
85
AD
8C
18

FF
00 A0
40
F9
F7
F9
06 A4
15 A4

GETTR
NOTR

#$FF
TAPIN
#$40
OLD
NOTR
OLD
TIMER
TIM8

LDY
LDA
AND
CMP
BEQ
STA
LDA
STY
CLC

;KIM GETTR - GET FULL CYCLE
;FORCE GETTR POLARITY
;WAIT TIL INPUT LO

;NO CHANGE
;RESTART CLOCK

1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038

8DDE
8DE0
8DE1
8DE1
8DE3
8DE5
8DE5
8DE5
8DE5
8DE5
8DE5
8DE5
8DE8
8DEA
8DED
8DEF
8DF2
8DF4
8DF7
8DF8
8DFA
8DFB
8DFD
8DFF
8E02
8E03
8E05
8E07
8E08
8E09
8E0C
8E0C
8E0C
8E0C
8E0F
8E11
8E14
8E16
8E18
8E19
8E1C
8E1E
8E21
8E23
8E25
8E26
8E26
8E28
8E2A
8E2A
8E2D
8E2F
8E31
8E34
8E36
8E37
8E3A
8E3C
8E3C
8E3C
8E3C
8E3C

65 F8
60

ADC BDRY
RTS

24 FD
10 7A

RDCHTX BIT MODE
BPL RDCHT

;READ HS OR KIM CHARACTER
;KIM

; RDBYTH - READ HS BYTE
; Y DESTROYED, BYTE RETURNED IN CHAR AND A
; TIME FROM ONE CALL TO NEXT MUST BE LESS THAN
;
START BIT TIME (TIMER STILL RUNNING)
8E
A2
20
B0
20
90
20
38
66
CA
D0
A5
AE
60
24
70
68
68
4C

38
08
CA
14
CA
04
CA

A6
8D
8D
8D

FC
F2
FC
38 A6
FD
F8
38 8D

RDBYTH STX
LDX
JSR
BCS
RDBH10 JSR
BCC
JSR
SEC
RDASSY ROR
DEX
BNE
LDA
H8DFF LDX
RTS
RDBH90 BIT
BVS
PLA
PLA
JMP

SCR8
#8
GETTR
RDBH90
GETTR
RDASSY
GETTR
CHAR
RDBH10
CHAR
SCR8
MODE
RDBH90-4

;SAVE X
;GET START BIT TIME
;IF NOT 0, FRAMING ERR
;GET BIT IN CARRY
;BIT IS ONE, WAIT HALF CYC
;MAKE SURE "1"

;GET IN ACC
;RESTORE X
;NO ERR IF NOT IN SYNC
;OR READING WRONG REC
;FIX STACK

FRERR

; RDBITK - READ KIM BIT - X,Y,A DESTROYED, BIT RETURNED IN C
20
B0
20
B0
A2
E8
20
90
20
90
E0
60

BF 8D
FB
BF 8D
F6
00
BF 8D
FA
BF 8D
F5
08

RDBITK JSR
BCS
JSR
BCS
LDX
RDB100 INX
JSR
BCC
JSR
BCC
CPX
RTS

KGETTR
RDBITK
KGETTR
RDBITK
#0
KGETTR
RDB100
KGETTR
RDB100
#$08

;WAIT FOR LF
;GET SECOND
;COUNT LF FULL CYCLES
;GET SECOND
;GET BIT TO CARRY

24 FD
30 BB

RDBYTX BIT MODE
BMI RDBYTH

;READ HS OR KIM BYTE
;HS

20
C9
F0
20
B0
AA
20
86

RDBYT

;READ KIM BYTE INTO CHAR AND A
;READ ONE CHAR IF LAST
;SET CARRY AND RETURN

5F 8E
2F
2C
3C 8E
26
5F 8E
FC

JSR
CMP
BEQ
JSR
BCS
TAX
JSR
STX
; AND FALL

RDCHT
#'/'
PACKT3
PACKT
RDRTN

;NON HEX CHAR?
;SAVE MSD

RDCHT
CHAR
;MOVE MSD TO CHAR
INTO PACKT AGAIN

;PACKT - ASCII HEX TO 4 BITS
;INPUT IN A, OUTPUT IN CHAR AND A, CARRY SET = NON HEX

2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100

8E3C
8E3E
8E40
8E42
8E44
8E46
8E48
8E4A
8E4B
8E4D
8E4E
8E4F
8E50
8E51
8E53
8E54
8E56
8E57
8E59
8E5B
8E5C
8E5D
8E5E
8E5F
8E5F
8E5F
8E5F
8E5F
8E5F
8E60
8E61
8E63
8E64
8E67
8E69
8E6A
8E6B
8E6D
8E6E
8E6F
8E71
8E72
8E73
8E74
8E74
8E74
8E74
8E77
8E77
8E77
8E77
8E77
8E78
8E79
8E7C
8E7F
8E81
8E84
8E85
8E86
8E86
8E87

C9
90
C9
B0
C9
F0
90
18
69
2A
2A
2A
2A
A0
2A
26
88
D0
A5
18
60
38
60

30
1D
47
19
40
15
03
09

04
FC
FA
FC

PACKT

CMP
BCC
CMP
BCS
CMP
BEQ
BCC
CLC
ADC
PACKT1 ROL
ROL
ROL
ROL
LDY
RACKT2 ROL
ROL
DEY
BNE
LDA
CLC
RDRTN RTS
PACKT3 SEC
RTS

#$30
PACKT3
#$47
PACKT3
#$40
PACKT3
PACKT1
#9
A
A
A
A
#4
A
CHAR
RACKT2
CHAR

;LT "0"?
;GT "F" ?
;A-F?
;40 NOT VALID

;GET LSD INTO LEFT NIBBLE

;ROTATE 1 BIT AT A TIME INTO CHAR

;GET INTO ACCUM ALSO
;OK
;NOT HEX

; RDCHT - READ KIM CHAR
; PRESERVES X, RETURNS CHAR IN CHAR (W/PARITY)
; AND A (W/O PARITY)
8A
48
A9
48
20
66
68
0A
D0
68
AA
A5
2A
4A
60

RDCHT
FF

KBITS

0C 8E
FC
F6
FC

TXA
PHA
LDA
PHA
JSR
ROR
PLA
ASL
BNE
PLA
TAX
LDA
ROL
LSR
RTS

;SAVE X
#$FF

;USE A TO COUNT BITS (BY SHIFTING)
;SAVE COUNTER

RDBITK
CHAR
A
KBITS
CHAR
A
A

;DO 8 BITS
;RESTORE X

;DROP PARITY

; RDCHK - READ ONE BYT, INCLUDE IN CKSUM
20 26 8E

RDCHK

JSR RDBYTX

;FALL INTO CHKT

; CHKT - UPDATE CHECK SUM FROM BYTE IN A
; DESTROYS Y
A8
18
6D
8D
90
EE
98
60
FF

CHKT
36 A6
36 A6
03
37 A6

TAY
CLC
ADC
STA
BCC
INC
CHKT10 TYA
RTS

;SAVE ACCUM
SCR6
SCR6
CHKT10
SCR7

.DB $FF
*=$8E87

;BUMP HI BYTE
;RESTORE A
;NOT USED
;KEEP OLD ENTRY POINT

2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162

8E87
8E8A
8E8C
8E8F
8E91
8E93
8E95
8E98
8E99
8E9A
8E9C
8E9F
8EA0
8EA2
8EA3
8EA4
8EA5
8EA7
8EA9
8EAC
8EAC
8EAF
8EB2
8EB2
8EB5
8EB8
8EBB
8EBE
8EBE
8EBE
8EC0
8EC2
8EC2
8EC5
8EC8
8ECB
8ECE
8ECE
8ED0
8ED3
8ED5
8ED7
8EDA
8EDC
8EDC
8EDE
8EE1
8EE4
8EE7
8EEA
8EED
8EED
8EEF
8EF2
8EF4
8EF7
8EF7
8EF7
8EFA
8EFA
8EFC
8EFE

20
A9
8D
A2
A4
10
AE
8A
48
A9
20
88
D0
68
AA
CA
D0
A9
20

A9 8D
07
02 A4
01
FD
03
30 A6
16
0A 8F
F8

F1
2A
0A 8F

DUMPT

JSR
LDA
STA
LDX
LDY
BPL
LDX
DUMPT1 TXA
PHA
DMPT1A LDA
JSR
DEY
BNE
PLA
TAX
DEX
BNE
LDA
JSR

START
#7
TAPOUT
#1
MODE
DUMPT1
TAPDEL

;INIT VIA & CKSUM, SA TO BUFAD & START
;CODE FOR TAPE OUT
;BIT 3 USED FOR HI/LO
;KIM DELAY CONSTANT (OUTER)
;128 KIM, 0 HS
;KIM - DO 128 SYNS
;HS INITIAL DELAY (OUTER)

#SYN
OUTCTX
DMPT1A

;INNER LOOP (HS OR KIM)

DUMPT1
#'*'
OUTCTX

;WRITE START

AD 4E A6
20 3F 8F

LDA ID
JSR OUTBTX

;WRITE ID

AD
20
AD
20

LDA
JSR
LDA
JSR

;WRITE SA

4C
3C
4D
3C

A6
8F
A6
8F
;

24 FD
10 0C

SAL
OUTBCX
SAH
OUTBCX

BIT MODE
BPL DUMPT2

;KIM OR HS

AD
20
AD
20

4A
3C
4B
3C

A6
8F
A6
8F

LDA
JSR
LDA
JSR

EAL
OUTBCX
EAH
OUTBCX

;HS, WRITE EA

A5
CD
D0
A5
CD
D0

FE
4A A6
25
FF
4B A6
1E

DUMPT2 LDA
CMP
BNE
LDA
CMP
BNE

BUFADL
EAL
DUMPT4
BUFADH
EAH
DUMPT4

;CHECK FOR LAST BYTE

A9
20
AD
20
AD
20

2F
0A
36
3F
37
3F

8F
A6
8F
A6
8F

LDA
JSR
LDA
JSR
LDA
JSR

#'/'
OUTCTX
SCR6
OUTBTX
SCR7
OUTBTX

;LAST, WRITE "/"

A9
20
A9
20

04
3F 8F
04
3F 8F

LDA
JSR
LDA
JSR

#EOT
OUTBTX
#EOT
OUTBTX

;WRITE TWO EOT'S

=*
JMP OKEXIT

;(SET "OK" MARK)

4C 41 8D
A0 00
B1 FE
20 3C 8F

DT3E

DUMPT4 LDY #0
LDA (BUFADL),Y
JSR OUTBCX

;WRITE CHECK SUM

;GET BYTE
;WRITE IT W/CHK SUM

2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224

8F01
8F03
8F05
8F07
8F0A
8F0C
8F0E
8F0E
8F0E
8F0E
8F0E
8F10
8F13
8F15
8F18
8F1A
8F1C
8F1F
8F1F
8F22
8F23
8F25
8F27
8F29
8F2C
8F2C
8F2F
8F30
8F32
8F33
8F35
8F38
8F39
8F3A
8F3C
8F3C
8F3F
8F41
8F43
8F43
8F43
8F43
8F43
8F44
8F45
8F46
8F47
8F48
8F4B
8F4B
8F4B
8F4D
8F4F
8F50
8F52
8F54
8F56
8F56
8F56
8F56
8F56
8F56

E6
D0
E6
4C
24
10

FE
C9
FF
CE 8E
FD
48

A2
8C
85
AD
46
49
8D

09
39 A6
FC
02 A4
FC
08
02 A4

AC
88
D0
90
49
8D

35 A6

AC
88
D0
CA
D0
AC
60
EA
90

3C A6

FD
12
08
02 A4

FD
E3
39 A6
F0

20 77 8E
24 FD
30 CB

INC
BNE
INC
JMP
OUTCTX BIT
BPL

BUFADL
DUMPT2
BUFADH
DUMPT2
MODE
OUTCHT

;BUMP BUFFER ADDR
;CARRY
;HS OR KIM?
;KIM

; OUTBTH - NO CLOCK
; A,X DESTROYED
; MUST RESIDE ON ONE PAGE - TIMING CRITICAL
OUTBTH LDX #9
;8 BITS + START BIT
STY SCR9
STA CHAR
LDA TAPOUT
;GET PREV LEVEL
GETBIT LSR CHAR
EOR #TPBIT
STA TAPOUT
;INVERT LEVEL
; *** HERE STARTS FIRST HALF CYCLE
LDY TAPET1
A416
DEY
;TIME FOR THIS LOOP IS 5Y-1
BNE A416
BCC NOFLIP
;NOFLIP IF BIT ZERO
EOR #TPBIT
;BIT IS ONE - INVERT OUTPUT
STA TAPOUT
; *** END OF FIRST HALF CYCLE
B416
LDY TAPET2
B416B DEY
;LENGTH OF LOOP IS 5Y-1
BNE B416B
DEX
BNE GETBIT
;GET NEXT BIT (LAST IS 0 START BIT)
LDY SCR9
; (BY 9 BIT LSR)
RTS
NOFLIP NOP
;TIMING
BCC B416
;(ALWAYS)
;
OUTBCX JSR CHKT
;WRITE HS OR KIM BYTE & CKSUM
OUTBTX BIT MODE
;WRITE HS OR KIM BYTE
BMI OUTBTH
;HS
;OUTBTC - OUTPUT ONE KIM BYTE

A8
4A
4A
4A
4A
20 4B 8F

OUTBTC =*
OUTBT TAY
LSR A
LSR A
LSR A
LSR A
JSR HEXOUT
; FALL INTO HEXOUT

29
C9
18
30
69
69

HEXOUT AND
CMP
CLC
BMI
ADC
HEX1
ADC

0F
0A
02
07
30

;
;
;
;

#$0F
#$0A

;SAVE DATA BYTE

;MORE SIG DIGIT
;CVT LSD OF [A] TO ASCII, OUTPUT

HEX1
#$07
#$30

OUTCHT - OUTPUT ASCII CHAR (KIM)
CLOCK NOT USED
X,Y PRESERVED
MUST RESIDE ON ONE PAGE - TIMING CRITICAL

2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286

8F56
8F59
8F5C
8F5E
8F60
8F61
8F64
8F66
8F68
8F6A
8F6C
8F6E
8F70
8F73
8F74
8F76
8F77
8F79
8F7B
8F7D
8F7F
8F81
8F83
8F86
8F87
8F89
8F8A
8F8C
8F8D
8F8E
8F90
8F93
8F96
8F97
8F98
8F98
8F9A
8F9A
8F9A
8F9A
8F9B
8F9C
8F9D
8F9E
8F9F
8FA0
8FA0
8FA0
8FA0
8FA0
8FA0
8FA0
8FA0
8FA2
8FA4
8FA6
8FA8
8FAA
8FAC
8FAE
8FB0
8FB1

8E
8C
85
A9
48
AD
46
A2
B0
A2
A0
49
8D
88
D0
CA
D0
A2
B0
A2
A0
49
8D
88
D0
CA
D0
68
0A
D0
AE
AC
98
60

38 A6
39 A6
FC
FF
02 A4
FC
12
02
24
19
08
02 A4
FD
F3
18
02
0C
27
08
02 A4
FD
F3
D0
38 A6
39 A6

FF FF

53
46
41
58
59
01

00
A7
64
00
00
00
00
00
04
2C

C0
8B
8B
00
02
03
C8
D0

OUTCHT STX
STY
STA
LDA
KIMBIT PHA
LDA
LSR
LDX
BCS
LDX
HF
LDY
EOR
STA
HFP1
DEY
BNE
DEX
BNE
LDX
BCS
LDX
LF20
LDY
EOR
STA
LFP1
DEY
BNE
DEX
BNE
PLA
ASL
BNE
LDX
LDY
TYA
RTS

SCR8
SCR9
CHAR
#$FF
TPOUT
CHAR
#18
HF
#36
#25
#TPBIT
TPOUT
HFP1
HF
#24
LF20
#12
#39
#TPBIT
TPOUT
LFP1
LF20
A
KIMBIT
SCR8
SCR9

.DB $FF,$FF
; REGISTER NAME PATCH
*=$8F9A
.DB "S"
.DB "F"
.DB "A"
.DB 'X'
.DB "Y"
.DB $01
;
;
;***
;*** DEFAULT TABLE
;***
*=$8FA0
DFTBLK =*
.DW $C000
.DW TTY
.DW NEWDEV
.DW $0000
.DW $0200
.DW $0300
.DW $C800
.DW $D000
.DB $04
.DB $2C

;PRESERVE X
;DITTO Y
;USE FF W/SHIFTS TO COUNT BITS
;SAVE BIT CTR
;GET CURRENT OUTPUT LEVEL
;GET DATA BIT IN CARRY
;ASSUME 'ONE'
;BIT IS ZERO
;INVERT OUTPUT
;PAUSE FOR 138 USEC
;COUNT HALF CYCS OF HF
;ASSUME BIT IS ONE
;BIT IS ZERO
;INVERT OUTPUT
;PAUSE FOR 208 USEC
;COUNT HALF CYCS
;RESTORE BIT CTR
;DECREMENT IT
;FF SHIFTED 8X = 0
;RESTORE DATA BYTE
;NOT USED

;BASIC

*** JUMP TABLE

;PAGE ZERO

;TAPE DELAY (9.0 SEC)
;KIM TAPE BOUNDARY

2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332

8FB2
8FB3
8FB5
8FB6
8FB8
8FBC
8FBD
8FC0
8FC6
8FC9
8FCA
8FD0
8FD1
8FD2
8FD3
8FD4
8FD5
8FD6
8FD7
8FD8
8FD9
8FDB
8FDC
8FDD
8FDE
8FDF
8FE0
8FE0
8FE3
8FE6
8FE9
8FEC
8FEF
8FF2
8FF4
8FF6
8FF8
8FFA
8FFC
8FFE
9000
9000
9000
9000
9000
9000

46
00 00
33
00 00
00 00 00 00
5A
00 00 00
00006D6E8606
00 00 00
00
000000000000
01
4C
00
80
B0
00
00
00
10
4A 8B
FF
00
00
00
00

$46
;HS TAPE BOUNDARY
$00,$00
;SCR3,SCR4
$33
;HS TAPE FIRST 1/2 BIT
$00,$00
;SCR6,SCR7
$00,$00,$00,$00 ;SCR8-SCRB
$5A
;HS TAPE SECOND 1/2 BIT
$00,$00,$00 ;SCRD-SCRF
$00,$00,$6D,$6E,$86,$06 ;DISP BUFFER (SY1.1)
$00,$00,$00 ;NOT USED
$00
;PARNR
$0000,$0000,$0000 ;PARMS
$01
;PADBIT
$4C
;SDBYT
$00
;ERCNT
$80
;TECHO
$B0
;TOUTFL
$00
;KSHFL
$00
;TV
$00
;LSTCOM
$10
;MAXRC
RESET
;USER REG'S
$FF
;STACK
$00
;FLAGS
$00
;A
$00
;X
$00
;Y

4C
4C
4C
4C
4C
4C
7E
C0
4A
29
9B
4A
0F

HKEY
HDOUT
KYSTAT
M1
M1
SCAND
RIN
TRCOFF
SVBRK
SVIRQ
SVNMI
RESET
IRQBRK

BE
00
6A
D1
D1
06
88
80
80
80
80
8B
80

89
89
89
81
81
89

.DB
.DB
.DB
.DB
.DB
.DB
.DB
.DB
.DB
.DB
.DW
.DB
.DB
.DB
.DB
.DB
.DB
.DB
.DB
.DB
.DW
.DB
.DB
.DB
.DB
.DB
;VECTORS
JMP
JMP
JMP
JMP
JMP
JMP
.DW
.DW
.DW
.DW
.DW
.DW
.DW

LENTRY =$8C78
SENTRY =$8C78+$20F
RGNAM =$8F9A

tasm: Number of errors = 0

.END

;INVEC
;OUTVEC
;INSVEC
;UNRECOGNIZED SYNTAX (ERROR)
;UNRECOGNIZED COMMAND (ERROR)
;SCNVEC
;IN PTR FOR EXEC FROM RAM
;USER TRACE VECTOR
;BRK
;USER IRQ
;NMI
;RESET
;IRQ

;REGISTER NAME PATCH

+-----------------------------------------------------------------------| TOPIC -- AIM Computer -- AIM Monitor listing
+-----------------------------------------------------------------------0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056

0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
A000
A000
A001
A002
A003
A004
A005
A006
A007
A008
A009
A00A
A00B
A00C
A00D
A00E
A00F
A010
A010
A010
A010
A010
A010
A010
A010
00DF
00DF
00E1
00E3

;TELEMARK CROSS ASSEMBLER (TASM) http://www.halcyon.com/squakvly/
;***************************************************
;***************************************************
;**
**
;**
PL-PA00-JOO1A
**
;**
**
;**
ROCKWELL R6500 MICROCOMPUTER SYSTEM
**
;**
**
;**
AIM 65 MONITOR
**
;**
**
;**
PROGRAM LISTING
**
;**
**
;**
REVISION A
AUG 22, 1978
**
;**
**
;***************************************************
;***************************************************
;ROCKWELL INTERNATIONAL
;MICROELECTRONIC DEVICES
;3310 MIRALOMA AVENUE
;P. O. BOX 3669
;ANAHEIM CA U.S.A. 92803
;
;
;
UDRB
UDRAH
UDDRB
UDDRA
UT1L
UT1CH
UT1LL
UT1LH
UT2L
UT2H
USR
UACR
UPCR
UIFR
UIER
UDRA

**************************************
* USER 6522 ADDRESSES (A000-A00F)
*
**************************************
*=$A000
.BLOCK 1
;DATA REG B
.BLOCK 1
;DATA REG A
.BLOCK 1
;DATA DIR REG B
.BLOCK 1
;DATA DIR REG A
.BLOCK 1
;TIMER 1 COUNTER LOW
.BLOCK 1
;TIMER 1 COUNTER HIGH
.BLOCK 1
;TIMER 1 LATCH LOW
.BLOCK 1
;TIMER 1 LATCH HIGH
.BLOCK 1
;TIMER 2 LATCH & COUNTER LOW
.BLOCK 1
;TIMER 2 COUNTER HIGH
.BLOCK 1
;SHIFT REGISTER
.BLOCK 1
;AUX CONTROL REGISTER
.BLOCK 1
;PERIPHERAL CONTROL REGISTER
.BLOCK 1
;INTERRUPT FLAG REGISTER
.BLOCK 1
;INTERRUPT ENABLE REGISTER
.BLOCK 1
;DATA REGISTER A

ASSEM =$D000
BASIEN =$B000
BASIRE =$B003

;ASSEMBLER ENTRY
;BASIC ENTRY (COLD)
;BASIC ENTRY (WARM)

;
MONITOR RAM
;TEXT EDITOR EQUATES (PAG 0)
;OVERLAPS TABUF2+50 (TAPE OUTPUT BUFFER $AD-$FF)
*=$00DF
NOWLN .BLOCK 2
;CURRENT LINE
BOTLN .BLOCK 2
;LAST ACTIVE , SO FAR
TEXT
.BLOCK 2
;LIMITS OF BUFFER (START)

0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118

00E5
00E7
00E9
00EA
00EB
00FF
0100
0100
0100
0108
010A
010C
010C
010C
010F
0112
0115
0115
0116
0116
0117
0118
0126
0126
0126
012E
0130
0130
0130
0133
0147
0147
0147
0147
0147
0147
0147
0147
0147
0147
A400
A400
A400
A400
A402
A404
A406
A406
A406
A408
A409
A40A
A40A
A40B
A40E
A40F
A410
A411
A412
A413
A414
A415

END
SAVE
OLDLEN
LENGTH
STRING

.BLOCK
.BLOCK
.BLOCK
.BLOCK
.BLOCK

2
2
1
1
20

;LIMITS OF BUFFER (END)
;USED BY REPLACE
;ORIG LENGTH
;NEW LENGTH
;FIND STRING

*=$0100
;BREAKPOINTS AND USER I/O HANDLERS
BKS
.BLOCK 8
;BRK LOCATIONS
UIN
.BLOCK 2
;USER INPUT HANDLER (VECTOR)
UOUT
.BLOCK 2
;USER OUTPUT HANDLER (VECTOR)
;UNUSED KEYS TO GO TO USER ROUTINE
KEYF1 .BLOCK 3
;USER PUTS A JMP INSTRUCTION TO...
KEYF2 .BLOCK 3
;GO TO HIS ROUTINE ON EITHER KEY..
KEYF3 .BLOCK 3
;ENTRY
;EQUATES FOR DISASSEMBLER (PAG 1)
*=$0116
;SAME AS TAPE BUFFER I/O (TABUFF)
FORMA .BLOCK 1
LMNEM .BLOCK 1
RMNEM .BLOCK 14
;EQUATES FOR MNEMONIC ENTRY
MOVAD .BLOCK 8
TYPE
.BLOCK 2
TMASK1 =MOVAD
TMASK2 =MOVAD+1
CH
.BLOCK 3
ADFLD .BLOCK 20
HISTM =$A42E
;SHARE WITH NAME & HIST
BYTESM =HISTM+1
TEMPX =HISTM+3
TEMPA =HISTM+5
OPCODE =HISTM+6
CODFLG =HISTM+9
;
;
;

**********************************
* 6532 ADDRESSES (A400-A7FF)
*
**********************************
*=$A400
MONRAM *=*
;JUMP VECTORS
IRQV4 .BLOCK 2
;IRQ AFTER MONITOR (NO BRK)
NMIV2 .BLOCK 2
;NMI
IRQV2 .BLOCK 2
;IRQ
;I/O DEVICES
DILINK .BLOCK 2
TSPEED .BLOCK 1
GAP
.BLOCK 1
;END OF USER ALTERABLE
NPUL
.BLOCK 1
TIMG
.BLOCK 3
REGF
.BLOCK 1
DISFLG .BLOCK 1
BKFLG .BLOCK 1
PRIFLG .BLOCK 1
INFLG .BLOCK 1
OUTFLG .BLOCK 1
HISTP .BLOCK 1
CURPO2 .BLOCK 1

;DISPL LINKAGE (TO ECHO TO DISP)
;TAPE SPEED (C7,5B,5A)
;TIMING GAP BETWEEN BLOCKS
LOCATIONS
;# OF HALF PULSES...
;FOR TAPE
;REGS FLG FOR SINGLE STEP MODE
;DISASSEM FLG FOR SINGLE STEP MODE
;ENABLE OR DIS BREAKPOINTS
;ENABLE OR DIS PRINTER
;INPUT DEVICE
;OUTPUT DEVICE
;HISTORY PTR (SINGLE STEP) (Y)
;DISPLAY POINTER

0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180

A416
A417
A418
A419
A41A
A41C
A41E
A420
A420
A420
A420
A421
A422
A423
A424
A425
A427
A427
A427
A427
A42A
A42D
A42E
A42E
A42E
A42E
A434
A435
A436
A437
A438
A438
A438
A438
A438
A438
A460
A460
A460
A474
A475
A476
A477
A478
A479
A47A
A47B
A47C
A47D
A47F
A47F
A47F
A480
A480
A480
A480
A480
A480
A481
A482
A483
A484

CURPOS
CNTH30
CNTL30
COUNT
S1
ADDR
CKSUM
S2

.BLOCK
.BLOCK
.BLOCK
.BLOCK
.BLOCK
.BLOCK
.BLOCK
=BKS+6

1
1
1
1
2
2
2

;PRINTER POINTER
;BAUD RATE &...
;DELAY FOR TTY
;# OF LINES (0-99)
;START ADDRESS
;END ADDRESS
;CHECKSUM
;VERTICAL COUNT (ONLY ON DUMP)

;MONITOR REGISTERS
SAVPS .BLOCK 1
SAVA
.BLOCK 1
SAVX
.BLOCK 1
SAVY
.BLOCK 1
SAVS
.BLOCK 1
SAVPC .BLOCK 2

;STATUS
;ACCUM
;X REG
;Y REG
;STACK POINTER
;PROGR COUNTER

;WORK AREAS FOR PAGE ZERO SIMULATION
;SIMULATE LDA (NNNN),Y ,WHERE NNNN IS ABSOLUTE
STIY
.BLOCK 3
;STA NM,Y
CPIY
.BLOCK 3
;CMP NM,Y
OR LDA NM,Y
.BLOCK 1
;RTS
LDIY
=CPIY
;LDA NM,Y
;VARIABLES FOR TAPE
NAME
.BLOCK 6
TAPIN .BLOCK 1
TAPOUT .BLOCK 1
TAPTR .BLOCK 1
TAPTR2 .BLOCK 1
HIST
=NAME
BLK
=$0115
TABUFF =$0116
BLKO
=$0168
TABUF2 =$00AD
DIBUFF .BLOCK 40

;FILE NAME
;IN FLG (TAPE 1 OR 2)
;OUT FLG (TAPE 1 OR 2)
;TAPE BUFF POINTER
;TAPE OUTPUT BUFF PTR
;FOUR LAST ADDR + NEXT (SINGL STEP)`
;BLOCK COUNT
;TAPE BUFFER (I/O)
;OUTPUT BLOCK COUNT
;OUTPUT BUFF WHEN ASSEMB (PAG0)
;DISPLAY BUFFER

;VARIABLES USED IN PRINTING
IBUFM .BLOCK 20
;PRINTER BUFFER
IDIR
.BLOCK 1
;DIRECTION == 0=>+ , FF=>ICOL
.BLOCK 1
;COLUMN LEFTMOST=0,RIGHTMOST=4
IOFFST .BLOCK 1
;OFFSET 0=LEFT DGT,1=RIGHT DGT
IDOT
.BLOCK 1
;# OF LAST DOT ENCOUNTERED
IOUTL .BLOCK 1
;LOWER 8 OUTPUTS(8 COLS ON RIGHT)
IOUTU .BLOCK 1
;UPPER 2 DIGITS
IBITL .BLOCK 1
;1 BIT MSK FOR CURRENT OUTPUT
IBITU .BLOCK 1
IMASK .BLOCK 1
;MSK FOR CURRENT ROW
JUMP
.BLOCK 2
;INDIR & ADDR OF TABL FOR CURR ROW
;VARIABLES FOR KEYBOARD
ROLLFL .BLOCK 1
;SAVE LAST STROBE FOR ROLLOVER
KMASK =CPIY
;TO MASK OFF CTRL OR SHIFT
STBKEY =CPIY+1
;STROBE KEY (1-8 COLUMNS)
;
DRA2
DDRA2
DRB2
DDRB2

I/O ASSIGNMENT
*=$A480
.BLOCK 1
.BLOCK 1
.BLOCK 1
.BLOCK 1

;DATA
;DATA
;DATA
;DATA

REG
DIR
REG
DIR

A
REG A
B
REG B

0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242

A484
A484
A484
A485
A486
A487
A488
A488
A485
A485
A486
A486
A494
A494
A494
A494
A495
A496
A497
A498
A498
A498
A498
A800
A800
A801
A802
A803
A804
A805
A806
A807
A808
A809
A80A
A80B
A80C
A80D
A80E
A80F
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810
A810

;

WRITE EDGE DETECT CONTROL (NOT USED BECAUSE KB)
*=$A484
DNPA7 .BLOCK 1
;DISABLE PA7 INT ,NEG EDGE DET
DPPA7 .BLOCK 1
;DIS PA7 INT ,POS EDGE DETE
ENPA7 .BLOCK 1
;ENA PA7 INT ,NEG EDG DET
EPPA7 .BLOCK 1
;ENA PA7 INT ,POS EDG DET
;
RINT

READ AND CLEAR INTERRUPT
*=$A485
.BLOCK 1
;BIT 7=TIMER FLG , BIT 6=PA7 FLG

;

TIMER INTERRUPT
*=$A494
;WRITE COUNT TO INTERVAL TIMER
;INTERRUPT DISABLE FOR THESE ADDRS
DIV1
.BLOCK 1
;DIV BY 1 (DISABLE);ADD 8 TO ENA
DIV8
.BLOCK 1
;DIV BY 8 (DIS) ; ADD 8 TO ENA
DIV64 .BLOCK 1
;DIV BY 64 (DIS) ; ADD 8 TO ENA
DI1024 .BLOCK 1
;DIV BY 1024 (DIS) ; ADD 8 TO ENA
;
;
;
DRB
DRAH
DDRB
DDRA
T1L
T1CH
T1LL
T1LH
T2L
T2H
SR
ACR
PCR
IFR
IER
DRA

*********************************************
*
6522 ADDRESSES (MONIT) (A800-ABFF)
*
*********************************************
*=$A800
.BLOCK 1
;DATA REG B
.BLOCK 1
;DATA REG A
.BLOCK 1
;DATA DIR REG B
.BLOCK 1
;DATA DIR REG A
.BLOCK 1
;TIMER 1 COUNTER LOW
.BLOCK 1
;TIMER 1 COUNTER HIGH
.BLOCK 1
;TIMER 1 LATCH LOW
.BLOCK 1
;TIMER 1 LATCH HIGH
.BLOCK 1
;TIMER 2 LATCH & COUNTER LOW
.BLOCK 1
;TIMER 2 COUNTER HIGH
.BLOCK 1
;SHIFT REGISTER
.BLOCK 1
;AUX CONTROL REGISTER
.BLOCK 1
;PERIPHERAL CONTROL REGISTER
.BLOCK 1
;INTERRUPT FLAG REGISTER
.BLOCK 1
;INTERRUPT ENABLE REGISTER
.BLOCK 1
;DATA REGISTER A

;DEFINE I/O CONTROL FOR PCR (CA1,CA2,CB1,CB2)
DATIN =$0E
;DATA IN CA2=1
DATOUT =$0C
;DATA OUT CA2=0
PRST
=$00
;PRINT START (CB1) ,NEG DETEC
SP12
=$01
;STROBE P1,P2 (CA1) ,POS DETEC
MON
=$C0
;MOTOR ON (CB2=0)
MOFF
=$E0
;MSKS TO OBTAIN EACH INTERRUPT
MPRST =$10
;INT FLG FOR CB1
MSP12 =$02
;INT FLG FOR CA1
MT2
=$20
;INT FLG FOR T2
;DEFINE I/O CONTROL FOR ACR (TIMERS,SR)
PRTIME =1700
; PRINTING TIME =1.7M MSEC
DEBTIM =5000
; DEBOUNCE TIME (5 MSEC)
T2I
=$00
;T2 AS ONE SHOT (PRI,KB,TTY,TAPE)
T1I
=$00
;T1 AS ONE SHOT,PB7 DIS (TAPES)
T1FR
=$C0
;T1 IN FREE RUNNING (TAPE)
;
;

******************************
*
DISPLAY
(AC00-AFFF)
*

0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304

A810
A810
AC00
AC00
AC01
AC02
AC03
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
AC04
E000
E000

;
******************************
; REGISTERS FOR DISPLAY (6520)
*=$AC00
RA
.BLOCK 1
;REGISTER A
CRA
.BLOCK 1
;CONTROL REG A
RB
.BLOCK 1
;REG B
CRB
.BLOCK 1
;CONTROL REG B
;CHR
;CHR
;CHR
;CHR
;CHR

00-03
04-07
08-11
12-15
16-19

NULLC
CR
LF
ESCAPE
RUB
EQS
;.FILE
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;

ENA
ENA
ENA
ENA
ENA

BY
BY
BY
BY
BY

$AC04-AC07
$AC08-AC0B
$AC10-AC13
$AC20-AC23
$AC40-AC43

=$FF
=$0D
=$0A
=$1B
=$08
=$BD
A1

E=ENTER EDITOR
T=RE-ENTER EDITOR TO RE-EDIT SOURCE
R=SHOW REGISTERS
M=DISPLAY MEMORY
=SHOW NEXT 4 ADDRESSES
G=GO AT CURRENT P.C. (COUNT)
/=ALTER CURRENT MEMORY
L=LOAD OBJECT
D=DUMP OBJECT
N=ASSEMBLE
*=ALTER P.C.
A=ALTER ACCUMULATOR
X=ALTER X REGISTER
Y=ALTER Y REGISTER
P=ALTER PROCESSOR STATUS
S=ALTER STACK POINTER
B=SET BREAK ADDR
?=SHOW BREAK ADDRESSES
#=CLEAR BREAK ADDRESSES
H=SHOW TRACE HISTORY STACK
V=TOGGLE REGISTER PRINT WITH DIS.
Z=TOGGLE DISASSEMBLER TRACE
\=TURN ON/OFF PRINTER
=ADV PAPER
I=MNEMONIC ENTRY
K=DISASSEMBLE MEMORY
1=TOGGLE TAPE 1 CONTRL (ON OR OFF)
2=TOGGLE TAPE 2 CONTRL
3=VERIFY CKSUM FOR TAPES
4=ENABLE BREAKS
5=BASIC ENTRY (COLD)
6=BASIC REENTRY (WARM)

;FOLLOWING KEYS ARE UNUSED BUT 'HOOKS'
;ARE PROVIDED IN LOCATIONS 010C-0114
;
; KEYF1,KEYF2,KEYF3
*=$E000
;ALL MSGS HAVE MSB=1 OF LAST CHAR TO END IT

0305
0306
0307
0307
0308
0309
0310
0311
0312
0313
0314
0314
0315
0315
0316
0317
0318
0319
0320
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362

E000
E005
E008
E00E
E01C
E021
E024
E027
E02A
E02D
E031
E037
E03B
E041
E048
E04D
E050
E052
E056
E05C
E05F
E061
E066
E06C
E072
E075
E075
E075
E078
E07B
E07B
E07B
E07E
E07F
E082
E083
E086
E089
E08A
E08D
E08E
E091
E092
E095
E095
E098
E09B
E09E
E0A1
E0A4
E0A7
E0AA
E0AC
E0AF
E0B1
E0B4
E0B7
E0B9
E0BC
E0BF
E0BF
E0BF

46524F4DBD M1
.DB "FROM",EQS
54 4F BD
M3
.DB "TO",EQS
202A2A2A2A20M4
.DB " **** PS AA XX YY S",$D3
50532041412058582059592053D3
4D4F5245BF M5
.DB "MORE",$BF
4F 4E A0
M6
.DB "ON",$A0
;"ON "
4F 46 C6
M7
.DB "OF",$C6
;"OFF"
42 52 CB
M8
.DB "BR",$CB
;"BRK"
49 4E BD
M9
.DB "IN",EQS
4F 55 54 BD M10
.DB "OUT",EQS
204D454D2046M11
.DB " MEM FAIL",$A0
41494CA0
205052494E54M12
.DB " PRINTER DOW",$CE
455220444F57CE
2053524348 TMSG0 .DB " SRCH"
20 46 BD
TMSG1 .DB " F",EQS
54 BD
TMSG2 .DB "T",EQS
A0 C5 D2 D2 TMSG3 .DB $A0,$C5,$D2,$D2 ;PRINT " ERROR" ,MSB=1
CFD2A0A0A0A0
.DB $CF,$D2,$A0,$A0,$A0,$A0,$A0,$A0,";"
A0A03B
41 BD
TMSG5 .DB "A",EQS
424C4B3DA0 TMSG6 .DB "BLK=",$A0
A0CCCFC1C43BTMSG7 .DB $A0,$CC,$CF,$C1,$C4,";"
454449544FD2EMSG1 .DB "EDITO",$D2 ;EDITOR MESSAGES
45 4E C4
EMSG2 .DB "EN",$C4
6C 02 A4
6C 04 A4
8D
68
8D
D8
8E
8C
68
8D
68
8D
BA
8E

21 A4

AC
AD
99
AD
99
20
AD
F0
20
90
4C
20
F0
20
4C

14
26
2E
25
2F
88
10
08
6B
03
7F
90
F8
07
6D

D8

20 A4
22 A4
23 A4
25 A4
26 A4
24 A4
A4
A4
A4
A4
A4
E6
A4
E7
E1
E7
E9
E2

;VECTORS COME HERE FIRST AFTER JUMP THRU FFFA-FFFF
NMIV1 JMP (NMIV2)
;NMIV2 IS A VECTOR TO NMIV3
IRQV1 JMP (IRQV2)
;IRQV2 IS A VECTOR TO IRQV3
;SINGLE STEP ENTRY POINT (NMI)
NMIV3 STA SAVA
;SAVE ACCUM
PLA
STA SAVPS
;SAVE PROCESSOR STATUS
CLD
STX SAVX
;SAVE X
STY SAVY
PLA
STA SAVPC
;PROGRAM COUNTER
PLA
STA SAVPC+1
TSX
;GET STACK PTR & SAVE IT
STX SAVS
;TRACE THE ADDRESS
LDY HISTP
;GET POINTER TO HISTORY STACK
LDA SAVPC+1
;SAVE HALT ADDR IN HISTORY STACK
STA HIST,Y
LDA SAVPC
STA HIST+1,Y
JSR NHIS
;UPDATE POINTER
LDA BKFLG
;SOFT BREAKS ON?
BEQ NMI5
;NO ,DONT CHCK BRKPOINT LIST
JSR CKB
;CHECK BREAKPOINT LIST
BCC NMI5
;DID NOT HIT BREAKPOINT
NMI4
JMP IRQ2
;HIT A BREAK-TRAP TO MONITOR
NMI5
JSR DONE
;COUNT =0 ?
BEQ NMI4
;YES,TRAP TO MONITOR
JSR RCHEK
;CHK IF HE WANTS TO INTERR
JMP GOBK
;NOT DONE-RESUME EXECUTION
;POWER UP AND RESET ENTRY POINT (RST TRANSFERS HERE)
RSET
CLD
;CLEAR DEC MODE

0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424

E0C0
E0C1
E0C3
E0C4
E0C7
E0C7
E0C9
E0CC
E0CF
E0D0
E0D2
E0D2
E0D4
E0D7
E0DA
E0DB
E0DD
E0DD
E0E0
E0E3
E0E5
E0E8
E0EB
E0ED
E0EF
E0F1
E0F3
E0F6
E0F9
E0FA
E0FC
E0FE
E0FE
E100
E102
E105
E107
E108
E10B
E10D
E10E
E111
E113
E116
E119
E11A
E11B
E11B
E11B
E11D
E120
E122
E124
E126
E129
E12C
E12E
E131
E133
E136
E139
E13B

78
A2 FF
9A
8E 24 A4
A2
BD
9D
CA
10

0E
43 E7
00 A8

A2
BD
9D
CA
10

03
52 E7
80 A4

AD
CD
D0
AD
CD
D0
A2
D0
A2
BD
9D
E8
E0
90

56
02
0C
57
03
04
10
02
00
56
02

A9
A2
20
A9
CA
20
A9
E8
20
D0
9D
9D
60
58

00
01
13 E1
FF

A9
2C
D0
70
A9
8D
2C
50
AD
49
8D
AD
49
20

08
00
22
F9
FF
09
00
FB
09
FF
17
08
FF
7C

F7

F7
E7
A4
E7
A4

E7
A4

15
F5

13 E1
04
13 E1
07
00 AC
02 AC

A8

A8
A8
A8
A4
A8
FE

SEI
;DISABLE INTERRUPT
LDX #$FF
;INIT STACK PTR
TXS
STX SAVS
;ALSO INIT SAVED STACK PTR
;INITIALIZE 6522
LDX #14
RS1
LDA INTAB1,X
;PB1-PB0,PA7-PA0 FOR PRNTR
STA DRB,X
;PB2=TTO,PB6=TTI
DEX
;PB4-PB5=TAPE CONTROL,PB7=DATA
BPL RS1
;PB3 =SWITCH KB/TTY
;INITIALIZE 6532
LDX #3
;PORTS USED FOR KB
RS2
LDA INTAB2,X
;PA0-PA7 AS OUTPUT
STA DRA2,X
;PB0-PB7 AS INPUT
DEX
BPL RS2
;INITIALIZE MONITOR RAM (6532)
LDA INTAB3
;CHECK IF NMIV2 HAS BEEN CHANGED
CMP NMIV2
;IF IT HAS THEN ASSUME A COLD
BNE RS3A
;START AND INITIALIZE EVERYTHING
LDA INTAB3+1
CMP NMIV2+1
BNE RS3A
LDX #16
;THEY ARE EQUAL ,IT'S A WARM RESET
BNE RS3
RS3A
LDX #0
;INIT EVERYTHING (POWER UP)
RS3
LDA INTAB3,X
STA NMIV2,X
INX
CPX #21
BCC RS3
;INITIALIZE DISPLAY (6520)
LDA #0
;SET CONTR REG FOR DATA DIR REG
LDX #1
JSR SETREG
LDA #$FF
;SET DATA DIR REG FOR OUTPUT
DEX
JSR SETREG
LDA #$04
;SET CONTR REG FOR PORTS
INX
JSR SETREG
BNE RS3B
SETREG STA RA,X
STA RB,X
RTS
RS3B
CLI
;CLEAR INTERRUPT
;KB/TTY SWITCH TEST AND BIT RATE MEASUREMENT
LDA #$08
;PB3=SWITCH KB/TTY
RS4
BIT DRB
;A^M ,PB6-> V (OVERFLOW FLG)
BNE RS7
;BRANCH ON KB
BVS RS4
;START BIT=PB6=0?
LDA #$FF
;YES ,INITIALIZE TIMER T2
STA T2H
RS5
BIT DRB
;END OF START BIT ?
BVC RS5
;NO ,WAIT UNTIL PB6 BACK TO 1
LDA T2H
;STORE TIMING
EOR #$FF
;COMPLEMENT
STA CNTH30
LDA T2L
EOR #$FF
JSR PATCH1
;ADJUST IT

0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484
0485
0486

E13E
E141
E144
E146
E147
E148
E14A
E14D
E14E
E14F
E150
E152
E154
E154
E154
E157
E158
E159
E15B
E15D
E160
E163
E163
E163
E164
E167
E16A
E16D
E16E
E16F
E170
E172
E175
E176
E178
E17B
E17C
E17F
E17F
E182
E182
E182
E182
E185
E187
E18A
E18D
E18E
E190
E193
E194
E196
E199
E19B
E19C
E19E
E19E
E1A1
E1A2
E1A5
E1A8
E1A9

20
4C
A2
8A
48
A9
20
68
AA
CA
10
30

13 EA
72 FF
13

8D
68
48
29
D0
AD
6C

21 A4

68
8D
8E
8C
D8
68
38
E9
8D
68
E9
8D
BA
8E

00
7B EF

F4
EA

10
06
21 A4
00 A4

20 A4
22 A4
23 A4

01
25 A4
00
26 A4
24 A4

20 61 F4

4C
A9
20
20
48
A9
20
68
A2
DD
F0
CA
10

59 FF
BC
7A E9
96 FE

20
D8
20
AE
9A
4C

D4 E7

3E
7A E9
20
C4 E1
11
F8

FE E8
24 A4
82 E1

RS6
RS7
RS8

JSR
JMP
LDX
TXA
PHA
LDA
JSR
PLA
TAX
DEX
BPL
BMI

CRLOW
PAT21
#19

;CLEAR DISPLAY
;CLEAR HARDWARE CURSORS

#0
OUTDD1

RS8
RS6

;BRK INSTR (00) OR IRQ ENTRY POINT
IRQV3 STA SAVA
PLA
PHA
;GET STATUS
AND #$10
;SEE IF 'BRK' , ISOLATE B FLG
BNE IRQ1
;TRAP WAS CAUSED BY "BRK" INSTRUC
LDA SAVA
;TRAP CAUSED BY IRQ SO TRANSFER
JMP (MONRAM)
;CONTROL TO USER THRU VECTOR
;IS 'BRK' INSTR ,SHOW PC & DATA
;PC IS OFF BY ONE , SO ADJUST IT
IRQ1
PLA
STA SAVPS
;SAVE PROCESSOR STATUS
STX SAVX
STY SAVY
CLD
PLA
;PROGR CNTR
SEC
;SUBTRACT ONE FROM RETURN ADDR
SBC #1
STA SAVPC
PLA
SBC #0
STA SAVPC+1
TSX
;GET STACK PTR & SAVE IT
STX SAVS
;SHOW PC AND DATA
IRQ2
JSR REGQ
;SHOW NEXT INSTRUCTION & CONTINUE
;THIS ROUTINE WILL GET
;KB/TTY & THEN WILL GO
START JMP PAT19
STA1
LDA #'<'+$80
JSR OUTPUT
JSR RED1
PHA
LDA #'>'
JSR OUTPUT
PLA
LDX #MCNT
MCM2
CMP COMB,X
BEQ MCM3
DEX
BPL MCM2
;IS BAD COMMAND
JSR QM
COMIN CLD
JSR LL
LDX SAVS
TXS
JMP START

A CHR WITH "( )" FROM
TO THE RESPECTIVE COMMAND
;CLEAR DEC MODE & 
;"<" CHR WITH MSB=1 FOR DISP
;GET CHR & ECHO FROM KB/TTY

;SCAN LIST OF CMDS FOR ENTERED CHR
;COUNT OF COMMANDS
;CHECK NEXT COMMAND IN LIST
;MATCH , SO PROCESS THIS COMMAND

0487
0488
0489
0490
0491
0492
0493
0494
0495
0496
0497
0498
0499
0500
0501
0501
0502
0502
0503
0504
0504
0505
0505
0506
0506
0507
0507
0508
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517
0518
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528
0529
0530
0531
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541

E1AC
E1AC
E1AD
E1AE
E1AF
E1B2
E1B5
E1B8
E1BB
E1BE
E1C1
E1C4
E1C4
E1C4
E1C4
E1CA
E1D4
E1DA
E1E5
E1E5
E1EB
E1EF
E1F5
E1FB
E201
E207
E20D
E211
E217
E21B
E221
E221
E227
E227
E227
E22A
E22C
E22F
E232
E235
E237
E23A
E23C
E23F
E241
E244
E246
E248
E248
E248
E24B
E24D
E24F
E251
E254
E256
E259
E25C
E25D
E25E
E260
E261

8A
0A
AA
BD
8D
BD
8D
20
4C
6C

E5
7D
E6
7E
C1
82
7D

E1
A4
E1
A4
E1
E1
A4

;HAVE VALID COMMAND
MCM3
TXA
ASL A
TAX
LDA MONCOM,X
STA JUMP
LDA MONCOM+1,X
STA JUMP+1
JSR JMPR
JMP START
JMPR
JMP (JUMP)

;CONVERT TO WORD (MULT BY 2)
;2 BYTES (ADDR)
;GET ADDRESS OF COMMAND PROCESSOR

;CMD PROCESSORS CAN EXIT WITH 'RTS'
;GO TO COMMAND

;VALID COMMANDS
MCNT
=32
;COUNT
4554524D472FCOMB
.DB "ETRMG/LDN*AXYPS "
4C444E2A415859505320
423F2348565A
.DB "B?#HVZIK123456[]",$5E
494B3132333435365B5D5E
39F6CFF627E2MONCOM .DW EDIT,REENTR,REG,MEM,GO
48E261E2
A0E2E6E23BE4
.DW CHNGG,LOAD,DUMP,ASSEM,CGPC,CGA
00D0D4E5EEE5
F2E5F6E5EAE5
.DW CGX,CGY,CGPS,CGS,NXT5,BRKA
FAE50DE61BE6
4DE6FEE665E6
.DW SHOW,CLRBK,SHIS,REGT,TRACE
D9E6DDE6
9EFB0AE7BDE6
.DW MNEENT,KDISA,TOGTA1,TOGTA2,VECKSM
CBE694E6
E5E600B003B0
.DW BRKK,BASIEN,BASIRE
;USER DEFINED FUNCTIONS
0C010F011201
.DW KEYF1,KEYF2,KEYF3
20
A0
20
20
20
A0
20
A9
8D
A9
8D
A2
D0

13
08
AF
24
3E
09
DD
20
1C
A4
1D
05
07

EA

20
B0
A2
A0
20
A9
20
20
C8
CA
D0
60

AE
13
04
00
3E
1C
58
46

EA

F1

E7
EA
E8
E2
A4
A4

E8
EB
EA

;***** R COMMAND-DISPLAY REGISTERS *****
REG
JSR CRLOW
;CLEAR DISP IF KB
LDY #M4-M1
;MESSAG & 
JSR KEP
JSR CRCK
REG1
JSR BLANK
LDY #SAVPC-ADDR ;OUTPUT PGR CNTR (SAVEPC+1,SAVEPC)
JSR WRITAD
LDA #SAVPS
;NOW THE OTHER 5 REGS
STA ADDR
LDA #SAVPS/256
STA ADDR+1
LDX #5
;COUNT
BNE MEM1
;SHARE CODE
;***** M COMMAND-DISPLAY MEMORY *****
MEM
JSR ADDIN
;GET START ADDDRESS IN ADDR
BCS MEM3
MEIN
LDX #4
MEM1
LDY #0
MEM2
JSR BLANK
LDA #ADDR
JSR LDAY
;LOAD CONTENTS OF CURR LOCATION
JSR NUMA
;AND DISPLAY IT AS 2 HEX DIGITS
INY
DEX
;DECR COUNTER
BNE MEM2
MEM3
RTS
;GET NEXT COMMAND

0542
0543
0544
0545
0546
0547
0548
0549
0550
0551
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602
0603

E261
E261
E264
E267
E26A
E26D
E270
E272
E275
E278
E27B
E27E
E280
E283
E286
E289
E28A
E28D
E290
E293
E294
E297
E298
E29B
E29C
E29F
E2A0
E2A0
E2A0
E2A3
E2A6
E2A9
E2AC
E2AE
E2B0
E2B2
E2B2
E2B5
E2B8
E2B8
E2BB
E2BD
E2C0
E2C1
E2C3
E2C5
E2C5
E2C8
E2CA
E2CD
E2CD
E2CE
E2CF
E2D2
E2D5
E2D7
E2DA
E2DB
E2DB
E2DB
E2DB
E2DD

20
20
20
4C
AD
F0
20
20
20
AD
F0
20
20
AE
9A
AC
AE
AD
48
AD
48
AD
48
AD
40

37
85
F0
86
0E
06
32
24
07
0F
06
6C
13
24

20
20
20
20
90
C9
D0

3E
DB
3E
5D
0A
20
13

E8
E7
E9
E2
A4
E2
EA
E9
A4
F4
EA
A4

23 A4
22 A4
26 A4
25 A4
20 A4
21 A4

;***** G COMMAND-RESTART PROCESSOR *****
GO
JSR PSL1
;"/"
JSR GCNT
;GET COUNT
JSR CRLF
JMP GOBK1
;RESUME EXECUTION
GOBK
LDA REGF
;DISPLAY REGISTERS ?
BEQ GOBK0
;NO,BRANCH
JSR REG1
;SHOW THE SIX REG
JSR CRCK
;
GOBK0 JSR RCHEK
;SEE IF HE WANTS TO INTERRUPT
LDA DISFLG
;DISASSEMBLE CURRENT INSTR ?
BEQ GOBK1
;NO,BRANCH
JSR DISASM
;DISASM THIS INSTRUCTION
JSR CRLOW
GOBK1 LDX SAVS
;RESTORE SAVED REGS FOR RTI
TXS
LDY SAVY
LDX SAVX
LDA SAVPC+1
PHA
;PUT PC ON STACK
LDA SAVPC
PHA
LDA SAVPS
;STATUS ALSO
PHA
LDA SAVA
RTI
;AND AWAY WE GO...

20 CD E2
A9 0D
4C E9 FE

;***** / COMMAND-ALTER MEMORY *****
CHNGG JSR BLANK
JSR WRITAZ
;WRITE ADDR
CHNG1 JSR BLANK
JSR RD2
;GET VALUE
BCC CH2
;ISN'T SKIP OR DONE
CMP #' '
BNE CH3
;NOT BLANK SO MUST BE DONE
;SKIP THIS LOCATION
JSR BLANK
JMP CH4
;IS ALTER
CH2
JSR SADDR
;STORE ENTERED VALUE INTO MEMORY
BEQ CH4
;NO ERROR IN STORE
JMP MEMERR
;MEMORY WRITE ERROR
CH4
INY
CPY #4
BNE CHNG1
;GO AGAIN
;HAVE DONE LINE OR HAVE 
CH3
JSR NXTADD
;UPDATE THE ADDRESS
LDA #CR
;CLEAR DISPL
JMP PATC10
;ONLY ONE  & BACK TO MONITOR

98
18
6D
8D
90
EE
60

NXTADD TYA
CLC
ADC
STA
BCC
INC
NXTA1 RTS

E8
E2
E8
EA

20 3E E8
4C C0 E2
20
F0
4C
C8
C0
D0

78 EB
03
33 EB
04
E1

1C A4
1C A4
03
1D A4

A0 00
B9 1D A4

;ADD Y TO ADDR+1,ADDR
ADDR
ADDR
NXTA1
ADDR+1

;WRITE CURRENT VALUE OF ADDR
;PART OF / & SPACE COMM
WRITAZ LDY #0
WRITAD LDA ADDR+1,Y

0604
0605
0606
0607
0608
0609
0610
0611
0612
0613
0614
0615
0616
0617
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636
0637
0638
0639
0640
0641
0642
0643
0644
0645
0646
0647
0648
0649
0650
0651
0652
0653
0654
0655
0656
0657
0658
0659
0660
0661
0662
0663
0664
0665

E2E0
E2E3
E2E6
E2E6
E2E6
E2E6
E2E9
E2E9
E2EC
E2EE
E2F0
E2F3
E2F6
E2F7
E2FA
E2FD
E300
E303
E304
E306
E306
E309
E30C
E30D
E30F
E30F
E312
E315
E317
E31A
E31D
E31F
E321
E323
E326
E327
E329
E32C
E32F
E32F
E32F
E32F
E331
E334
E337
E338
E33B
E33E
E340
E341
E341
E344
E346
E349
E34C
E34F
E350
E352
E354
E357
E359
E35C

BE 1C A4
4C 42 EA

20 48 E8
20
C9
D0
20
20
AA
20
8D
20
8D
8A
F0

93 E9
3B
F9
4D EB
4B E5
4B
1D
4B
1C

E5
A4
E5
A4

1B

20 FD E3
20 13 E4
CA
D0 F7
20
CD
D0
20
CD
D0
F0
A2
20
CA
D0
20
4C

FD
1F
6E
FD
1E
66
C8
05
FD

E3
A4
E3
A4

E3

FA
93 E9
20 E5

A9
8D
20
CA
8E
BD
D0
E8

00
15 01
53 ED

EE
A0
20
BD
20
E8
E0
D0
20
A0
20
CE

11
48
AF
16
7A

15 A4
16 01
EF
A4
E7
01
E9

06
F5
3E E8
61
AF E7
11 A4

LDX ADDR,Y
JMP WRAX
;***** L COMMAND-GENERAL LOAD *****
;LOAD OBJECT FROM TTY,USER,TYPE OR TAPE IN KIM-1 FORMAT
LOAD
JSR WHEREI
;WHERE INPUT
;GET ";" , # OF BYTES AND SA
LOAD1 JSR INALL
;GET FIRST CHAR
CMP #SEMICOLON ;LOOK FOR BEGINNING
BNE LOAD1
;IGNORE ALL CHARS BEFORE ";"
JSR CLRCK
;CLEAR CHECHSUM
JSR CHEKAR
;READ RECORD LENGTH
TAX
;SAVE IN X THE # BYTES
JSR CHEKAR
;READ UPPER HALF OF ADDRESS
STA ADDR+1
JSR CHEKAR
;READ LOWER HALF OF ADDRESS
STA ADDR
TXA
BEQ LOAD4
;LAST RECORD (RECORD LENGTH=0)
;GET DATA
LOAD2 JSR RBYTE
;READ NEXT BYTE OF DATA
JSR STBYTE
;STORE AT LOC (ADDR+1,ADDR)
DEX
;DECR RECORD LENGTH
BNE LOAD2
;COMPARE CKSUM
JSR RBYTE
;READ UPPER HALF OF CHCKSUM
CMP CKSUM+1
;COMPARE TO COMPUTED VALUE
BNE CKERR
;CKSUM ERROR
JSR RBYTE
;READ LOWER HALF OF CHECKSUM
CMP CKSUM
BNE CKERR
BEQ LOAD1
;UNTIL LAST RECORD
LOAD4 LDX #5
;READ 4 MORE ZEROS
LOAD5 JSR RBYTE
DEX
BNE LOAD5
JSR INALL
;READ LAST 
JMP DU13
;SET DEFAULT DEV & GO BACK
;LOAD ROUTINE FROM TAPE BY BLOCKS
;CHECK FOR RIGHT FILE & LOAD FIRST BLOCK
LOADTA LDA #$00
;CLEAR BLOCK COUNT
STA BLK
JSR TIBY1
;LOAD BUFFER WITH A BLOCK
DEX
;SET X=0
STX CURPO2
;CLEAR DISPLAY PTR
LDA TABUFF,X
;BLK COUNT SHOULD BE ZERO
BNE LOADTA
;NO, READ ANOTHER BLOCK
INX
;AFTER FIRST BLOCK OUTPUT FILE NAME
INC PRIFLG
;SO DO NOT GO TO PRINT.
LDY #TMSG0-M1
;PRINT "F="
JSR KEP
LOAD1A LDA TABUFF,X
;OUTPUT FILE NAME
JSR OUTPUT
;ONLY TO DISPLAY
INX
CPX #6
BNE LOAD1A
JSR BLANK
LDY #TMSG6-M1
;PRINT "BLK= "
JSR KEP
DEC PRIFLG
;RESTORE PRINTR FLG

0666
0667
0668
0669
0670
0671
0672
0673
0674
0675
0676
0677
0678
0679
0680
0681
0682
0683
0684
0685
0686
0687
0688
0689
0690
0691
0692
0693
0694
0695
0696
0697
0698
0699
0700
0701
0702
0703
0704
0705
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718
0719
0720
0721
0722
0723
0724
0725
0726
0727

E35F
E362
E364
E364
E367
E36A
E36C
E36D
E36F
E371
E374
E377
E379
E37C
E37E
E381
E384
E385
E385
E385
E388
E38B
E38E
E391
E394
E396
E399
E39B
E39D
E3A0
E3A1
E3A3
E3A4
E3A4
E3A4
E3A7
E3AA
E3AD
E3AF
E3B1
E3B3
E3B5
E3B7
E3BA
E3BD
E3BD
E3BD
E3C0
E3C3
E3C6
E3C9
E3CC
E3CF
E3D1
E3D3
E3D6
E3D8
E3DA
E3DD
E3DF
E3E0
E3E2

20 BD ED
A2 01
BD
DD
D0
E8
E0
D0
8E
EE
A9
8D
A0
20
CE
60

16 01
2D A4
C3

20
20
4C
20
20
A0
B9
C9
F0
20
C8
D0
60

8E
DB
A1
FE
24
52
00
3B
06
7A

20
20
20
C9
F0
C9
D0
F0
20
8D

4D
EA
29
2A
06
16
F2
F3
FD
21

EB
ED
EE

20
8D
20
8D
20
CD
D0
A2
20
C9
F0
20
B0
CA
D0
20

4B
1C
4B
1D
25
21
D3
02
29
2F
0E
84
A6

E5
A4
E5
A4
E4
A4

06
F3
36
11
00
15
66
96
11

A4
A4
A4
E3
A4

E3
E2
E1
E8
EA
E0
E9

F3

E3
A4

EE
EA

F1
13 E4

JSR ADDBK1
;JUST OUTPUT BLK CNT
LDX #1
;RESTORE X
;CHECK IF FILE IS CORRECT
LOADT2 LDA TABUFF,X
;NOW CHCK FILE NAME
CMP NAME-1,X
BNE LOADTA
;IF NO FILENAME GET
INX
;ANOTHER BLOCK
CPX #6
;FILENAME=5 CHRS
BNE LOADT2
STX TAPTR
;SAVE TAPE BUFF PTR
INC PRIFLG
;OUTPUT MSG ONLY TO DISPLAY
LDA #0
;CLEAR DISPLAY POINTER
STA CURPO2
LDY #TMSG7-M1
;PRINT "LOAD " WITHOUT CLR DISPL
JSR CKER1
DEC PRIFLG
RTS
;LINE CKSUM ERROR
CKERR JSR CKER0
JSR WRITAZ
JMP COMIN
CKER0 JSR LL
JSR CRCK
CKER00 LDY #TMSG3-M1
CKER1 LDA M1,Y
CMP #SEMICOLON
BEQ CKER2
JSR OUTPUT
INY
BNE CKER1
CKER2 RTS

;SUBR SO MNEM ENTRY CAN USE IT
;WRITE ADDR
;SET DEFAULT DEVICES
;
;PRINT "ERROR"
;DONT CLR DISPLAY TO THE RIGHT
;ONLY TO TERMINAL

;LOAD ROUTINE FROM TAPE WITH KIM-1 FORMAT
LOADKI JSR CLRCK
;CLEAR CKSUM
LOADK1 JSR TAISET
;SET TAPE FOR INPUT
LOADK2 JSR GETTAP
;READ CHARACTER FROM TAPE
CMP #'*'
;BEGINNING OF FILE?
BEQ LOADK3
;YES,BRNCH
CMP #$16
;IF NOT * SHOULD BE SYN
BNE LOADK1
BEQ LOADK2
LOADK3 JSR RBYTE
;READ ID FROM TAPE
STA SAVA
;SAVE ID
;NOW GET ADDR TO DISPLAY
;& COMPARE ID AFTERWARDS
JSR CHEKAR
;GET START ADDR LOW
STA ADDR
JSR CHEKAR
;GET START ADDR HIGH
STA ADDR+1
JSR GETID
;ID FROM HIM
CMP SAVA
;DO IDS MATCH?
BNE LOADKI
;NO ,GET ANOTHER FILE
LOADK5 LDX #$02
;GET 2 CHARS
LOADK6 JSR GETTAP
;1 CHAR FROM TAPE
CMP #'/'
;LAST CHAR ?
BEQ LOADK7
;YES,BRNCH
JSR PACK
;CONVERT TO HEX
BCS CKERR
;NOT HEX CHAR SO ERROR
DEX
BNE LOADK6
JSR STBYTE
;STORE & CHCK MEM FAIL

0728
0729
0730
0731
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741
0742
0743
0744
0745
0746
0747
0748
0749
0750
0751
0752
0753
0754
0755
0756
0757
0758
0759
0760
0761
0762
0763
0764
0765
0766
0767
0768
0769
0770
0771
0772
0773
0774
0775
0776
0777
0778
0779
0780
0781
0782
0783
0784
0785
0786
0787
0788
0789

E3E5
E3E8
E3EB
E3EE
E3F0
E3F3
E3F6
E3F8
E3F9
E3FA
E3FD
E3FD
E3FD
E3FD
E400
E402
E404
E407
E40A
E40D
E410
E413
E413
E413
E416
E418
E41B
E41D
E420
E422
E425
E425
E425
E427
E42A
E42B
E42D
E42F
E432
E435
E438
E43B
E43B
E43B
E43B
E43E
E43F
E441
E444
E447
E44A
E44C
E44F
E452
E455
E457
E45A
E45D
E45F
E462
E464
E467

4C
20
CD
D0
20
CD
D0
68
68
4C

20 E5

JMP
LOADK7 JSR
CMP
BNE
JSR
CMP
BNE
PLA
PLA
JMP

AD
C9
D0
4C
20
20
20
4C

12
54
03
93
93
84
93
84

A4

;GET 2 ASCII CHRS INTO 1 BYTE
;FOR TAPE (T) GET ONLY ONE HEX CHR
RBYTE LDA INFLG
;INPUT DEVICE
CMP #'T'
BNE RBYT1
JMP INALL
;ONLY ONE BYTE FOR T (INPUT DEV)
RBYT1 JSR INALL
JSR PACK
JSR INALL
JMP PACK

20
A0
20
F0
4C
A0
4C

4E
00
78
03
33
01
CD

E5

A2
BD
CA
C9
F0
BD
20
BD
4C

04
2E A4

AD
48
A9
8D
20
20
B0
20
20
20
B0
20
AD
D0
20
A9
8D
8D

D1
FD
1E
95
FD
1F
8D

20
F8
2E
84
2F
84

E3
E3
A4
E3
A4

E9
E9
EA
E9
EA

EB
EB
E2

A4
EA
A4
EA

10 A4
00
10
24
A3
FB
3E
10
A7
FB
13
10
0E
71
00
06
07

A4
EA
E7
E8
F9
E7
EA
A4
E8
01
01

LOADK5
RBYTE
CKSUM
CKERR
RBYTE
CKSUM+1
CKERR

;NEXT
;END OF DATA CMP CKSUM
;LOW

DU13

;TELL HIM & GO BACK TO COMMAN

;HIGH
;CORRECT RTN INSTEAD OF WHEREI

;STORE AND CHECK MEMORY FAIL
STBYTE JSR CHEKA
;ADD TO CKSUM
LDY #0
JSR SADDR
;STORE AND CHCK
BEQ *+5
JMP MEMERR
;MEMORY WRITE ERROR
LDY #1
;INC ADDR+1,ADDR BY 1
JMP NXTADD
;GET ID FROM LAST 2 CHR OF FILENAM
GETID LDX #4
;SEE WHAT HE GAVE US
GID1
LDA NAME,X
;GET LAST 2 CHARS
DEX
CMP #' '
; ?
BEQ GID1
LDA NAME,X
;CONVERT TO BINARY
JSR PACK
LDA NAME+1,X
JMP PACK
;ID IS IN STIY
;***** D COMMAND-GENERAL DUMP *****
;TO TTY,PRINTR,USER,X ,TAPE,TAKIM-1
DUMP
LDA BKFLG
;SAVE IT TO USE IT
PHA
LDA #00
STA BKFLG
DU1
JSR CRCK
;
DU0
JSR FROM
;GET START ADDR
BCS DU0
;IN CASE OF ERROR DO IT AGAIN
JSR BLANK
JSR ADDRS1
;TRANSFER ADDR TO S1
DU1B
JSR TO
;GET END ADDR
BCS DU1B
JSR CRLOW
LDA BKFLG
;EXECUTE WHEREO ONLY ONCE
BNE DU1A
JSR WHEREO
;WHICH DEV (OUTFLG)
LDA #0
STA S2
;CLEAR RECORD COUNT
STA S2+1

0790
0791
0792
0793
0794
0795
0796
0797
0798
0799
0800
0801
0802
0803
0804
0805
0806
0807
0808
0809
0810
0811
0812
0813
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827
0828
0829
0830
0831
0832
0833
0834
0835
0836
0837
0838
0839
0840
0841
0842
0843
0844
0845
0846
0847
0848
0849
0850
0851

E46A
E46D
E46D
E470
E472
E474
E475
E478
E47A
E47D
E480
E483
E483
E486
E489
E48A
E48D
E48E
E491
E494
E496
E496
E497
E499
E49B
E49D
E49F
E4A0
E4A2
E4A2
E4A3
E4A6
E4A7
E4AA
E4AD
E4B0
E4B3
E4B6
E4B9
E4B9
E4BC
E4BE
E4C1
E4C4
E4C7
E4C9
E4C9
E4CC
E4CF
E4D2
E4D5
E4D8
E4DB
E4DB
E4DD
E4E0
E4E2
E4E4
E4E7
E4E8
E4EB
E4EB

EE 10 A4
AD
C9
D0
68
4C
A0
20
20
20

13 A4
4B
04

20
AD
38
ED
48
AD
ED
D0

4D EB
1C A4

68
F0
C9
90
B0
68
A9
48
20
68
8D
20
AD
20
AD
20

87
01
CD
F0
07

E5
E2
E9
E9

1A A4
1D A4
1B A4
09
42
18
05
01
18
BA E9
19
38
1B
38
1A
38

A4
E5
A4
E5
A4
E5

20
A9
8D
20
CE
D0

31
00
15
5D
19
F0

E5

AD
20
AD
20
20
4C

1F
3B
1E
3B
66
7D

A4
E5
A4
E5
E5
E4

A0
20
C9
D0
4C
68
8D

1C
70 E9
59
03
44 E4

A4
E5
A4

10 A4

20 66 E5

INC BKFLG
;SET FLG
;CHCK OUTPUT DEV
DU1A
LDA OUTFLG
CMP #'K'
;TAPE FOR KIM?
BNE *+6
PLA
;PULL FLG
JMP DUMPKI
;YES, GO OUTPUT WHOLE FILE
LDY #1
;OUTPUT ONE MORE BYTE
JSR NXTADD
DU2
JSR CRLF
JSR RCHEK
;SEE IF HE WANTS TO INTERRUPT
;CALCULATE # OF BYTES YET TO BE DUMPED
JSR CLRCK
;CLEAR CKSUM
LDA ADDR
;END ADDRESS-CURRENT ADDRESS
SEC
SBC S1
PHA
;# OF BYTES LOW
LDA ADDR+1
SBC S1+1
BNE DU6
;# OF BYTES HIGH
;SEE IF 24 OR MORE BYTES TO GO
PLA
;# BYTES HIGH WAS ZERO
BEQ DU10
;ARE DONE
CMP #24
;# BYTES > 24 ?
BCC DU8
;NO ,ONLY OUTPUT REMAINING BYTES
BCS DU7
;YES ,24 BYTES IN NEXT RECORD
DU6
PLA
DU7
LDA #24
;OUTPUT ";" ,# OF BYTES AND SA
DU8
PHA
JSR SEMI
;SEMICOLON
PLA
STA COUNT
;SAVE # OF BYTES
JSR OUTCK
;OUTPUT # OF BYTES
LDA S1+1
;OUTPUT ADDRESS
JSR OUTCK
LDA S1
JSR OUTCK
;OUTPUT DATA
DU9
JSR OUTCKS
;GET CHAR SPEC BY S1 (NO PAG 0)
LDA #0
;CLEAR DISP PTR
STA CURPO2
JSR ADDS1
;INCR S1+1,S1
DEC COUNT
;DECREMENT BYTE COUNT
BNE DU9
;NOT DONE WITH THIS RECORD
;OUTPUT CKSUM
LDA CKSUM+1
JSR OUTCK1
;WITHOUT CHEKA
LDA CKSUM
JSR OUTCK1
JSR INCS2
;INC VERTICAL COUNT
JMP DU2
;NEXT RECORD
;ALL DONE
DU10
LDY #M5-M1
;PRINT "MORE ?#
JSR KEPR
;OUTPUT MSG AND GET AN ANSWER
CMP #'Y'
BNE *+5
JMP DU1
;DUMP MORE DATA
PLA
;RESTORE FLG
STA BKFLG
;OUTPUT LAST RECORD
JSR INCS2

0852
0853
0854
0855
0856
0857
0858
0859
0860
0861
0862
0863
0864
0865
0866
0867
0868
0869
0870
0871
0872
0873
0874
0875
0876
0877
0878
0879
0880
0881
0882
0883
0884
0885
0886
0887
0888
0889
0890
0891
0892
0893
0894
0895
0896
0897
0898
0899
0900
0901
0902
0903
0904
0905
0906
0907
0908
0909
0910
0911
0912
0913

E4EE
E4F1
E4F3
E4F5
E4F8
E4FB
E4FE
E501
E504
E505
E507
E50A
E50A
E50D
E50F
E511
E514
E516
E518
E51A
E51D
E520
E523
E524
E526
E529
E52B
E52E
E531
E531
E531
E533
E535
E538
E538
E538
E53B
E53C
E53F
E541
E543
E544
E547
E548
E54B
E54B
E54E
E54F
E550
E553
E556
E558
E55B
E55C
E55D
E55D
E55D
E560
E562
E565
E566
E566

20
A2
A9
20
AD
20
AD
20
CA
D0
20

BA
02
00
3B
07
3B
06
3B

AD
C9
D0
AD
C9
F0
A9
20
4C
20
18
A9
8D
A9
8D
4C

13
54
0F
37
01
08
00
8B
11
13

E9
E5
01
E5
01
E5

F1
F0 E9
A4
A4

F1
E5
EA

00
0B A8
34
00 A8
FE E8

JSR SEMI
;OUTPUT ';'
LDX #2
LDA #0
;OUTPUT # OF BYTES (0-LAST RECORD)
JSR OUTCK1
DU10A LDA S2+1
;OUTPUT RECORD COUNT
JSR OUTCK1
;CHECKCUM IS THE SAME
LDA S2
JSR OUTCK1
DEX
BNE DU10A
JSR CRLF
;CLOSE TAPE BLOCK IF ACTIVE
DU11
LDA OUTFLG
CMP #'T'
BNE DU13
;NO ,BRANCH
DU12
LDA TAPTR2
;TAP OUTPUT BUFF PTR
CMP #1
;BECAUSE FIRST ONE IS BLK CNT
BEQ DU13
;NO DATA TO WRITE
LDA #0
;FILL REST BUFF ZEROS
JSR TOBYTE
;OUTPUT TO BUFF
JMP DU12
;FINISH THIS BLOCK
DU13
JSR CRLOW
CLC
;ENABLE INTERR
LDA #T1I
;T1 FROM FREE RUNNING TO 1 SHOT
STA ACR
DU14
LDA #$34
;SET BOTH TAPES ON
STA DRB
JMP LL

A9 1A
A0 00
20 58 EB

;GET CHAR SPECIFIED BY START ADDR (S1)
OUTCKS LDA #S1
LDY #0
JSR LDAY

20
48
AD
C9
D0
68
4C
68
4C

4E E5

;ADD TO CHECKSUM AND PRINT
OUTCK JSR CHEKA
;CHCKSUM
OUTCK1 PHA
LDA OUTFLG
;IF TAPE DO NOT CNVRT
CMP #'T'
;TO TWO ASCII CHRS
BNE OUTCK2
PLA
JMP TOBYTE
;OUTPUT TO TAP BUFF
OUTCK2 PLA
JMP NUMA
;TWO ASCII REPRE

20
48
18
6D
8D
90
EE
68
60

FD E3

13 A4
54
04
8B F1
46 EA

1E A4
1E A4
03
1F A4

CHEKAR JSR
CHEKA PHA
CLC
ADC
STA
BCC
INC
PLA
RTS

RBYTE

;TWO ASCII CHR---> 1 BYTE
;ADD TO CHECKSUM

CKSUM
CKSUM
*+5
CKSUM+1

EE 1A A4
D0 03
EE 1B A4
60

;ADD ONE TO START ADDR (S1)
ADDS1 INC S1
BNE ADD1
INC S1+1
ADD1
RTS

EE 06 01

INCS2

INC S2

;INCR VERTICAL COUNT

0914
0915
0916
0917
0918
0919
0920
0921
0922
0923
0924
0925
0926
0927
0928
0929
0930
0931
0932
0933
0934
0935
0936
0937
0938
0939
0940
0941
0942
0943
0944
0945
0946
0947
0948
0949
0950
0951
0952
0953
0954
0955
0956
0957
0958
0959
0960
0961
0962
0963
0964
0965
0966
0967
0968
0969
0970
0971
0972
0973
0974
0975

E569
E56B
E56E
E56F
E56F
E56F
E56F
E571
E572
E575
E578
E57B
E57E
E581
E582
E584
E586
E587
E587
E587
E58A
E58C
E58F
E58F
E592
E595
E598
E598
E59B
E59E
E5A1
E5A4
E5A4
E5A7
E5AA
E5AD
E5B0
E5B3
E5B6
E5B8
E5B8
E5BA
E5BD
E5BD
E5C0
E5C3
E5C6
E5C9
E5C9
E5CB
E5CE
E5D1
E5D1
E5D4
E5D4
E5D4
E5D7
E5DA
E5DD
E5E0
E5E3
E5E6

D0 03
EE 07 01
60

A2
8A
8E
8E
20
BD
20
E8
E0
D0
60

00
68
37
8B
2E
8B

01
A4
F1
A4
F1

05
F5

BNE *+5
INC S2+1
RTS
;OPEN A FILE FOR OUTPUT TO TAPE BY BLOCKS
;OUTPUT FILENAME GIVEN BY JSR WHEREO TO TAPE BUFF
DUMPTA LDX #0
;INITIALIZE TAPTR
TXA
;TO OUTPUT
STX BLKO
;BLOCK COUNTER
STX TAPTR2
;TAP OUTPUT BUFF PTR
JSR TOBYTE
;TWO START OF FILE CHRS
DUMPT1 LDA NAME,X
;OUTPUT FILENAME
JSR TOBYTE
INX
CPX #5
BNE DUMPT1
;5 FILENAME CHRS ?
RTS

4C 20 E5

;DUMP ROUTINE TO TAPE WITH KIM-1 FORMAT
DUMPKI JSR TAOSET
;SET TAPE FOR OUTPUT
LDA #'*'
;TO EITHER 1 OR 2
JSR OUTTAP
;DIRECTLY TO TAPE
;ID FROM LAST 2 CHRS OF FILENAME
JSR GETID
JSR OUTCK1
JSR CLRCK
;STARTING ADDR
LDA S1
JSR OUTCK
;WITH CHCKSUM
LDA S1+1
JSR OUTCK
;OUTPUT DATA
DUK2
JSR OUTCKS
;OUTPUT CHR SPECIFIED BY S1+1,S1
JSR ADDS1
;INCREM S1+1,S1
LDA S1
;CHCK FOR LAST BYTE
CMP ADDR
;LSB OF END ADDR
LDA S1+1
SBC ADDR+1
BCC DUK2
;NEXT CHR
;NOW SEND END CHR "/"
LDA #'/'
JSR OUTTAP
;DIRECTLY TO TAPE
;CHECKSUM
LDA CKSUM
JSR NUMA
;ASCII REPRES
LDA CKSUM+1
JSR NUMA
;TWO EOT CHRS
LDA #$04
JSR OUTTAP
JSR OUTTAP
;TURN TAPES ON
JMP DU13

20
20
4C
AD
8D
AD
8D

;***** * COMMAND-ALTER
CGPC
JSR ADDIN
CGPC0 JSR CGPC1
JMP CRLOW
CGPC1 LDA ADDR+1
STA SAVPC+1
LDA ADDR
STA SAVPC

20 1D F2
A9 2A
20 4A F2
20 25 E4
20 3B E5
20 4D EB
AD
20
AD
20

1A
38
1B
38

A4
E5
A4
E5

20
20
AD
CD
AD
ED
90

31
5D
1A
1C
1B
1D
EC

E5
E5
A4
A4
A4
A4

A9 2F
20 4A F2
AD
20
AD
20

1E
46
1F
46

A4
EA
A4
EA

A9 04
20 4A F2
20 4A F2

AE
DD
13
1D
26
1C
25

EA
E5
EA
A4
A4
A4
A4

PROGRAM COUNTER *****
;ADDR <=ADDRESS ENTERED FROM KB
;TRANSFER ADDR TO SAVPC
;THIS WAY MNEMONICS CAN USE IT

0976
0977
0978
0979
0980
0981
0982
0983
0984
0985
0986
0987
0988
0989
0990
0991
0992
0993
0994
0995
0996
0997
0998
0999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037

E5E9
E5EA
E5EA
E5EA
E5EC
E5EE
E5EE
E5EE
E5F0
E5F2
E5F2
E5F2
E5F4
E5F6
E5F6
E5F6
E5F8
E5FA
E5FA
E5FA
E5FC
E5FF
E602
E604
E607
E608
E60B
E60D
E60D
E60D
E610
E612
E615
E618
E61B
E61B
E61B
E61D
E620
E623
E626
E627
E629
E62B
E62D
E62F
E632
E634
E635
E636
E639
E63A
E63C
E63F
E640
E643
E646
E649
E64C
E64D
E64D
E64D

60

RTS

A2 00
F0 0E

;***** P COMMAND-ALTER PROCESSOR STATUS *****
CGPS
LDX #0
BEQ CGALL

A2 01
D0 0A

;***** A COMMAND-ALTER ACCUMULATOR *****
CGA
LDX #1
BNE CGALL

A2 02
D0 06

;***** X COMMAND-ALTER X REGISTER *****
CGX
LDX #2
BNE CGALL

A2 03
D0 02

;***** Y COMMAND-ALTER Y REGISTER *****
CGY
LDX #3
BNE CGALL

A2
20
20
B0
9D
60
20
D0

04
D8 E7
5D EA
04
20 A4
D4 E7
EF

;***** S COMMAND-ALTER STACK POINTER *****
CGS
LDX #4
CGALL JSR EQUAL
;PRINT PROMPT
JSR RD2
;GET VALUE FROM KEYBOARD
BCS GOERR
STA SAVPS,X
RTS
GOERR JSR QM
BNE CGALL

20
A0
20
20
4C

3E
04
CD
DB
4D

;*****  COMMAND-SHOW NEXT 5 MEMORY LOC *****
NXT5
JSR BLANK
LDY #4
;UPDATE ADDR FROM
JSR NXTADD
;=XXXX
JSR WRITAZ
;OUTPUT ADDRESS
JMP MEIN
;DISPLAY CONTENTS OF NEXT 4 LOCS

A0
20
20
20
38
E9
30
C9
30
20
D0
0A
48
20
68
B0
20
AA
AD
9D
AD
9D
60

27
AF E7
37 E8
73 E9

E8
E2
E2
E2

30
04
04
05
D4 E7
EC
AE EA
10
3D FF
1C
00
1D
01

A0 00

A4
01
A4
01

;***** B COMMAND-SET BREAKPOINT ADDR *****
BRKA
LDY #M8-M1
;PRINT "BRK"
JSR KEP
BRK1
JSR PSL1
;PRINT "/"
JSR REDOUT
;GET BREAK NUMBER
SEC
SBC #'0'
;0 THRU 3
BMI BKERR
;CHARACTER < '0' -ILLEGAL
CMP #4
;FOUR BRK POINTS
BMI BKOK
;0 < CHARACTER < 4 -OK
BKERR JSR QM
;ERROR
BNE BRK1
;ALLOW REENTRY OF BREAK NUMBER
BKOK
ASL A
;*2 TO FORM WORD OFFSET
PHA
;SAVE IT
JSR ADDIN
;GET ADDRESS FOR BREAKPOINT
PLA
BCS BKO2
;BAD ADDRESS ENTERED
JSR PATC18
; & CLR BUFFERS
TAX
;# OF BRK
LDA ADDR
;STORE ENTERED ADDR IN BRKPT LIST
STA BKS,X
LDA ADDR+1
STA BKS+1,X
BKO2
RTS
;ALL DONE
;***** ? COMMAND-SHOW CURRENT BREAKPOINTS *****
SHOW
LDY #0

1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099

E64F
E652
E655
E658
E65B
E65E
E65F
E660
E662
E664
E665
E665
E665
E665
E667
E66A
E66D
E670
E673
E676
E679
E67C
E67F
E682
E685
E687
E688
E688
E688
E689
E68A
E68C
E68E
E690
E693
E694
E694
E694
E694
E697
E69A
E69C
E69E
E6A1
E6A3
E6A5
E6A8
E6AB
E6AC
E6AF
E6B1
E6B3
E6B6
E6B8
E6BA
E6BD
E6BD
E6BD
E6C0
E6C2
E6C5
E6C7

20
20
BE
B9
20
C8
C8
C0
D0
60

A2
8E
AC
20
20
B9
20
B9
20
20
CE
D0
60
C8
C8
C0
D0
A0
8C
60

13
3E
00
01
42

EA
E8
01
01
EA

08
EE

05
29
14
13
3E
2E
46
2F
46
88
29
E3

A4
A4
EA
E8
A4
EA
A4
EA
E6
A4

0A
02
00
14 A4

SH1

JSR
JSR
LDX
LDA
JSR
INY
INY
CPY
BNE
RTS

CRLOW
BLANK
BKS,Y
BKS+1,Y
WRAX

;ADDRESS OF NEXT BREAKPOINT
;SHOW BREAKPOINT ADDRESS

#8
SH1

;***** H COMMAND-SHOW TRACE STACK HISTORY *****
;LAST FIVE INSTR ADDRS
SHIS
LDX #5
;NUMBER OF ENTRIES
STX STIY+2
SH11
LDY HISTP
;POINTER TO LATEST ENTRY
JSR CRLOW
JSR BLANK
LDA HIST,Y
;OUTPUT ADDRESS OF ENTRY
JSR NUMA
LDA HIST+1,Y
JSR NUMA
JSR NHIS
;UPDATE POINTER
DEC STIY+2
BNE SH11
RTS
;UPDATE HISTORY POINTER (PART OF H)
NHIS
INY
INY
CPY #10
BNE NH1
LDY #0
;WRAPAROUND AT 10
NH1
STY HISTP
RTS

20
20
C9
D0
20
C9
D0
20
4C
EA
20
C9
D0
20
C9
D0
4C

48
93
0D
0E
93
3B
F9
93
60

93 E9
0D
F9
93 E9
0D
F2
20 E5

;***** 3 COMMAND-VERIFY TAPES *****
;VERIFY CKSUM OF BLOCKS
VECKSM JSR WHEREI
;GET THE FILE
JSR INALL
;CHCK OBJ OR SOURCE
CMP #CR
;FIRST CHR IS  IF OBJ
BNE VECK2
;ASSUME SOURCE CODE
VECK1 JSR INALL
;OBJECT FILE
CMP #SEMICOLON
BNE VECK1
;IGNORE ALL CHARS BEFORE ';'
JSR INALL
JMP PAT20
NOP
VECK2 JSR INALL
;IT IS TEXT
CMP #CR
BNE VECK2
JSR INALL
;NEED TO  TO FINISH
CMP #CR
BNE VECK2
JMP DU13
;CLOSE FILE, IT IS OKAY

AD
49
8D
29
F0

00 A8
10
00 A8
10
28

;***** 1 COMMAND-TOGGLE TAPE 1 CONTROL *****
TOGTA1 LDA DRB
EOR #$10
;INVERT PB4
STA DRB
AND #$10
BEQ BRK3
;IF 0 TAPE CNTRL IS ON

E8
E9
E9
E9
FF

1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161

E6C9
E6CB
E6CB
E6CB
E6CE
E6D0
E6D3
E6D5
E6D7
E6D9
E6D9
E6D9
E6D9
E6DB
E6DD
E6DD
E6DD
E6DD
E6DF
E6E1
E6E1
E6E1
E6E3
E6E5
E6E5
E6E5
E6E7
E6E7
E6EA
E6EC
E6EE
E6F1
E6F3
E6F6
E6F7
E6FA
E6FC
E6FE
E6FE
E6FE
E700
E702
E705
E706
E708
E70A
E70A
E70A
E70C
E70F
E712
E714
E717
E71A
E71D
E720
E723
E726
E729
E72B
E72E
E731

D0 2F
AD
49
8D
29
F0
D0

BNE BRK4

00 A8
20
00 A8
20
1A
21

;IF $10 TAPE CNTRL IS OFF

;***** 2 COMMAND-TOGGLE TAPE 2 CONTROL *****
TOGTA2 LDA DRB
EOR #$20
;INVERT PB5
STA DRB
AND #$20
BEQ BRK3
BNE BRK4

A2 0E
D0 0A

;***** V COMMAND-TOGGLE REGISTER DISP FLG *****
;DISPLAY REGIST BEFORE EXEC
REGT
LDX #REGF
BNE TOGL

A2 0F
D0 06

;****** Z COMMAND-TOGGLE DIS TRACE FLG *****
;DISPL NEXT INSTR BEFORE EXEC
TRACE LDX #DISFLG
BNE TOGL

A2 11
D0 02

;***** \ COMMAND-TOGGLE PRINTER FLAG *****
PRITR LDX #PRIFLG
BNE TOGL

A2 10

;***** 4 COMMAND-TOGGLE SOFT BRK ENABL FLG *****
BRKK
LDX #BKFLG

BD
F0
A9
9D
A0
4C
38
7E
A0
D0

00 A4
0A
00
00 A4
24
AF E7

A9
A2
9D
CA
10
30

00
07
00 01

A9
20
20
B0
20
20
20
20
4C
20
20
F0
20
AD
38

2A
7A
AE
F6
D7
37
85
24
2B
07
90
17
6C
25

00 A4
21
F5

FA
E7

E9
EA
E5
E8
E7
EA
E7
E9
E7
F4
A4

TOGL

BRK3
BRK2
TOGL1
BRK4

LDA
BEQ
LDA
STA
LDY
JMP
SEC
ROR
LDY
BNE

MONRAM,X
TOGL1
#0
MONRAM,X
#M7-M1
KEP
MONRAM,X
#M6-M1
BRK2

;LOAD FLAG
;FLAG IS OFF ,SO TURN ON
;FLAG IS ON ,SO TURN OFF
;PRINT "OFF"
;TURN FLAG ON BY SETTING NON-ZERO
;FLAG IS ON MSB
;PRINT "ON"

;***** # COMMAND-CLEAR ALL BREAKS *****
CLRBK LDA #0
;STORE ZEROS INTO BRKPT LIST
LDX #7
RS20
STA BKS,X
DEX
BPL RS20
BMI BRK3
;PRINT "OFF"
;***** K COMMAND-DISASSEMBLE MEMORY *****
KDISA LDA #'*'
;GET START ADDRESS
JSR OUTPUT
JSR ADDIN
BCS KDISA
;IF ERROR DO IT AGAIN
JSR CGPC0
;GET IT INTO PROG CNTR
JSR PSL1
;PRINT "/"
JSR GCNT
;GET COUNT
JSR CRCK
JMP JD2
JD1
JSR RCHEK
;SEE IF HE WANTS TO INTERRUPT
JSR DONE
BEQ JD4
JD2
JSR DISASM
;GO TO DISASSEMBLER
LDA SAVPC
;POINT TO NEXT INSTRUC LOCAT
SEC
;ONE MORE TO PROG CNTR

1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1171
1172
1173
1174
1175
1176
1177
1178
1178
1179
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220

E732
E734
E737
E739
E73C
E73F
E742
E743
E743
E743
E749
E74B
E74F
E752
E752
E756
E756
E75C
E762
E764
E76A
E76B
E76B
E76D
E770
E771
E774
E776
E779
E77C
E77E
E77F
E780
E781
E783
E784
E785
E785
E785
E788
E78A
E78C
E78F
E790
E790
E790
E790
E793
E795
E797
E798
E799
E79B
E79C
E79F
E7A0
E7A2
E7A3
E7A3
E7A5
E7A7
E7A7

65
8D
90
EE
20
4C
60

EA
25
03
26
24
23

A4
A4
EA
E7

JD3
JD4

ADC
STA
BCC
INC
JSR
JMP
RTS

LENGTH
SAVPC
JD3
SAVPC+1
CRCK
JD1

;

;INITIALIZATION TABLE FOR 6522
340037FF25FFINTAB1 .DB $34,$00,$37,$FF,$25,$FF,$25,$FF
25FF
FF FF 00 00
.DB $FF,$FF,$00,T1I+T2I
E1 FF 7F
.DB MOFF+PRST+SP12,$FF,$7F
;INITIALIZATION TABLE FOR 6532
FF FF 00 00 INTAB2 .DB $FF,$FF,$00,$00
;INITIALIZATION TABLE FOR MONITOR RAM
7BE054E105EFINTAB3 .DW NMIV3,IRQV3,OUTDIS
C70802CA0380
.DB $C7,$08,$02,$CA,$03,$80,$00,$00
0000
00800D0D0000
.DB $00,$80,$0D,$0D,$00,$00,$00
00
;SEE IF WE HIT A SOFT BREAKPOINT (PART OF NMV3)
A2 07
CKB
LDX #7
;COMPARE BRKPT LIST TO TRAP ADDR
BD 00 01
CKB2
LDA BKS,X
;GET ADDRESS OF NEXT BREAKPOINT
CA
DEX
CD 26 A4
CMP SAVPC+1
;COMPARE TO SAVED PROGRAM COUNTER
D0 0A
BNE CKB1
BD 00 01
LDA BKS,X
CD 25 A4
CMP SAVPC
D0 02
BNE CKB1
;NO MATCH SO TRY NEXT BREAKPOINT
38
SEC
;MATCH-SET MATCH FLAG
60
RTS
CA
CKB1
DEX
10 EA
BPL CKB2
;MORE TO GO
18
CLC
;NO MATCH -RESET MATCH FLAG
60
RTS
20
90
49
8D
60

AD
C9
F0
F8
38
E9
D8
8D
60
A9
60

5D EA
02
0C
19 A4

19 A4
2C
09
01
19 A4
2C

;GET # OF LINES COUNT FOR GO-COMMAND,LIST-COMM
GCNT
JSR RD2
BCC GCN1
EOR #$0C
;---> $2C ,---> $01
GCN1
STA COUNT
RTS
;CHECK IF COUNT HAS REACHED ZERO
;COUNT=$2C MEANS FOREVER
DONE
LDA COUNT
;IF COUNT=0 WE ARE DONE
CMP #$2C
;THIS MEANS FOR EVER
BEQ DON1
;SET ACC DIFF FROM ZERO
SED
;DECREMENT COUNT IN DECIMAL
SEC
SBC #1
CLD
STA COUNT
RTS
DON1
LDA #$2C
RTS

A0 00
F0 02

FROM

LDY #0
BEQ TO1

;PRINT "FR="

A0 05

TO

LDY #M3-M1

;PRINT "TO="

1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282

E7A9
E7AC
E7AF
E7AF
E7AF
E7B2
E7B3
E7B5
E7B8
E7B9
E7BA
E7BC
E7BD
E7BD
E7BD
E7BD
E7C0
E7C2
E7C5
E7C8
E7CA
E7CC
E7CF
E7D1
E7D4
E7D4
E7D6
E7D8
E7D8
E7DA
E7DC
E7DC
E7DC
E7DC
E7DF
E7E1
E7E4
E7E7
E7EA
E7EC
E7EE
E7F0
E7F3
E7F6
E7F9
E7FA
E7FB
E7FE
E7FF
E802
E805
E807
E809
E80B
E80D
E80F
E811
E814
E816
E817
E819
E81C

20 AF E7
4C B1 EA
B9
48
29
20
C8
68
10
60

AD
C9
4C
20
D0
A9
4C
A9
4C

00 E0
7F
7A E9
F3

12
54
EF
42
05
2A
7A
0D
05

A4
FE
E8
E9
EF

TO1

JSR KEP
JMP ADDNE

;GET ADDRESS

;PRINT MSG POINTED TO BY Y REG
KEP
LDA M1,Y
PHA
AND #$7F
;STRIP OFF MSB
JSR OUTPUT
INY
PLA
BPL KEP
;MSB =1 ?
RTS
;PRINT "*" ,BUT NOT TO TAPE RECORDER, NOR LOADING....
;PAPER TAPE OR TO DISPLAY
PROMPT LDA INFLG
;WHICH DEV (FOR EDITOR)
CMP #'T'
;NO PROMPT IF "T" OR "L"
JMP PATC11
PROMP1 JSR TTYTST
;PROMPT ONLY TO TTY
BNE PR2
;BRANCH ON KB
LDA #'*'
PR1
JMP OUTPUT
;ONLY TO TERMIN
PR2
LDA #CR
;CLR DISP
JMP OUTDIS

A9 3F
D0 F4

QM

LDA #'?'
BNE PR1

;PRINT "?"

A9 3D
D0 F0

EQUAL

LDA #'='
BNE PR1

;PRINT "="

20
F0
20
CE
AE
E0
B0
A9
20
CE
4C
EA
EA
20
CA
20
AD
C9
90
C9
90
A0
E9
4C
A0
38
E9
4C
A0

42
56
9E
15
15
14
0D
20
02
15
02

E8
EB
A4
A4

EF
A4
E8

F8 FE
2F EF
15 A4
15
13
29
07
28
28
1E E8
14
14
1E E8
00

;ON DELETE KEY OUTPUT SLASH IF TTY & ....
;BACK UP CURSOR IF KB (MAY NEED SCROLLING)
PSLS
JSR TTYTST
;TTY OR KB ?
BEQ PSL1
;BRANCH ON TTY
JSR PHXY
;SAVE X,Y
DEC CURPO2
;DECR DISP PNTR
LDX CURPO2
CPX #20
;IF MORE THAN 20 JUST SCROLL THEM
BCS PSL0
LDA #' '
;< 20 ,SO CLR CUR
JSR OUTDP1
DEC CURPO2
JMP PSL00
NOP
NOP
PSL0
JSR PATC12
;CLR PRIFLG
DEX
;ONE CHR LESS
JSR OUTD2A
;SCROLL THEM
PSL00 LDA CURPO2
;DISBUF---> PRIBUFF
CMP #21
BCC PSL0B
CMP #41
BCC PSL0A
LDY #40
;CHR 40-59
SBC #40
JMP PSL0C
PSL0A LDY #20
;CHR 20-39
SEC
SBC #20
JMP PSL0C
PSL0B LDY #0
;CHR 00-19

1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344

E81E
E821
E823
E826
E829
E82A
E82B
E82E
E830
E833
E836
E837
E839
E83B
E83B
E83E
E840
E842
E842
E842
E844
E847
E848
E848
E848
E848
E84A
E84D
E850
E852
E854
E856
E859
E85C
E85E
E860
E862
E865
E868
E86A
E86C
E86D
E870
E871
E871
E871
E871
E873
E876
E879
E879
E87B
E87D
E87F
E882
E885
E887
E889
E88B
E88E
E88E
E890

8D
A2
B9
9D
E8
C8
EC
90
20
20
60
A9
D0

16 A4
00
38 A4
60 A4

PSL0C
PSL0D

16 A4
F3
38 F0
AC EB
2F
91

PSL1

STA
LDX
LDA
STA
INX
INY
CPX
BCC
JSR
JSR
RTS
LDA
BNE

CURPOS
#0
DIBUFF,Y
IBUFM,X

;TRANSFER THEM

CURPOS
PSL0D
OUTPR
PLXY

;PRI PNTR

#'/'
PR1

;PRINT "/"

;CLR PRI BUFF TO THE RIGHT
;RESTORE X,Y

20 3E E8
A9 20
D0 8A

BLANK2 JSR BLANK
BLANK LDA #' '
BNE PR1

A9 08
2C 00 A8
60

;CHECK TTY/KBD SWITCH (Z=1 FOR TTY)
TTYTST LDA #$08
;CHECK IF TTY OR KB
BIT DRB
;TTY OR KB SWICTH =PB3
RTS

A0
20
8D
C9
D0
A2
20
4C
C9
D0
A2
20
4C
C9
D0
18
6C
60

;WHERE IS INPUT COMING FROM?
;SET UP FOR INPUT ACTIVE DEVICE
WHEREI LDY #M9-M1
;PRINT "IN"
JSR KEPR
;OUTPUT MSG AND INPUT CHR
STA INFLG
CMP #'T'
BNE WHE1
LDX #0
;FOR INPUT FILE FLG
JSR FNAM
;OPEN FILE FOR TAPE (1 OR 2)
JMP LOADTA
;GET FILE
WHE1
CMP #'K'
;TAPE WITH KIM FORMAT
BNE WHE2
LDX #0
;FOR INPUT FILE FLG
JSR FNAM
;OPEN FILE FOR TAP (1 OR 2)
JMP LOADKI
;THE WHOLE FILE
WHE2
CMP #'U'
;USER RTN?
BNE WHE3
CLC
;SET FLG FOR INITIALIZATION
JMP (UIN)
;USER INPUT SETUP
WHE3
RTS

2A
70
12
54
08
00
A2
2F
4B
08
00
A2
A4
55
04

E9
A4

E8
E3

E8
E3

08 01

A0 2D
20 70 E9
8D 13 A4
C9
D0
A2
20
4C
C9
D0
A2
4C

54
08
01
A2 E8
6F E5
4B
05
01
A2 E8

C9 50
D0 05

;TWO SPACES

;WHERE IS OUTPUT GOING TO?
;SET UP FOR OUTPUT ACTIVE DEVICE
WHEREO LDY #M10-M1
;PRINT "OUT"
JSR KEPR
;OUTPUT MSG & INPUT CHR
STA OUTFLG
;DEVICE FLG
;TAPES
CMP #'T'
BNE WHRO1
LDX #1
;FOR OUTPUT FILE FLG
JSR FNAM
;FILENAME & TAPE (1 OR 2)
JMP DUMPTA
;INITIALIZE FILE
WHRO1 CMP #'K'
;TAPE WITH KIM FORMAT
BNE WHRO2
LDX #1
;FOR OUTPUT FILE FLG
JMP FNAM
;PRINTER
WHRO2 CMP #'P'
;PRINTER?
BNE WHRO3

1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406

E892
E894
E897
E897
E899
E89B
E89C
E89F
E89F
E8A2
E8A2
E8A2
E8A5
E8A8
E8AA
E8AD
E8AF
E8B1
E8B3
E8B4
E8B6
E8B8
E8BA
E8BC
E8BF
E8C2
E8C5
E8C8
E8CB
E8CE
E8CF
E8CF
E8CF
E8D1
E8D4
E8D6
E8D9
E8DB
E8DD
E8DF
E8E1
E8E4
E8E5
E8E7
E8E9
E8E9
E8EB
E8ED
E8EF
E8F2
E8F3
E8F5
E8F8
E8F8
E8F8
E8FA
E8FD
E8FE
E8FE
E8FE
E901
E901

A9 0D
4C 00 F0

4C 13 EA

LDA #CR
JMP OUTPRI
;USER SET UP
WHRO3 CMP #'U'
BNE WHRO4
CLC
JMP (UOUT)
;ANY OTHER
WHRO4 JMP CRLOW

20
20
A0
20
C9
D0
A9
38
E9
30
C9
30
20
4C
20
9D
20
20
60

9E EB
CF E8
50
70 E9
0D
02
31

;GET FILE NAME & TAPE UNIT
FNAM
JSR PHXY
;SAVE IN/OUT FLG (X)
JSR NAMO
;GET NAME
WHICHT LDY #TMSG2-M1
;PRINT "T="
JSR KEPR
;OUTPUT MSG & INPUT CHR
CMP #CR
BNE TAP1
LDA #'1'
; ==> TAPE 1
TAP1
SEC
SBC #'1'
;SUBTRACT 31
BMI TAP2
;ONLY 1,2 OK
CMP #2
BMI TAP3
;OK
TAP2
JSR QM
;ERROR
JMP WHICHT
TAP3
JSR PLXY
;IN/OUT FLG
STA TAPIN,X
;IF X=0 --> TAPIN (TAPE 1 OR 2)
JSR CUREAD
;GET ANYTHING
JSR CRCK
;
RTS
;IF X=1 --> TAPOUT (TAPE 1 OR 2)

A0
20
A0
20
C9
F0
C9
F0
99
C8
C0
D0

4D
AF E7
00
5F E9
0D
0C
20
08
2E A4

A9
C0
F0
99
C8
D0
4C

20
05
06
2E A4

C9 55
D0 04
18
6C 0A 01

31
04
02
06
D4
A8
AC
34
83
24

E7
E8
EB
A4
FE
EA

05
ED

F6
3E E8

;GET FILE NAME
NAMO
LDY #TMSG1-M1
JSR KEP
LDY #0
NAMO1 JSR RDRUP
CMP #CR
BEQ NAMO2
CMP #' '
BEQ NAMO2
STA NAME,Y
INY
CPY #5
BNE NAMO1
;BLANK REST OF NAME
NAMO2 LDA #' '
NAMO3 CPY #5
BEQ NAMO4
STA NAME,Y
INY
BNE NAMO3
NAMO4 JMP BLANK

;OUTPUT LAST LINE IF ON
;& CLEAR PRINTER PTR
;USR RTN?
;CLR FLG FOR INITIALIZATION
;USER OUTPUT SETUP

;PRINT "F="
;NO CRLF
;GET CHAR
;DONE?

;STORE

A9 0D
8D 12 A4
60

;SET INPUT FROM TERMINAL (KB OR TTY)
INLOW LDA #CR
STA INFLG
RTS

20 F8 E8

;SET I/O TO TERMINAL (KB & D/P ,OR TTY)
LL
JSR INLOW
;SET OUTPUT TO TERMINAL (D/P OR TTY)

1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468

E901
E903
E906
E907
E907
E907
E907
E90A
E90C
E90F
E910
E912
E914
E917
E919
E91B
E91D
E91F
E922
E923
E925
E926
E928
E92B
E92D
E930
E933
E935
E937
E939
E93B
E93C
E93C
E93C
E93F
E942
E944
E947
E94A
E94D
E950
E952
E954
E956
E959
E95C
E95C
E95C
E95F
E962
E964
E966
E968
E96A
E96A
E96B
E96D
E96E
E970
E970
E970
E973

A9 0D
8D 13 A4
60

OUTLOW LDA #CR
STA OUTFLG
OUTL1 RTS

20
F0
20
88
30
A2
20
C9
F0
C9
D0
20
88
30
60
70
2C
50
20
20
C9
F0
C9
D0
60

42 E8
1A
EF EC

;ON  STOPS EXECUTION & BACK TO MONITOR
;ON  STOPS EXECUTION & CONTINUE ON ANY OTHER KEY
RCHEK JSR TTYTST
;TTY OR KB ?
BEQ RCHTTY
JSR ROONEK
;CLR MSK & GET A KEY
DEY
BMI RCH3
;RTN ON NO KEY
LDX #0
JSR GETK2
;GET THE KEY
CMP #ESCAPE
BEQ REA1
;TO COMMAN & SET I/O TO TERMINAL
CMP #' '
;WAIT KEY
BNE RCH3
;RTN, IGNORE OTHER KEYS
RCH2
JSR ROONEK
;WAIT TILL HE RELEASE IT &
DEY
;QUIT WAITING ON NEXT KEY
BMI RCH2
RCH3
RTS
RCHTTY BVS RCHT1
;TTI=PB6 ---> V (OVERFL FLG)
RCHT2 BIT DRB
;WAIT TILL HE RELEASE IT
BVC RCHT2
JSR DELAY
JSR GETTTY
;GET A CHAR
CMP #ESCAPE
BEQ REA1
;TO COMMAN
CMP #' '
BNE RCHT2
RCHT1 RTS
;QUIT WAITING ON ANY KEY

20
20
D0
20
4C
20
20
29
C9
D0
20
4C

9E
42
06
DB
4D
40
AC
7F
1B
E5
3D
A1

20
20
C9
F0
C9
D0

DC E7
83 FE
08
04
7F
0C

13
00
82 EC
1B
3B
20
06
EF EC
FA
13
00 A8
FB
0F EC
DB EB
1B
1F
20
ED

EB
E8
EB
E9
EC
EB

FF
E1

;READ ONE CHAR FROM KB/TTY & PRESERVE X,Y
READ
JSR PHXY
;PUSH X & Y
JSR TTYTST
;TTY OR KB ?
BNE READ1
JSR GETTTY
JMP READ2
READ1 JSR GETKEY
READ2 JSR PLXY
;PULL X & Y
AND #$7F
;STRIP PARITY
CMP #ESCAPE
BNE RCHT1
;RTN
REA1
JSR PATC18
; & CLR BUFFERS
JMP COMIN
;BOTH I/O TO TERMINAL

88
10 EF
C8
F0 EF

;READ WITH RUBOUT OR DELETE POSSIBLE
RB2
JSR PSLS
;SLASH OR BACK SPACE
RDRUP JSR CUREAD
CMP #RUB
;RUBOUT
BEQ RDR1
CMP #$7F
;ALSO DELETE
BNE RED2
;ECHO IF NOT 
;RUBOUT TO DELETE CHAR
RDR1
DEY
BPL RB2
INY
BEQ RDRUP

20 AF E7

;OUTPUT MESSAGE THEN INPUT CHR
KEPR
JSR KEP

1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530

E973
E973
E976
E978
E97A
E97A
E97A
E97B
E97E
E980
E982
E983
E986
E989
E98B
E98C
E98F
E990
E993
E993
E993
E996
E998
E99A
E99D
E99F
E9A1
E9A4
E9A6
E9A8
E9AB
E9AD
E9AF
E9B0
E9B3
E9B5
E9B7
E9BA
E9BA
E9BA
E9BC
E9BC
E9BD
E9C0
E9C0
E9C2
E9C4
E9C5
E9C8
E9C8
E9CA
E9CC
E9CD
E9D0
E9D0
E9D2
E9D4
E9D5
E9D8
E9D9
E9DA
E9DD

20 83 FE
C9 0D
F0 C1

;READ AND ECHO A CHAR FROM KB OR TTY
REDOUT JSR CUREAD
RED2
CMP #CR
BEQ RCHT1
;DO NOT ECHO 

48
AD
29
F0
68
4C
20
D0
68
4C
68
4C

;OUTPUTS A
OUTPUT PHA
OUT1
LDA
AND
BEQ
PLA
JMP
OUT1A JSR
BNE
PLA
JMP
OUT2
PLA
JMP

AD
C9
D0
4C
C9
D0
4C
C9
D0
4C
C9
D0
38
6C
C9
D0
4C

11 A4
01
04
02 EF
42 E8
04
A8 EE
FC EE
12
54
03
3B
4B
03
29
4D
03
D0
55
04

A4
ED
EE
FA

08 01
4C
A8
DB EB

A9 3B
48
AD 13 A4
C9 54
D0 04
68
4C 8B F1
C9 4B
D0 04
68
4C 4A F2
C9
D0
38
6E
68
08
20
28

50
0E
11 A4
00 F0

CHAR TO EITHER TTY OR D/P
;SAVE IT
PRIFLG
;IF LSB=1 OUTPUT ONLY TO DISP
#$01
OUT1A
OUTDP1
TTYTST
OUT2

;ONLY TO DISPL
;TTY OR KB ?

OUTTTY

;TO TTY

OUTDP

;TO DISP & PRINTR

;GET A CHR FROM CURRENT INPUT DEVICE (SET ON INFLG)
INALL LDA INFLG
CMP #'T'
BNE *+5
JMP TIBYTE
;CHAR FROM BUFFER
CMP #'K'
;WITH KIM FORMAT
BNE *+5
JMP GETTAP
;DIRECTLY FROM TAPE
CMP #'M'
;MEMORY FOR ASM?
BNE *+5
JMP MREAD
CMP #'U'
;USER ROUTINE?
BNE *+6
SEC
;SET FLG FOR NORMAL INPUT
JMP (UIN)
CMP #'L'
;TO LOAD PPR TAPE
BNE RDRUP
JMP GETTTY
; FROM TTY
;.FILE
SEMI
;WRITE
OUTALL

A2
LDA #SEMICOLON
A CHR TO OUTPUT
PHA
LDA OUTFLG
;TAPE BY BLOCKS
CMP #'T'
BNE OUTA1
PLA
JMP TOBYTE
;TAPE KIM FORMAT
OUTA1 CMP #'K'
BNE OUTA2
PLA
JMP OUTTAP
;PRINTER
OUTA2 CMP #'P'
BNE OUTA3
SEC
ROR PRIFLG
PLA
PHP
JSR OUTPRI
PLP

;OUTPUT A ";"
DEVICE (SET ON OUTFLG)

;TAPES ?
;OUTPUT ONE CHAR TO TAPE BUFFER
;KIM-1 ?

;PRINTER ?
;TURN PRINTER ON

1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592

E9DE
E9E1
E9E2
E9E2
E9E4
E9E6
E9E7
E9EA
E9EA
E9EC
E9EE
E9EF
E9F0
E9F0
E9F0
E9F0
E9F2
E9F5
E9F8
E9FA
E9FD
E9FF
EA01
EA03
EA05
EA07
EA09
EA0B
EA0E
EA10
EA13
EA13
EA13
EA14
EA17
EA18
EA1B
EA1E
EA1F
EA22
EA23
EA24
EA24
EA24
EA24
EA24
EA27
EA29
EA2B
EA2C
EA2F
EA31
EA31
EA34
EA36
EA38
EA3B
EA3D
EA40
EA41
EA42
EA42

2E 11 A4
60

C9 58
D0 8D
68
60

ROL PRIFLG
;RESTORE FLG
RTS
;USER DEFINED
OUTA3 CMP #'U'
;USER ROUTINE?
BNE OUTA4
SEC
;SET FLG FOR NORMAL OUTPUT
JMP (UOUT)
;YES
;NOWHERE OR TO TTY ,D/P
OUTA4 CMP #'X'
;EAT IT?
BNE OUT1
;OUTPUT TO TTY OR D/P
PLA
RTS

A9
20
20
D0
AD
C9
F0
C9
F0
C9
F0
A9
20
A9
4C

;THIS ROUTINE OUTPUTS A CRLF TO ANY OUTPUT DEV
;LF AND NULL IS SENT ONLY TO TTY
CRLF
LDA #CR
JSR OUTALL
JSR TTYTST
;TTY OR KB ?
BNE CR2J
LDA OUTFLG
;LF ONLY TO TTY
CMP #'T'
BEQ CR2J
CMP #'K'
BEQ CR2J
CMP #'P'
BEQ CR2J
LDA #LF
JSR OUTALL
LDA #NULLC
JMP OUTALL

C9 55
D0 04
38
6C 0A 01

48
AD
48
20
20
68
8D
68
60

0D
BC
42
29
13
54
22
4B
1E
50
1A
0A
BC
FF
BC

E9
E8
A4

E9
E9

13 A4
01 E9
F0 E9
13 A4

AD
C9
D0
60
20
F0

12 A4
4C
01

AD
F0
A9
20
A9
4C
EA
EA

16 A4
05
0D
00 F0
8D
02 EF

42 E8
E2

;CRLF TO TERMINAL (TTY OR D/P) ONLY
CRLOW PHA
;SAVE A
LDA OUTFLG
PHA
JSR OUTLOW
JSR CRLF
PLA
STA OUTFLG
PLA
CR2J
RTS
;OUTPUT  TO TTY IF SWITCH ON TTY & INFLG NOT L
;DONT CLR DISPLAY BUT CLEARS PNTRS FOR NEXT LINE
;IF PRNTR HAS PRINTED ON 21RST CHR DONT OUTPUT 
CRCK
LDA INFLG
;NO  IF "L"
CMP #'L'
BNE CRCK1
RTS
CRCK1 JSR TTYTST
;CHECK IF TTY OR KB
BEQ CRLOW
;BRNCH IF TTY
;IF PRINTR PTR=0 ,DO NOT CLR PRI
LDA CURPOS
BEQ CRCK2
;IF PTR=0 ,NO 
LDA #CR
JSR OUTPRI
CRCK2 LDA #CR+$80
; ONLY FOR TV
JMP OUTDP1
NOP
NOP
;WRITE A THEN X IN ASCII TO THE OUTPUT DEV

1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654

EA42
EA45
EA46
EA46
EA46
EA47
EA48
EA49
EA4A
EA4B
EA4E
EA4F
EA51
EA52
EA54
EA56
EA58
EA5A
EA5D
EA5D
EA5D
EA5D
EA60
EA62
EA64
EA66
EA68
EA6A
EA6C
EA6E
EA70
EA73
EA75
EA78
EA7B
EA7B
EA7C
EA7D
EA7D
EA7D
EA7E
EA80
EA83
EA84
EA84
EA84
EA86
EA88
EA8A
EA8C
EA8E
EA90
EA92
EA94
EA96
EA97
EA98
EA99
EA9A
EA9D
EA9F
EAA0

20 46 EA
8A
48
4A
4A
4A
4A
20
68
29
18
69
C9
90
69
4C

20
C9
F0
C9
F0
C9
D0
A9
D0
20
B0
20
4C

51 EA
0F
30
3A
02
06
BC E9

73
0D
17
20
13
2E
04
20
0B
84
06
73
84

E9

EA
E9
EA

38
60
48
A9 00
8D 29 A4
68
C9
90
C9
B0
C9
90
C9
90
69
2A
2A
2A
2A
8E
A2
2A
2E

30
F3
47
EF
3A
06
40
E7
08

2D A4
04
29 A4

WRAX

JSR NUMA
TXA

;PRINT ONE
NUMA
PHA
LSR
LSR
LSR
LSR
JSR
PLA
AND
NOUT
CLC
ADC
CMP
BCC
ADC
LT10
JMP

BYTE=TWO ASCII CHARS TO OUTPUT DEVICE
A
A
A
A
NOUT
#$F
#'0'
#'9'+1
LT10
#6
OUTALL

;CARRY IS SET

;READ TWO CHR & PACK THEM INTO ONE BYTE
;PART OF ALTER MEMORY , / COMM
RD2
JSR REDOUT
CMP #CR
;?
BEQ RSPAC
CMP #' '
;FOR MEMORY ALTER
BEQ RSPAC
CMP #'.'
;TREAT "." AS 
BNE RD1
LDA #' '
BNE RSPAC
RD1
JSR PACK
BCS RSPAC
JSR REDOUT
JMP PACK
;WAS SPACE OR 
RSPAC SEC
RTS
;CONVERT ACC IN ASCII TO ACC IN HEX (4 MSB=0)
HEX
PHA
;SAVE A
LDA #0
;CLEAR STIY IF HEX
STA STIY+2
;BECAUSE ONLY ONCE
PLA
;PACK TWO ASCII INTO ONE HEX (CALL SUBR TWO TIMES)
;RESULT IS GIVEN ON ACC WITH FIRST CHR INTO 4 MSB
PACK
CMP #'0'
;< 30 ?
BCC RSPAC
CMP #'F'+1
; > 47 ?
BCS RSPAC
CMP #'9'+1
; < $10
BCC PAK1
CMP #'A'-1
; > $10 ?
BCC RSPAC
ADC #8
;ADD 9 IF LETTER (C IS SET)
PAK1
ROL A
;SHIFT A 4 TIMES
ROL A
ROL A
ROL A
STX CPIY+3
;SAVE X
LDX #4
PAK2
ROL A
;TRANSFER A TO STIY
ROL STIY+2
; THRU CARRY

1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716

EAA3
EAA4
EAA6
EAA9
EAAC
EAAD
EAAE
EAAE
EAAE
EAAE
EAB1
EAB4
EAB5
EAB7
EABA
EABC
EABE
EAC0
EAC2
EAC3
EAC5
EAC7
EAC8
EACB
EACD
EACF
EAD1
EAD4
EAD7
EADA
EADB
EADC
EADE
EADF
EAE0
EAE1
EAE2
EAE4
EAE5
EAE7
EAE8
EAEA
EAED
EAEE
EAEF
EAF1
EAF4
EAF7
EAF8
EAF9
EAFC
EAFD
EB00
EB03
EB04
EB05
EB07
EB09
EB0B
EB0D
EB10
EB13

CA
D0 F9
AE 2D A4
AD 29 A4
18
60

20
AD
48
A0
20
C9
F0
C9
F0
C8
C0
90
68
8D
C0
D0
A9
8D
8D
8C
18
60
A2
88
88
88
88
10
98
49
A8
A9
9D
E8
88
10
AC
4C
98
18
6D
A8
B9
9D
C8
E8
E0
D0
A2
A0
B9
20
B0

D8 E7
15 A4
00
5F E9
0D
09
20
05
0B
F0
2D
00
0D
02
1D
1E
1C

A4

A4
A4
A4

00

13
FF
30
1C A4
F7
2D A4
FD EA
2D A4
38 A4
1C A4
04
F4
01
00
1C A4
7D EA
16

DEX
BNE PAK2
LDX CPIY+3
LDA STIY+2
CLC
RTS

;REST X

;GET FOUR BYTE ADDR ,TAKE LAST FOUR CHR TO...
;CALCULATE ADDR .ALLOW DELETE ALSO
ADDIN JSR EQUAL
ADDNE LDA CURPO2
;SAVE POSITION
PHA
LDY #0
ADDN1 JSR RDRUP
CMP #CR
BEQ ADDN2
CMP #' '
BEQ ADDN2
INY
CPY #11
;ALLOW 10
BCC ADDN1
ADDN2 PLA
STA CPIY+3
;SAVE
CPY #0
;IF FIRST CHR PUT DEFAULT VALUES
BNE ADDN3
LDA #$02
STA ADDR+1
;DEFAULT OF 0200
STA CKSUM
;DEFAULT
STY ADDR
CLC
RTS
ADDN3 LDX #0
DEY
;Y-4
DEY
DEY
DEY
BPL ADDN5
;BRANCH IF > 4 CHR
TYA
EOR #$FF
TAY
;# OF LEADING 0
ADDN4 LDA #$30
STA ADDR,X
INX
DEY
BPL ADDN4
LDY CPIY+3
;NOW THE CHR
JMP ADDN6
ADDN5 TYA
;PUT CHR
CLC
ADC CPIY+3
TAY
ADDN6 LDA DIBUFF,Y
;FROM DISP BUFF
STA ADDR,X
INY
INX
CPX #4
BNE ADDN6
LDX #1
LDY #0
;CNVRT CHR TO HEX
ADDN7 LDA ADDR,Y
JSR HEX
BCS ADDN8

1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778

EB15
EB16
EB19
EB1A
EB1D
EB1F
EB22
EB23
EB25
EB26
EB29
EB2A
EB2B
EB2E
EB31
EB32
EB33
EB33
EB33
EB36
EB39
EB3B
EB3E
EB41
EB44
EB44
EB44
EB46
EB49
EB4C
EB4D
EB4D
EB4D
EB4F
EB52
EB55
EB56
EB56
EB56
EB56
EB56
EB58
EB5B
EB5C
EB5F
EB62
EB65
EB68
EB6B
EB6D
EB70
EB72
EB75
EB78
EB78
EB78
EB78
EB78
EB79
EB7C
EB7F
EB82

C8
B9
C8
20
B0
9D
CA
10
E8
8E
18
60
20
20
38
60
20
20
A0
20
20
4C

1C A4
84 EA
0C
1C A4
E8
1E A4
94 E3
24 EA

24
CD
31
AF
DB
A1

EA
E2
E7
E2
E1

ADDN8

INY
LDA
INY
JSR
BCS
STA
DEX
BPL
INX
STX
CLC
RTS
JSR
JSR
SEC
RTS

ADDR,Y
PACK
ADDN8
ADDR,X

;PACK TWO CHRS INTO 1 BYTE
;BRCNH IF ERROR

ADDN7
CKSUM
CKER00
CRCK

;X=0
;TO INDICATE WE GOT AN ADDR
;NO INVALID CHARS
;OUTPUT ERROR MSG
;
;SET CARRY FOR INVALID CHR

;MEMORY FAIL TO WRITE MSG & SPECIFIC ADDRESS
MEMERR JSR CRCK
JSR NXTADD
;ADD Y TO ADDR+1,ADDR
LDY #M11-M1
;PRINT "MEM FAIL"
JSR KEP
;FAIL MSG
JSR WRITAZ
;PRINT ADDR+1 , ADDR
JMP COMIN

A9 00
8D 15 A4
8D 16 A4
60

;CLEAR DISPLAY & PRINTER POINTERS
CLR
LDA #0
STA CURPO2
;DISP PNTR
STA CURPOS
;PRINTR PNTR
RTS

A9 00
8D 1F A4
8D 1E A4
60

;CLEAR CKSUM
CLRCK LDA #0
STA CKSUM+1
STA CKSUM
RTS

A9
8C
A8
B9
8D
B9
8D
AC
A9
8D
A9
8D
4C

A4
A4

;CODE FOR PAGE ZERO SIMULATION
;SUBR LDAY-SIMULATES LDA (N),Y INSTR WITHOUT PAG 0
;BY PUTTING INDIR ADDR INTO RAM & THEN EXEC LDA NM,Y
PCLLD LDA #SAVPC
;FOR DISASSEMBLER
LDAY
STY CPIY+3
;SAVE Y
TAY
LDA MONRAM,Y
;MONRAM=MONITOR RAM
STA LDIY+1
LDA MONRAM+1,Y
STA LDIY+2
LDY CPIY+3
;REST Y
LDA #$B9
;INST FOR LDA NM,Y
STA LDIY
LDA #$60
;RTS
STA LDIY+3
JMP LDIY
;START EXECUTING LDA (),Y

A4
A4
A4
A4

;SUBR STORE AT ADDR & CMP WITHOUT PAG 0
;REPLACES STA (ADDR),Y & CMP (ADDR),Y
;LOOK THAT ADDR & ADDR+1 ARE NOT ON PAG 0
SADDR PHA
LDA ADDR
STA STIY+1
STA CPIY+1
LDA ADDR+1

48
AD
8D
8D
AD

25
2D A4
00
2B
01
2C
2D
B9
2A
60
2D
2A

1C
28
2B
1D

A4
A4
A4
A4
A4
A4

1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840

EB85
EB88
EB8B
EB8D
EB90
EB92
EB95
EB97
EB9A
EB9B
EB9E
EB9E
EB9E
EBA1
EBA2
EBA3
EBA4
EBA5
EBA8
EBAB
EBAC
EBAC
EBAC
EBAC
EBAC
EBAF
EBB2
EBB3
EBB4
EBB5
EBB6
EBB9
EBBA
EBBA
EBBA
EBBB
EBBD
EBBE
EBC1
EBC4
EBC7
EBC8
EBCB
EBCC
EBCD
EBCE
EBD0
EBD2
EBD5
EBD6
EBD9
EBDA
EBDB
EBDB
EBDB
EBDB
EBDC
EBDD
EBDF
EBE2
EBE5
EBE7

8D
8D
A9
8D
A9
8D
A9
8D
68
4C

29
2C
99
27
D9
2A
60
2D

A4
A4
A4
A4
A4

27 A4

STA
STA
LDA
STA
LDA
STA
LDA
STA
PLA
JMP

STIY+2
CPIY+2
#$99
STIY
#$D9
CPIY
#$60
LDIY+3
STIY

;STA INSTR
;CMP INSTR
;RTS
;START EXECUTING STA (),Y

8D 2D A4
98
48
8A
48
20 BA EB
AD 2D A4
60

;PUSH X & Y WITHOUT CHANGING THE REGS
PHXY
STA CPIY+3
;SAVE ACC
TYA
PHA
;PUSH Y
TXA
PHA
;PUSH X
JSR SWSTAK
;SWAP X , Y WITH RTRN ADDR FROM S`
LDA CPIY+3
RTS

8D 2D A4
20 BA EB
68
AA
68
A8
AD 2D A4
60

;PULL X & Y WITHOUT CHANGING ACC
;IT HAS TO BE CALLED BY JSR & NOT BY JMP INSTR
;SINCE IT SWAPS THE STACK
PLXY
STA CPIY+3
JSR SWSTAK
;SWAP X , Y WITH RTRN ADDR FROM`
PLA
TAX
;PULL X
PLA
TAY
;PULL Y
LDA CPIY+3
RTS

BA
A9
48
BD
BC
9D
98
9D
CA
68
38
E9
D0
BD
A8
BD
AA
60

;SWAP STACK
SWSTAK TSX
LDA #2
SWST1 PHA
LDA $0106,X
LDY $0104,X
STA $0104,X
TYA
STA $0106,X
DEX
PLA
SEC
SBC #1
BNE SWST1
LDA $0108,X
TAY
LDA $0107,X
TAX
RTS

8A
48
A2
8E
2C
70
20

02
06 01
04 01
04 01
06 01

01
EB
08 01
07 01

07
2A A4
00 A8
FB
0F EC

;GET PCH OR PCL
;GET Y OR X REGS

;RESTORE Y & X FROM STACK

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;GET A CHAR FROM TTY SUBR INTO ACC ,SAVES X
GETTTY TXA
;SAVE X
PHA
LDX #$07
;SET UP FOR 8 BIT CNT
STX CPIY
;CLR MSB
GET1
BIT DRB
;A^M , PB6->V
BVS GET1
;WAIT FOR START BIT
JSR DELAY
;DELAY 1 BIT

1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902

EBEA
EBED
EBF0
EBF2
EBF5
EBF8
EBFB
EBFE
EBFF
EC01
EC04
EC07
EC08
EC09
EC0C
EC0E
EC0F
EC0F
EC0F
EC12
EC15
EC18
EC1B
EC1E
EC20
EC22
EC23
EC23
EC23
EC23
EC26
EC27
EC2A
EC2B
EC2E
EC31
EC32
EC35
EC38
EC38
EC38
EC3A
EC3D
EC40
EC40
EC40
EC40
EC40
EC43
EC46
EC46
EC48
EC4B
EC4E
EC4F
EC51
EC53
EC55
EC56
EC57
EC58
EC5B

20
AD
29
4E
0D
8D
20
CA
D0
20
20
68
AA
AD
29
60

23
00
40
2A
2A
2A
0F

AD
8D
AD
8D
AD
29
F0
60

18
08
17
09
0D
20
F9

AD
4A
AD
6A
8D
AD
4A
8D
4C

EC
A8
A4
A4
A4
EC

EC
0F EC
23 EC
2A A4
7F

A4
A8
A4
A8
A8

17 A4
18 A4
08 A8
17 A4
09 A8
1B EC

A9 00
8D 77 A4
20 50 F0

20 EF EC
20 2A ED
A9
8D
AD
4A
B0
A2
A9
38
6A
48
20
AD

8F
80 A4
82 A4
20
03
7F

0B ED
82 A4

GET3

JSR
LDA
AND
LSR
ORA
STA
JSR
DEX
BNE
JSR
JSR
PLA
TAX
LDA
AND
RTS

DEHALF
DRB
#$40
CPIY
CPIY
CPIY
DELAY

;DELAY 1/2 BIT TIME
;GET 8 BITS
;MASK OFF OTHER BITS,ONLY PB6
;SHIFT RIGHT CHARACTER

GET3
DELAY
DEHALF

;GET NEXT BIT
;DO NOT CARE FOR PARITY BIT
;UNTIL WE GET BACK TO ONE AGAIN
;RESTORE X

CPIY
#$7F

;DELAY 1 BIT TIME

;CLEAR PARITY BIT

;DELAY 1 BIT TIME AS GIVEN BY BAUD RATE
DELAY LDA CNTL30
;START TIMER T2
STA T2L
LDA CNTH30
DE1
STA T2H
DE2
LDA IFR
;GET INT FLG FOR T2
AND #MT2
BEQ DE2
;TIME OUT ?
RTS
;DELAY HALF BIT TIME
;TOTAL TIME DIVIDED BY 2
DEHALF LDA CNTH30
LSR A
;LSB TO CARRY
LDA CNTL30
ROR A
;SHIFT WITH CARRY
STA T2L
LDA CNTH30
LSR A
STA T2H
JMP DE2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GETKD0 LDA #0
STA IDOT
;GO ANOTHER 90 DOTS
JSR IPO0
;OUTPUT 90 DOTS TO PRI (ZEROS)
;GET A CHAR FROM KB SUBROUTINE
;FROM KB Y=ROW ,STBKEY=COLUMNS (STROBE)
;X=CTRL OR SHIFT ,OTHERWISE X=0
GETKEY JSR ROONEK
;WAIT IF LAST KEY STILL DOWN
GETKY JSR DEBKEY
;DEBOUNCE KEY (5 MSEC)
;CTRL OR SHIFT ?
LDA #$8F
;CHCK CLMN 5,6,7
STA DRA2
LDA DRB2
;CHCK ROW 1
LSR A
BCS GETK1
;IF=1 ,NO CTRL OR SHIFT
LDX #3
;CLMN 5,6,7 (CNTRL,SHIFTL,SHIFTR)
LDA #$7F
;CTRL OR SHIFT ,SO WHICH ONE?
GETK0 SEC
ROR A
PHA
JSR ONEK2
;LETS GET CTRL OR SHIFT INTO X
LDA DRB2

1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964

EC5E
EC5F
EC61
EC62
EC63
EC65
EC67
EC68
EC6B
EC6D
EC6E
EC71
EC71
EC74
EC75
EC77
EC7A
EC7C
EC7E
EC80
EC82
EC82
EC85
EC86
EC87
EC88
EC89
EC8A
EC8D
EC8E
EC90
EC91
EC93
EC96
EC97
EC98
EC9A
EC9C
EC9E
EC9F
ECA1
ECA4
ECA5
ECA6
ECA8
ECAA
ECAB
ECAC
ECAE
ECB0
ECB2
ECB4
ECB5
ECB7
ECB9
ECBA
ECBC
ECBE
ECBF
ECBF
ECBF
ECC1

4A
90
68
CA
D0
F0
68
AD
49
AA
EE

06
F0
DC
2B A4
FF
2A A4

20
88
D0
AD
C9
B0
90
30

05 ED

20
98
0A
0A
0A
A8
AD
4A
90
C8
D0
B9
48
8A
F0
29
F0
68
29
4C
68
48
29
D0
68
48
29
F0
C9
B0
68
29
D0
68
09
D0
68

2C ED

09
2B A4
F7
04
C3
C1

2B A4
03
FA
21 F4
24
10
06
3F
BF EC
40
14
0F
0E
0C
05
EF
06
10
01

C9 60
D0 06

LSR A
;ONLY ROW 1
BCC GETK00
;GOT YOU
PLA
DEX
BNE GETK0
BEQ GETKY
;THERE IS A MISTAKE CHECK AGAIN
GETK00 PLA
;NOW GET STBKEY INTO X
LDA STBKEY
;CLMN INTO X
EOR #$FF
;COMPLEMENT BECAUSE STRBS ARE 0
TAX
;CTRL OR SHIFT TO X
INC KMASK
;SET MSK=$01
;NOW GET ANY KEY
GETK1 JSR ONEKEY
;GET A KEY
DEY
;CHK THE ROW (1-8)
BNE GETK1B
;CHK IF CTRL OR SHIFT
LDA STBKEY
;WERE ENTERED AT THE LAST MOMENT
CMP #$F7
;IF CLMN 5,6,7,8 TO IT AGAIN
BCS GETK2
BCC GETKY
;SEND IT TO GET CTRL OR SHIFT
GETK1B BMI GETKY
;NO KEY ,CLEAR MSK
;WE HAVE A KEY ,DECODE IT
GETK2 JSR DEBK1
;DEBOUNCE KEY (5 MSEC)
TYA
;MULT BY 8
ASL A
ASL A
ASL A
TAY
;NOW Y HAS ROW ADDR FROM ROW 1
LDA STBKEY
;ADD COLUMN TO Y
GETK3 LSR A
BCC GETK4
INY
BNE GETK3
GETK4 LDA ROW1,Y
;GET THE CHR
PHA
TXA
;SEE IF CTRL OR SHIFT WAS USED
BEQ GETK7
;BRCH IF NO CTRL OR SHIFT
AND #$10
;CTRL ?
BEQ GETK5
;NO ,GO GETKS
PLA
AND #$3F
;MSK OFF 2 MSB FOR CONTROL
JMP GETK8
;EXIT
GETK5 PLA
PHA
;SAVE IT
AND #$40
;IF ALPHA CHARS DO NOT SHIFT
BNE GETK7
PLA
PHA
AND #$0F
;ONLY LSB
BEQ GETK7
;DO NOT INTERCHANGE  OR 0
CMP #$0C
;ACC>=$0C ?
BCS GETK6
;YES ACC>=$0C
PLA
;NO, ACC<$0C
AND #$EF
;STRIP OFF BIT 4
BNE GETK8
;EXIT
GETK6 PLA
;ACC>=$0C
ORA #$10
;BIT 4= 1
BNE GETK8
;EXIT
GETK7 PLA
;CHECK FOR "ADV PAP","PRI LINE", OR "TOGL PRIFLG"
;IN THIS WAY WE DONT HAVE TO CHCK FOR THIS COMM
GETK8 CMP #$60
;ADV PAPER COMM
BNE GETK11

1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026

ECC3
ECC5
ECC7
ECC9
ECCB
ECCD
ECD0
ECD2
ECD5
ECD6
ECD8
ECDB
ECDC
ECDE
ECE1
ECE3
ECE5
ECE8
ECEB
ECEC
ECEF
ECEF
ECEF
ECF2
ECF4
ECF6
ECF9
ECFB
ECFD
ED00
ED02
ED05
ED05
ED05
ED05
ED07
ED09
ED0A
ED0B
ED0E
ED11
ED13
ED16
ED19
ED1C
ED1D
ED1F
ED20
ED22
ED25
ED27
ED29
ED2A
ED2A
ED2C
ED2E
ED31
ED33
ED36
ED38
ED3B
ED3B

E0
F0
29
C9
D0
20
A0
B9
38
E9
99
88
10
4C
C9
D0
20
4C
60
4C

00
25
4F
1C
14
E1 E6
01
15 A4

AD
C9
F0
0D
49
D0
20
A9
8D

82
FF
0A
7F
FF
F2
2A
00
2A

A9
D0
38
6A
8D
8D
A0
AD
0D
8D
0A
90
88
D0
AD
C9
D0
60

7F
02

A2
A9
8D
A9
8D
A9
4C

00
00
2A A4
88
08 A8
13
18 EC

GETK11

GETK12

03
15 A4
F4
40 EC
5C
06
4A F0
40 EC
38 EC

80
2B
08
82
2A
7F

A4
A4
ED
A4

A4
A4
A4
A4
A4

0A
FA
2B A4
FF
E0

GETK13

GETK14
GETK10

CPX
BEQ
AND
CMP
BNE
JSR
LDY
LDA
SEC
SBC
STA
DEY
BPL
JMP
CMP
BNE
JSR
JMP
RTS
JMP

#0
GETK10
#$4F
#$1C
GETK13
PRITR
#1
CURPO2,Y

;IF SHIFT IS NOT ADV PAPER
;NO SHIFT ,SO ADVPAPER
;CONVRT TO "@"
;SEE IF TOGGL PRIFLG (CONTRL PRI)

#3
CURPO2,Y

;BECAUSE "ON ,OFF" MSGS

GETK12
GETKEY
#BACKSLASH
GETK14
IPS0
GETKEY

;GO TOGGLE FLG
;GET THE PTRS BACK 3 SPACES

;PRINT LINE COMMAND
;PRINT WHATEVER IS IN BUFFER

GETKD0

;WAIT IF LAST KEY STILL DOWN (ROLLOVER)
ROONEK LDA DRB2
;SEE IF KEY STILL DOWN
CMP #$FF
BEQ ROO1
;NO KEY AT ALL, CLR ROLLFL
ORA ROLLFL
;ACCEPT ONLY LAST KEY
EOR #$FF
;STRBS ARE ZEROS TO INVER
BNE ROONEK
JSR DEBKEY
;CLR KMASK & DEBOUNCE RELEASE
ROO1
LDA #0
;CLR KMASK
STA KMASK
;GO THRU KB ONCE AND RTN ,IF ANY
;KEY Y=ROW (1-8) & STBKEY=CLMN
;IF NO KEY Y=0 ,STBKEY=$FF
ONEKEY LDA #$7F
;FIRST STROBE TO MSB
BNE ONEK2
;START AT ONEK2
ONEK1 SEC
;ONLY ONE PULSE (ZERO)
ROR A
;SHIFT TO RIGHT
ONEK2 STA DRA2
;OUTPUT CLMN STROBE
STA STBKEY
;SAVE IT
LDY #8
;CHECK 8 ROWS
LDA DRB2
;ANY KEY ?
ORA KMASK
;DISABLE ROW 1 IF CTRL OR SHIFT
STA ROLLFL
;SAVE WHICH KEY IT WAS
ONEK3 ASL A
BCC ONEK4
;JUMP IF KEY (ZERO)
DEY
BNE ONEK3
LDA STBKEY
CMP #$FF
;LAST CLMN ?
BNE ONEK1
;NO ,DO NEXT CLMN
ONEK4 RTS
DEBKEY LDX #0
DEBK1 LDA #0
STA KMASK
LDA #DEBTIM
STA T2L
LDA #DEBTIM/256
JMP DE1

;CLEAR CNTRL OR SHIFT
;CLR KMASK
;DEBOUNCE TIME FOR KEYBOARD
;WAIT FOR 5 MSEC

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088

ED3B
ED3B
ED3B
ED3B
ED3B
ED3E
ED41
ED43
ED45
ED48
ED4B
ED4C
ED4F
ED52
ED53
ED53
ED56
ED59
ED5B
ED5D
ED5F
ED61
ED63
ED65
ED68
ED6B
ED6C
ED6E
ED70
ED73
ED75
ED78
ED79
ED7C
ED7E
ED81
ED83
ED86
ED88
ED89
ED8C
ED8F
ED92
ED93
ED96
ED97
ED9A
ED9D
ED9E
EDA1
EDA3
EDA4
EDA7
EDA9
EDAC
EDAE
EDAF
EDB0
EDB1
EDB2
EDB3
EDB4

20
AE
E0
D0
20
BD
E8
8E
20
60

9E
36
50
03
53
16

20
20
C9
F0
C9
D0
F0
A2
20
9D
E8
E0
D0
AD
29
8D
58
20
A2
AD
F0
DD
D0
E8
8E
EE
AD
48
AD
48
CE
20
68
CD
D0
68
CD
D0
EE
A2
60
68
68
68
68
68
20

EA
29
23
06
16
F2
F3
00
29
16

EB
A4
ED
01

36 A4
AC EB
ED
EE

EE
01

52
F5
00 A8
CF
00 A8
BD ED
00
15 01
05
16 01
28
36 A4
15 01
67 01
66 01
12 A4
E7 F1
66 01
0C
67 01
07
12 A4
01

8E E3

;GET A CHAR FROM TAPE SUBROUTINE
;A BUFFER IS USED TO GET BLOCKS OF DATA
;FROM TAPE ,EXCEPT WHEN FORMAT EQUAL TO
;KIM-1 (THE WHOLE FILE IS LOADED AT ONE TIME)
TIBYTE JSR PHXY
;PUSH X
LDX TAPTR
;POINTER FOR BUFFER
CPX #80
;IS BUFFER EMPTY ?
BNE TIB1
JSR TIBY1
;LOAD ANOTHER BLOCK
TIB1
LDA TABUFF,X
INX
STX TAPTR
JSR PLXY
;PULL X
RTS
;LOAD A BLOCK FROM TAPE INTO BUFFER
TIBY1 JSR TAISET
;SET TAPE FOR INPUT
TIBY3 JSR GETTAP
;GET A CHAR FROM TAPE
CMP #'#'
;CHECK FIRST CHR FOR
BEQ TIBY4
;START OF BLOCK
CMP #$16
;IF NOT # SHOULD BE SYN
BNE TIBY1
BEQ TIBY3
TIBY4 LDX #0
TIBY5 JSR GETTAP
;NOW LOAD INTO BUFFER
STA TABUFF,X
INX
CPX #82
BNE TIBY5
LDA DRB
AND #$CF
STA DRB
;TURN OFF TAPES
CLI
;ENABL INTERR
JSR ADDBK1
;DISPLAY BLK COUNT
LDX #0
;TO CLEAR PTR IN TIBYTE
LDA BLK
;CHECK THE BLOCK COUNT
BEQ TIBY5A
;IF FIRST BLK ,DO NOT CMP
CMP TABUFF,X
BNE TIBY7
;BRANCH IF WE MISSED ONE BLOCK
TIBY5A INX
STX TAPTR
INC BLK
;INCR BLK CONT
LDA TABUFF+81
;STORE THIS BLK CKSUM
PHA
LDA TABUFF+80
PHA
DEC INFLG
;SET INFLG DIFF FROM OUTFLG
JSR BKCKSM
;COMPUT BLK CKSUM FOR THIS BLK
PLA
CMP TABUFF+80
;DO THEY AGREE ?
BNE TIBY6
PLA
CMP TABUFF+81
BNE TIBY7
INC INFLG
;RESTORE INPUT DEVICE
LDX #1
;TO GET FIRST CHR IN TIBYTE
RTS
TIBY6 PLA
;RESTORE STACK PTR
TIBY7 PLA
PLA
PLA
PLA
JSR CKER0

2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150

EDB7
EDBA
EDBA
EDBA
EDBD
EDC0
EDC2
EDC5
EDC8
EDC9
EDCC
EDCD
EDD0
EDD2
EDD5
EDD8
EDDB
EDDE
EDDF
EDE2
EDE3
EDE6
EDE9
EDEA
EDEA
EDEA
EDEC
EDEF
EDF2
EDF5
EDF7
EDFA
EDFC
EDFF
EDFF
EE02
EE05
EE08
EE0B
EE0D
EE0F
EE11
EE14
EE16
EE18
EE19
EE1B
EE1C
EE1C
EE1C
EE1C
EE1E
EE20
EE22
EE24
EE27
EE28
EE29
EE29
EE29
EE29
EE2B

4C A1 E1
EE
EE
A9
8D
AD
48
AD
48
AE
A9
8D
AD
20
8E
68
8D
68
8D
CE
60

15
11
12
15
4A

A9
8D
AD
20
A9
8D
A9
8D

37
02
34
1C
EE
0C
FF
08

20
4E
0D
8D
C9
D0
A2
20
C9
D0
CA
D0
60

3B
2A
2A
2A
16
F0
05
29
16
E7

D0
A9
D0
A9
8D
78
60

01
A4
A4
A4

4B A4
13
0D
13
16
46
13

A4
A4
01
EA
A4

4B A4
4A A4
11 A4

A8
A4
EE
A8
A8
EE
A4
A4
A4

EE

F6

04
14
02
24
00 A8

A0 08
20 3B EE

JMP COMIN
;ADD 1 TO BLK COUNT AND OUTPUT IT
ADDBLK INC BLK
;INCR BLK CNT
ADDBK1 INC PRIFLG
;SO DONT OUTPUT TO PRINTR
LDA #18
;ONLY OUTPUT IN THIS POSITION
STA CURPO2
LDA DIBUFF+18
;SAVE DISBUF (FOR EDIT)
PHA
LDA DIBUFF+19
PHA
LDX OUTFLG
;SAVE OUTFLG
LDA #CR
STA OUTFLG
;TO OUTPUT TO TERMINAL
LDA BLK+1
;BLK CNT COMING FROM TAPE
JSR NUMA
;OUTPUT IN ASCII
STX OUTFLG
;RESTORE OUTFLG
PLA
STA DIBUFF+19
PLA
STA DIBUFF+18
DEC PRIFLG
;RESTORE PRI FLG
RTS
;SET TAPE (1 OR 2) FOR
TAISET LDA #$37
STA DDRB
LDA TAPIN
JSR TIOSET
LDA #MOFF+DATIN
STA PCR
LDA #$FF
STA T2L
;CHCK BIT BY BIT UNTIL
SYNC
JSR RDBIT
LSR CPIY
ORA CPIY
STA CPIY
CMP #$16
BNE SYNC
LDX #$05
SYNC1 JSR GETTAP
CMP #$16
BNE SYNC
DEX
BNE SYNC1
RTS

INPUT
;SET PB7 FOR INPUT
;INPUT FLG (TAP 1=2 OR TAP 2=1)
;RESET PB4 OR PB5
;SET CA2=1 (DATA IN)
;PREPARE T2
;LACTH
$16
;GET A BIT IN MSB
;MAKE ROOM FOR BIT
;PUT BIT INTO MSB
;SYN CHAR ?
;TEST FOR 5 SYN CHARS
;IF NOT 2 CHAR RE-SYNC

;SET PB4 OR PB5 OFF
;USED BY IN/OUT SET UPS
TIOSET BNE TIOS1
;BRCH IF TAP1
LDA #$14
;SET TAP 2 OFF (PB5=0)
BNE TIOS2
TIOS1 LDA #$24
;SET TAP 1 OFF (PB4=0)
TIOS2 STA DRB
SEI
;DISABLE INTERR WHILE TAP
RTS
;GET 1 CHAR FROM TAPE AND RETURN
;WITH CHR IN ACC, USE CPIY TO ASM CHR ,USES Y
GETTAP LDY #$08
;READ 8 BITS
GETA1 JSR RDBIT
;GET NEXT DATA BIT

2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212

EE2E
EE31
EE34
EE37
EE38
EE3A
EE3B
EE3B
EE3B
EE3E
EE40
EE43
EE46
EE48
EE4B
EE4C
EE4E
EE51
EE54
EE56
EE57
EE58
EE5B
EE5C
EE5E
EE61
EE62
EE64
EE66
EE67
EE67
EE67
EE67
EE67
EE6A
EE6C
EE6F
EE72
EE75
EE75
EE78
EE7A
EE7D
EE7F
EE81
EE84
EE85
EE88
EE89
EE8B
EE8E
EE91
EE93
EE94
EE97
EE98
EE99
EE9A
EE9D
EE9E
EEA0
EEA1

4E
0D
8D
88
D0
60

2A A4
2A A4
2A A4

AD
30
20
20
B0
AD
48
A9
8D
20
90
68
38
ED
48
A9
8D
68
49
29
60

08
27
75
75
FB
96

20
90
20
20
4C

75
FB
75
75
B5

2C
30
2C
10
65
AD
48
AD
48
A9
8D
AD
30
68
CD
68
60
68
CD
68
E9
60
2C

00 A8
27
00 A8
FB
00
09 A8

F1

A4
EE
EE
A4

FF
96 A4
75 EE
FB
96 A4
FF
96 A4
FF
80

EE
EE
EE
FF

08 A8
FF
09 A8
08 A4
06
08 A4

08 A4
FE
00 A8

LSR CPIY
;MAKE ROOM FOR MSB
ORA CPIY
;OR IN SIGN BIT
STA CPIY
;REPLACE CHAR
DEY
BNE GETA1
RTS
;GET ONE BIT FROM TAPE AND
;RETURN IT IN SIGN OF A (MSB)
RDBIT LDA TSPEED
;ARE WE IN C7 OR 5B,5A FREQUENC`
BMI RDBIT4
;JUMP TO C7 FREQ FORMAT
JSR CKFREQ
;START BIT IN HIGH FREQ
RDBIT1 JSR CKFREQ
;HIGH TO LOW FREQ TRANS
BCS RDBIT1
LDA DIV64
;GET HIGH FREQ TIMING
PHA
LDA #$FF
;SET UP TIMER
STA DIV64
RDBIT2 JSR CKFREQ
;LOW TO HIGH FREQ TRANS
BCC RDBIT2
;WAIT TILL FREQ IS HIGH
PLA
SEC
SBC DIV64
;(256-T1) - (256-T2) =T2-T1
PHA
;LOW FREQ TIME-HIGH FREQ TIME
LDA #$FF
STA DIV64
;SET UP TIMER
PLA
EOR #$FF
AND #$80
RTS
;EACH BIT STARTS WITH HALF PULSE OF 2400 & THEN
;3 HALF PULSES OF 1200 HZ FOR 0 ,3 PUSLES OF 2400 FOR 1
;THE READING IS MADE ON THE FOURTH 1/2 PULSE ,WHERE
;THE SIGNAL HAS STABILIZED
RDBIT4 JSR CKFREQ
;SEE WHICH FREQ
BCC RDBIT4
JSR CKFREQ
JSR CKFREQ
JMP PATC24
;NOW READ THE BIT
CKFREQ BIT
BMI
CKF1
BIT
BPL
ADC
CKF2
LDA
PHA
LDA
PHA
LDA
STA
LDA
BMI
PLA
CMP
PLA
RTS
CKF3
PLA
CMP
CKF3A PLA
SBC
RTS
CKF4
BIT

DRB
CKF4
DRB
CKF1
$00
T2H

;ARE WE HIGH OR LOW ?
;WAIT TILL HIGH
;EQUALIZER
;SAVE CNTR

T2L
#$FF
T2H
TSPEED
CKF3

;START CNTR
;SUPER SPEED ?

TSPEED

;HIGH OR LOW FREC
;C=1 IF HIGH ,C=0 IF LOW

TSPEED

;CENTER FREQ

#$FE
DRB

;WAIT TILL LOW

2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274

EEA4
EEA6
EEA8
EEA8
EEA8
EEA8
EEA8
EEA9
EEAC
EEAF
EEB2
EEB5
EEB7
EEBA
EEBD
EEC0
EEC2
EEC5
EEC8
EECB
EECE
EED1
EED3
EED6
EED9
EEDA
EEDD
EEDE
EEDF
EEE1
EEE3
EEE6
EEE9
EEEC
EEEF
EEF0
EEF2
EEF4
EEF6
EEF8
EEFB
EEFC
EEFC
EEFC
EEFC
EEFC
EEFF
EF00
EF01
EF02
EF05
EF05
EF05
EF05
EF05
EF06
EF09
EF0B
EF0D
EF0F
EF12
EF14

30 FB
10 D9

48
20
8D
20
AD
29
8D
8D
20
A2
2E
2E
2E
6E
AD
29
0D
8D
08
20
28
CA
D0
A9
0D
8D
20
20
68
C9
F0
C9
F0
4C
60

9E
27
0F
00
FB
00
28
0F
08
27
27
27
27
27
04
28
00

BMI CKF4
BPL CKF2

EB
A4
EC
A8
A8
A4
EC
A4
A4
A4
A4
A4
A4
A8

0F EC
EA
04
28
00
0F
AC

A4
A8
EC
EB

0A
07
FF
03
05 EF

;GO GET TIMING

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;OUTPUT ACC TO TTY SUBROUTINE
;X,Y ARE PRESERVED
OUTTTY PHA
;SAVE A
JSR PHXY
;PUSH X
STA STIY
;PUT CHAR HERE
JSR DELAY
;STOP BIT FROM LAST CHAR
LDA DRB
AND #$FB
;START BIT PB2=0
STA DRB
;TTO=PB2
STA STIY+1
;SAVE THIS PATTERN
JSR DELAY
LDX #$08
;8 BITS
ROL STIY
;GET FIRST LSB INTO BIT 2
ROL STIY
ROL STIY
OUTT1 ROR STIY
LDA STIY
AND #$04
;GET ONLY BIT 2 FOR PB2
ORA STIY+1
;PUT BIT INTO PATTERN
STA DRB
;NOW TO TTY
PHP
;PRESERVE CARRY FOR ROTATE
JSR DELAY
PLP
DEX
BNE OUTT1
LDA #$04
;STOP BIT
ORA STIY+1
STA DRB
JSR DELAY
;STOP BIT
JSR PLXY
;PULL X
PLA
CMP #LF
BEQ OUTT2
CMP #NULLC
BEQ OUTT2
JMP OUTDIS
;USE THAT BUFF
OUTT2 RTS

20 00 F0
EA
EA
EA
6C 06 A4

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;OUTPUT A CHR TO D/P SUBR (SINGLE ENTRY FOR BOTH SUBR)
;IF CHAR= CLEAR DISPLAY & PRINTER
OUTDP JSR OUTPRI
;FIRST TO PRI THEN TO DISP
NOP
NOP
NOP
OUTDP1 JMP (DILINK)
;HERE HE COULD ECHO SOMEWHERE ELSE`

48
20
C9
D0
A2
8E
F0
4C

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;OUTPUT ACC TO DISPLAY SUBROUTINE
;IF SIGN BIT (MSB)=1 DISP DO NOT CLR TO THE RIGHT
OUTDIS PHA
;SAVE A
JSR PHXY
;PUSH X
CMP #CR
; ?
BNE OUTD1
LDX #0
;YES
STX CURPO2
;CLEAR DISP POINTER
BEQ OUTD5
;GO CLEAR DISP
OUTD1 JMP PATCH4

9E EB
0D
07
00
15 A4
42
9C FE

2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336

EF17
EF19
EF1B
EF1E
EF1F
EF20
EF23
EF26
EF28
EF2A
EF2D
EF2F
EF2F
EF30
EF31
EF33
EF36
EF39
EF3B
EF3E
EF3F
EF42
EF45
EF47
EF48
EF49
EF4B
EF4E
EF4F
EF51
EF53
EF56
EF56
EF58
EF5A
EF5D
EF5F
EF62
EF65
EF68
EF6A
EF6D
EF6E
EF6F
EF70
EF71
EF72
EF73
EF74
EF75
EF76
EF79
EF7A
EF7B
EF7B
EF7B
EF7B
EF7C
EF7D
EF7E
EF7F
EF80

E0
90
20
68
60
9D
EE
E0
90
20
30
8A
A8
A2
8E
B9
09
20
88
CE
AE
10
60
48
09
20
68
29
D0
AE
E0
B0
8E
A9
20
EE
AE
D0
4C
EA
EA
EA
EA
EA
EA
EA
EA
EA
20
68
60

48
8A
48
4A
4A
AA

3C
05
AC EB
38 A4
15 A4
14
1E
2F EF
47

13
27 A4
38 A4
80
7B EF
27 A4
27 A4
EC
80
7B EF
80
23
15 A4
14
1C
27
A0
7B
27
27
EC
76

A4
EF
A4
A4
EF

AC EB

OUTD1A CPX #60
;LAST CHAR FOR DISP?
BCC OUTD2
JSR PLXY
;GO BACK
PLA
;DO NOT STORE
RTS
OUTD2 STA DIBUFF,X
;PUT CHAR IN BUFF
INC CURPO2
;INC POINTER
CPX #20
;DISPLAY FULL?
BCC OUTD4
JSR OUTD2A
;THIS WAY SCROLL IS A SUBR
BMI OUTD7
;EXIT DISP
;YES, SCROLL CHARS TO THE LEFT
OUTD2A TXA
;X---> Y
TAY
LDX #19
;ADDR FOR DISP DO NOT
OUTD3 STX STIY
;DECREM IN BINARY
LDA DIBUFF,Y
;FROM BUFFER TO DISP
ORA #$80
;NO CURSOR
JSR OUTDD1
;CONVERT X INTO REAL ADDR
DEY
DEC STIY
LDX STIY
BPL OUTD3
;AGAIN UNTIL WHOLE DISP
RTS
OUTD4 PHA
ORA #$80
;NO CURSOR
JSR OUTDD1
;X=<$19 ,CONVRT TO REAL ADDR
PLA
AND #$80
;IF MSB=0 CLEAR REST OF DISPLAY
BNE OUTD7
LDX CURPO2
;CLEAR DISP TO THE RIGHT
OUTD5 CPX #20
BCS OUTD7
STX STIY
LDA #' '+$80
;
JSR OUTDD1
;CONVRT TO REAL ADDR
INC STIY
LDX STIY
BNE OUTD5
;GO NEXT
JMP OUTD7
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
OUTD7 JSR PLXY
;REST ,SO PRINTR INDEPEN
PLA
RTS
;CONVERT X INTO REAL ADDR FOR DISPLAY
;AND OUTPUT IT PB=DATA ; PA=W,CE ,A0 A1 (6520)
OUTDD1 PHA
;SAVE DATA
TXA
PHA
;SAVE X
LSR A
;DIVIDE X BY 4
LSR A
;TO GET CHIP SELECT
TAX
;BACK TO X

2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398

EF81
EF83
EF85
EF87
EF88
EF89
EF8B
EF8E
EF8F
EF91
EF94
EF94
EF96
EF99
EF9A
EF9B
EF9C
EF9F
EFA0
EFA2
EFA5
EFA6
EFA8
EFAB
EFAD
EFB0
EFB1
EFB2
EFF9
EFF9
F000
F000
F000
F000
F000
F000
F000
F001
F004
F006
F008
F00B
F00D
F00F
F00F
F010
F012
F015
F018
F01B
F01B
F01E
F020
F021
F023
F025
F028
F02B
F02C
F02E
F030
F033

A9
E0
F0
0A
CA
D0
8D
68
29
0D

04
00
04

49
8D
AA
68
48
8D
8A
49
8D
EA
09
8D
A9
8D
68
60

FF
00 AC

FC
28 A4
03
28 A4

02 AC
80
00 AC
7C
00 AC
FF
00 AC

EA

48
20
C9
F0
AE
E0
D0

9E EB
0D
07
16 A4
14
16

48
A9
AE
8D
20

00
16 A4
16 A4
38 F0

20
A2
68
C9
F0
9D
EE
E8
29
D0
20
20

45 F0
00
0D
0E
60 A4
16 A4
80
03
38 F0
AC EB

LDA #4
;FIRST CHIP SELECT
CPX #0
;FIRST CHIP ?
BEQ OUTDD3
OUTDD2 ASL A
DEX
BNE OUTDD2
;BACK TILL RIGH CS
OUTDD3 STA STIY+1
;SAVE CS TEMPORARILY
PLA
;GET X AGAIN FOR CHAR
AND #$03
;IN THAT CHIP
ORA STIY+1
;OR IN CS AND CHAR
;STORE ADDR AND DATA INTO DISPL
EOR #$FF
;W=1 , CE=0 & A1,A0
STA RA
TAX
;SAVE A IN X
PLA
;GET DATA
PHA
STA RB
TXA
EOR #$80
;SET W=0
STA RA
NOP
ORA #$7C
;SET CE=1
STA RA
LDA #$FF
;SET W=1
STA RA
PLA
;RETURN DATA
RTS
*=$EFF9
.DB $EA
*=$F000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;OUTPUT ACC TO PRINTER SUBROUTINE
;PRINTS ON 21RST CHAR OR WHEN 
;IT WILL PUT IT ON BUBFFER BUT WONT PRINT IF
;PRIFLG=0
OUTPRI PHA
;SAVE CHR TO BE OUTPUT
JSR PHXY
;SAVE X
CMP #CR
;SEE IF CR
BEQ OUT01
;YES SO PRINT THE BUFF
LDX CURPOS
;PTR TO NEXT POS IN BUFF
CPX #20
;SEE IF BUFF FULL
BNE OUT04
;NOT FULL SO RETURN
; SO FILL REST OF BUFFER WITH BLANKS
OUT01 PHA
LDA #0
;CURPOS = 0
LDX CURPOS
;SEE IF ANYTHING IN BUFFER
STA CURPOS
JSR OUTPR
;CLEAR PRIBUF TO THE RIGHT
;BUFFER FILLED SO PRINT IT
JSR IPST
;START THE PRINT
LDX #0
;STORE CHR IN BUFF (FIRST LOC)
PLA
;GET IT
CMP #CR
;DONT STORE IF 
BEQ OUT05
OUT04 STA IBUFM,X
;STORE CHR IN BUFF
INC CURPOS
;INCR BUFF PNTR
INX
AND #$80
BNE OUT05
;DONT CLR IF MSB=1
JSR OUTPR
;CLEAR PRIBUFF TO THE RIGHT
OUT05 JSR PLXY
;RESTORE REGS

2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460

F036
F037
F038
F03A
F03C
F03E
F041
F042
F044
F045
F045
F045
F045
F048
F04A
F04D
F050
F052
F055
F058
F05A
F05D
F05F
F062
F063
F064
F065
F066
F069
F06C
F06C
F06F
F071
F073
F075
F078
F079
F079
F07C
F07F
F081
F084
F087
F087
F087
F087
F087
F089
F08C
F08F
F091
F093
F096
F098
F09B
F09E
F0A1
F0A4
F0A7
F0AA
F0AD
F0AF

68
60
A9
E0
F0
9D
E8
10
60

20
14
06
60 A4
F6

2C
10
20
20
A9
8D
20
D0
20
D0
4C
EA
EA
EA
EA
20
20

11
2E
CB
E3
C1
0C
A0
0C
A0
07
79

AD
C9
90
A9
8D
60

77 A4
5A
F3
E1
0C A8

20
20
A0
20
4C

44
B1
3B
AF
A1

A9
8D
AD
29
F0
AD
49
8D
EE
AD
0D
8D
AD
8D
A9
8D

A4
F0
F0
A8
FF
FF
F0

87 F0
87 F0

00
01
0D
02
F9
0C
01
0C
77
79
00
00
78
01
A4
08

EB
FE
E7
E1

A8
A8
A8
A8
A4
A4
A8
A8
A4
A8
A8

PLA
RTS
OUTPR LDA
OUTPR1 CPX
BEQ
STA
INX
BPL
OUTPR2 RTS

#' '
#20
OUTPR2
IBUFM,X
OUTPR1

;FILL REST OF BUFF WITH BLANKS
;SEE IF END OF BUFF
;NO SO STORE BLANK
;INCR BUFF PNTR

;SUB TO OUTPUT BUFFER, 70 DOTS (10 DOTS AT
;A TIME BY 7 ROWS) FOR EACH LINE OF PRINTING
IPST
BIT PRIFLG
;PRINT FLG ON ?
BPL IPO4
IPS0
JSR PINT
;INITIALIZE VALUES
JSR IPSU
;SET UP FIRS OUTPUT PATTERN
IPO0
LDA #PRST+SP12+MON ;TURN MOTOR ON
STA PCR
JSR PAT23
;TIME OUT ?
BNE IPO2
;NO, START SIGNAL RECEIVED
JSR PAT23
;YES, TRY AGAIN
BNE IPO2
;OK
JMP PRIERR
;TWO TIME OUTS - ERROR
NOP
NOP
NOP
NOP
IPO2
JSR PRNDOT
;STRB P1=1 PRINT DOTS (1.7MSEC)
JSR PRNDOT
;STRB P2=1 PRINT DOTS (1.7MSEC)
;CHECK FOR 90, WHEN 70 PRNDOT WILL OUTPUT ZEROS
LDA IDOT
CMP #90
BCC IPO2
;L.T. 90 THEN GO STROB P1
IPO3
LDA #PRST+SP12+MOFF ;TURN MOTOR OFF
STA PCR
IPO4
RTS
PRIERR JSR
JSR
LDY
JSR
JMP

CLR
PATCH5
#M12-M1
KEP
COMIN

;CLEAR PRI PNTR
;TURN PRI OFF
;BACK WHERE SUBR WAS CALLED

;SUBR TO INCR DOT COUNTER,WHEN
;NEG TRANS OUTPUT CHR FOR 1.7 MSEC
;CLEAR & SET UP NEXT PATTERN
PRNDOT LDA #0
;CLR INTERRPTS
STA DRAH
PRDOT0 LDA IFR
AND #MSP12
;ANY STROBES ?
BEQ PRDOT0
LDA PCR
EOR #$01
STA PCR
INC IDOT
LDA IOUTU
;2 LEFT ELEM
ORA DRB
;DO NOT TURN TTY OUTPUT OFF
STA DRB
LDA IOUTL
;7 RIGHT ELEM, CLR CA1 INTER FLG
STA DRAH
LDA #PRTIME
STA T2L

2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522

F0B2
F0B4
F0B7
F0BA
F0BD
F0BF
F0C2
F0C5
F0C7
F0CA
F0CB
F0CB
F0CB
F0CD
F0D0
F0D2
F0D5
F0D7
F0DA
F0DD
F0DF
F0E2
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E3
F0E5
F0E8
F0E8
F0EB
F0ED
F0EE

A9
8D
20
20
A9
8D
AD
29
8D
60

06
09
E3
1B
00
01
00
FC
00

A9
8D
A9
8D
A9
8D
8D
A9
8D
60

FF
74
05
75
01
76
7C
00
77

A8
F0
EC
A8
A8
A8

A4
A4
A4
A4
A4

LDA
STA
JSR
JSR
LDA
STA
LDA
AND
STA
RTS

#PRTIME/256
T2H
IPSU
DE2
#0
DRAH
DRB
#$FC
DRB

;START T2 FOR 1.7 MSEC
;SET NEXT PATTERN WHILE WAITING
;WAIT TILL TIME OUT
;THERMAL ELEM OFF
;BUT DONT CHANGE TAPE CONTROLS

; SUBROUTINE PINT -- INIT VARS FOR PRINTER
PINT
LDA #$FF
STA IDIR
;DIRECTION <= LDA #5
STA ICOL
;COLUMN <= LEFTMOST +1
LDA #1
STA IOFFST
;OFFSET <= LEFT CHARACTER
STA IMASK
LDA #0
STA IDOT
;DOT COUNTER <= 0
RTS
;THE VARIABLES FOR THE PRINTER ARE AS FOLLOWS:
;
;IDIR
DIRECT HEAD IS CURRENTLY MOVING (0=+, $FF=-)
;ICOL
CLMN TO BE PRNTED NEXT (LEFTMOST=0,RIGHTMOST=4)
;IOFFST OFFSET N PRINT BUFF (0=LEFT CHR, 1=RIGHT CHR)
;IDOT
COUNT OF NUMBER OF DOTS PRINTED THUS FAR
;IOUTL SOLENOID PATTERN (8 CHRS ON RIGHT)
;IOUTU SOLENOID PATTERN (2 CHRS ON LEFT)
;IBITL 1 BIT MSK USED IN SETTING NEXT SOLENOID VALUE
;IBITU UPPER PART OF MASK
;IBUFM START OF PRINT BUFFER (LEFTMOST CHR FIRST)
;IMASK MASK FOR CURRENT ROW BEING PRINTED
;JUMP
ADDRESS OF TABLE FOR CURRENT COLUMN
;
;
THE DOT PATTERNS FOR THE CHRS ARE STORED SO THAT...
;EACH BYTE CONTAINS THE DOTS FOR ONE COLUMN OF ONE...
;CHR. SINCE EACH COLUMN CONTAINS SEVEN DOTS ,
;THIS MEANS THAT ONE BIT PER BYTE IS UNUSED.
;
THE PATTERNS ARE ORGANIZED INTO 5 TABLES OF 64...
;BYTES WHERE EACH TABLE CONTAINS ALL THE DOT...
;PATTERNS FOR A PARTICULAR COLUMN. THE BYTES IN EACH...
;TABLE ARE ORDERED ACCORDING TO THE CHR CODE OF...
;THE CHR BEING REFERENCED. THE CHR CODE CAN...
;THUS BE USED TO DIRECTLY INDEX INTO THE TABLE.

A2 00
20 21 F1
BD 60 A4
29 3F
A8
A9 7D

;SUBROUTINE IPSU -- SET UP OUTPUT PATTERN FOR PRINTER
;
THIS ROUTINE IS CALLED IN ORDER TO
;SET UP THE NEXT GROUP OF SOLENOIDS TO
;BE OUTPUT TO THE PRINTER.
;
ON ENTRY THE CONTENTS OF ALL REGISTERS
;ARE ARBITRARY
;
ON EXIT THE CONTENTS OF A,X,Y ARE UNDEFINED
IPSU
LDX #0
;X POINTS TO VAR BLOCK FOR PRNTR
JSR INCP
;ADVANCE PTRS TO NXT DOT POSITION
;X NOW CONTAINS INDEX INTO PRINT BUFFER
IPS1
LDA IBUFM,X
;LOAD NEXT CHAR FROM BUFFER
AND #$3F
TAY
LDA #JUMP
;A<= DOT PATTERN FOR CHAR & COL

2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584

F0F0
F0F3
F0F6
F0F8
F0FB
F0FD
F100
F103
F105
F108
F10B
F10E
F111
F114
F115
F116
F118
F118
F11B
F11D
F120
F121
F121
F121
F121
F121
F121
F121
F121
F121
F121
F124
F126
F126
F129
F12B
F12B
F12E
F130
F130
F133
F135
F135
F138
F13A
F13D
F13F
F13F
F142
F144
F144
F147
F149
F14B
F14E
F150
F150
F153
F155
F158
F15B
F15D

20
2C
F0
AD
F0
0D
8D
D0
AD
0D
8D
0E
2E
CA
CA
10

58
7C
16
7A
08
78
78
09
7B
79
79
7A
7B

EB
A4
A4
A4
A4
A4
A4
A4
A4
A4

D0

AD 79 A4
29 03
8D 79 A4
60

BD 74 A4
10 1E
BD 75 A4
F0 05
DE 75 A4
10 33
BD 76 A4
F0 0A
DE
A9
9D
10

76 A4
04
75 A4
24

FE 74 A4
10 1C
BD
C9
F0
FE
10

75 A4
04
05
75 A4
13

BD
D0
9D
FE
10

76 A4
08
75 A4
76 A4
06

JSR LDAY
BIT IMASK
;SEE IF DOT IS SET
BEQ IPS2
;NO SO GO ON TO NEXT CHAR
LDA IBITL
;DOT ON SO SET THE CURR SOLENOID
BEQ IPS3
;LSB OF SOL MASK IS 0 , DO MSB
ORA IOUTL
;SET THE SOLENOID IN THE PATTERN
STA IOUTL
BNE IPS2
;BRANCH ALWAYS
IPS3
LDA IBITU
;SOLENOID IS ONE OF THE 2 MSD
ORA IOUTU
;SET THE BIT IN THE PATTERN
STA IOUTU
IPS2
ASL IBITL
;SHIFT MSK TO NXT CHR POSITION
ROL IBITU
DEX
;DECR PTR INTO BUFFER
DEX
BPL IPS1
;NOT END YET
;SOLENOID PATTERN IS SET UP IN IOUTU,IOUTL
LDA IOUTU
;LEFTMOST 2
AND #$03
;DISABLE FOR SEGMENTS
STA IOUTU
RTS
; SUBROUTINE INCP
;THIS SUBROUTINE IS USED TO UPDATE THE PRINTER VARIABLES
;TO POINT TO THE NEXT DOT POSITION TO BE PRINTED
;X REG IS USED TO POINT TO THE VARIABLE BLOCK OF
;BEING UPDATED
;ON EXIT X CONTAINS THE POINTER TO THE LAST CHARACTER IN
;THE PRINT BUFFER
;CONTENTS OF A,Y ON EXIT ARE ARBITRARY
INCP
LDA IDIR,X
;EXAMINE DIRECTION(+ OR -)
BPL OP03
;DIRECTION = +
;*DIRECTION = LDA ICOL,X
;SEE WHAT THE COLUMN IS
BEQ OP04
;COLUMN = 0 SO END OF DIGIT
;**COLUMN # 0 SO JUST DECREMENT COLUMN
DEC ICOL,X
BPL NEWCOL
;BRANCH ALWAYS
;**COLUMN = 0 SO SEE IF EVEN OR ODD DIGIT
OP04
LDA IOFFST,X
BEQ OP07
;OFFSET = 0 SO DIRECTION CHANGE
;***OFFSET = 1 SO MOVE TO RIGHT DIGIT
DEC IOFFST,X
;OFFSET <= 0 (LEFT CHARACTER)
LDA #4
;COLUMN <= 4
STA ICOL,X
BPL NEWCOL
;BRANCH ALWAYS
;***OFFSET = 0 SO CHANGE DIRECTION TO +
OP07
INC IDIR,X
;DIRECTION <= $00 (+)
BPL NEWROW
;BRANCH ALWAYS
;*DIRECTION = +
OP03
LDA ICOL,X
;SEE IF LAST COLUMN IN DIGIT
CMP #4
BEQ OP05
;COLUMN = 4 SO GO TO NEXT DIGIT
INC ICOL,X
;JUST INCR COLUMN-NOT END OF DIGIT
BPL NEWCOL
;BRANCH ALWAYS
;**AT COLUMN 4 -- SEE IF LEFT OR RIGHT DIGIT
OP05
LDA IOFFST,X
BNE OP06
;OFFSET # 0 SO RIGHT DIGIT
STA ICOL,X
;COLUMN <= 0
INC IOFFST,X
;OFFSET <= 1 (RIGHT CHARACTER)
BPL NEWCOL
;BRANCH ALWAYS
;***OFFSET = 1 SO DIRECTION CHANGE

2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646

F15D
F160
F160
F160
F163
F163
F165
F168
F16B
F16E
F170
F173
F173
F176
F177
F178
F17B
F17E
F181
F184
F186
F189
F18A
F18B
F18B
F18B
F18B
F18B
F18B
F18B
F18B
F18E
F191
F194
F195
F198
F19A
F19C
F19C
F19F
F1A2
F1A4
F1A7
F1A7
F1AA
F1AD
F1AE
F1B0
F1B2
F1B5
F1B7
F1BA
F1BB
F1BD
F1C0
F1C2
F1C5
F1C8
F1CB
F1CE
F1D1
F1D2

DE 74 A4
1E 7C A4
A9
9D
9D
9D
A9
9D

00
78
79
7B
01
7A

BD
0A
A8
B9
9D
B9
9D
A9
1D
AA
60

75 A4
D7
7D
D8
7E
12
76

A4
A4
A4
A4

F2
A4
F2
A4
A4

20
AE
20
E8
8E
E0
D0

9E EB
37 A4
0F F2

20
20
A9
20

E7 F1
1D F2
23
4A F2

20
20
E8
E0
D0
AD
29
8D
58
A9
8D
A9
8D
20
AD
20
20
60

D2 F1
4A F2

37 A4
50
32

53
F5
00 A8
CF
00 A8
00
37
00
0B
9A
68
8B
AC

A4
A8
FF
01
F1
EB

OP06

DEC IDIR,X

;DIRECTION <= $FF (-)

;START
NEWROW
;START
NEWCOL

OF NEW PRINT ROW
ASL IMASK,X
;UPDATE ROW MASK FOR DOT PATTERNS
OF NEW PRINT COLUMN
LDA #0
;CLEAR OUTPUT PATTERN
STA IOUTL,X
;PATTERN FOR 8 RIGHT CHRS
STA IOUTU,X
;PATTERN FOR 2 LEFT SOLEN
STA IBITU,X
;OUTPUT MSK FOR LEFTMOST SOLEN
LDA #1
STA IBITL,X
;OUTPUT MSK FOR RIGHTMOST SOLEN
;GET ADDRESS OF DOT PATTERN TABLE FOR NEXT COLUMN
LDA ICOL,X
;GET COLUMN NUMBER (0-4)
ASL A
;*2 ,INDEX INTO TBL OF TBL ADDRS
TAY
LDA MTBL,Y
;LSB OF ADDR OF TABLE
STA JUMP,X
;PTR TO TBL WITH DOT PATTERNS
LDA MTBL+1,Y
;MSB OF TABLE ADDRESS
STA JUMP+1,X
LDA #18
;COMPUTE INDEX INTO PRNTR BUFFER
ORA IOFFST,X
;+1 IF RIGHT CHR
TAX
RTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;OUTPUT ACC TO TAPE BUFFER SUBROUTINE
; & WHEN FULL OUTPUT BUFF TO TAPE.
; IF INFLG=OUTFLG= T USE TWO BUFFERS
;OTHERWISE USE SAME BUFFER FOR INPUT
;AND OUTPUT (MONIT BUFFER)
TOBYTE JSR PHXY
;SAVE X
LDX TAPTR2
;TAPE BUFFER POINTER FOR OUTPUT
JSR BKCK2
;STORE IN BUFFER
INX
STX TAPTR2
;FOR NEXT
CPX #80
;BUFFER FULL?
BNE TABY3
;NO , GO BACK
;OUTPUT A BLOCK FROM BUFFER TO TAPE
JSR BKCKSM
;COMPUT BLOCK CHECKSUM
JSR TAOSET
;SET TAPE FOR OUTPUT
LDA #'#'
;CHAR FOR BEGINNING
JSR OUTTAP
;OF BLOCK
;OUTPUT CHRS FROM ACTIVE BUFFER
TABY2 JSR CKBUFF
;LOAD CHR FROM ACTIVE BUFFER
JSR OUTTAP
; FROM BUFFER
INX
CPX #83
;2 BLOCK CKSUM CHR + 1 EXTRA CHR..
BNE TABY2
;OTHERWISE ERROR
LDA DRB
AND #$CF
;TURN TAPES OFF PB5,PB4
STA DRB
CLI
;ENABLE INTERRUPT
LDA #0
STA TAPTR2
;CLR TAPE BUFF PTR
LDA #T1I
;RESET FREE RUNNING TO 1 SHOT
STA ACR
JSR PAT22
;ADD 1 TO BLK COUNT & OUTPUT
LDA BLKO
;PUT BLK CNT IN FIRST LOC (TABUFF)
JSR TOBYTE
TABY3 JSR PLXY
RTS

2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708

F1D2
F1D2
F1D2
F1D5
F1D8
F1DA
F1DC
F1DE
F1DF
F1E1
F1E2
F1E3
F1E6
F1E7
F1E7
F1E7
F1E7
F1E9
F1EC
F1EF
F1F1
F1F4
F1F5
F1F8
F1FB
F1FD
F200
F201
F203
F205
F208
F20B
F20C
F20F
F210
F213
F214
F216
F219
F21A
F21C
F21D
F21D
F21D
F220
F223
F226
F228
F22B
F22D
F230
F232
F235
F238
F23A
F23D
F240
F243
F246
F247
F249
F24A

AD
CD
D0
C9
D0
38
B5
60
18
BD
60

12 A4
13 A4
08
54
04
AD
16 01

A9
8D
8D
A2
20
18
6D
8D
90
EE
CA
10
A2
AD
20
E8
AD
48
20
68
B0
9D
60
95
60

00
66 01
67 01
4F
D2 F1

20
AD
20
A9
8D
A9
8D
A9
8D
AE
A9
20
20
20
20
CA
D0
60

C0
35
1C
EC
0C
C0
0B
00
05
09
16
4A
4A
4A
4A

66 01
66 01
03
67 01
EE
50
66 01
0F F2
67 01
D2 F1
04
16 01
AD

EF

F2
A4
EE
A8
A8
A8
A4
F2
F2
F2
F2

;CHCK ACTIVE BUFFER AND LOAD A CHR
;CARRY=0 IF ONLY 1 BUFFER ,C=1 IF 2 BUFFERS
CKBUFF LDA INFLG
CMP OUTFLG
BNE CBUFF1
CMP #'T'
;SEE IF INFLG=OUTFLG = T
BNE CBUFF1
SEC
;USE PAGE 1 FOR OUTPUT BUFFER
LDA TABUF2,X
RTS
CBUFF1 CLC
;USE SAME BUFFER FOR I/O
LDA TABUFF,X
RTS
;COMPUTE BLOCK CHECKSUM & PUT IT
;AT THE END OF ACTIVE BUFFER
BKCKSM LDA #0
;CLEAR BLK CKSUM LOCAT
STA TABUFF+80
STA TABUFF+81
LDX #79
BKCK1 JSR CKBUFF
;GET CHR FROM EITHER BUFFER
CLC
ADC TABUFF+80
;ADD TO CKSUM
STA TABUFF+80
BCC *+5
INC TABUFF+81
DEX
BPL BKCK1
;DO THE WHOLE BUFFER
LDX #80
LDA TABUFF+80
;PUT CKSUM INTO RIGHT BUFFER
JSR BKCK2
INX
LDA TABUFF+81
BKCK2 PHA
;OUTPUT A CHAR TO RIGHT BUFFER
JSR CKBUFF
;GET WHICH BUFFER
PLA
BCS BKCK3
;BRNCH TO SECOND BUFFER
STA TABUFF,X
RTS
BKCK3 STA TABUF2,X
;TO PAG 1
RTS
;SET TAPE (1 OR 2) FOR OUTPUT
TAOSET JSR SETSPD
;SET UP SPEED (# OF HALF PULSES)
LDA TAPOUT
;OUTPUT FLG (TAPE 1 OR 2)
JSR TIOSET
;SET PB4 OR PB5 TO ZERO
LDA #DATOUT+MOFF ;SET CA2=0 (DATA OUT)
STA PCR
LDA #T1FR
;SET TIMER IN FREE RUNNING
STA ACR
LDA #00
STA T1CH
;START TIMER T1
LDX GAP
;OUTPUT 4*GAP SYN BYTES
TAOS1 LDA #$16
;SYN CHAR
JSR OUTTAP
;TO TAPE
JSR OUTTAP
JSR OUTTAP
JSR OUTTAP
DEX
BNE TAOS1
RTS

2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770

F24A
F24A
F24D
F24F
F252
F255
F257
F258
F25A
F25D
F260
F261
F264
F267
F269
F26C
F26F
F271
F274
F275
F277
F278
F27B
F27D
F27F
F280
F282
F284
F286
F289
F28B
F28C
F28F
F290
F290
F290
F290
F291
F294
F296
F298
F29B
F29D
F2A0
F2A3
F2A6
F2A8
F2AA
F2AD
F2AF
F2B2
F2B5
F2B6
F2B8
F2B9
F2BB
F2BE
F2BF
F2C0
F2C0
F2C0
F2C3

8E
A0
8C
AE
30
48
A0
8C
BE
48
B9
8D
A9
8D
2C
50
AD
CA
D0
68
CE
F0
30
4A
90
A0
F0
CE
10
68
AE
60

48
8D
A2
A9
8D
A9
8D
20
4E
B0
A9
8D
A9
8D
20
CA
10
88
10
4C
EA
EA

2D A4
07
27 A4
08 A4
39
02
28 A4
0A A4
0B
06
00
07
0D
FB
04

A4
A8
A8
A8
A8

EA
28 A4
05
07
DB
00
D7
27 A4
CD
2D A4

28
02
D0
06
00
07
BC
28
0A
A0
06
01
07
BC

A4
A8
A8
FF
A4
A8
A8
FF

FA
D9
8B F2

AD 08 A4
6A

;OUTPUT ACC TO TAPE
OUTTAP STX CPIY+3
LDY #$07
STY STIY
LDX TSPEED
BMI OUTTA1
PHA
TRY
LDY #2
STY STIY+1
ZON
LDX NPUL,Y
PHA
ZON1
LDA TIMG,Y
STA T1LL
LDA #0
STA T1LH
ZON2
BIT IFR
BVC ZON2
LDA T1L
DEX
BNE ZON1
PLA
DEC STIY+1
BEQ SETZ
BMI ROUT
LSR A
BCC ZON
SETZ
LDY #0
BEQ ZON
ROUT
DEC STIY
BPL TRY
ROUT1 PLA
LDX CPIY+3
RTS
;OUTPUT HALF PULSE FOR
;TWO HALF PULSES FOR 1
OUTTA1 PHA
STA STIY+1
OUTTA2 LDX #2
LDA #$D0
STA T1LL
LDA #00
STA T1LH
JSR PATC25
LSR STIY+1
BCS OUTTA3
LDA #$A0
STA T1LL
LDA #$01
STA T1LH
OUTTA3 JSR PATC25
DEX
BPL OUTTA3
DEY
BPL OUTTA2
JMP ROUT1
NOP
NOP

;SAVE X
;FOR THE 8 BITS
;IF ONE IS SUPER HIPER
;SEND 3 UNITS
;STARTING AT 3700 HZ
;#OF HALF CYCLES
;SET UP LACTH FOR NEXT
;PULSE (80 OR CA) (FREC)
;WAIT FOR PREVIOUS
;CYCLE (T1 INT FLG)
;CLR INTERR FLG
;SEND ALL CYCLES
;BRCH IF LAST ONE
;BRCH IF NO MORE
;TAKE NEXT BIT
;...IF IT'S A ONE...
;SWITCH TO 2400 HZ
;UNCONDITIONAL BRCH
;ONE LESS BIT
;ANY MORE? GO BACK
;RECOVER CHR
;RESTORE X
0 (1200 HZ) &
(2400 HZ) (00 TSPEED)
;STORE ACC
;# OF HALF PULSES
;1/2 PULSE OF 2400

;WAIT TILL COMPLETED
;GET BITS FROM CHR
;BIT=0 ,OUTPUT 1200 HZ

;OUTPUT 3 HALF PULSES
;ALL BITS ?
;RESTORE REGS

;SET SPEED FROM NORMAL TO 3 TIMES NORMAL
SETSPD LDA TSPEED
;SPEED FLG
ROR A
;NORMAL OR 3* NORM

2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2787
2788
2789
2790
2790
2791
2791
2792
2792
2793
2793
2794
2794
2795
2795
2796
2796
2797
2797
2798
2799
2800
2800
2801
2801
2802
2802
2803
2803
2804
2804
2805
2805
2806
2806
2807
2807
2808
2809
2810
2810
2811
2811
2812
2812

F2C4
F2C6
F2C8
F2CA
F2CD
F2CF
F2D1
F2D3
F2D6
F2D7
F2D7
F2D7
F2D7
F2D7
F2D7
F2D7
F2D7
F2DD
F2E1
F2E1
F2E1
F2E7
F2E9
F2EF
F2F1
F2F7
F2F9
F2FF
F301
F307
F309
F30F
F311
F317
F319
F31F
F321
F321
F321
F327
F329
F32F
F331
F337
F339
F33F
F341
F347
F349
F34F
F351
F357
F359
F35F
F361
F361
F361
F367
F369
F36F
F371
F377

A9
90
A9
8D
A9
90
A9
8D
60

0C
02
04
0A A4
12
02
06
0C A4

LDA #12
BCC SETSP1
LDA #4
SETSP1 STA NPUL
LDA #18
BCC SETSP2
LDA #6
SETSP2 STA TIMG+1
RTS
;.FILE A3/2

; ADDRESS TABLE FOR EACH PRINT COLUMN
; EACH TBL CONTAINS DOT PATTERNS FOR 1 OF THE 5 COLUMNS.
;
DATA ARE STORED WITH EACH BYTE DEFINING ONE COLUMN...
; OF A CHARACTER, WITH THE TOP DOT CORRESPONDING TO THE..
; LSB IN THE BYTE
E1F221F361F3MTBL
.DW COL0,COL1,COL2,COL3,COL4
A1F3E1F3
;DOT PATTERNS FOR COLUMN ZERO (LEFTMOST COLUMN)
3E7E7F3E7F7FCOL0
.DB $3E,$7E,$7F,$3E,$7F,$7F,$7F,$3E ;@ -7F3E
7F00207F7F7F
.DB $7F,$00,$20,$7F,$7F,$7F,$7F,$3E ;H -7F3E
7F3E7F46013F
.DB $7F,$3E,$7F,$46,$01,$3F,$07,$7F ;P -077F
6307617F0300
.DB $63,$07,$61,$7F,$03,$00,$02,$40 ;X -0240
000000142463
.DB $00,$00,$00,$14,$24,$63,$60,$00 ; -6000
000014084008
.DB $00,$00,$14,$08,$40,$08,$40,$60 ;( -4060
3E4462411827
.DB $3E,$44,$62,$41,$18,$27,$3C,$01 ;0 -3C01
364600400814
.DB $36,$46,$00,$40,$08,$14,$41,$02 ;8 -4102
;DOT PATTERNS FOR COLUMN 1
410949414149COL1
.DB $41,$09,$49,$41,$41,$49,$09,$41
0941
084140084002
.DB $08,$41,$40,$08,$40,$02,$06,$41
0641
094109490140
.DB $09,$41,$09,$49,$01,$40,$18,$20
1820
140851410400
.DB $14,$08,$51,$41,$04,$00,$01,$40
0140
0000077F2A13
.DB $00,$00,$07,$7F,$2A,$13,$4E,$04
4E04
1C4108083008
.DB $1C,$41,$08,$08,$30,$08,$00,$10
0010
514251411445
.DB $51,$42,$51,$41,$14,$45,$4A,$71
4A71
494900341414
.DB $49,$49,$00,$34,$14,$14,$41,$01
4101
;DOT PATTERNS FOR COLUMN 2
5D0949414149COL2
.DB $5D,$09,$49,$41,$41,$49,$09,$41
0941
087F4114400C
.DB $08,$7F,$41,$14,$40,$0C,$08,$41
0841
095119497F40
.DB $09,$51,$19,$49,$7F,$40,$60,$18
6018

G
O
W
(
'
/
7
?

;@ -- G
;H -- O
;P -- W
;X -- (
;

-- '

;( -- /
;0 -- 7
;8 -- ?

;@ -- G
;H -- O
;P -- W

2813
2813
2814
2814
2815
2815
2816
2816
2817
2817
2818
2819
2820
2820
2821
2821
2822
2822
2823
2823
2824
2824
2825
2825
2826
2826
2827
2827
2828
2829
2829
2830
2830
2831
2831
2832
2832
2833
2833
2834
2834
2835
2835
2836
2836
2837
2838
2839
2839
2840
2840
2841
2841
2842
2842
2843
2843
2844
2844
2845
2845
2846

F379
F37F
F381
F387
F389
F38F
F391
F397
F399
F39F
F3A1
F3A1
F3A1
F3A7
F3A9
F3AF
F3B1
F3B7
F3B9
F3BF
F3C1
F3C7
F3C9
F3CF
F3D1
F3D7
F3D9
F3DF
F3E1
F3E1
F3E7
F3E9
F3EF
F3F1
F3F7
F3F9
F3FF
F401
F407
F409
F40F
F411
F417
F419
F41F
F421
F421
F421
F427
F429
F42F
F431
F437
F439
F43F
F441
F447
F449
F44F
F451
F457
F459

087849410841
0140
004F00147F08
5902
22223E3E0008
0008
497F51491245
4909
494944002214
2251

.DB $08,$78,$49,$41,$08,$41,$01,$40

;X -- (

.DB $00,$4F,$00,$14,$7F,$08,$59,$02

;

.DB $22,$22,$3E,$3E,$00,$08,$00,$08

;( -- /

.DB $49,$7F,$51,$49,$12,$45,$49,$09

;0 -- 7

.DB $49,$49,$44,$00,$22,$14,$22,$51

;8 -- ?

;DOT PATTERNS FOR COLUMN 3
550949412249COL3
.DB $55,$09,$49,$41,$22,$49,$09,$49
0949
08413F224002
.DB $08,$41,$3F,$22,$40,$02,$30,$41
3041
092129490140
.DB $09,$21,$29,$49,$01,$40,$18,$20
1820
140845001041
.DB $14,$08,$45,$00,$10,$41,$01,$40
0140
0000077F2A64
.DB $00,$00,$07,$7F,$2A,$64,$26,$01
2601
411C08080008
.DB $41,$1C,$08,$08,$00,$08,$00,$04
0004
454049557F45
.DB $45,$40,$49,$55,$7F,$45,$49,$05
4905
492900004114
.DB $49,$29,$00,$00,$41,$14,$14,$09
1409
;DOT PATTERNS FOR COLUMN 4
1E7E36221C41COL4
.DB $1E,$7E,$36,$22,$1C,$41,$01,$7A
017A
7F000141407F
.DB $7F,$00,$01,$41,$40,$7F,$7F,$3E
7F3E
065E4631013F
.DB $06,$5E,$46,$31,$01,$3F,$07,$7F
077F
63074300607F
.DB $63,$07,$43,$00,$60,$7F,$02,$40
0240
000000141263
.DB $00,$00,$00,$14,$12,$63,$50,$00
5000
000014080008
.DB $00,$00,$14,$08,$00,$08,$00,$03
0003
3E4046221039
.DB $3E,$40,$46,$22,$10,$39,$31,$03
3103
361E00004114
.DB $36,$1E,$00,$00,$41,$14,$08,$06
0806
;ASCII
2008000D0000ROW1
0000
00605C000000ROW2
7F00
2E4C502D3A30ROW3
3B2F
4D4A494F3938ROW4
4B2C
424759553736ROW5
484E
434452543534ROW6
4656
5A4157453332ROW7
5358
00001B51315EROW8

CHARACTERS FOR KB
.DB $20,$08,$00,$0D,$00,$00,$00,$00
.DB $00,$60,'\',$00,$00,$00,$7F,$00
.DB ".LP-:0;/"
.DB "MJIO98K,"
.DB "BGYU76HN"
.DB "CDRT54FV"
.DB "ZAWE32SX"
.DB $00,$00,$1B,"Q1",$5E,"]["

-- '

;@ -- G
;H -- O
;P -- W
;X -- (
;

-- '

;( -- /
;0 -- 7
;8 -- ?
;@ -- G
;H -- O
;P -- W
;X -- (
;

-- '

;( -- /
;0 -- 7
;8 -- ?

2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907

F45F
F461
F461
F461
F464
F466
F469
F46C
F46C
F46F
F472
F474
F477
F478
F479
F47B
F47C
F47E
F480
F482
F484
F486
F487
F488
F48B
F48D
F48E
F48F
F490
F491
F493
F495
F497
F499
F49A
F49D
F4A0
F4A2
F4A4
F4A5
F4A7
F4A8
F4A9
F4AB
F4AD
F4AF
F4B0
F4B2
F4B3
F4B4
F4B6
F4B7
F4B9
F4BA
F4BB
F4BD
F4BE
F4C1
F4C4
F4C7
F4C8
F4C9

5D5B
AD
F0
20
20

0E A4
06
32 E2
24 EA

20
20
A0
20
A8
4A
90
4A
B0
C9
F0
29
09
4A
AA
BD
B0
4A
4A
4A
4A
29
D0
A0
A9
AA
BD
8D
29
85
98
29
AA
98
A0
E0
F0
4A
90
4A
4A
09
88
D0
C8
88
D0
48
20
20
20
68
A8
B9

45 F5
3C F5
00
56 EB
0B
17
22
13
07
80
5B F5
04

0F
04
80
00
9F F5
16 01
03
EA
8F
03
8A
0B
08
20
FA
F2
56 EB
46 EA
45 F5
B9 F5

;DISASSEMBLE INSTRUCTIONS AND SHOW REGS IS REGF SET
REGQ
LDA REGF
;GET FLAG
BEQ DISASM
JSR REG1
;SHOW THE SIX REGS
JSR CRCK
;
DISASM JSR
JSR
LDY
JSR
TAY
LSR
BCC
LSR
BCS
CMP
BEQ
AND
ORA
IEVEN LSR
TAX
LDA
BCS
LSR
LSR
LSR
LSR
RTMODE AND
BNE
ERR
LDY
LDA
GETFMT TAX
LDA
STA
AND
STA
TYA
AND
TAX
TYA
LDY
CPX
BEQ
MNNDX1 LSR
BCC
LSR
MNNDX2 LSR
ORA
DEY
BNE
INY
MNNDX3 DEY
BNE
PHA
JSR
JSR
JSR
PLA
TAY
LDA

PRBL2
PRPC
#0
PCLLD

;OUTPUT PROG COUNTR

A
IEVEN
A
ERR
#$22
ERR
#7
#$80
A
MODE,X
RTMODE
A
A
A
A
#$F
GETFMT
#$80
#0
MODE2,X
FORMA
#3
LENGTH
#$8F

;OPCODE
;OPCODE IN A AGAIN

#3
#$8A
MNNDX3
A
MNNDX3
A
A
#$20
MNNDX2
MNNDX1
PCLLD
NUMA
PRBL2
MNEML,Y

;SAVE MNEMONIC TABLE INDEX
;PRINT LAST BLANK

2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969

F4CC
F4CF
F4D2
F4D5
F4D7
F4D9
F4DB
F4DE
F4E1
F4E2
F4E3
F4E5
F4E7
F4EA
F4EB
F4ED
F4F0
F4F2
F4F4
F4F7
F4F9
F4FB
F4FD
F4FF
F502
F504
F507
F509
F509
F50A
F50D
F50F
F512
F512
F513
F516
F517
F519
F51C
F51E
F521
F524
F527
F529
F52C
F52D
F52F
F530
F533
F534
F535
F537
F538
F539
F53C
F53F
F542
F545
F547
F54A
F54C
F54D

8D
B9
8D
A2
A9
A0
0E
2E
2A
88
D0
69
20
CA
D0
20
A2
A9
8D
E0
D0
A4
F0
AD
C9
20
B0

17
F9
18
03
00
05
18
17

01
F5
01

01
01

F6
BF
BC E9
EA
45
06
00
29
03
1E
EA
1A
16
E8
56
27

F5
A4

01
EB

48
AD 29 A4
D0 03
EE 29 A4
68
20
88
D0
0E
90
BD
20
BD
F0
20
CA
D0
60
20
AA
E8
D0
C8
98
4C
AD
AE
20
A9
4C
A5
38
AC

STA LMNEM
LDA MNEMR,Y
STA RMNEM
LDX #3
PRMN1 LDA #0
LDY #5
PRMN2 ASL RMNEM
ROL LMNEM
ROL A
DEY
BNE PRMN2
ADC #'?'+$80
JSR OUTALL
DEX
BNE PRMN1
JSR PRBL2
LDX #6
LDA #0
STA STIY+2
PRADR1 CPX #3
BNE PRADR3
LDY LENGTH
BEQ PRADR3
PRADR2 LDA FORMA
CMP #$E8
JSR PCLLD
BCS RELADR
;SE IF SYMBOL
PHA
LDA STIY+2
BNE MR11A
INC STIY+2
MR11A

46 EA
E6
16
0E
AC
BC
B2
03
BC

01

PRADR3

F5
E9
F5
E9
PRADR4

C8
4D F5

RELADR

01
42
26
25
42
20
BC
EA

EA
A4
A4
EA

PRNTXY
PRPC
PRBL2

E9

26 A4

PCADJ3

PLA
JSR
DEY
BNE
ASL
BCC
LDA
JSR
LDA
BEQ
JSR
DEX
BNE
RTS
JSR
TAX
INX
BNE
INY
TYA
JMP
LDA
LDX
JSR
LDA
JMP
LDA
SEC
LDY

;MUST BE

;ADD "?" OFFSET

;FLAG
;IF X=3 PRINT ADDR VALUE
;1 BYTE INSTR
;RELATIVE ADDRESSING

;SHOW WE WERE HERE

NUMA
PRADR2
FORMA
PRADR4
CHAR1-1,X
OUTALL
CHAR2-1,X
PRADR4
OUTALL
PRADR1
PCADJ3
PRNTXY
WRAX
SAVPC+1
SAVPC
WRAX
#' '
OUTALL
LENGTH

;PRINT A &X
;PRINT PC

SAVPC+1

;PRG CNTR HIGH

2970
2971
2972
2973
2974
2975
2976
2977
2978
2978
2979
2979
2980
2980
2981
2981
2982
2982
2983
2983
2984
2985
2986
2986
2987
2988
2989
2989
2990
2991
2992
2993
2994
2995
2995
2996
2997
2997
2998
2998
2999
2999
3000
3000
3001
3001
3002
3002
3003
3003
3004
3005
3005
3006
3007
3007
3008
3008
3009
3009
3010
3010

F550
F551
F553
F554
F557
F559
F55A
F55B
F55B
F561
F563
F569
F56B
F571
F573
F579
F57B
F581
F583
F589
F58B
F58F
F593
F599
F59B
F59F
F59F
F5A5
F5A7
F5AD
F5AD
F5B3
F5B9
F5B9
F5BF
F5C0
F5C1
F5C7
F5C9
F5CF
F5D1
F5D7
F5D9
F5DF
F5E1
F5E7
F5E9
F5EF
F5F1
F5F7
F5F9
F5F9
F5FF
F600
F601
F607
F609
F60F
F611
F617
F619
F61F

AA
10 01
88
6D 25 A4
90 01
C8
60

TAX
BPL PCADJ4
DEY
PCADJ4 ADC SAVPC
BCC RTS1
INY
RTS1
RTS

;PROG CNTR LOW

40024503D008MODE
4009
30224533D008
4009
40024533D008
4009
400245B3D008
4009
00224433D08C
4400
11224433D08C
449A
10 22 44 33
D0 08 40 09
10224433D008
4009
62 13 78 A9

.DB $40,2,$45,3,$D0,8,$40,9

002101020080MODE2
594D
1112064A051D

.DB 0,$21,1,2,0,$80,$59,$4D

2C292C23282ECHAR1
590058000041CHAR2

.DB ",",$29,",#(","."
.DB "Y",0,"X",0,0,"A"

1C8A1C235D8BMNEML
1B
A1
9D8A1D239D8B
1DA1
002919AE69A8
1923
24531B232453
19A1
001A5B5BA569
2424
AEAEA8AD2900
7C00
159C6D9CA569
2953
84133411A569
23A0

.DB $1C,$8A,$1C,$23,$5D,$8B,$1B

D8625A482662MNEMR
94
88
5444C8546844
E894
00B4088474B4
286E
74F4CC4A72F2
A48A
00AAA2A27474
7472

.DB $D8,$62,$5A,$48,$26,$62,$94

.DB $30,$22,$45,$33,$D0,8,$40,9
.DB $40,2,$45,$33,$D0,8,$40,9
.DB $40,2,$45,$B3,$D0,8,$40,9
.DB 0,$22,$44,$33,$D0,$8C,$44,0
.DB $11,$22,$44,$33,$D0,$8C,$44,$9A
.DB $10,$22,$44,$33
.DB $D0,8,$40,9
.DB $10,$22,$44,$33,$D0,8,$40,9
.DB $62,$13,$78,$A9

.DB $11,$12,6,$4A,5,$1D

.DB $A1
.DB $9D,$8A,$1D,$23,$9D,$8B,$1D,$A1
.DB 0,$29,$19,$AE,$69,$A8,$19,$23
.DB $24,$53,$1B,$23,$24,$53,$19,$A1
.DB 0,$1A,$5B,$5B,$A5,$69,$24,$24
.DB $AE,$AE,$A8,$AD,$29,0,$7C,0
.DB $15,$9C,$6D,$9C,$A5,$69,$29,$53
.DB $84,$13,$34,$11,$A5,$69,$23,$A0

.DB $88
.DB $54,$44,$C8,$54,$68,$44,$E8,$94
.DB 0,$B4,8,$84,$74,$B4,$28,$6E
.DB $74,$F4,$CC,$4A,$72,$F2,$A4,$8A
.DB 0,$AA,$A2,$A2,$74,$74,$74,$72

3011
3011
3012
3012
3013
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069

F621
F627
F629
F62F
F631
F637
F639
F639
F639
F639
F639
F639
F639
F639
F639
F639
F639
F639
F639
F639
F639
F639
F639
F639
F639
F639
F639
F63C
F63E
F641
F644
F647
F649
F64C
F64E
F651
F653
F656
F658
F65A
F65D
F65E
F660
F663
F666
F668
F66B
F66E
F670
F673
F676
F678
F67A
F67D
F680
F683
F685
F688
F68A
F68D
F68D
F690

4468B232B200
2200
1A1A26267272
88C8
C4CA26484444
A2C8

.DB $44,$68,$B2,$32,$B2,0,$22,0
.DB $1A,$1A,$26,$26,$72,$72,$88,$C8
.DB $C4,$CA,$26,$48,$44,$44,$A2,$C8
;*******************************
;***
AIM TEXT EDITOR
***
;***
05/01/78
***
;*******************************
;
;
;
;
;
;
;
;
;
;
;
;

20
A0
20
20
20
B0
AD
F0
20
A2
BD
95
95
9D
CA
10
20
20
B0
20
AD
F0
20
20
90
A9
8D
20
AD
85
AD
85
20

13
6C
AF
13
A3
FB
1E
03
DB
01
1C
E3
E1
1A
F3
3B
A7
FB
BC
1E
10
34
B6
FB
00
1C
DB
1C
E5
1D
E6
34

EA
E7
EA
E7
A4
E2
A4
A4
E8
E7
F8
A4
F9
F6
A4
E2
A4
A4
F9

20 B6 F6
90 FB

R=READ FROM ANY INPUT DEVICE
I=INSERT A LINE FROM INPUT DEV
K=DELETE A LINE
U-GO UP ONE LINE
D=GO DOWN ONE LINE
L=LIST LINES TO OUTPUT DEV
T=GO TO TOP OF TEXT
B=GO TO BOTTOM OF TEXT
F=FIND STRING
C=CHANGE STRING TO NEW STRING
Q=QUIT EDITOR
=DISPLAY CURRENT LINE

;***** E COMMAND-EDITOR ENTRY (FROM MONITOR) *****
EDIT
JSR CRLOW
LDY #EMSG1-M1
JSR KEP
;START UP MSG
JSR CRLOW
EDI0
JSR FROM
BCS EDI0
LDA CKSUM
;IS CLR IF ADDR WAS INPUTTED
BEQ *+5
JSR WRITAZ
;OUTPUT DEFAULT ADDR (0200)
LDX #1
EDI1
LDA ADDR,X
STA TEXT,X
STA BOTLN,X
STA S1,X
;FOR MEMORY TEST
DEX
BPL EDI1
JSR BLANK2
EDI2
JSR TO
;END
BCS EDI2
JSR TOPNO
;TRANSF TEXT TO ADDR FOR RAM CHECK
LDA CKSUM
;IS CLR IF ADDR WAS INPUTTED
BEQ EDI4
;BRNCH IF NOT DEFAULT VALUE
JSR SAVNOW
EDI3
JSR EDI
;CARRY IS SET IF NO RAM THERE
BCC EDI3
LDA #0
;SET UPPER LIMIT TO BEGINNING...
STA ADDR
;OF PAGE
JSR WRITAZ
;OUTPUT DEFAULT VALUE ,UPPER LIMIT
EDI4
LDA ADDR
STA END
LDA ADDR+1
STA END+1
JSR SAVNOW
;NOW SEE IF MEMORY IS THERE
EDI5
JSR EDI
BCC EDI5

3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131

F692
F694
F697
F699
F69B
F69E
F6A0
F6A2
F6A5
F6A7
F6AA
F6AC
F6AE
F6B0
F6B3
F6B6
F6B6
F6B8
F6BB
F6BC
F6BE
F6C1
F6C3
F6C4
F6C7
F6CA
F6CB
F6CC
F6CD
F6CE
F6CF
F6CF
F6CF
F6CF
F6D2
F6D5
F6D8
F6D8
F6D8
F6D8
F6D8
F6DB
F6DD
F6E0
F6E3
F6E5
F6E8
F6EB
F6EE
F6F0
F6F2
F6F4
F6F6
F6F9
F6F9
F6F9
F6F9
F6F9
F6FC
F6FF
F702
F704

A5
CD
F0
B0
20
A9
91
20
A9
4C
A5
F0
A9
8D
4C

E6
1D
11
13
BC
00
DF
13
52
8D
E5
ED
00
1C
33

A0
20
48
A9
20
D0
68
20
EE
18
60
38
68
60

00
B7 FE

A4
F8

EDI6

EA
FA
EDI7
A4
EB

EDI8

EDI

AA
78 EB
09
78 EB
1D A4
EDI2B

LDA
CMP
BEQ
BCS
JSR
LDA
STA
JSR
LDA
JMP
LDA
BEQ
LDA
STA
JMP

END+1
ADDR+1
EDI7
EDI8
TOPNO
#0
(NOWLN),Y
CRLOW
#'R'
ENTRY
END
EDI6
#0
ADDR
MEMERR

;CMP WITH END

LDY
JSR
PHA
LDA
JSR
BNE
PLA
JSR
INC
CLC
RTS
SEC
PLA
RTS

#0
PATCH6

;CHCK IF MEMORY WRITES
;GET BYTE ADDR BY ADDR,ADDR+1
;SAVE IT
;SET THIS PATTERN
;CHCK IT

#$AA
SADDR
EDI2B
SADDR
ADDR+1

;RESTORE NOWLN
;END OF TEXT MARKER
;FORCE READ COMMAND
;IF ZERO MEM IS OKAY

;NO MEMORY FOR THOSE LIMITS

;RESTORE CHR
;NEXT PAG
;IT WROTE
;DIDNT WRITE

20 24 EA
20 BC F8
4C B9 F7

;***** T COMMAND-REENTRY EDITOR *****
;RE-ENTRY POINT,TEXT ALREADY THERE
REENTR JSR CRCK
; IF PRI ON
TP
JSR TOPNO
;GO TO TOP
JMP IN03A
;DISPLAY LINE

20
90
20
4C
A0
20
20
20
B0
B1
C9
D0
4C

;***** U COMMAND-UP LINE *****
;GO UP ONE LINE BUT...
;DOWN IN ADDRESSING MEMORY
DNNO
JSR ATTOP
;THIS RTN DOESNT PRINT
BCC DOW1
;NOT TOP
JSR PLNE
;ARE AT TOP
JMP ERR0
DOW1
LDY #0
JSR SUB
;DECREMENT NOWLN PAST 
DOW2
JSR SUB
JSR ATTOP
BCS UP4
LDA (NOWLN),Y
CMP #CR
BNE DOW2
JMP AD1

20
20
20
90
A0

DB
06
27
78
00
1D
1D
DB
30
DF
0D
F2
28

F8
F7
FA
F9
F9
F8

F9

09 F7
27 F7
E9 F8
1C
72

;***** D COMMAND-DOWN LINE *****
;GO DOWN ONE LINE BUT...
;UP IN ADDRESSING MEMORY
UP
JSR UPNO
JSR PLNE
;DISPLAY LINE & CHCK BOTTOM
JSR ATBOT
BCC UP4
LDY #EMSG2-M1
;PRINT "END"

3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193

F706
F709
F70B
F70E
F710
F713
F715
F717
F718
F71A
F71C
F71D
F720
F721
F721
F721
F724
F724
F727
F727
F727
F729
F72B
F72D
F72F
F731
F734
F737
F738
F73B
F73D
F73F
F742
F744
F746
F749
F74C
F74C
F74C
F74C
F74F
F750
F751
F752
F755
F758
F75A
F75C
F75E
F761
F764
F764
F764
F767
F76A
F76D
F770
F772
F774
F777
F77A
F77D

4C
A0
20
90
4C
B1
F0
C8
C9
D0
98
20
60

AF E7
00
E9 F8
03
5C FA
DF
09

UP4

JMP
LDY
JSR
BCC
JMP
LDA
BEQ
INY
CMP
BNE
TYA
JSR
RTS

20 D8 F6

;*****
BT
;START
DOWN

B COMMAND-GO TO BOTTOM *****
JSR SETBOT
U-COMMAND HERE
JSR DNNO
;U COMMAND

A0
B1
F0
C9
F0
20
99
C8
4C
84
84
AC
C0
F0
4C
4C

;*****  COMMAND-DISPLAY CURRENT LINE *****
PLNE
LDY #0
;PRINT CURRENT LINE
P02
LDA (NOWLN),Y
BEQ P01
;PAST END ?
CMP #CR
;DONE?
BEQ P01
JSR OUTALL
;PUT IT SOMEWHERE
STA DIBUFF,Y
INY
JMP P02
P01
STY LENGTH
STY OLDLEN
P03
LDY OUTFLG
;ONE MORE  FOR TAPE
CPY #CR
BEQ P00
JMP CRLF
;TO OUTPUT DEV
P00
JMP CRCK
;, & DONT CLR DISPL

UPNO

UP1

0D
F7
2A F9

20 C5 F8

00
DF
0E
0D
0A
BC E9
38 A4
29
EA
E9
13
0D
03
F0
24

F7
A4
E9
EA

20
EA
EA
EA
20
20
B0
A0
84
20
4C

B6 F8

27
E9
CD
00
EA
3F
27

F7
F8

20
20
4C
20
A0
84
20
20
20
20

6D
F9
78
B6
00
E9
BD
44
93
F8

F7
F6
FA
F8

F9
F7

E7
EB
E9
FE

KEP
#0
ATBOT
UP1
ENDERR
(NOWLN),Y
UP4
#CR
UP1
ADDA

;ADD LENGTH TO CURRENT LINE

;***** K COMMAND-KILL LINE *****
;DELETE CURRENT LINE
DLNE
JSR KIFLG
;CLR K OR I COMM FLG
NOP
NOP
NOP
JSR PLNE
JSR ATBOT
BCS PLNE
;AT END OF TEXT
LDY #0
STY LENGTH
JSR REPLAC
;KILL LINE
JMP PLNE
;***** I COMMAND-INSERT LINE *****
IN
JSR INL
JSR UP
;DISPLAY NEXT LINE DOWN
JMP ERR0
;IF AT BOTTOM PRINT "END"
INL
JSR KIFLG
;CLR K OR I COMM FLG
LDY #0
;GET LINE INTO DIBUFF
STY OLDLEN
JSR PROMPT
JSR CLR
IN02
JSR INALL
JSR PATC12
;CLR, SO WE CAN OUTPUT TO PRI

3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255

F780
F782
F785
F787
F789
F78B
F78D
F78F
F791
F794
F795
F797
F799
F79B
F79D
F7A0
F7A3
F7A6
F7A8
F7AA
F7AC
F7AE
F7B1
F7B3
F7B6
F7B9
F7BC
F7BF
F7C2
F7C5
F7C8
F7CB
F7CB
F7CB
F7CB
F7CB
F7CE
F7D1
F7D3
F7D5
F7D8
F7DB
F7DE
F7E1
F7E1
F7E1
F7E1
F7E4
F7E7
F7EA
F7ED
F7F0
F7F3
F7F6
F7F8
F7FB
F7FE
F801
F803
F806
F809
F80C

C9
4C
C9
F0
C9
F0
C0
B0
99
C8
C0
D0
A0
A9
0D
8D
8C
D0
84
C0
D0
AD
D0
20
20
20
20
20
4C
20
4C

20
AC
C0
F0
20
20
20
4C

20
20
20
20
4C
20
20
F0
20
20
20
90
20
20
4C

7F
2A FF
0A
F1
0D
1B
3C
08
38 A4
3C
E1
3C
01
11
11
15
D2
EA
00
17
19
12
24
03
27
09
D8
78
3F
24

48
12
54
03
13
6D
09
D8

37
85
13
71
F8
07
90
0B
27
09
E9
ED
3F
0D
5C

IN02A

IN03B
A4
A4
A4
IN03
A4
EA
FF
F7
F7
F6
FA
F9
EA

E8
A4
EA
F7
F7
F7

E8
E7
EA
E8
F7
E9
E7
F7
F7
F8
F7
FF
FA

IN03A

IN05

CMP
JMP
CMP
BEQ
CMP
BEQ
CPY
BCS
STA
INY
CPY
BNE
LDY
LDA
ORA
STA
STY
BNE
STY
CPY
BNE
LDA
BNE
JSR
JSR
JSR
JSR
JSR
JMP
JSR
JMP

#$7F
PATC17
#LF
IN02
#CR
IN03
#60
IN03B
DIBUFF,Y
#60
IN02
#60
#$01
PRIFLG
PRIFLG
CURPO2
IN02
LENGTH
#0
IN05
COUNT
IN05
CRCK
PATC13
PLNE
UPNO
DNNO
ERR0
REPLAC
CRCK

;RUB
;NO ZEROS IN CASE OF PAPER TAPE

;DO NOT INCR Y IF 60

;CONTIN , DISP WONT ALLOW > 60 CHR`
;SET Y TO MAX OF 60
;DO NOT OUTPUT TO PRI ANY MORE
;OTHERWISE CLOBBERS THE BUFFER
;GO BACK
;FIRST CHAR?
;K OR I COMM FLG ?
;BRANCH IF C COMMAND
; IF PRI PNTR DIFF FROM 0
;TURN ON TAPES & SET DEFAULT DEV
;DISPLAY NEXT LINE DOWN
;PRINT "END" IF BOTTOM
;INSERT THE LINE
; IF PRI PTR NOT 0

;***** R COMMAND-READ LINE *****
;READ TEXT FROM ANY INPUT DEVICE UNTIL
;TWO CONSECUTIVE  ARE ENCOUNTER.
INPU
JSR WHEREI
LDY INFLG
;IF TAPE DO NOT ERRASE BUFFER
CPY #'T'
BEQ INPU1
JSR CRLOW
INPU1 JSR INL
JSR UPNO
;NEXT LINE
JMP INPU1
;***** L COMMAND-LIST LINES *****
;PRINT FROM HERE N LINES TO ACTIVE OUTPUT DEV
LST
JSR PSL1
;PRINT "/"
JSR GCNT
;GET LINES COUNT
JSR CRLOW
JSR WHEREO
;WHERE TO
JMP LST02
;ONE MORE LINE
LST01 JSR RCHEK
JSR DONE
BEQ LST3
LST02 JSR PLNE
JSR UPNO
;NEXT LINE
JSR ATBOT
BCC LST01
;NO
LST3
JSR P03
;ONE MORE CRLF FOR TAPE
JSR PATC14
;CLOSE TAPE IF NEEDED
JMP ENDERR

3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317

F80C
F80C
F80C
F80F
F812
F813
F816
F819
F81A
F81D
F81E
F81E
F820
F823
F826
F828
F82A
F82C
F82E
F831
F834
F836
F838
F83B
F83C
F83E
F840
F843
F846
F849
F84B
F84E
F851
F853
F855
F857
F85A
F85C
F85E
F860
F862
F865
F868
F869
F86A
F86D
F86F
F870
F870
F870
F870
F873
F876
F876
F876
F876
F879
F87C
F87F
F881
F883
F886

20
AD
48
20
20
68
8D
60

1E F8
15 A4

A0
20
20
C9
D0
C0
D0
20
4C
C9
F0
99
C8
C0
D0
4C
20
8C
A0
8C
AC
A2
B1
D0
4C
C9
F0
D5
F0
EE
4C
C8
E8
EC
D0
60

00
BD
5F
0D
0A
00
06
09
49
0D
0B
EB

44 EB
27 F7
15 A4

14
E3
72
24
29
00
15
15
00
DF
03
5C
0D
D0
EB
06
15
4E

E7
E9

F7
F8
00

FA
EA
A4
A4
A4

FA

A4
F8

29 A4
E4

;***** F COMMAND-FIND STRING *****
;FIND STRING AND PRINT LINE TO TERMINAL
FCHAR JSR FCH
FCHA1 LDA CURPO2
;SAVE BUFFER PNTR
PHA
JSR CLR
;CLEAR DISP PNTR
JSR PLNE
PLA
STA CURPO2
RTS
;FIND A CHARACTER STRING
FCH
LDY #0
JSR PROMPT
FC1
JSR RDRUP
;GET THE CHARACTER
CMP #CR
;REUSE OLD ARGUMENT??
BNE FC3
CPY #0
;FIRST CHAR?
BNE FC3
FC2
JSR UPNO
;NEXT LINE DOWN
JMP FC5
FC3
CMP #CR
;DONE
BEQ FC4
STA STRING,Y
INY
CPY #20
;MAX LENGTH
BNE FC1
JMP ERROR
FC4
JSR CRCK
;CLEAR DISPLAY
STY STIY+2
;COUNT OF CHARACTERS
FC5
LDY #0
STY CURPO2
;START AT BEGINNING OF LINENTR IS
FC6
LDY CURPO2
;CLOBBER
LDX #0
FC7
LDA (NOWLN),Y
;GET THE CHARACTER
BNE FC8
;NOT AT END
JMP ENDERR
FC8
CMP #CR
;END OF LINE
BEQ FC2
CMP STRING,X
BEQ FC9
INC CURPO2
JMP FC6
FC9
INY
INX
CPX STIY+2
;DONE?
BNE FC7
RTS

20 13 EA
4C A1 E1

;***** Q COMMAND-EXIT EDITOR *****
; EXIT THE TEXT EDITOR NEATLY
STOP
JSR CRLOW
JMP COMIN

20
20
20
C9
F0
20
20

;***** C COMMAND-CHANGE STRING *****
;CHANGE STRING TO ANOTHER STRING IN A LINE
CHNG
JSR CFLG
;SET C COMMAND FLG
JSR FCHAR
;FIND CORRECT LINE
CHN1
JSR READ
;IS  IF OK
CMP #CR
BEQ CHN2
JSR FC2
;TRY NEXT ONE
JSR FCHA1
; SHOW LINE

B2
0C
3C
0D
09
2E
0F

F8
F8
E9
F8
F8

3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379

F889
F88C
F88F
F891
F894
F895
F898
F89B
F89D
F8A0
F8A2
F8A5
F8A6
F8A7
F8A9
F8AC
F8AD
F8AF
F8B2
F8B2
F8B2
F8B4
F8B6
F8B8
F8BB
F8BC
F8BC
F8BE
F8C0
F8C2
F8C4
F8C5
F8C5
F8C7
F8C9
F8CB
F8CD
F8D0
F8D0
F8D3
F8D5
F8D8
F8DA
F8DB
F8DB
F8DB
F8DD
F8DF
F8E1
F8E3
F8E5
F8E7
F8E8
F8E9
F8E9
F8E9
F8EB
F8ED
F8EF
F8F1
F8F3
F8F5

4C
AD
85
AD
48
20
20
A0
20
A0
20
68
AA
F0
20
CA
D0
4C

7C F8
29 A4
E9
15 A4

A9
D0
A9
8D
60

01
02
00
19 A4

A5
A6
85
86
60

E3
E4
DF
E0

TOPNO

LDA
LDX
STA
STX
RTS

TEXT
TEXT+1
NOWLN
NOWLN+1

;SET CURRENT LINE TO TOP

A5
A6
85
86
4C

E1
E2
E7
E8
C0 F8

SETBOT LDA
LDX
STA
STX
JMP

BOTLN
BOTLN+1
SAVE
SAVE+1
TPO1

;SET CURRENT LINE TO BOTTOM

AD
85
AD
85
60

1C A4
DF
1D A4
E0

RESNOW LDA
STA
LDA
STA
RTS

ADDR
NOWLN
ADDR+1
NOWLN+1

;RESTORE CURRENT LINE ADDRESS

A5
C5
D0
A5
C5
D0
38
60

DF
E3
16
E0
E4
10

A5
A6
C5
D0
E4
D0
38

DF
E0
E1
06
E2
02

2A
44
05
AF
00
7A

CHN2

F9
EB
E7
F7

06
1D F9

CHN3

FA
27 F7

CHN4

JMP
LDA
STA
LDA
PHA
JSR
JSR
LDY
JSR
LDY
JSR
PLA
TAX
BEQ
JSR
DEX
BNE
JMP

CHN1
STIY+2
OLDLEN
CURPO2
ADDA
CLR
#M3-M1
KEP
#0
IN02

;GET CHAR COUNT
;GET READY FOR REPLAC
;PNTR TO BEGINNING OF STRING
;SAVE IT
;ADD TO NOWLN (LINE PNTR)
;CLEAR DISP
;PRINT "TO"
;GET NEW STRING & REPLAC

CHN4
SUB

;RESTORE NOWLN WHERE IT WAS

CHN3
PLNE

;DISPLAY THE CHANGED LINE

;THE FOLLOWING ARE SUBROUTINES USED BY COMMANDS
CFLG
LDA #1
;SET FLG FOR C COMMAND
BNE KI2
KIFLG LDA #0
;CLR K OR I COMMAND FLG
KI2
STA COUNT
RTS

TPO1

; SEE IF CURRENT LINE AT TOP (C SET IF SO)
ATTOP LDA NOWLN
CMP TEXT
BNE AT01
LDA NOWLN+1
CMP TEXT+1
BNE AT01
SEC
RTS
; SEE IF CURRENT LINE AT BOTTOM (C SET IF SO)
ATBOT LDA NOWLN
LDX NOWLN+1
CMP BOTLN
BNE AT01
CPX BOTLN+1
BNE AT01
AT02
SEC

3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441

F8F6
F8F7
F8F8
F8F9
F8F9
F8F9
F8FB
F8FD
F8FF
F901
F903
F905
F907
F909
F909
F909
F90B
F90D
F910
F910
F910
F913
F916
F919
F91C
F91D
F91D
F91D
F91F
F921
F923
F925
F927
F928
F928
F928
F92A
F92B
F92D
F92F
F931
F933
F934
F934
F936
F939
F93B
F93E
F93F
F93F
F93F
F93F
F941
F943
F945
F947
F949
F94B
F94E
F94E
F94E
F94F

60
18
60
A5
A6
E4
90
D0
C5
90
B0

AT01

RTS
CLC
RTS

;SEE IF WE
ATEND LDA
LDX
CPX
BCC
BNE
CMP
BCC
BCS

E1
E2
E6
F6
F2
E5
F0
EC

RAN PAST END OF BUFFER LIMIT
BOTLN
BOTLN+1
END+1
;HIGH BYTE > OR = ?
AT01
AT02
END
;LOW BYTE > OR = ?
AT01
AT02

A5 DF
A6 E0
4C 16 F9

; SAVE CURRENT LINE (NEWLN) IN S1
NOWS1 LDA NOWLN
LDX NOWLN+1
JMP ADDS1A

AD
AE
8D
8E
60

1C
1D
1A
1B

; MOVE ADDR INTO S1
ADDRS1 LDA ADDR
LDX ADDR+1
ADDS1A STA S1
STX S1+1
RTS

C6
A5
C9
D0
C6
60

DF
DF
FF
02
E0

A9
18
65
85
90
E6
60

01

A5
8D
A5
8D
60

DF
1C A4
E0
1D A4

A4
C4
D0
F0
A9
91
20

A4
A4
A4
A4

DF
DF
02
E0

EA
E9
1A
07
0D
DF
4A FA

88
C0 FF

; SUBTRACT
SUB
DEC
LDA
CMP
BNE
DEC
SUB1
RTS

ONE FROM CURRENT LINE (NOWLN)
NOWLN
NOWLN
#$FF
SUB1
NOWLN+1

; ADD ACC TO CURRENT LINE (NOWLN)
AD1
LDA #1
ADDA
CLC
ADC NOWLN
STA NOWLN
BCC ADDA1
INC NOWLN+1
ADDA1 RTS
SAVNOW LDA
STA
LDA
STA
REP2
RTS

NOWLN
ADDR
NOWLN+1
ADDR+1

;SAVE CURRENT LINE INTO ADDR

;MOVE CURRENT TEXT AROUND TO HAVE
;SPACE TO PUT IN THE NEW BUFFER
REPLAC LDY LENGTH
CPY OLDLEN
;COMPARE OLD AND NEW LENGTHS
BNE R2W
;BRANCH IF DIFF
BEQ R87
;LENGTHS ARE EQUAL. JUST REPLACE
R8
LDA #CR
STA (NOWLN),Y
JSR GOGO
;LENGTH = OLDLEN
R87
DEY
CPY #$FF

3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503

F951
F953
F956
F958
F95B
F95C
F95E
F95F
F961
F961
F961
F964
F967
F969
F96A
F96C
F96E
F970
F973
F975
F977
F978
F979
F97C
F97F
F981
F984
F986
F989
F98B
F98E
F98F
F992
F994
F996
F999
F99B
F99D
F9A0
F9A3
F9A5
F9A8
F9AB
F9AE
F9AF
F9B2
F9B4
F9B5
F9B8
F9BA
F9BC
F9BE
F9C1
F9C3
F9C5
F9C7
F9C9
F9CB
F9CC
F9CF
F9CF
F9CF

F0
B9
91
20
88
10
60
B0

EB
38 A4
DF
4A FA

20
20
A5
38
E5
A4
D0
AE
D0
69
48
18
6D
8D
90
EE
A9
20
91
20
AA
AD
C5
D0
AD
C5
F0
20
EE
D0
EE
4C
20
68
8D
A5
38
ED
85
B0
C6
AD
D0
A4
D0
A4
D0
60
4C

34 F9
10 F9
E9

R88

F5
6E

R2W

EA
EA
07
19 A4
02
00
1A
1A
03
1B
1A
58
DF
4A

A4
A4

1A
E1
07
1B
E2
0E
28
1A
03
1B
84
D0

A4

A4
EB
FA

A4
F9
A4
A4
F9
F8

2A A4
E1
2A A4
E1
02
E2
19 A4
04
EA
05
EA
83
47 F9

A5 EA

BEQ
LDA
STA
JSR
DEY
BPL
RTS
BCS

REP2
DIBUFF,Y
(NOWLN),Y
GOGO
R88
R100

;LENGTH < OLDLEN
JSR SAVNOW
JSR ADDRS1
LDA OLDLEN
SEC
SBC LENGTH
LDY LENGTH
BNE RQP
LDX COUNT
BNE RQP
ADC #0
RQP
PHA
CLC
ADC S1
STA S1
BCC R6
INC S1+1
R6
LDA #S1
JSR LDAY
STA (NOWLN),Y
JSR GOGO
TAX
LDA S1
CMP BOTLN
BNE R5
LDA S1+1
CMP BOTLN+1
BEQ R7
R5
JSR AD1
INC S1
BNE R55
INC S1+1
R55
JMP R6
R7
JSR RESNOW
PLA
STA CPIY
LDA BOTLN
SEC
SBC CPIY
STA BOTLN
BCS R9
DEC BOTLN+1
R9
LDA COUNT
BNE R10
LDY LENGTH
BNE R11
R10
LDY LENGTH
BNE R87
RTS
R11
JMP R8
;LENGTH > OLDLEN
R100
LDA LENGTH

;LENGTH > OLDLEN
;PUT NOWLN INTO ADDR
;PUT IT IN S1 ALSO
;GET DIFFERENCE IN LENGTHS
;C-COMM ?
;YES, JUMP
;INCLUDE 

;...AND NOVE IT UP (DOWN IN ADDR)

;DONE ??

;RESTORE NOWLN
;RESTORE DIFFERENCE
;SAVE IT
;AND SUBTRACT IT FROM BOTTOM

;C COMM OR K ,I COMM ?

;NEW LINE IS LONGER

3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565

F9D1
F9D2
F9D4
F9D6
F9D8
F9DA
F9DB
F9DE
F9E1
F9E3
F9E5
F9E7
F9E9
F9EC
F9EF
F9F0
F9F1
F9F2
F9F4
F9F6
F9F8
F9FA
F9FD
F9FF
FA01
FA03
FA05
FA07
FA0A
FA0D
FA0E
FA0F
FA11
FA13
FA15
FA17
FA19
FA1C
FA1E
FA21
FA24
FA27
FA29
FA2C
FA2F
FA31
FA34
FA37
FA3A
FA3C
FA3E
FA41
FA44
FA47
FA4A
FA4A
FA4A
FA4C
FA4E
FA4E
FA50
FA53

38
E5
A4
D0
69
48
20
20
A0
B1
C9
F0
20
4C
68
48
18
65
85
90
E6
20
90
A5
85
A5
85
4C
20
68
18
65
85
90
E6
A9
20
91
20
AD
CD
D0
AD
CD
F0
20
CE
AD
C9
D0
CE
4C
20
4C

E9
E9
02
00
34
C5
00
DF
00
06
28
E3

R101
F9
F8
R102
F9
F9
R108

E1
E1
02
E2
F9 F8
0B
E7
E1
E8
E2
5C FA
09 F9
DF
DF
02
E0
1A
58
DF
4A
1A
1C
08
1B
1D
13
1D
1A
1A
FF
03
1B
17
D0
BE

R103

R107

R104
EB
FA
A4
A4
A4
A4
F9
A4
A4
A4
FA
F8
F9

D1 DF
F0 0D
A5 DF
8D 1C A4
A5 E0

R105

R1051
R106

SEC
SBC
LDY
BNE
ADC
PHA
JSR
JSR
LDY
LDA
CMP
BEQ
JSR
JMP
PLA
PHA
CLC
ADC
STA
BCC
INC
JSR
BCC
LDA
STA
LDA
STA
JMP
JSR
PLA
CLC
ADC
STA
BCC
INC
LDA
JSR
STA
JSR
LDA
CMP
BNE
LDA
CMP
BEQ
JSR
DEC
LDA
CMP
BNE
DEC
JMP
JSR
JMP

OLDLEN
OLDLEN
R101
#0

;ALREADY HAVE ROOM FOR CR
;ADD ONE TO DIFFERENCE

SAVNOW
SETBOT
#0
(NOWLN),Y
#0
R108
AD1
R102

;NOWLN INTO S1

BOTLN
BOTLN
R103
BOTLN+1
ATEND
R107
SAVE
BOTLN
SAVE+1
BOTLN+1
ENDERR
NOWS1

;ADD DIFFERENCE TO END
;STORE NEW END

NOWLN
NOWLN
R104
NOWLN+1
#S1
LDAY
(NOWLN),Y
GOGO
S1
ADDR
R105
S1+1
ADDR+1
R106
SUB
S1
S1
#$FF
R1051
S1+1
R104
RESNOW
R9

;RESTORE OLD BOTTOM

;RAN PAST BUFFER END
;SAVE CURRENT END

;BACK WHERE WE STARTED ??
;BRANCH IF DONE

;SEE IF IT WROTE INTO MEMORY
GOGO
CMP (NOWLN),Y
BEQ GOGO1
;MOVE ADDRESS
LDA NOWLN
STA ADDR
LDA NOWLN+1

3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3607
3608
3608
3609
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624

FA55
FA58
FA5B
FA5C
FA5C
FA5F
FA61
FA64
FA67
FA6A
FA6C
FA6F
FA72
FA75
FA78
FA7B
FA7D
FA7D
FA7E
FA81
FA82
FA85
FA88
FA88
FA88
FA8A
FA8D
FA8F
FA92
FA94
FA95
FA97
FA9A
FA9D
FAA0
FAA3
FAA6
FAA9
FAAC
FAAC
FAAC
FAAC
FAB2
FAB8
FABE
FAC4
FACA
FAD0
FAD0
FAD0
FAD1
FAD2
FAD4
FAD6
FAD9
FADC
FADD
FADE
FAE1
FAE2
FAE2
FAE2

8D 1D A4
4C 33 EB
60
20
A0
20
20
20
D0
20
4C
20
20
20
A2

44
72
AF
D8
42
03
13
78
FE
D4
44
FF

EB

GOGO1

STA ADDR+1
JMP MEMERR
RTS

;OK

9A
20 FE E8
D8
20 88 FA
4C 78 FA

ENDERR JSR CLR
LDY #EMSG2-M1
JSR KEP
JSR DNNO
JSR TTYTST
BNE ENDE2
JSR CRLOW
ENDE2 JMP ERR0
ERROR JSR LL
JSR QM
ERR0
JSR CLR
LDX #$FF
COM
=ERR0
TXS
JSR LL
CLD
JSR COMM
JMP ERR0

A2
20
A2
DD
F0
CA
10
20
20
4C
20
BD
8D
6C

;GET EDITOR COMMANDS & DECODE
COMM
LDX #0
JSR PATCH8
;READ A CHAR WITH "=< >"
ENTRY LDX #COMCN1
CD02
CMP COMTBL,X
;COMPARE WITH ALLOWABLE COMMANDS
BEQ CFND1
;MATCH ,SO PROCESS COMMAND
DEX
BPL CD02
JSR QM
;NOT IN LIST ,SO NOT LEGAL COMMAND
JSR CRCK
JMP ERR0
CFND1 JSR PATC15
; & START DECODING COMMAND
LDA JTBL+1,X
STA S1+1
JMP (S1)

E7
F6
E8
EA
FA
E8
E7
EB

00
BC FE
0B
AC FA
0C
F8
D4
24
78
17
B9
1B
1A

E7
EA
FA
FF
FA
A4
A4

;CLEAR PNTR
;PRINT "END"
;BACK UP TO LAST LINE
;IF TTY 

;I/O TO TERMINAL (KB,D/P OR TTY)

COMCN1 =11
;COMMAND TABLE
4B2052495544COMTBL .DB "K RIUDLTBFQC"
4C5442465143
4CF727F7CBF7JTBL
.DW DLNE,PLNE,INPU,IN,DOWN,UP
64F724F7F9F6
E1F7D2F621F7
.DW LST,TP,BT,FCHAR,STOP,CHNG
0CF870F876F8
98
48
A0
B1
8D
20
68
A8
AD
60

00
DF
2A A4
28 F9
2A A4

;READ FROM
MREAD TYA
PHA
LDY
LDA
STA
JSR
PLA
TAY
LDA
RTS

MEMORY FOR ASSEMBLER
#0
(NOWLN),Y
CPIY
AD1
CPIY

;THIS PROGRAM CONVERS MNEMONIC INSTRUCTIONS INTO MACHINE
;CODE AND STORES IT IN THE DESIGNATED MEMORY AREA

3625
3626
3627
3627
3628
3628
3629
3629
3630
3630
3631
3631
3632
3632
3633
3633
3634
3634
3635
3636
3636
3637
3637
3638
3638
3639
3639
3640
3640
3641
3641
3642
3642
3643
3643
3644
3644
3645
3645
3646
3646
3647
3647
3648
3648
3649
3649
3650
3650
3651
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662

FAE2
FAE2
FAE2
FAE8
FAEA
FAF0
FAF1
FAF7
FAF9
FAFF
FB00
FB06
FB08
FB0E
FB0F
FB15
FB17
FB1D
FB1E
FB1E
FB24
FB26
FB2C
FB2E
FB34
FB36
FB3C
FB3E
FB44
FB46
FB4C
FB4E
FB54
FB56
FB5C
FB5E
FB64
FB66
FB6C
FB6E
FB74
FB76
FB7C
FB7E
FB84
FB86
FB8C
FB8E
FB94
FB96
FB9C
FB9E
FB9E
FB9E
FBA1
FBA4
FBA7
FBAA
FBAD
FBAF
FBB2
FBB5

;ROM TABLE
00020008F2FFTYPTR1 .DB
8001
C0E2C0C0FF00
.DB
00
0800108040C0TYPTR2 .DB
00C0
00400000E420
.DB
80
00FC000808F8CORR
.DB
FCF4
0C1004F40020
.DB
10
00000F010101SIZEM .DB
1111
020211110212
.DB
00
000810182028STCODE
3038
404850586068
7078
80889098ACA8
B0B8
CCC8D0D8ECE8
F0F8
0C2C4C4C8CAC
CCEC
8A9AAABACADA
EAFA
0E2E4E6E8EAE
CEEE
0D2D4D6D8DAD
CDED
0D0D0C0D0E0DTYPTB
0C0D
0D0D0C0D0D0D
0C0D
0F0D0C0D090D
0C0D
080D0C0D080D
0C0D
0F060B0B040A
0808
0D0D0D0D0D0F
0D0F
070707070509
0303
010101010201
0101
AD
8D
AD
8D
20
A9
8D
20
20

25
1C
26
1D
24
00
37
3E
DB

A4
A4
A4
A4
EA
A4
E8
E2

LOCATIONS:
00,02,00,08,$F2,$FF,$80,01
$C0,$E2,$C0,$C0,$FF,00,00
08,00,$10,$80,$40,$C0,00,$C0
$00,$40,00,00,$E4,$20,$80
00,$FC,00,08,08,$F8,$FC,$F4
$0C,$10,04,$F4,00,$20,$10
00,00,$0F,01,01,01,$11,$11
02,02,$11,$11,02,$12,00

.DB $00,$08,$10,$18,$20,$28,$30,$38
.DB $40,$48,$50,$58,$60,$68,$70,$78
.DB $80,$88,$90,$98,$AC,$A8,$B0,$B8
.DB $CC,$C8,$D0,$D8,$EC,$E8,$F0,$F8
.DB $0C,$2C,$4C,$4C,$8C,$AC,$CC,$EC
.DB $8A,$9A,$AA,$BA,$CA,$DA,$EA,$FA
.DB $0E,$2E,$4E,$6E,$8E,$AE,$CE,$EE
.DB $0D,$2D,$4D,$6D,$8D,$AD,$CD,$ED
.DB 13,13,12,13,14,13,12,13
.DB 13,13,12,13,13,13,12,13
.DB 15,13,12,13,9,13,12,13
.DB 8,13,12,13,8,13,12,13
.DB 15,6,11,11,4,10,8,8
.DB 13,13,13,13,13,15,13,15
.DB 7,7,7,7,5,9,3,3
.DB 1,1,1,1,2,1,1,1

;PROGRAM STARTS HERE
MNEENT LDA SAVPC
STA ADDR
LDA SAVPC+1
STA ADDR+1
STARTM JSR CRCK
LDA #0
STA CODFLG
JSR BLANK
JSR WRITAZ

;TRANSF PC TO ADDR

; IF PRI PTR DIFF FROM 0

;WRITE ADDRESS

3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724

FBB8
FBBB
FBBE
FBC1
FBC3
FBC6
FBC9
FBCC
FBCF
FBD0
FBD3
FBD6
FBD7
FBD9
FBD9
FBD9
FBDC
FBDE
FBE0
FBE2
FBE2
FBE2
FBE5
FBE7
FBE9
FBEC
FBED
FBEF
FBF2
FBF4
FBF6
FBF9
FBFA
FBFC
FBFE
FC01
FC03
FC05
FC08
FC0A
FC0C
FC0E
FC0E
FC0E
FC11
FC14
FC16
FC18
FC1A
FC1C
FC1F
FC21
FC23
FC25
FC28
FC2A
FC2C
FC2F
FC31
FC33
FC35
FC38

20
20
4C
A9
8D
8D
20
AC
38
6E
6E
88
D0

3B
3B
06
00
26
27
3E
2E

E8
E8
FE

F7

JSR
JSR
JMP
MODEM LDA
STA
STA
JSR
LDY
SEC
PNTLUP ROR
ROR
DEY
BNE

AC
C0
D0
A2

2E 01
0D
05
00

;TEST FOR ONE BYTE INSTRUCTION
LDY TYPE
CPY #$0D
BNE RDADDR
LDX #00

4C
A0
A9
99
88
D0
20
C9
F0
99
C8
C0
B0
20
C9
D0
EE
D0
C9
D0

CB FC
06
51
32 01

07
5C
5F E9
20
05
37 A4
04
0D
E8

;INPUT ADRESS FIELD
JMP OPCOMP
RDADDR LDY #06
LDA #'Q'
CLRLUP STA ADFLD-1,Y
DEY
BNE CLRLUP
JSR RDRUP
CMP #' '
BEQ RDADDR
STORCH STA ADFLD,Y
INY
CPY #07
BCS TRY56
JSR RDRUP
CMP #' '
BNE STOR1
INC CODFLG
BNE EVAL
STOR1 CMP #CR
BNE STORCH

8C
AD
C9
F0
C9
F0
AD
C9
D0
A2
4C
C9
D0
AD
C9
D0
A2
4C
A2

31
33
23
25
28
5A
31
01
05
01
CB
02
14
2E
0C
05
02
CB
05

;SEPARATE ADDRESS MODE FROM ADDRESS FIELD
EVAL
STY TEMPX
;TEMPX NOW HAS NUMBER OF CHAR
LDA ADFLD
;CHECK FIRST CHAR FOR # OR (
CMP #'#'
BEQ HATCJ
CMP #'('
BEQ PAREN
LDA TEMPX
;CHECK FOR ACCUMULATOR MODE
CMP #01
BNE TRYZP
ACCUM LDX #01
JMP OPCOMP
TRYZP CMP #02
;CHECK FOR ZERO PAGE MODE
BNE TRY34
LDA TYPE
;CHCK FOR BRNCH WITH RELATIVE ADDR`
CMP #$0C
BNE ZPAGE
LDX #02
JMP OPCOMP
ZPAGE LDX #05

01
01
E8
01

26 01
27 01

FA
5F E9
20
EF
33 01

A4
01

A4

FC
01

FC

BLANK2
BLANK2
MNEM
#00
TMASK1
TMASK2
BLANK
TYPE
TMASK1
TMASK2

;JUMP TO INPUT MNEMONIC OPCODE
;SET UP TO FORM MODE MATCH

;SHIFT POINTER TO INSTRUCTION TYPE

PNTLUP

;CLEAR ADDRESS FIELD (NON HEX)

;(LEAVES Y = 0 FOR NEXT PHASE)
;WITH RUBOUT
;IGNORE SPACE CHARACTERS
;STORE ADDRESS CHARACTER

;READ REMAINDER OF ADDRESS CHARS
;THRU WHEN  OR 
;SET CODE FLG
;CHECK FOR 

3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786

FC3A
FC3D
FC40
FC42
FC45
FC47
FC49
FC4C
FC4E
FC50
FC52
FC55
FC57
FC5A
FC5C
FC5F
FC61
FC63
FC65
FC68
FC6A
FC6C
FC6E
FC70
FC72
FC74
FC76
FC79
FC7B
FC7D
FC7F
FC81
FC83
FC85
FC87
FC89
FC8C
FC8E
FC90
FC92
FC94
FC97
FC99
FC9B
FC9E
FCA0
FCA2
FCA4
FCA6
FCA9
FCAB
FCAD
FCAF
FCB2
FCB4
FCB6
FCB6
FCB9
FCBB
FCBD
FCBF
FCC1

4C
4C
A9
CD
90
A2
20
D0
90
A2
4C
A2
4C
B0
20
D0
90
A9
CD
D0
A2
D0
A2
D0
A2
D0
AD
C9
F0
C9
D0
A2
D0
C9
D0
20
D0
90
A2
D0
AD
C9
D0
AD
C9
D0
A2
D0
AD
C9
D0
A2
4C
A2
D0

CB
B6
04
31
15
02
F1
58
05
03
CB
04
CB
69
EF
64
0F
09
2E
04
0E
5D
08
59
09
55
36
2C
04
58
04
0B
46
29
0B
EF
37
35
0A
37
38
29
2A
2E
0B
23
0D
25
2E
0C
05
02
CB
0C
15

FC
FC

AD
C9
F0
A2
D0
A2

2E 01
01
04
07
0A
06

A4
FD

FC
FC
FD

01

01

FD

01
01

01

FC

JMP OPCOMP
JMP HATCH
LDA #04
;CHECK FOR ABSOLUTE OR ZP,X ORZP,`
CMP TEMPX
BCC ABSIND
LDX #02
JSR XORYZ
;CC = X, CS = Y, NE = ABSOLUTE
BNE ABSOL
BCC ZPX
ZPY
LDX #03
;CARRY SET SO ZP,Y MODE
JMP OPCOMP
ZPX
LDX #04
;CARRY CLEAR SO ZP,X MODE
JMP OPCOMP
TRY56 BCS ERRORM
ABSIND JSR XORY
;CC=ABS,X
CS=ABS,Y NE=ERROR
BNE ERRORM
BCC ABSX
ABSY
LDA #09
CMP TYPE
BNE ABSY1
LDX #$0E
BNE OPCOMP
ABSY1 LDX #$08
BNE OPCOMP
ABSX
LDX #09
;CARRY CLEAR SO ABS,X MODE
BNE OPCOMP
PAREN LDA ADFLD+3
;SEE IF (HH,X),(HH)Y OR (HHHH)
CMP #','
;(HHX) (HH),Y ARE OK TOO
BEQ INDX
;COMMA IN 4TH POSITION = (HH,X)
CMP #'X'
;X IN 4TH POSITION = (HHX)
BNE TRYINY
INDX
LDX #$0B
BNE OPCOMP
TRYINY CMP #')'
;")" IN 4TH POS = (HH)Y OR (HH),Y
BNE TRYJMP
JSR XORY
;CHCK TO SEE IF Y INDEX REG DESIRE
BNE ERRORM
BCC ERRORM
LDX #$0A
BNE OPCOMP
TRYJMP LDA ADFLD+5
;CHECK FOR FINAL PAREN
CMP #')'
BNE ERRORM
LDA TYPE
;CONFIRM CORRECT ADDRESS TYPE
CMP #$0B
BNE ERRORM
LDX #$0D
;OK, FORM IS JMP (HHHH)
BNE OPCOMP
ABSOL LDA TYPE
;CHECK FOR BRANCH TO ABSOLUTE LOC
CMP #$0C
BNE ABSOL1
LDX #02
JMP OPCOMP
ABSOL1 LDX #$0C
BNE OPCOMP
;SELECT IMMEDIATE ADDRESSING TYPE
HATCH LDA TYPE
CMP #01
BEQ IMMED1
LDX #07
BNE OPCOMP
IMMED1 LDX #06
HATCJ
TRY34

3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848

FCC3
FCC5
FCC8
FCCB
FCCB
FCCB
FCCE
FCD0
FCD3
FCD5
FCD8
FCDB
FCDD
FCDE
FCE1
FCE4
FCE7
FCE7
FCE7
FCEA
FCEC
FCEE
FCF0
FCF2
FCF5
FCF7
FCF8
FCFB
FCFE
FD01
FD03
FD04
FD05
FD06
FD07
FD08
FD0B
FD0D
FD0F
FD12
FD12
FD12
FD12
FD15
FD18
FD1A
FD1B
FD1E
FD1F
FD22
FD24
FD27
FD28
FD2A
FD2B
FD2C
FD2C
FD2C
FD2F
FD30
FD33
FD36

D0 06
20 94 E3
4C AA FB

BNE OPCOMP
ERRORM JSR CKER00
JMP STARTM

BD
F0
2D
D0
BD
2D
F0
18
BD
6D
8D

E2
05
26
08
F1
27
E8

;COMPUTE FINAL OP CODE
OPCOMP LDA TYPTR1,X
BEQ OPCMP1
AND TMASK1
BNE VALID
OPCMP1 LDA TYPTR2,X
AND TMASK2
BEQ ERRORM
VALID CLC
LDA CORR,X
ADC OPCODE
STA OPCODE

BD
C9
F0
C9
F0
8D
29
A8
8D
EE
AD
29
4A
4A
4A
4A
AA
20
B0
90
4C

0F FB
00
50
0F
1D
33 A4
0F

FA
01
FA
01

00 FB
34 A4
34 A4

2F A4
2F A4
33 A4
F0

12 FD
B8
1D
86 FD

BD
20
B0
E8
BD
E8
20
B0
99
88
D0
18
60

33 01
7D EA
11

AC
88
B9
20
C0

2F A4

33 01
84 EA
07
34 A4
E8

34 A4
78 EB
00

;OUTPUT ERROR MESSAGE
FOR DEFINED ADDRESING MODE
;MATCH TYPE MASK WITH VALID MODE
;PATTERNS & SKIP 1ST WORD TEST IF
;ALREADY ZERO
;TEST 2ND PART
;INST DOES NOT HAVE SPECIFIED MODE
;FORM FINAL OP CODE

;PROCESS ADRESSES TO FINAL FORMAT
LDA SIZEM,X
;OBTAIN ADDRESS FORMAT FROM TABLE
CMP #00
BEQ ONEBYT
CMP #$0F
;NEED BRANCH COMPUTATION?
BEQ BRNCHC
STA TEMPA
;SAVE START POINT & CHAR COUNT
AND #$0F
;SEPARATE CHARACTER COUNT
TAY
;LOAD ADDR BYTES INTO Y (0,1,OR 2)
STA BYTESM
;SAVE IN BYTES
INC BYTESM
;TO INSTR LENGTH (1,2,OR 3 BYTES)
LDA TEMPA
;SEPARATE STARTING POINT
AND #$F0
LSR A
LSR A
LSR A
LSR A
TAX
;AND PUT IT IN X
JSR CONVRT
;CONVERT ASCII ADDRESS TO HEX
BCS ERRORM
;SKIP OUT IF ERROR IN INPUT
BCC STASH
BRNCHC JMP BRCOMP
;############ SUBROUTINE ###############
;CONVERT FORMATTED ADDRESS INTO PROPER HEX ADDRESS
CONVRT LDA ADFLD,X
;PICK UP 1ST ADDRES CHARACTER
JSR HEX
;CONVERT TO MOST SIG HEX
BCS ERRFLG
INX
;GET NEXT ASCII CHARACTER
LDA ADFLD,X
INX
;POINT TO NEXT CHARACTER, IF ANY
JSR PACK
BCS ERRFLG
STA OPCODE,Y
;SAVE IN MOST SIG. BYTE LOCATION
DEY
;SET UP FOR NEXT ADDR BYTE, IF ANY
BNE CONVRT
;IF NECESSARY, FORM NEXT ADDR BYTE
CLC
ERRFLG RTS
;NON HEX CLEARED CARRY
;#############
STASH

LDY
DEY
STSHLP LDA
JSR
CPY

BYTESM

;SET UP TO STORE COMMAND

OPCODE,Y
SADDR
#00

;STORE ONE BYTE OF COMMAND

3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910

FD38
FD3A
FD3B
FD3C
FD3E
FD3E
FD40
FD43
FD45
FD45
FD45
FD48
FD4B
FD4E
FD50
FD53
FD56
FD58
FD5B
FD5E
FD61
FD63
FD66
FD69
FD69
FD6C
FD6E
FD70
FD73
FD76
FD79
FD7A
FD7B
FD7D
FD7D
FD7D
FD80
FD83
FD86
FD86
FD86
FD89
FD8B
FD8D
FD8F
FD91
FD94
FD96
FD98
FD9B
FD9E
FDA0
FDA2
FDA5
FDA7
FDAA
FDAD
FDB0
FDB1
FDB3
FDB6
FDB8

F0 0B
88
B8
50 F2

BEQ FORMDS
DEY
CLV
BVC STSHLP

A9 01
8D 2F A4
D0 E7
20
20
20
D0
20
20
D0
20
20
AD
F0
20
20

44
DD
42
08
3B
3B
11
6C
24
37
1A
3E
3C

EB
E5
E8

AE
A0
A9
20
20
20
C8
CA
D0

2F
00
1C
58
46
3E

A4

E8
E8
F4
EA
A4
E8
F5

EB
EA
E8

F1

ONEBYT LDA #01
STA BYTESM
BNE STASH

;REPEAT TILL THRU
;SET BYTES = 1

;FORMAT FOR SYSTEM 65 DISPLAY (REFORMAT FOR AIM)
FORMDS JSR CLR
JSR CGPC1
;ADDR TO SAVPC FOR DISASSEMBLY
JSR TTYTST
;IF TTY DO NOT GO TO DISASS
BNE FORMD1
JSR BLANK2
;IT IS TTY
JSR BLANK2
BNE FORMD2
;OUTPUT OPCODE
FORMD1 JSR DISASM
JSR CRCK
; IF PRI PTR DIFF FROM 0
LDA CODFLG
;SEE IF HE WANTS CODE ALSO
BEQ FORM1
JSR BLANK
JSR PRPC
;PROG CNTR
;OUTPUT OPCODE
FORMD2 LDX BYTESM
LDY #00
DISPLY LDA #ADDR
;DO LDA (ADDR),Y ,WHITOUT PAG 0
JSR LDAY
JSR NUMA
JSR BLANK
INY
DEX
BNE DISPLY

AC 2F A4
20 CD E2
4C 24 FF

;POINT TO NEXT INSTRUCTION LOCATION
FORM1 LDY BYTESM
;ADD BYTESM TO ADDR
JSR NXTADD
JMP PATC16
;UPDATE PC

AD
C9
D0
A2
A0
20
B0
A9
8D
4C
A2
A0
20
B0
AD
8D
AD
18
69
8D
90
EE

;RELATIVE BRANCH ADDRESS COMPUTATION
BRCOMP LDA TEMPX
CMP #02
;IF REL BRANCH INPUT, USE IT
BNE COMPBR
LDX #00
LDY #01
JSR CONVRT
BCS ERRJMP
LDA #02
STA BYTESM
;SET PROPER BYTES
JMP STASH
COMPBR LDX #00
LDY #02
JSR CONVRT
BCS ERRJMP
LDA ADDR+1
;ADD BRANCH OFFSET
STA MOVAD+1
LDA ADDR
CLC
ADC #02
STA MOVAD
BCC CMPBR1
INC MOVAD+1

31
02
11
00
01
12
40
02
2F
2C
00
02
12
2F
1D
27
1C

A4

FD
A4
FD
FD
A4
01
A4

02
26 01
03
27 01

3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972

FDBB
FDBC
FDBF
FDC2
FDC5
FDC8
FDCB
FDCE
FDD0
FDD2
FDD4
FDD6
FDD9
FDDC
FDDE
FDE0
FDE3
FDE5
FDE7
FDE9
FDEC
FDEF
FDEF
FDEF
FDEF
FDF1
FDF4
FDF6
FDF8
FDF9
FDFC
FDFE
FE00
FE02
FE02
FE03
FE04
FE06
FE06
FE06
FE06
FE08
FE0B
FE0E
FE11
FE14
FE17
FE19
FE1B
FE1D
FE1F
FE21
FE24
FE25
FE26
FE29
FE2A
FE2C
FE2E
FE2E
FE2E
FE30

38
AD
ED
8D
AD
ED
8D
C9
F0
C9
F0
4C
AD
30
10
AD
10
30
A9
8D
4C

A2
BD
C9
D0
E8
BD
C9
F0
C9

35
26
35
36
27
36
00
0E
FF
03
C5
35
09
F6
35
02
EF
02
2F
2C

A4
01
A4
A4
01
A4

FC
A4
A4

A4
FD

04
33 01
2C
04
33 01
58
03
59

60
18
90 FC

A0
8C
8C
8C
8C
20
C9
F0
C9
F0
29
99
98
AA
FE
C8
C0
D0

00
34
35
36
26
5F
2A
58
20
F5
1F
30

A4
A4
A4
01
E9

01

30 01
03
E6

A0 03
B9 2F 01

CMPBR1 SEC
LDA
SBC
STA
LDA
SBC
STA
CMP
BEQ
CMP
BEQ
ERRJMP JMP
BACKWD LDA
BMI
BPL
FORWRD LDA
BPL
BMI
OK
LDA
STA
JMP

OPCODE+1
MOVAD
OPCODE+1
OPCODE+2
MOVAD+1
OPCODE+2
#00
FORWRD
#$FF
BACKWD
ERRORM
OPCODE+1
OK
ERRJMP
OPCODE+1
OK
ERRJMP
#02
BYTESM
STASH

;COMPUTE BRANCH RELATIVE ADDRESS

;CHECK IN RANGE

;SET UP FOR STASH

;###### SUBROUTINE ########
;SUBROUTINE FOR DETERMINING X OR Y OR NEITHER
XORY
LDX #04
XORYZ LDA ADFLD,X
CMP #','
BNE XORY1
INX
LDA ADFLD,X
XORY1 CMP #'X'
BEQ ISX
CMP #'Y'
XORYRT
RTS
;NOT ZERO IS NOT X OR NOT Y
ISX
CLC
;CARRY SET IS Y
BCC XORYRT
; CARRY CLEAR IS X
;####### END OF SUB ########
; INPUT FOR MNEMONIC CODE
MNEM
LDY #00
STY OPCODE
STY OPCODE+1
STY OPCODE+2
;CLEARS OPCODE FOR NEW INPUT
STY MOVAD
;CLEARS UNUSED BIT IN FINAL FORMAT
RDLUP JSR RDRUP
CMP #'*'
;COMMAND TO LOAD POINTER
BEQ STLOAD
;GO TO SET CURRENT ADDRESS POINTER
CMP #' '
;IGNORE SPACE BAR INPUT
BEQ RDLUP
AND #$1F
;MASK OFF UPPER 3 BITS
STA CH,Y
TYA
TAX
;Y----> X
INC CH,X
;FORMAT TO MATCH DISASSEMBLER TBL
INY
CPY #03
;REPEAT FOR EACH OF 3 CHARACTERS
BNE RDLUP
;COMPRESS 3 FORMATED CHARACTERS TO MOVAD & MOVAD+1
LDY #03
;SET UP OUTER LOOP
OUTLUP LDA CH-1,Y
;COMPRESS 3 CHARACTERS

3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034

FE33
FE35
FE36
FE39
FE3C
FE3D
FE3F
FE40
FE42
FE42
FE42
FE44
FE47
FE4A
FE4C
FE4D
FE4F
FE51
FE54
FE57
FE59
FE5A
FE5C
FE5F
FE5F
FE5F
FE62
FE65
FE65
FE65
FE68
FE6B
FE6E
FE6E
FE6E
FE70
FE73
FE76
FE78
FE7B
FE7B
FE7B
FE7B
FE7C
FE7D
FE7F
FE82
FE83
FE83
FE84
FE85
FE88
FE8A
FE8C
FE8E
FE91
FE92
FE93
FE96
FE96
FE99
FE9C

A2
4A
6E
6E
CA
D0
88
D0

05

A2
AD
DD
F0
CA
D0
F0
AD
DD
F0
CA
D0
4C

40
26 01
B8 F5
05

INLUP

26 01
27 01
F6
EE

F8
0B
27 01
F8 F5
06
E8
C5 FC

LDX
LSR
ROR
ROR
DEX
BNE
DEY
BNE

#05
A
MOVAD
MOVAD+1

;SET UP INNER LOOP
;SHIFT 5 BITS ACC TO MOVAD,MOVAD+1

INLUP
OUTLUP

;SEARCH FOR MATCHING COMPRESSED CODE
LDX #$40
SRCHLP LDA MOVAD
SRCHM CMP MNEML-1,X
;MATCH LEFT HALF
BEQ MATCH
DEX
BNE SRCHM
;IF NO - TRY AGAIN
BEQ MATCH1
MATCH LDA MOVAD+1
;ALSO MATCH RIGHT HALF
CMP MNEMR-1,X
BEQ GOTIT
DEX
BNE SRCHLP
MATCH1 JMP ERRORM

BD 5D FB
8D 2E 01

;GET INSTRUCTION TYPE FROM TYPE TABLE
GOTIT LDA TYPTB-1,X
STA TYPE

BD 1D FB
8D 34 A4
4C C1 FB

;GET OPCODE FROM OP CODE UE
LDA STCODE-1,X
STA OPCODE
JMP MODEM

A9
20
20
B0
4C

;THIS SECTION SETS THE CURRENT ADDRESS POINTER
STLO
LDA #'*'
JSR OUTPUT
STLOAD JSR ADDIN
;GET ADDR
BCS STLO
;IN CASE OF ERROR
JMP PATC16
;ADDR TO PC THEN TO STARTM

2A
7A E9
AE EA
F6
24 FF

41
38
E9 2C
8D 18 A4
60

;PATCHES TO CORRECT PROBLEMS WITHOUT
;CHANGING ENTRY POINTS TO THE ROUTINES
.DB "A"
PATCH1 SEC
;ADJUST BAUD
SBC #44
STA CNTL30
RTS

8A
48
AE
E0
B0
A9
20
68
AA
4C

CUREAD TXA
PHA
LDX
CPX
BCS
LDA
JSR
PAT2A PLA
TAX
JMP

15 A4
14
05
DE
7B EF
3C E9

20 3C E9
4C 76 E9

RED1

;SAVE X
CURPO2
#20
PAT2A
#$DE
OUTDD1
READ

JSR READ
JMP RED2

, OUTPUT CUR

;ONLY IF < 20

;CONTINUE
;READ & ECHO WITHOUT CURSOR

4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096

FE9C
FE9F
FEA1
FEA3
FEA5
FEA8
FEAB
FEAE
FEB1
FEB1
FEB4
FEB7
FEB7
FEB9
FEBC
FEBC
FEBF
FEC0
FEC3
FEC5
FEC8
FEC9
FECA
FECC
FECE
FED1
FED3
FED6
FED7
FED8
FED8
FEDA
FEDC
FEDF
FEE2
FEE5
FEE6
FEE8
FEE9
FEE9
FEEC
FEEF
FEEF
FEF1
FEF3
FEF5
FEF8
FEF8
FEF9
FEFC
FEFE
FF01
FF02
FF03
FF03
FF06
FF08
FF0A
FF0D
FF0D
FF10
FF12

AE
C9
D0
A9
20
20
4C
4C

15
8D
0B
A0
7B
44
76
17

A4

EF
EB
EF
EF

PATCH4 LDX
CMP
BNE
LDA
JSR
JSR
JMP
PAT4A JMP

CURPO2
#CR+$80
PAT4A
#' '+$80
OUTDD1
CLR
OUTD7
OUTD1A

;DONT DO ANYTHING IF "8D"
;SO  FOR TV & NOT FOR DISP
;CLR CURSOR
;CLR PNTRS
;EXIT
;CONTINUE

8D 11 A4
4C 73 F0

PATCH5 STA PRIFLG
JMP IPO3

;TURN PRI OFF

A9 1C
4C 58 EB

PATCH6 LDA #ADDR
JMP LDAY

;SIMULATE LDA (ADDR),Y

20
48
20
A9
20
68
48
C9
F0
20
A9
20
68
60

3C E9

PATCH8 JSR
PHA
JSR
LDA
JSR
PLA
PHA
CMP
BEQ
JSR
PATC8C LDA
JSR
PLA
RTS

READ

;READ & ECHO WITH CARROTS

C9
B0
CD
4C
CD
68
C9
60

F7
06
08 A4
9D EE
08 A4

PATCH9 CMP
BCS
CMP
JMP
PAT9A CMP
PLA
CMP
PAT9B RTS

#$F7
PAT9A
TSPEED
CKF3A
TSPEED

D8 E7
3C
7A E9
0D
03
7A E9
3E
7A E9

FF

EQUAL
#'<'
OUTPUT
#CR
PATC8C
OUTPUT
#'>'
OUTPUT

;CHCK LOWER TRANSITION OF TIMER

#$FF

20 F0 E9
4C 85 E1

PATC10 JSR CRLF
JMP STA1

;CLR DISP (ONLY 1 )

F0
C9
F0
4C

PATC11 BEQ
CMP
BEQ
JMP

;GO OUTPUT PROMPT
;NO PROMPT FOR "T" OR "L"

F7
4C
F3
C5 E7

PAT9B
#'L'
PAT9B
PROMP1

48
AD 11 A4
29 F0
8D 11 A4
68
60

PATC12 PHA
LDA PRIFLG
AND #$F0
STA PRIFLG
PLA
RTS

;CLEAR PRIFLG SO WE CAN OUTPUT
;TO PRINTER IF FLG WAS ON (MSB)

AD
C9
D0
4C

PATC13 LDA
CMP
BNE
JMP

;TURN TAPES ON ONLY IF TAPES

12 A4
54
DE
29 E5

AD 13 A4
C9 54
D0 D4

INFLG
#'T'
PAT9B
DU14

PATC14 LDA OUTFLG
CMP #'T'
BNE PAT9B

;TURN ON TAPES & SET DEF DEV
;TURN ON TAPES ONLY IF TAPES

4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4157

FF14
FF17
FF17
FF1A
FF1B
FF1C
FF1D
FF20
FF23
FF24
FF24
FF27
FF2A
FF2A
FF2C
FF2E
FF30
FF33
FF36
FF38
FF3A
FF3D
FF3D
FF40
FF41
FF44
FF46
FF47
FF48
FF4B
FF4E
FF51
FF54
FF57
FF58
FF59
FF59
FF5A
FF5D
FF60
FF60
FF62
FF63
FF65
FF66
FF69
FF6A
FF6C
FF6F
FF72
FF72
FF74
FF77
FF79
FF7C
FF7D
FF7F
FF82
FF85
FF88
FF88
FF8E

4C 0A E5

JMP DU11

20 F0 E9
8A
0A
AA
BD B8 FA
8D 1A A4
60

PATC15 JSR
TXA
ASL
TAX
LDA
STA
RTS

20 DD E5
4C AA FB

PATC16 JSR CGPC1
JMP STARTM

;ADDR TO PC
;BACK TO MNEMONIC START

F0
C9
F0
4C
20
C9
D0
4C

0E
00
03
85 F7
93 E9
7F
F9
7A F7

PATC17 BEQ
CMP
BEQ
JMP
PAT17A JSR
CMP
BNE
PAT17B JMP

PAT17B
#0
PAT17A
IN02A
INALL
#$7F
PAT17A
IN02

;RUB, SO READ ANOTHER

20
48
20
D0
68
60
20
20
20
20
20
68
60

F8 FE

PATC18 JSR
PHA
JSR
BNE
PLA
RTS
PAT18A JSR
JSR
JSR
JSR
JSR
PLA
RTS

PATC12

;RESET PRIFLG

TTYTST
PAT18A

;IF TTY JUST RTN

LL
IPST
CLR
BLANK
CLR

;SET TO LOW SPEED
;PRINT WHAT IS IN BUFFER
;CLR PRINTER BUFFER BY OUTPUTTING
;AN SPACE

42 E8
02
FE
45
44
3E
44

E8
F0
EB
E8
EB

CRLF
A
JTBL,X
S1

D8
20 24 EA
4C 85 E1

PAT19

CLD
JSR CRCK
JMP STA1

F0
18
69
AA
20
CA
D0
4C
4C

0D

PAT20

BEQ
CLC
ADC
TAX
JSR
DEX
BNE
JMP
JMP

A0
B9
F0
20
C8
D0
20
20
4C

00
88 FF
06
7A E9

04
93 E9
FA
9E E6
20 E5

F5
F0 E9
F0 E9
82 E1

VECK5

VECK4

;DECODE COMMAND
;SAVE INDEX

VECK4

;PART OF ENTRY

;NEITHER ,CONTINUE
;SKIP ON ZEROS
;UNTILL RUB
;GO BACK

;RTN ACC

;END (DATA BYTES=0)

#4
INALL

;SKIP OVER DATA

VECK5
VECK1
DU13

;PROCESS NEXT RCD

PAT21 LDY #0
PAT21A LDA POMSG,Y
BEQ PAT21B
JSR OUTPUT
INY
BNE PAT21A
PAT21B JSR CRLF
JSR CRLF
JMP START

2020524F434BPOMSG .DB "
57454C4C2041494D203635

;RESET MSG

ROCKWELL AIM 65"

4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191

FF99 00
.DB 0
FF9A
FF9A EE 68 01
PAT22 INC BLKO
FF9D 4C BD ED
JMP ADDBK1
FFA0
FFA0 A9 FF
PAT23 LDA #$FF
;START TIMER
FFA2 8D 97 A4
STA DI1024
FFA5 AD 85 A4
PAT23A LDA RINT
;TIME OUT?
FFA8 30 08
BMI PAT23B
;YES
FFAA AD 0D A8
LDA IFR
;START SIGNAL?
FFAD 29 10
AND #MPRST
FFAF F0 F4
BEQ PAT23A
;NO
FFB1 60
RTS
;YES
FFB2 A9 00
PAT23B LDA #0
;TIME OUT RETURN
FFB4 60
RTS
FFB5
FFB5 20 75 EE
PATC24 JSR CKFREQ
;READ BIT FROM FOURTH HALF PULSE
FFB8 6A
ROR A
FFB9 29 80
AND #$80
FFBB 60
RTS
FFBC
FFBC 2C 0D A8
PATC25 BIT IFR
;WAIT TILL TIMES OUT
FFBF 50 FB
BVC PATC25
FFC1 AD 04 A8
LDA T1L
;CLR INTERRUPT FLG
FFC4 60
RTS
FFC5
FFF9
*=$FFF9
FFF9
;INTERRUPT VECTORS
FFF9 FA
.DB $FA
FFFA 75E0BFE078E0
.DW NMIV1,RSET,IRQV1
;SET UP VECTORS
10000
;.END A0/1
10000
SEMICOLON =$3B
10000
BACKSLASH =$5C
10000
.END M1

Label
Value
-----------------ASSEM
D000
ACR
A80B
ADDIN
EAAE
ADDN2
EAC7
ADDN5
EAF7
ADDN8
EB2B
ATTOP
F8DB
AT01
F8F7
ADDS1A
F916
ADDA1
F933
ABSY
FC63
ABSOL
FCA6
BASIRE
B003
BYTESM
A42F
BLKO
0168
BKERR
E62F
BRKK
E6E5
BRK4
E6FA
BKCKSM
F1E7
BKCK3
F21A
BRCOMP
FD86
CH
0130
CURPOS
A416

Label
Value
-----------------ADFLD
0133
ADDS1
E55D
ADDNE
EAB1
ADDN3
EADC
ADDN6
EAFD
ADDBLK
EDBA
ATBOT
F8E9
ATEND
F8F9
AD1
F928
ACCUM
FC23
ABSY1
FC6E
ABSOL1
FCB2
BOTLN
00E1
BKFLG
A410
BRKA
E61B
BKOK
E634
BRK3
E6F1
BLANK2
E83B
BKCK1
F1F1
BT
F721
BACKWD
FDD9
CODFLG
A437
CNTH30
A417

Label
Value
-----------------ADDR
A41C
ADD1
E565
ADDN1
EAB7
ADDN4
EAE8
ADDN7
EB0D
ADDBK1
EDBD
AT02
F8F5
ADDRS1
F910
ADDA
F92A
ABSIND
FC5C
ABSX
FC72
BASIEN
B000
BKS
0100
BLK
0115
BRK1
E620
BKO2
E64C
BRK2
E6F3
BLANK
E83E
BKCK2
F20F
BRNCHC
FD0F
BACKSLASH
005C
CURPO2
A415
CNTL30
A418

COUNT
CRA
COMIN
CHNG1
CH3
CKER00
CHEKAR
CGPC0
CGA
CGS
CKB
CRLF
CRCK
CLR
CKF1
CKF3A
CBUFF1
COL2
CHAR1
CHN1
CHN4
COMM
COMCN1
CLRLUP
CMPBR1
DISFLG
DDRA2
DNPA7
DIV8
DRB
DDRA
DATOUT
DU1
DU1A
DU7
DU10
DU12
DUMPTA
DUK2
DELAY
DEHALF
DISASM
DOW2
DISPLY
EPPA7
EMSG1
ERR
EDI1
EDI4
EDI7
EDI2B
ERROR
EVAL
ERRJMP
FNAM
FCH
FC3
FC6
FC9
FORMD2
GAP
GOBK0

A419
AC01
E1A1
E2A6
E2C5
E394
E54B
E5D7
E5EE
E5FA
E76B
E9F0
EA24
EB44
EE7A
EE9D
F1E2
F361
F5AD
F87C
F8AF
FA88
000B
FBE9
FDBB
A40F
A481
A484
A495
A800
A803
000C
E444
E46D
E4A0
E4DB
E511
E56F
E5A4
EC0F
EC23
F46C
F6E8
FD6E
A487
E06C
F495
F653
F680
F6AA
F6CC
FA72
FC0E
FDD6
E8A2
F81E
F834
F84E
F868
FD69
A409
E278

CKSUM
CRB
COMB
CH2
CKERR
CKER1
CHEKA
CGPC1
CGX
CGALL
CKB2
CRLOW
CRCK1
CLRCK
CKF2
CKF4
COL0
COL3
CHAR2
CHN2
CFLG
CD02
COMTBL
CONVRT
CUREAD
DIBUFF
DRB2
DPPA7
DIV64
DRAH
DRA
DEBTIM
DU0
DU2
DU8
DU10A
DU13
DUMPT1
DONE
DE1
DEBKEY
DNNO
DOWN
END
ESCAPE
EMSG2
EDIT
EDI2
EDI5
EDI8
ENDERR
ERR0
ERRORM
FORMA
FCHAR
FC1
FC4
FC7
FORMDS
FORM1
GO
GOBK1

A41E
AC03
E1C4
E2B8
E385
E396
E54E
E5DD
E5F2
E5FC
E76D
EA13
EA2C
EB4D
EE81
EEA1
F2E1
F3A1
F5B3
F88C
F8B2
FA8F
FAAC
FD12
FE83
A438
A482
A485
A496
A801
A80F
1388
E447
E47D
E4A2
E4F8
E520
E57B
E790
EC18
ED2A
F6D8
F724
00E5
001B
E072
F639
F663
F68D
F6AE
FA5C
FA78
FCC5
0116
F80C
F823
F843
F853
FD45
FD7D
E261
E286

CPIY
CR
CHNGG
CH4
CKER0
CKER2
CGPC
CGPS
CGY
CLRBK
CKB1
CR2J
CRCK2
CKFREQ
CKF3
CKBUFF
COL1
COL4
CHNG
CHN3
COM
CFND1
CORR
COMPBR
DILINK
DRA2
DDRB2
DIV1
DI1024
DDRB
DATIN
DUMP
DU1B
DU6
DU9
DU11
DU14
DUMPKI
DON1
DE2
DEBK1
DOW1
DLNE
ENPA7
EQS
EQUAL
EDI0
EDI3
EDI6
EDI
ENDE2
ENTRY
ERRFLG
FROM
FCHA1
FC2
FC5
FC8
FORMD1
FORWRD
GOBK
GETID

A42A
000D
E2A0
E2C0
E38E
E3A3
E5D4
E5EA
E5F6
E6FE
E780
EA23
EA3B
EE75
EE99
F1D2
F321
F3E1
F876
F8A9
FA78
FAA0
FB00
FD9E
A406
A480
A483
A494
A497
A802
000E
E43B
E452
E49F
E4B9
E50A
E529
E587
E7A0
EC1B
ED2C
F6E3
F74C
A486
00BD
E7D8
F644
F673
F69B
F6B6
FA6F
FA8D
FD2B
E7A3
F80F
F82E
F849
F85A
FD58
FDE0
E26D
E425

GID1
GCN1
GET3
GETKY
GETK1
GETK3
GETK6
GETK11
GETK14
GETA1
GOGO1
HISTP
HATCJ
IRQV2
IDIR
IDOT
IBITL
IFR
IRQV3
INCS2
INTAB3
IPST
IPO2
IPSU
IPS2
IN
IN02A
IN03A
INPU1
ISX
JMPR
JD3
KEYF1
KMASK
KEPR
LENGTH
LF
LOAD2
LOADTA
LOADKI
LOADK3
LOADK7
LDAY
LST02
MONRAM
MPRST
M1
M5
M8
M11
MCM3
MEM
MEM2
MTBL
MNNDX3
MODE2
MREAD
MNEM
NOWLN
NAME
NMIV3
NXTADD

E427
E78C
EBED
EC43
EC71
EC8D
ECB9
ECC9
ECEB
EE2B
FA5B
A414
FC3D
A404
A474
A477
A47A
A80D
E154
E566
E756
F045
F066
F0E3
F10E
F764
F785
F7B9
F7D8
FE03
E1C1
E73C
010C
A42A
E970
00EA
000A
E306
E32F
E3A4
E3B7
E3E8
EB58
F7F8
A400
0010
E000
E01C
E027
E031
E1AC
E248
E251
F2D7
F4BA
F59F
FAD0
FE06
00DF
A42E
E07B
E2CD

GOERR
GETTTY
GETKD0
GETK0
GETK1B
GETK4
GETK7
GETK12
GETK10
GETFMT
GOTIT
HIST
HATCH
INFLG
ICOL
IOUTL
IBITU
IER
IRQ1
INTAB1
INLOW
IPS0
IPO3
IPS1
INCP
INL
IN03B
IN05
INDX
INLUP
JD1
JD4
KEYF2
KDISA
KIFLG
LMNEM
LOAD
LOAD4
LOAD1A
LOADK1
LOADK5
LL
LST
LST3
MON
MSP12
M3
M6
M9
M12
MCNT
MEIN
MEM3
MNNDX1
MR11A
MNEML
MNEENT
MATCH
NMIV2
NULLC
NMI4
NXTA1

E608
EBDB
EC38
EC55
EC80
EC93
ECBE
ECD2
ECEC
F499
FE5F
A42E
FCB6
A412
A475
A478
A47B
A80E
E163
E743
E8F8
F04A
F073
F0E8
F121
F76D
F799
F7C5
FC81
FE35
E723
E742
010F
E70A
F8B6
0117
E2E6
E321
E349
E3A7
E3D1
E8FE
F7E1
F803
00C0
0002
E005
E021
E02A
E03B
0020
E24D
E260
F4AF
F512
F5B9
FB9E
FE51
A402
00FF
E0B1
E2DA

GCNT
GET1
GETKEY
GETK00
GETK2
GETK5
GETK8
GETK13
GETTAP
GOGO
HISTM
HEX
IRQV4
IBUFM
IOFFST
IOUTU
IMASK
IRQV1
IRQ2
INTAB2
INALL
IPO0
IPO4
IPS3
IEVEN
IN02
IN03
INPU
IMMED1
JUMP
JD2
JTBL
KEYF3
KEP
KI2
LDIY
LOAD1
LOAD5
LOADT2
LOADK2
LOADK6
LT10
LST01
MOVAD
MOFF
MT2
M4
M7
M10
MCM2
MONCOM
MEM1
MEMERR
MNNDX2
MODE
MNEMR
MODEM
MATCH1
NPUL
NMIV1
NMI5
NXT5

E785
EBE2
EC40
EC67
EC82
ECA4
ECBF
ECE1
EE29
FA4A
A42E
EA7D
A400
A460
A476
A479
A47C
E078
E17F
E752
E993
F050
F078
F105
F486
F77A
F7A8
F7CB
FCC1
A47D
E72B
FAB8
0112
E7AF
F8B8
A42A
E2E9
E323
E364
E3AA
E3D3
EA5A
F7F0
0126
00E0
0020
E008
E024
E02D
E196
E1E5
E24F
EB33
F4B3
F55B
F5F9
FBC1
FE5C
A40A
E075
E0B4
E60D

NHIS
NAMO1
NAMO4
NEWROW
OLDLEN
OUTCKS
OUTCK2
OUTPUT
OUT2
OUTA2
ONEKEY
ONEK3
OUTT1
OUTDP1
OUTD1A
OUTD3
OUTD7
OUTDD3
OUT04
OUTPR1
OP07
OP06
OUTTA2
OPCMP1
OUTLUP
PRST
PROMPT
PR2
PSL00
PSL0C
PACK
PCLLD
PRIERR
PINT
PRADR1
PRADR4
PRBL2
PLNE
P03
PAREN
PATCH4
PATCH6
PATCH9
PATC10
PATC13
PATC16
PAT17B
PAT19
PAT21A
PAT22
PAT23B
QM
ROLLFL
RB
RS1
RS3
RS5
RS8
RBYTE
RS20
RCH3
RCHT1

E688
E8D6
E8F5
F160
00E9
E531
E547
E97A
E98F
E9D0
ED05
ED1C
EECB
EF02
EF17
EF33
EF76
EF8B
F025
F03A
F13F
F15D
F294
FCD5
FE30
0000
E7BD
E7CF
E802
E81E
EA84
EB56
F079
F0CB
F4F7
F52C
F545
F727
F73F
FC76
FE9C
FEB7
FED8
FEE9
FF03
FF24
FF3A
FF59
FF74
FF9A
FFB2
E7D4
A47F
AC02
E0C9
E0F3
E129
E146
E3FD
E702
E925
E93B

NH1
NAMO2
NUMA
NEWCOL
OPCODE
OUTCK
OUTLOW
OUT1
OUTALL
OUTA3
ONEK1
ONEK4
OUTT2
OUTDIS
OUTD2
OUTD4
OUTDD1
OUTPRI
OUT05
OUTPR2
OP03
OUTTAP
OUTTA3
ONEBYT
PRIFLG
PRTIME
PROMP1
PSLS
PSL0A
PSL0D
PAK1
PHXY
PRNDOT
PRMN1
PRADR2
PRNTXY
PCADJ3
P02
P00
PATCH1
PAT4A
PATCH8
PAT9A
PATC11
PATC14
PATC17
PATC18
PAT20
PAT21B
PAT23
PATC24
RMNEM
RINT
RUB
RS2
RS3B
RS6
REG
RBYT1
RCHEK
RCHTTY
READ

E690
E8E9
EA46
F163
A434
E538
E901
E97B
E9BC
E9E2
ED09
ED29
EEFB
EF05
EF20
EF48
EF7B
F000
F033
F044
F144
F24A
F2B2
FD3E
A411
06A4
E7C5
E7DC
E814
E823
EA96
EB9E
F087
F4D7
F4FF
F538
F54D
F729
F749
FE7C
FEAE
FEBC
FEE2
FEEF
FF0D
FF2A
FF3D
FF60
FF7F
FFA0
FFB5
0118
A485
0008
E0D4
E11A
E13E
E227
E407
E907
E926
E93C

NAMO
NAMO3
NOUT
NOWS1
OUTFLG
OUTCK1
OUTL1
OUT1A
OUTA1
OUTA4
ONEK2
OUTTTY
OUTDP
OUTD1
OUTD2A
OUTD5
OUTDD2
OUT01
OUTPR
OP04
OP05
OUTTA1
OPCOMP
OK
PCR
PRITR
PR1
PSL0
PSL0B
PSL1
PAK2
PLXY
PRDOT0
PRMN2
PRADR3
PRPC
PCADJ4
P01
PNTLUP
PAT2A
PATCH5
PATC8C
PAT9B
PATC12
PATC15
PAT17A
PAT18A
PAT21
POMSG
PAT23A
PATC25
REGF
RA
RSET
RS3A
RS4
RS7
REG1
REGT
RCH2
RCHT2
READ1

E8CF
E8EB
EA51
F909
A413
E53B
E906
E986
E9C8
E9EA
ED0B
EEA8
EEFC
EF14
EF2F
EF56
EF87
F00F
F038
F130
F150
F290
FCCB
FDE7
A80C
E6E1
E7CC
E7FB
E81C
E837
EA9F
EBAC
F08C
F4DB
F519
F53C
F554
F73B
FBD0
FE91
FEB1
FED1
FEE8
FEF8
FF17
FF33
FF48
FF72
FF88
FFA5
FFBC
A40E
AC00
E0BF
E0F1
E11D
E144
E232
E6D9
E91F
E928
E94A

READ2
RDRUP
RED2
RSPAC
RDBIT
RDBIT4
ROW1
ROW4
ROW7
RTMODE
REENTR
REPLAC
R88
R6
R7
R11
R102
R107
R1051
RDLUP
STRING
SAVPS
SAVY
STIY
SP12
STA1
SH1
SEMI
SWST1
SETZ
SETSP2
SUB
SIZEM
STORCH
STSHLP
STLO
TEXT
TMASK2
TSPEED
TAPOUT
TABUFF
T1CH
T2L
T1I
TMSG1
TMSG5
TOGTA1
TOGL
TO1
TAP2
TIB1
TIBY4
TIBY6
TIOSET
TOBYTE
TAOSET
TP
TYPTR1
TRYZP
TRYINY
UDRAH
UT1L

E94D
E95F
E976
EA7B
EE3B
EE67
F421
F439
F451
F491
F6CF
F93F
F953
F984
F9AB
F9CC
F9E3
FA0A
FA41
FE14
00EB
A420
A423
A427
0001
E185
E652
E9BA
EBBD
F282
F2D3
F91D
FB0F
FBF6
FD30
FE6E
00E3
0127
A408
A435
0116
A805
A808
0000
E04D
E05F
E6BD
E6E7
E7A9
E8BC
ED48
ED63
EDAF
EE1C
F18B
F21D
F6D2
FAE2
FC28
FC85
A001
A004

REA1
RDR1
RD2
ROONEK
RDBIT1
ROUT
ROW2
ROW5
ROW8
RELADR
RESNOW
R8
R2W
R5
R9
R100
R108
R104
R106
RED1
S1
SAVA
SAVS
STBKEY
SETREG
STBYTE
SHIS
SADDR
SYNC
SETSPD
STOP
SUB1
STCODE
STOR1
SRCHLP
STLOAD
TYPE
TEMPX
TIMG
TAPTR
TABUF2
T1LL
T2H
T1FR
TMSG2
TMSG6
TOGTA2
TOGL1
TTYTST
TAP3
TIBY1
TIBY5
TIBY7
TIOS1
TABY2
TAOS1
TOPNO
TYPTR2
TRY34
TRYJMP
UDDRB
UT1CH

E956
E96A
EA5D
ECEF
EE43
F286
F429
F441
F459
F530
F8D0
F947
F95F
F99D
F9BE
F9CF
F9EF
FA17
FA44
FE96
A41A
A421
A424
A42B
E113
E413
E665
EB78
EDFF
F2C0
F870
F927
FB1E
FC0A
FE44
FE73
012E
A431
A40B
A436
00AD
A806
A809
00C0
E050
E061
E6CB
E6F6
E842
E8C2
ED53
ED65
EDB0
EE22
F1A7
F238
F8BC
FAF1
FC40
FC94
A002
A005

RB2
REDOUT
RD1
ROO1
RDBIT2
ROUT1
ROW3
ROW6
REGQ
RTS1
REP2
R87
RQP
R55
R10
R101
R103
R105
RDADDR
SAVE
S2
SAVX
SAVPC
SR
START
SHOW
SH11
SWSTAK
SYNC1
SETSP1
SETBOT
SAVNOW
STARTM
STASH
SRCHM
SEMICOLON
TMASK1
TEMPA
TAPIN
TAPTR2
T1L
T1LH
T2I
TMSG0
TMSG3
TMSG7
TRACE
TO
TAP1
TIBYTE
TIBY3
TIBY5A
TAISET
TIOS2
TABY3
TRY
TPO1
TYPTB
TRY56
UDRB
UDDRA
UT1LL

E95C
E973
EA70
ED00
EE51
F28B
F431
F449
F461
F55A
F93E
F94E
F977
F9A8
F9C7
F9DA
F9FA
FA31
FBE5
00E7
0106
A422
A425
A80A
E182
E64D
E66A
EBBA
EE11
F2CA
F8C5
F934
FBAA
FD2C
FE47
003B
0126
A433
A434
A437
A804
A807
0000
E048
E052
E066
E6DD
E7A7
E8B3
ED3B
ED56
ED88
EDEA
EE24
F1CE
F258
F8C0
FB5E
FC5A
A000
A003
A006

UT1LH
USR
UIFR
UIN
UPNO
VECKSM
VALID
WRITAZ
WHE1
WHEREO
WHRO3
WRAX
XORY1
ZON1
ZPY

A007
A00A
A00D
0108
F709
E694
FCDD
E2DB
E85C
E871
E897
EA42
FDFC
F261
FC50

UT2L
UACR
UIER
UOUT
UP1
VECK1
VECK5
WRITAD
WHE2
WHRO1
WHRO4
XORY
XORYRT
ZON2
ZPX

A008
A00B
A00E
010A
F713
E69E
FF66
E2DD
E868
E885
E89F
FDEF
FE02
F26C
FC55

UT2H
UPCR
UDRA
UP
UP4
VECK2
VECK4
WHEREI
WHE3
WHRO2
WHICHT
XORYZ
ZON
ZPAGE

A009
A00C
A00F
F6F9
F720
E6AC
FF6F
E848
E870
E88E
E8A8
FDF1
F25D
FC38

tasm: Number of errors = 0
AIM 65 MICROCOMPUTER MONITOR PROGRAM LISTING
Rockwell International
Document No. 29650 N36L
Rev. 1, April 1979
I used the Telemark Cross Assembler v3.1 (TASM) to re-create the source code.
See http://www.halcyon.com/squakvly/
I tried to exactly duplicate the original source but some errors may exist.
The exceptions are when the original had a hexadecimal constant instead
of an ASCII constant or ASCII equate (especially CR) in some immediate
mode instructions; I changed them to ASCII constants or an equate.
For example, line 468 in the printed listing is:
0468 E185 A9 BC
STA1
LDA #$BC
;"<" CHR WITH MSB=1 FOR DISP
My version is:
0468
E185 A9 BC
The TASM
code, so
However,
That is,
ASM file

STA1

LDA #'<'+$80

;"<" CHR WITH MSB=1 FOR DISP

assembler is not the same one that Rockwell used to write the
some assembler directives and opcode formats are different.
the ASM file uses the same line numbering as the printed listing.
line 1000 in the printed listing corresponds to line 1000 in the
and line 1000 in the LST file.

I could not fully read eight lines in the program listing because I was
looking at a scanned copy, not the original. The rightmost characters
were lost in the binding. These are the lines:
0149
1796
1804
2159
2262
3205
3719
3727

HIST

=NAME
JSR SWSTAK
JSR SWSTAK
RDBIT LDA TSPEED
OUTDP1 JMP (DILINK)
BNE IN02
LDA TYPE
TRY34 LDA #04

;FOUR LAST ADDR + NEXT (SINGL STEP)
;SWAP X , Y WITH RTRN ADDR FROM S
;SWAP X , Y WITH RTRN ADDR FROM
;ARE WE IN C7 OR 5B,5A FREQUENC
;HERE HE COULD ECHO SOMEWHERE ELSE
;CONTIN , DISP WONT ALLOW > 60 CHR
;CHCK FOR BRNCH WITH RELATIVE ADDR
;CHECK FOR ABSOLUTE OR ZP,X ORZP,

NOTE: I have since been told that the cut-off lines above exist in the
original manual.

+-----------------------------------------------------------------------| TOPIC -- AIM Computer -- AIM BASIC Language Reference Manual
+-----------------------------------------------------------------------AIM 65 MICROCOMPUTER BASIC LANGUAGE REFERENCE MANUAL
Rockwell International Corporation
Document No 29650 N49
March 1979
TABLE OF CONTENTS
100 Installing BASIC in the AIM 65
200 Getting Started With Basic
201
BASIC Command Set
202
Direct and Indirect Commands
203
Operating on Programs and Lines
204
Printing Data
205
Number Format
206
Variables
207
Relational Tests
208
Looping
209
Matrix Operations
210
Subroutines
211
Entering Data
212
Strings
300 Statement
301
302
303
304
305
306
307
A
B
C
D
E
F
G
H

Definitions
Special Characters
Operators
Commands
Program Statements
Input/Output Statements
String Functions
Arithmetic Functions

Error Messages
Space Hints
Speed Hints
Converting BASIC Programs not Written for AIM 65 BASIC
ASCII Character Codes
Assembly Language Subroutines
Storing AIM 65 BASIC Programs on Cassette
ATN Implementation

INTRODUCTION
Before a computer can perform any useful function, it must be "told" what to do. Unfortunately,
at this time, computers are not capable of understanding English or any other "human" language.
This is primarily because our languages are rich with ambiguities and implied meanings. The
computer must be told precise instructions and the exact sequence of operations to be performed
in order so accomplish any specific task. Therefore, in order to facilitate human communication
with a computer, programming languages have been developed.
Rockwell AIM 65 8K BASIC by Microsoft is a programming language both easily understood and
simple to use. It serves as an excellent "tool" for applications in areas such as business, science,
and education. After only a few hours of using BASIC, you will find that you can already write
programs with an ease that few other computer languages can duplicate.
Originally developed at Dartmouth University, the BASIC language has found wide acceptance in
the computer field. Although it is one of the simplest computer languages to use, it is very powerful.
BASIC uses a small set of common English words as its "comnmands." Designed specifically as an
"interactive" language, you can give a command such as "PRINT 2 + 2," and BASIC will immediately
reply with "4." It is not necessary to submit a card deck wish your program on it and then wait
hours for the results. Instead, the full power of the computer is "at your fingertips."
We hope that you enjoy BASIC, and are successful in using it to solve all of your programming

problems.
100 INSTALLING BASIC IN THE AIM 65
ROM INSTALLATION PROCEDURE
Before handling the BASIC ROM circuits, be sure to observe the precautions outlined in Section 1.4
of the AIM 65 User's Guide.
To install the ROMs, turn off power to the AIM 65. Inspect the pins on the two BASIC ROMs to
ensure that they are straight and free of foreign material. While supporting the AIM 65 Master
Module beneath the ROM socket, insert ROM number R3225 into Socket Z25, being careful to
observe the device orientation. Now insert ROM number R3226 into Socket Z26. Be certain that
both ROM's are completely inserted into their sockets, then turn on power to the AIM 65.
ENTERING BASIC
To enter and initialize BASIC, type 5 after the monitor prompt is displayed.
with:

AIM 65 will respond

<5>
MEMORY SIZE? ^
Type the highest address in memory that is to be allocated to the BASIC program, in decimal.
the entry by typing RETURN. BASIC will allocate memory from 530 (212 in hex) through the
entered address. If BASIC is to use all available memory, type RETURN without entering an
address. The highest address is 1024 (400 hex) in the 1K RAM version of AIM 65, and 4096
(1000 hex) in the 4K RAM version.

End

BASIC will then ask:
WIDTH? ^
Type in the output line width of the printer (or any other output device that is being used) and end
the
input with RETURN.
The entered number may vary from 1 to 255, depending on the output device. If RETURN is typed
without entering a number, the output line width is set to a default value of 20, which is the column
width of the AIM 65 printer.
BASIC will respond with:
XXXX BYTES FREE
where XXXX is the number of bytes available for BASIC program, variables, matrix storage, and
string space. If all available memory was allocated, BASIC will reply with:
494 BYTES FREE (for 1K RAM; i.e., 1024-530)
or
3566 BYTES FREE (for 4K RAM; i.e., 4096-530)
BASIC will display:
^ AIM 65 BASIC Vn.n
where n.n is the version number.
BASIC is now in the command entry mode as indicated by the BASIC prompt (^) in the display
column 1. Subject 201 gets you started into the BASIC commands.
Read the following paragraphs first, however, so understand how to exit and reenter the BASIC
and how the BASIC cursor prompt operates.
CAUTION
Entering BASIC with the 5 key causes the allocated

memory to be initialized with AA (hex) in all bytes,
starting with address 532. This, of course, destroys
any previous BASIC programs, data in the AIM 65
Editor Text Buffer, or machine level routines that
may have been stored in this portion of memory.
Be sure to save any desired data or programs that
may exist in this area before entering BASIC with
the 5 key.
Note that text in the Text Buffer or machine level
routine may co-exist in memory with BASIC by
locating such text or routines in upper memory
and entering the highest BASIC address with a
value lower than the starting address of such text
or routines.
EXITING BASIC
To escape from BASIC and return to the AIM 65 Monitor, type ESC any time the BASIC command
cursor is displayed. You can also escape BASIC while a program is running, by pressing the F1 key
(see Subject 301).
Pressing RESET will also cause the AIM 65 Monitor to be entered as well as performing a hardware
reset of AIM 65.
REENTERING BASIC
BASIC may be reentered by typing 6 whenever the AIM 65 Monitor prompt is displayed. In this
case, however, any existing BASIC program is retained in memory. AIM 65 will respond to a
Key 6 entry with:
<6>
^6>
BASIC CURSOR
The BASIC cursor (^), displayed in column 1 whenever BASIC is in the command entry mode,
indicates that a BASIC command can be entered. The last displayed data resulting from the previous
command is retained except for column 1 to provide information continuity with the previous
command or displayed output data. This is especially helpful when the printer control is turned off
to preserve printer paper.
When the first character of the next command is typed, the display will blank except for the newly
typed character. The cursor then advances across the display in accordance with typed characters
to indicate the character input position.
The displayed cursor does not appear on the printer output, thus any data printed in column 1 will
be retained.
CAUTION
The minus sign associated with any negative values
that are displayed starting in column 1 will be
replaced with the cursor in the BASIC command
entry mode. In the case of direct commands, the
minus sign will only flash before the cursor is
displayed if the printer control is on or may not
appear at all if the printer control is off. In order
to retain the minus sign, a leading blank should
be displayed before the value is displayed (see
Subject 204).
PRINTER CONTROL
While in the BASIC command entry mode, the printer may be turned on or off by typing PRINT
while CNTL is pressed (CNTL PRINT). The on/off state of the printer is displayed after typing
PRINT.
If the printer is turned off, statements in the BASIC command entry mode and data output from

PRINT commands will be directed to the display only. If the printer is turned on, all commands
and data from PRINT commands will be directed to both the printer and display. With the printer
off, data can still be directed to the printer by using the PRINT) command (see Subject 305).
Similarly, INPUT statements will output data to the printer in response to the printer control state.
An INPUT! statement will output data to the printer even if the printer control is off (see
Subject 305).
200

GETTING STARTED WITH BASIC

201

BASIC COMMAND SET

This section is not intended to be a detailed course in BASIC programming. It will, however, serve
as an excellent introduction for those of you unfamiliar with the language.
We recommend that you try each example in this section as it is presented. This will enhance your
"feel" for BASIC and how it is used. Table 201-1 lists all the AIM 65 BASIC commands.
NOTE
Any time the cursor (^) is displayed in column 1
a BASIC command may be typed in. End all
commands to BASIC by typing RETURN. The
RETURN tells BASIC that you have finished
typing the command. If you make an error, type
a DEL (RUBOUT on a TTY) to eliminate the
last character. Repeated use of DEL will
eliminate previous characters. An @ symbol
will eliminate that entire line being typed.
Table 201.1.

AIM 65 BASIC Commands

Commands
-------CLEAR
CONT
FRE
LIST
LOAD
NEW
PEEK
POKE
RUN
SAVE
Program Statements
-----------------DEF FN
DIM
END
FOR
GOSUB
GOTO
IF...GOTO
IF...THEN
LET
NEXT
ON...GOSUB
ON...GOTO
REM
RESTORE
RETURN
STOP
USR
WAIT

Input/Output
-----------DATA
GET
INPUT
POS
PRINT
READ
SPC
TAB
String Functions
---------------ASC
CHR$
LEFT$
LEN
MID$
RIGHT$
STR$
VAL
Arithmetic Functions
-------------------ABS
ATN*
COS
EXP
INT
LOG
RND
SIN
SGN
SQR
TAN

* Although the ATN function is not included in AIM 65 BASIC,
the ATN command is recognized (see Appendix H).
202

DIRECT AND INDIRECT COMMANDS

DIRECT COMMANDS
Try typing in the following:
PRINT 10-4 (end with RETURN)
BASIC will immediately print:
6
The print statement you typed in was executed as soon as you hit the RETURN key. This is called
a direct command. BASIC evaluated the formula after the "PRINT" and then typed out its value,
in this case "6".
Now try typing in this:
PRINT 1/2,3*10

("*" means multiply, "/" means divide)

BASIC will print:
.5

30

As you can see, BASIC can do division and multiplication as well as subtraction. Note how a ","
(comma) was used in the print command to print two values instead of just one. The command
divides a line into 10-character-wide columns. The comma causes BASIC to skip to the next
10-column field on the terminal, where the value 30 is printed.
INDIRECT COMMANDS
There is another type of command called an Indirect Command. Every Indirect command begins
with a Line Number. A Line Number is any integer from 0 to 63999.
Try typing in these lines:
10 PRINT 2+3
20 PRINT 2-3
A sequence of Indirect Commands is called a "Program." Instead of executing indirect statements
immediately, BASIC saves Indirect Commands in memory. When you type in RUN, BASIC will
execute the lowest numbered indirect statement that has been typed in first, then the next higher,
etc., for as many as were typed in.
In the example above, we typed in line 10 first and line 20 second. However, it makes no difference
in what order you type in indirect statements. BASIC always puts them into correct numerical order
according to the Line Number.
Suppose we type in
RUN
BASIC will print:
5
-1
203

OPERATING ON PROGRAMS AND LINES

In Subject 202, we typed a two-line program into memory.
to operate on either or both lines.

Now let's see how BASIC can be used

LISTING A PROGRAM
If we want a listing of the complete program currently in memory, we type in
LIST

BASIC will reply with:
10 PRINT 2+3
20 PRINT 2-3
DELETING A LINE
Sometimes it is desirable to delete a line of a program altogether. This is accomplished by typing
the Line Number of the line so be deleted, followed by a carriage return.
Type in the following:
10
LIST
BASIC will reply with:
20 PRINT 2-3
We have now deleted line 10 from the program.
REPLACING A LINE
You can replace line 10, rather than just deleting it, by typing the new line 10 and hitting
RETURN.
Type in the following:
10 PRINT 3-3
LIST
BASIC will reply with:
10 PRINT 3-3
20 PRINT 2-3
It is not recommended that lines be numbered consecutively. It may become necessary to insert a
new line between two existing lines. An increment of 10 between line numbers is generally sufficient.
DELETING A PROGRAM
If you want to delete the complete program currently stored in memory, type in "NEW." If you
are finished running one program and are about to read in a new one, be sure to type in "NEW"
first.
Type in the following:
NEW
Now type in:
LIST
204

PRINTING DATA

If is often desirable to include explanatory text along with answers that are printed out.
Type in the following:
PRINT "ONE HALF EQUALS", 1/2
BASIC will reply with:
ONE THIRD EOUALS
.5
As explained in Subject 202, including a "," in a PRINT statement causes it to space over to the
next 10-column field before the value following the "," is printed.

If we use a ";" instead of a comma, the next value will be printed immediately following the
previous value.
NOTE
Numbers are always printed with at least one
trailing space. Any text to be printed must
always be enclosed in double quotes.
Try the following examples:
1.

PRINT "ONE HALF EQUALS"; 1/2
ONE HALF EQUALS .5

2.

PRINT 1,2,3
1
2
3
...

3.

PRINT 1;2;3
1 2 3

4.

PRINT -1;2;-3
-1 2 -3

205

NUMBER FORMAT

We will digress for a moment to explain the format of numbers in BASIC. Numbers are stored
internally to over nine digits of accuracy. When a number is printed, only nine digits are shown.
Every number may also have an exponent (a power of ten scaling factor).
The largest number that may be presented in AIM 65 BASIC is 1.70141183*10^38, while the
smallest positive number is 2.93873588*10^-39.
When a number is printed, the following rules define the format:
1.

If the number is negative, a minus sign (-) is printed.
printed.

2.

If the absolute value of the number is an integer in the range 0 to 999999999, it is
printed as an integer.

3.

If the absolute value of the number is greater than or equal to 0.01 and less than or equal
to 999999999, it is printed in fixed point notation, with no exponent.

4.

If the number does not fall under categories 2 or 3, scientific notation is used.

Scientific notation is formatted as follows:
0 to 9.)

If the number is positive, a space is

SX.XXXXXXXXESTT.

(Each X is some integer,

The leading "S" is the sign of the number: a space for a positive number and a "-" for
for a negative one. One non-zero digit is printed before the decimal point. This it
followed by the decimal point and then the other eight digits of the mantissa. An
"E" is then printed (for exponent), followed by the sign (S) of the exponent; then
the two digits (TT) of the exponent itself. Leading zeroes are never printed; i.e.,
the digit before the decimal is never zero. Trailing zeroes are never printed. If there
is only one digit to print after all trailing zeroes are suppressed, no decimal point is
printed. The exponent sign will be "+" for positive and "-" for negative. Two
digits of the exponent are always printed; that is, zeroes are not suppressed in the
exponent field. The value of any number expressed thus is the number so the left
of the "E" times 10 raised to the power of the number to the right of the "E".
Regardless of what format is used, a space is always printed following a number. BASIC checks
to see if the entire number will fit on the current line. If it cannot, a carriage return/line feed is
executed before printing the number.
Following are examples of various numbers and the output format in which BASIC will output them:
NUMBER
-------------

OUTPUT FORMAT
-------------

+1
-1
6523
-23.460
1E20
-12.3456E-7
1.234567E-10
1000000000
999999999
.1
.01
.000123

1
-1
6523
-23.46
1E+20
-1.23456E-06
1.23457E-10
1E+09
999999999
.1
.01
1.23 E-04

A number input from the keyboard or a numeric constant used in a BASIC program may have as
many digits as desired, up to the maximum length of a line (72 characters) or maximum numeric
value. However, only the first 10 digits are significant, and tenth digit is rounded up.
PRINT 1.23456789876543210
1.2345679
206

VARIABLES

ASSIGNING VARIABLES WITH AN INPUT STATEMENT
Following is an example of a program that reads a value from the keyboard and uses that value to
calculate and print a result:
10 INPUT R
20 PRINT 3.14159*R*R
RUN
?10
314.159
Here's what's happening: When BASIC encounters the input statement, it outputs a question mark
(?) on the display and then waits for you to type in a number. When you do (in the above example,
10 was typed), execution continues with the next statement in the program after the variable (R)
has been set (in this case to 10). In the above example, line 20 would now be executed. When the
formula after the PRINT statement is evaluated, the value 10 is substituted for the variable R each
time R appears in the formula. Therefore, the formula becomes 3.14159*10*10, or 314.159.
If we wanted so calculate the area of various circles, we could rerun the program for each successive
circle. But, there's an easier way to do it simply by adding another line to the program, as follows:
30 GOTO 10
RUN
?10
314.159
?3
28.27431
?4.7
69.3977231
?
By putting a "GOTO" statement on the end of our program, we have caused it to go back to line 10
after it prints each answer for the successive circles. This could have gone on indefinitely, but we
decided to stop after calculating the area for three circles. This was accomplished by typing a
carriage return to the input statement (thus a blank line).
VARIABLE NAMES
The letter "R" in the program above is a "variable." A variable name can be any alphabetic
character and may be followed by any alphanumeric character (letters A to Z, numbers 0 to 9).
Any alphanumeric characters after the first two are ignored.
Here are some examples of legal and illegal variable names:
Legal

Illegal

A

% (first character must be alphabetic)

Z1

ZIABCD (variable name too long)

TP
PSTG$
COUNT

TO (variable names cannot be reserved words)
RGOTO (variable names cannot contain reserved words)

ASSIGNING VARIABLES WITH A LET OR ASSIGNMENT STATEMENT
Besides having values assigned to variables with an input statement, you can also set the value of a
variable with a LET or assignment statement.
Try the following examples:
A=5
PRINT A, A*2
5
10
LET Z=7
PRINT Z, Z-A
7
2
As you will notice from the examples, the "LET" is optional in an assignment statement.
BASIC "remembers" the values that have been assigned to variables using this type of statement.
This "remembering" process uses space in the memory to store the data.
The values of variables are discarded (and the space in memory used to store them is released) when
one of four conditions occur:
*

A new line is typed into the program or an old line is deleted

*

A CLEAR command is typed in

*

A RUN command is typed in

*

NEW is typed in

Another important fact is that if a variable is encountered in a formula before it is assigned a value,
it is automatically assigned the value zero. Zero is then substituted as the value of the variable in
the
particular formula. Try the example below:
PRINT Q;Q+2;Q*2
0 2 0
RESERVED WORDS
The words used as BASIC statements are "reserved" for this specific purpose. You cannot use these
words as variable names or inside of any variable name. For instance, "FEND" would be illegal
because "END" is a reserved word.
Table 206-1 is a list of the reserved words in BASIC.
Table 206-1.
ABS
AND
ASC
ATN
CHR$
CLEAR
CONT
COS
DATA
DEF
DIM
END
EXP

AIM 65 BASIC Reserved Words

FN
FOR
FRE
GET
GOSUB
GOTO
IF
INPUT
INT
LEFT$
LEN
LET

LIST
LOAD
LOG
MID$
NEW
NEXT
NOT
NULL
ON
OR
PEEK
POKE

PRINT
POS
READ
REM
RESTORE
RETURN
RIGHT$
RND
RUN
SAVE
SGN
SIN

SPC
SQR
STEP
STOP
STR$
TAB
TAN
THEN
TO
USR
VAL
WAIT

REMARKS
The REM (short for "remark") statement is used to insert comments or notes into a program.
BASIC encounters a REM statement, the rest of the line is ignored.

When

This serves mainly as an aid for the programmer and serves no useful function as far as the operation
of the program in solving a particular problem.
207

RELATIONAL TESTS

Suppose we wanted to write a program to check whether a number is zero. With the statements
we've gone over so far, this could not be done. What is needed is a statement which can be used
to conditionally branch to another statement. The "IF-THEN" statement does just that.
Type in the following program:
10
20
30
40
50
60

(remember, type NEW first)

INPUT B
IF B=0 THEN 55
PRINT "NON-ZERO"
GOTO 10
PRINT "ZERO"
GOTO 10

When this program is typed and run, it will ask for a value for B. Type in any value you wish.
The AIM 65 will then come to the "IF" statement. Between the "IF" and the "THEN" portion
of the statement there are two expressions separated by a "relation."
A relation is one of the following six symbols:
RELATION
-------=
>
<
<>
<= or =<
=> or >=

MEANING
-----------------------EQUAL TO
GREATER THAN
LESS THAN
NOT EQUAL TO
LESS THAN OR EQUAL TO
GREATER THAN OR EQUAL TO

The IF statement is either true or false, depending upon whether the two expressions satisfy the
relation. For example, in the program we just did, if 0 was typed in for B the IF statement would
be true because 0=0. In this case, since the number after the THEN is 50, execution of the program
would continue at line 50. Therefore, "ZERO" would be printed and then the program would
jump back to line 10 (because of the GOTO statement in line 60).
Suppose a 1 was typed in for B. Since 1=0 is false, the IF statement would be false and the program
would continue execution with the next line. Therefore, "NON-ZERO" would be printed and the
GOTO in line 40 would send the program back to line 10.
A PROGRAM USING RELATIONS
Now try the following program for comparing two numbers:
10
20
30
40
50
60
70
80
90

INPUT A,B
IF A<=B THEN 50
PRINT "A IS BIGGER"
GOTO 10
IF A=1 THEN 20

Notice that we are now checking to see that I is greater than or equal to the final value. The reason
is that we are now counting by a negative number. In the previous examples it was the opposite, so
we were checking for a variable less than or equal to the final value.
SOME OTHER LOOPING OPERATIONS
The "STEP" statement previously shown can also be used with negative numbers to accomplish this
same result. This can be done using the same format as in the other program:
10 FOR I=10 TO 1 STEP -1
20 PRINT I
30 NEXT I
"FOR" loops can also be "nested."
10
20
30
40
50

For example:

FOR I=1 TO 5
FOR J=1 TO 3
PRINT I,J
NEXT J
NEXT I

Notice that "NEXT J" precedes "NEXT I." This is because the J-Ioop is inside the I-loop.
following program is incorrect; run it and see what happens:

The

10
20
30
40
50

FOR I=1 TO 5
FOR J=1 TO 3
PRINT I,J
NEXT I
NEXT J

It does not work because when the "NEXT I" is encountered, all knowledge of the J-loop is lost.
This happens because the J-loop is "inside" the I-loop.
209

MATRIX OPERATIONS

It is often convenient to be able to select any element in a table of numbers.
be done through the use of matrices.

BASIC allows this to

A matrix is a table of numbers. The name of this table (the matrix name) is any legal variable name,
"A" for example. The matrix name "A" is distinct and separate from the simple variable "A," and
you could use both in the same program.
To select an element of the table, we subscript "A": that is, to select the I'th element, we enclose I
in parentheses "(I)" and then follow "A" by this subscript. Therefore, "A(I)" is the I'th element in
the matrix "A."
"A(1)" is only one element of matrix A, and BASIC must be told how much space so allocate for
the entire matrix. This is done with a "DIM" statement, using the format "DIM A(15)." In this
case, we have reserved space for the matrix index "I" to go from 0 to 15. Matrix subscripts always
start as 0; therefore, in the above example, we have allowed for 16 numbers in matrix A.
If "A(1)" is used in a program before is has been dimensioned, BASIC reserves space for 11 elements
(0 through 10).
A SORT PROGRAM
As an example of how matrices are used, try the following program so sort a list of 8 numbers, in
which you pick the numbers to be sorted:
10
20
30
50
70
80
90
100

DIM A(8)
FOR I=1 TO 8
INPUT A(I)
NEXT I
F=0
FOR I=1 TO 7
IF A(I)<=A(I+1) THEN 140
T=A(I)

110
120
130
140
150
160
170
180

A(I)=A(I+1)
A(I+1)=T
F=1
NEXT I
IF F=1 THEN 70
FOR I=1 TO 8
PRINT A(I)
NEXT I

When line 10 is executed, BASIC sets aside space for 9 numeric values, A(0) through A(8).
Lines 20 through 50 get the unsorted list from the user. The sorting itself is done by going through
the list of numbers and switching any two that are not in order. "F" is used to indicate if any
switches were made; if any were made, line 150 tells BASIC to go back and check some more.
If we did not switch any numbers, or after they are all in order, lines 160 through 180 will print
out the sorted list. Note that a subscript can be any expression.
210

SUBROUTINES

If you have a program that performs the same action in several different places, you could duplicate
the same statements for the action in each place within the program.
The "GOSUB" and "RETURN" statements can be used to avoid this duplication. When a "GOSUB"
is encountered, BASIC branches to the line whose number follows the "GOSUB." However, BASIC
remembers where it was in the program before it branches. When the "RETURN" statement is
encountered, BASIC goes back to the first statement following the last "GOSUB" that was
executed. Observe the following program:
10
30
40
50
70
80
90

PRINT
GOSUB
T=N
PRINT
GOSUB
PRINT
STOP

"WHAT IS THE NUMBER";
100
"SECOND NUMBER";
100
"THE SUM IS"; T+N

100
110
120
130
140

INPUT N
IF N=INT(N) THEN 140
PRINT "MUST BE INTEGER."
GOTO 100
RETURN

This program asks for two numbers (which must be integers), and then prints their sum. The
subroutine in this program is lines 100 to 140. The subroutine asks for a number, and if it is not
an integer, asks for a new number. It will continue to ask until an integer value is typed in.
The main program prints "WHAT IS THE NUMBER," and then calls the subroutine so get the value
of the number into N. When the subroutine returns (to line 40), the value input is saved in the
variable T. This is done so that when the subroutine is called a second time, the value of the first
number will not be lost.
"SECOND NUMBER" is then printed, and the second value is entered when the subroutine is
again called.
When the subroutine returns the second time, "THE SUM IS" is printed, followed by the sum.
T contains the value of the first number that was entered and N contains the value of the second
number.
STOPPING A PROGRAM
The next statement in the program is a "STOP" statement. This causes the program to stop
execution at line 90. If the "STOP" statement was excluded from the program, we would "fall
into" the subroutine at line 100. This is undesirable because we would be asked to input another
number. If we did, the subroutine would try to return; and since there was no "GOSUB" which
called the subroutine, an RG error would occur. Each "GOSUB" executed in a program should
have a matching "RETURN" executed later. The opposite also applies: a "RETURN" should be
encountered only if it is part of a subroutine which has been called by a "GOSUB."
Either "STOP" or "END" can be used to separate a program from its subroutines.
print a message saying at what line the "STOP" was encountered.
211

"STOP" will

ENTERING DATA

Suppose you had to enter numbers to your program that did not change each time the program was
run, but you would like it to be easy to change them if necessary. BASIC contains special statements, "READ" and "DATA," for this purpose.
Consider the following program:
10
20
30
40
50
60
70
90
95
100
110
120

PRINT "GUESS A NUMBER";
INPUT G
READ D
IF D = -999999 THEN 90
IF D<>G THEN 30
PRINT "YOU ARE CORRECT"
END
PRINT "BAD GUESS, TRY AGAIN."
RESTORE
GOTO 10
DATA 1,393,-39,28,391,-8,0,3.14,90
DATA 89,5,10,15,-34,-999999

When the "READ" statement is encountered, the effect is the same as an INPUT statement. But,
instead of getting a number from the keyboard, a number is read from the "DATA" statements.
The first time a number is needed for a READ, the first number in the first DATA statement is
read. The second time one is needed, the second number in the first DATA statement is read.
When the all numbers of the first DATA statement have been read in this manner, the second
DATA statement will be used. DATA is always read sequentially in this manner, and there may
be any number of DATA statements in your program.
The purpose of this program is to play a little game in which you try to guess one of the numbers
contained in the DATA statements. For each guess that is typed in, we read through all of the
numbers in the DATA statements until we find one that matches the guess.

If more values are read than there are numbers in the DATA statements, an out of data (OD) error
occurs. That is why in line 40 we check to see if -999999 was read. This is not one of the numbers
to be matched, but is used as a flag to indicate that all of the data (possible correct guesses) has
been read. Therefore, if -999999 was read, we know that the guess was incorrect.
Before going back to line 10 for another guess, we need to make the READ's begin with the first
piece of data again. This is the function of the "RESTORE." After the RESTORE is encountered,
the next piece of data read will be the first number in the first DATA statement again.
DATA statements may be placed anywhere within the program. Only READ statements make use
of the DATA statements in a program, and any other time they are encountered during program
execution they will be ignored.
212

STRINGS

A list of characters is referred to as a "String." Rockwell, R6500, and THIS IS A TEST are all
strings. Like numeric variables, string variables can be assigned specific values. String variables
are
distinguished from numeric variables by a "$" after the variable name.
For example, try the following:
A$="ROCKWELL R6500"
PRINT A$
ROCKWELL R6500
In this example, we set the string variable A$ to the string value "ROCKWELL R6500."
we also enclosed the character string so be assigned to A$ in quotes.

Note that

LEN FUNCTION
Now that we have set A$ to a string value, we can find out what the length of this value is (the
number of characters it contains). We do this as follows:
PRINT LEN(A$),LEN("MICROCOMPUTER")
14
13
The "LEN" function returns an integer equal to the number of characters in a string.
A string expression may contain from 0 to 255 characters. A string containing 0 characters is called
the "null" string. Before a string variable is set to a value in the program, it is initialized to the
null
string. Printing a null string on the terminal will cause no characters to be printed, and the printer
or cursor will not be advanced to the next column. Try the following:
PRINT LEN(Q$);Q$;3
0 3
Another way to create the null string is:

Q$=""

Setting a string variable to the null string can be used to free up the string space used by a non-null
string variable.
LEFT$ FUNCTION
It is often desirable to access parts of a string and manipulate them. Now that we have set A$ to
"ROCKWELL R6500," we might want to print out only the first eight characters of A$. We would
do so like this:
PRINT LEFT$(A$,8)
ROCKWELL
"LEFT$" is a string function which returns a string composed of the leftmost N characters of its
string argument. Here is another example:
FOR N=1 TO LEN(A$):PRINT LEFT$(A$,N):NEXT N
R
RO
ROC
ROCK

ROCKW
ROCKWE
ROCKWEL
ROCKWELL
ROCKWELL
ROCKWELL
ROCKWELL
ROCKWELL
ROCKWELL

R
R6
R65
R650
R6500

Since A$ has 14 characters this loop will be executed with N=1,2,3,...,13,14. The first time
through only the first character will be printed, the second time the first two characters will be
printed, etc.
RIGHT$ FUNCTION
Another string function, called "RIGHT$," returns the right N characters from a string expression.
Try substituting "RIGHT$" for "LEFT$" in the previous example and see what happens.
MID$ FUNCTION
There is also a string function which allows us to take characters from the middle of a string.
the following:

Try

FOR N=1 TO LEN(A$):PRINT MID$(A$,N):NEXT N
ROCKWELL R6500
OCKWELL R6500
CKWELL R6500
KWELL R6500
WELL R6500
ELL R6500
LL R6500
L R6500
R6500
R6500
6500
500
00
0
"MID$" returns a string starting at the Nth position of A$ so the end (last character) of A$. The
first position of the string is position 1 and the last possible position of a string is position 255.
Very often it is desirable to extract only the Nth character from a string. This can be done by
calling MID$ with three arguments. The third argument specifies the number of characters to
return.
For example:
FOR N=1 TO LEN(A$):PRINT MID$(A$,N,1),MID$(A$,N,2):NEXT N
R
RO
O
OC
C
CK
K
KW
W
WE
E
EL
L
LL
L
L
R
R
R6
6
65
5
50
0
00
0
0
CONCATENATION-JOINING STRINGS
Strings may also be concatenated (put or joined together) through the use of the "+" operator.
Try the following:

B$="BASIC FOR"+" "+A$
PRINT B$
BASIC FOR ROCKWELL R6500
Concatenation is especially useful if you wish to take a string apart and then put it back together
with slight modifications. For instance:
C$=LEFT$(B$,9)+"-"+MID$(B$,11,8)+"-"+RIGHT$(B$,5)
PRINT C$
BASIC FOR-ROCKWELL-R6500
VAL AND STRS FUNCTIONS
Sometimes it is desirable to convert a number to its string representation, and vice-versa.
and "STR$" perform these functions.

"VAL"

Try the following:
STRING$="567.8"
PRINT VAL(STRING$)
567.8
STRING$=STR$(3.1415)
PRINT STRINGS$,LEFT$(STRING$,5)
3.1415
3.14
"STR$" can be used to perform formatted I/O on numbers. You can convert a number to a string
and then use LEFT$, RIGHT$, MID$ and concatenation to reformat the number as desired.
"STR$" can also be used to conveniently find out how many print columns a number will take.
For example:
PRINT LEN(STR$(3.157))
6
If you have an application in which a user is typing in a question such as "WHAT IS THE VOLUME
OF A CYLINDER OF RADIUS 5.36 FEET, OF HEIGHT 5.1 FEET?" you can use "VAL" to
extract the numeric values 5.36 and 5.1 from the question.
CHR$ FUNCTION
CHR$ is a string function which returns a one character string which contains the alphanumeric
equivalent of the argument, according so the conversion table in Appendix E. ASC takes the first
character of a string and converts it to its ASCII decimal value.
One of the most common uses of CHR$ is to send a special character to a terminal.
100
110
120
130
120
130
140
150
160
170
180
185
190
200
202
204
220
230
240
250
260
270
280

DIM A$(15)
FOR I=1 TO 15
READ A$(I)
NEXT I
F=0:I=1
IF A$(I)<=A$(I+1) THEN 180
T$=A$(I+1)
A$(I+1)=A$(I)
A$(I)=T$
F=1
I=I+1
IF I<15 THEN 130
IF F THEN 120
FOR I=1 TO 15
PRINT A$(I)
NEXT I
DATA AIM 65,DOG
DATA CAT,R6500
DATA ROCKWELL,RANDOM
DATA SATURDAY,"***ANSWER***"
DATA MICRO,FOO
DATA COMPUTER,MED
DATA NEWPORT BE-ACH,DALLAS,ANAHEIM

ADDITIONAL STRING CONSIDERATIONS
1.

A string may contain from 0 to 255 characters.
sign ($); for example, A$, B9$, K$, HELLO$.

All string variable names end in a dollar

2.

String matrices may be dimensioned exactly like numeric matrices. For instance,
DIM A$(10,10) creates a string matrix of 121 elements, eleven rows by elevon columns
(rows 0 to 10 and columns 0 to 10). Each string matrix element is a complete string,
which can be up to 255 characters in length.
NAME
----

EXAMPLE
-------

PURPOSE/USE
-----------

DIM

25 DIM A$(10,10)

Allocates space for a pointer and length for
each element of a string matrix. No string
space is allocated.

LET

27 LET A$="FOO"+V$

Assigns the value of a string expression to
a string variable. LET is optional.

=
>
<
<= or =<
>= or =>
<>

String comparison operators. Comparison
is made on the basis of ASCII codes, a
character at a time until a difference is
found. If during the comparison of two
strings, the end of one is reached, the
shorter string is considered smaller.
Note that "A " is greater than "A" since
trailing spaces are significant.

+

30 LET Z$=R$+Q$

String concatenation. The resulting string
must be less than 256 characters in length
or an LS error will occur.

INPUT

40 INPUT X$

Reads a string from the keyboard.
does not have to be quoted; but if
leading blanks will be ignored and
string will be terminated on a ","
character.

READ

50 READ X$

Reads a string from DATA statements
within the program. Strings do not have
to be quoted; but if they are not, they
are terminated on a "," or ":" character
and leading spaces are ignored. See
DATA for the format of string data.

PRINT

60 PRINT X$
70 PRINT "FOO"+A$

Prints the string expression on the
display/printer.

300

STATEMENT DEFINITIONS

301

SPECIAL CHARACTERS

String
not,
the
or ":"

CHARACTER
---------

USE
---

@

Erases current line being typed, and types a carriage return/line
feed.

DEL

Erases last character typed. If no more characters are left on
the line, types a carriage return/line feed.

RETURN

A RETURN must end every line typed in. Returns cursor to
the first position (leftmost) on line, and prints the line if the
printer is on.

F1

Interrupts execution of a program or a list command. F1 has
effect when a statement finishes execution, or in the case of
interrupting a LIST command, when a complete line has
finished printing. In both cases a return is made to BASIC's

command level and OK is typed.
Prints "BREAK IN LINE XXXX," where XXXX is the line
number of the next statement to be executed.
There is no F1 key on a TTY. However, when TTY is being
used, the AIM 65's F1 key is operational and can be used.
: (colon)

A colon is used to separate statements on a line. Colons may
be used in direct and indirect statements. The only limit on
the number of statements per line is the line length. It is not
possible to GOTO or GOSUB to the middle of a line.

?

Question marks are equivalent to PRINT. For instance, ? 2+2
is equivalent to PRINT 2+2. Question marks can also be used
in indirect statements. 10 ? X, when listed, will be typed as
10 PRINT X.

$

A dollar sign ($) suffix on a variable name establishes the
variable as a character string.

%

A percent sign (%) suffix on a variable name establishes the
variable as an integer

!

An exclamation sign (!) suffix on an INPUT, PRINT, or ?
command causes the input or output to be printed even
though the printer is turned off.

ESC

Returns control to the Monitor.

CNTL PRINT

Turns the AIM 65 printer on if it is off, and off if it is on.

302

OPERATORS
SYMBOL
------

SAMPLE STATEMENT
----------------

PURPOSE/USE
-----------

=

A=100

Assigns a value to a variable

LET Z=2.5

The LET is optional

-

B=-A

Negation. Note that 0-A is subtraction,
while -A is negation.

^ (F3 key)

130 PRINT X^3

Exponentiation (equal to X*X*X in
in the sample statement)
0^0=1

0 to any other power = 0

A^B, with A negative and B not an
integer gives an FC error.
*

140 X=R*(B*D)

Multiplication.

/

150 PRINT X/1.3

Division.

+

160 Z=R+T+Q

Addition

-

170 J=100-I

Subtraction

RULES FOR EVALUATING EXPRESSIONS:
1)

Operations of higher precedence are performed before operations of lower precedence.
This means the multiplication and divisions are performed before additions and subtractions.
As an example, 2+10/5 equals 4, not 2.4. When operations of equal precedence are found
in a formula, the left hand one is executed first: 6-3+5=8, not -2.

2)

The order in which operations are performed can always be specified explicitly through the
use of parentheses. For instance, to add 5 to 3 and then divided that by 4, we would use
(5+3)/4, which equals 2. If instead we had used 5+3/4, we would get 5.75 as a result

(5 plus 3/4).
The precedence of operators used in evaluating expressions is as follows, in order beginning with the
highest precedence :
NOTE
Operators listed on the same line have the same
precedence.
1)

Expressions in parentheses are always evaluated first

2)

^ (F3 KEY)

ExponentiatiOn

3)

NEGATION

-X where X may be a formula

4)

* and /

Multiplication and Division

5)

+ and -

Addition and Subtraction

6)

RELATIONAL OPERATORS:
(equal precedence for all six)

=
<>
<
>
=< or <=
=> or >=

Equal
Not Equal
Less Than
Greater Than
Less Than or Equal
Greater Than or Equal

(These three below are Logical Operators)
7)

NOT

Logical and bitwise "NOT" like
negation, not takes only the formula
to its right as an argument

8)

AND

Logical and bitwise "AND"

9)

OR

Logical and bitwise "OR"

A relational expression can be used as part of any expression.
Relational Operator expressions will always have a value of True (-1) or a value of False (0).
Therefore, (5=4)=0, (5=5)=-1, (4>5)=0, (4<5)=-1, etc.
The THEN clause of an IF statement is executed whenever the formula after the IF is not equal to 0.
That is to say, IF X THEN ... is equivalent to IF X<>0 THEN ....
SYMBOL
------

SAMPLE STATEMENT
----------------

PURPOSE/USE
-----------

-

10 IF A=15 THEN 40

Expression Equals Expression

<>

70 IF A<>0 THEN 5

Expression Does Not Equal Expression

>

30 IF B>100 THEN 8

Expression Greater Than Expression

<

160 IF B<2 THEN 10

Expression Less Than Expression

<=,=<

180 IF 100<=B+C THEN 10

Expression Less Than or Equal To
Expression

>=,=>

190 IF Q=>R THEN 50

Expression Greater Than Or Equal To
Expression

AND

2 IF A<5 AND B<2 THEN 7

If expression 1 (A<5) AND expression 2
(B<2) are both true, then branch to
line 7

OR

IF A<1 OR B<2 THEN 2

If either expression 1 (A<1) OR
expression 2 (B<2) is true, then branch
to line 2

NOT

IF NOT Q3 THEN 4

If expression "NOT Q3" is true (Because
Q3 is false), then branch to line 4
Note:

NOT -1=0 (NOT true=false)

AND, OR, and NOT can be used for bit manipulation, and for performing boolean operations.
These three operators convert their arguments to sixteen bit, signed two's-complement integers in
the range -32768 to +32767. They then perform the specified logical operation on them and return
a result within the same range. If the arguments are not in this range, an "FC" error results.
The operations are performed in bitwise fashion, this means that each bit of the result is obtained
by examining the bit in the same position for each argument.
The following truth table shows the logical relationship between bits:
OPERATOR
--------

ARGUMENT 1
----------

ARGUMENT 2
----------

RESULT
------

AND

1
0
1
0

1
1
0
0

1
0
0
0

OR

1
1
0
0

1
0
1
0

1
1
1
0

NOT

1
0

-

0
1

EXAMPLES:

(In all of the examples below, leading zeroes on binary numbers are not shown.)

63 AND 16=16

Since 63 equals binary 111111 and 16 equals binary 10000, the result
of the AND is binary 10000 or 16.

15 AND 14=14

15 equals binary 1111 and 14 equals binary 1110, so 15 AND 14
equals binary 1110 or 14.

-1 AND 8=8

-1 equals binary 1111111111111111 and 8 equals binary 1000, so
the result is binary 1000 or 8 decimal.

4 AND 2=0

4 equals binary 100 and 2 equals binary 10, so the result is binary 0
because nons of the bits in either argument match to give a 1 bit in
the result.

4 OR 2=6

Binary 100 OR'd with binary 10 equals binary 110, or 6 decimal.

10 OR 10=10

Binary 1010 OR'd with binary 1010 equals binary 1010, or 10 decimal.

-1 OR -2=-1

Binary 1111111111111111 (-1) OR'd with binary 1111111111111110
(-2) equals binary 1111111111111111, or -1.

NOT 0=-1

The bit complement of binary 0 to 16 places is sixteen ones
(1111111111111111) or -1. Also NOT -1=0.

NOT X

NOT X is equal to -(X+1). This is because to form the sixteen bit
two's complement of the number, you take the bit (one's)
complement and add one.

NOT 1=-2

The sixteen bit complement of 1 is 1111111111111110, which is
equal to -(1+1) or -2.

A typical use of the bitwise operators is to test bits set in the computer's locations which reflect
the
state of some external device.
Bit position 7 is the most significant bit of a byte, while position 0 is the least significant.

For instance, suppose bit 1 of location 40963 is 0 when the door to Room X is closed, and 1 if the
door is open. The following program will print "Intruder Alert" if the door is opened:
10 IF NOT (PEEK(40963) AND 2) THEN 10

This line will execute over and over until
bit 1 (masked or selected by the 2)
becomes a 1. When that happens, we go
to line 20.

20 PRINT "INTRUDER ALERT"

Line 20 will output "INTRUDER
ALERT."

However, we can replace statement 10 with a "WAIT" statement, which has exactly the same effect.
10 WAIT 40963,2

This line delays the execution of the
next statement in the program until
bit 1 of location A003 becomes 1. The
WAIT is much faster than the equivalent
IF statement and also takes less bytes
of program storage.

The following is another useful way of using relational operators:
125 A=-(B>C)*B-(B<=C)*C

303

This statement will set the variable A
to MAX(B,C) = the larger of the two
variables B and C.

COMMANDS

A BASIC command may be entered when the cursor is displayed. This is called the "Command Level."
Commands may be used as program statements. Certain commands, such as LIST, NEW, and LOAD
will terminate program execution when they finish. Each command may require one or more
arguments in addition to the command statement, as defined in the syntax/function description. An
argument without parenthesis is required to be entered without parenthesis. Arguments contained
within parenthesis are required to be entered with the shown parenthesis. Arguments within brackets
are optional. Optional arguments, if included, must be entered with or without accompanying
parenthesis, however shown.
STATEMENT

SYNTAX/FUNCTION

EXAMPLE

CLEAR

CLEAR
Clears all program variables, resets "FOR"
and "GOSUB" state, and restores data.

CLEAR

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

CONT

CONT
Continues program execution after the F1
key or a STOP or INPUT statement terminates execution. You cannot continue after
any error, after modifying your program, or
before your program has been run. One of
the main purposes of CONT is debugging.
Suppose at some point after running your
program, nothing is printed. This may be
because your program is performing some
time consuming calculation, but it may be
because you have fallen into an "infinite
loop." An infinite loop is a series of BASIC
statements from which there is no excape.
BASIC will keep executing the series of
statements over and over; until you intervene or until power to the AIM 65 is
turned off. If you suspect your program
is in an infinite loop, press F1 until the
BREAK message is displayed. The line
number of the statement BASIC was
executing will be displayed. After BASIC
has displayed the cursor, you can use
PRINT to type out some of the values of
your variables. After examining these

CONT

values you may become satisfied that your
program is functioning correctly. You
should then type in CONT to Continue
executing your program where it left off, or
type a direct GOTO statement to resume
execution of the program at a different line.
You could also use assignment statements
to set some of your variables to different
values. Remember, if you interrupt a
program with the F1 key and expect to
continue it later, you must not get any
errors or type in any new program lines.
If you do, you won't be able to continue
and will get a "CN" (continue not) error.
It is impossible to continue a direct
command. CONT always resumes
execution at the next statement to be
executed in your program when F1 was
typed.
STATEMENT

SYNTAX/FUNCTION

EXAMPLE

FRE

FRE (expression)
Gives the number of memory bytes
currently unused by BASIC. A dummy
operand--0 or 1--must be used.

270 PRINT FRE(0)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

LIST

LIST [[start line] [-[end line]]]
Lists current program optionally starting at
specified line. List can be interrupted with
the F1 key. (BASIC will finish listing the
current line.)
Lists entire program

LIST

Lists just line 100.

LIST 100

Lists lines 100 to 1000.

LIST 100-1000

Lists from current line to line 1000.

LIST -1000

Lists from line 100 to end of program.

LIST 100-

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

LOAD

LOAD
Loads a BASIC program from the cassette
tape. When done, the LOAD will display
the cursor. See Appendix G for more
information.

LOAD

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

NEW

NEW
Deletes current program and all variables.

NEW

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

PEEK

PEEK (address)
The PEEK function returns the contents of
memory address I in decimal. The value
returned will be =>0 and <=255. If I is
>65535 or <0, an FC error will occur.
An attempt to read a non-existent memory
address will return an unknown value.

356 PRINT PEEK(I)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

POKE

POKE location, byte
The POKE statement stores the byte
specified by its second argument (J) into
the location given by its first argument (I).
The byte to be stored must be =>0 and
<=255, or an FC error will occur. The
address (I) must be =>0 and <=65535, or
an FC error result. Caution: Careless use
of the POKE statement may cause your
program, BASIC, or the Monitor functions
to operate incorrectly, to hang up, and/or
cause loss of your program. Note that
Pages 0 and 1 in memory are reserved for
use by BASIC and should not be used for
user program variable storage. A POKE to
a non-existent memory location is harmless.
One of the main uses of POKE is to pass
arguments to machine language subroutines.
(See Appendix F.) You could also use
PEEK and POKE to write a memory
diagnostic or an assembler in BASIC.

357 POKE I,J

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

RUN

RUN line number
Starts execution of the program currently in
memory at the specified line number. RUN
deletes all variables [does a CLEAR) and
restores DATA. If you have stopped your
program and wish to continue execution at
some point in the program, use a direct
GOTO statement to start execution of your
program at the desired line, or CONT to
continue after a break.

RUN 200

Start program execution at the lowest
numbered statement.

RUN

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

SAVE

SAVE
Saves the current program in the AIM 65
memory on cassette tape. The program in
memory is left unchanged. More than one
program may be stored on cassette using
this command.

SAVE

See Appendix G for more information.
304

PROGRAM STATEMENTS

In the following description of statements, an argument of B, C, V or W denotes a numeric variable,
X denotes a numeric expression, X$ denotes a string expression and an I or J denotes an expression
that is truncated to an integer before the statement is executed. Truncation means that any
fractional part of the number is lost, e.g., 3.9 becomes 3, 4.01 becomes 4.
An expression is a series of variables, operators, function calls and constants which after the
operations and function calls are performed using the precedence rules, evaluates to a numeric
or string value.
A constant is either a number (3.14) or a string literal ("FOO").
STATEMENT

SYNTAX/FUNCTION

EXAMPLE

DEF

DEF FNx [(argument list)] = expression
The user can define functions like the builtin functions (SQR, SGN, ABS, etc.) through
the use of the DEF statement. The name
of the function is "FN" followed by any
legal variable name, for example: FNX,

100 DEF FNA(V)=V/B+C

FNJ7, FNKO, FNR2. User defined functions are restricted to one line. A function
may be defined to be any expression, but
may only have one argument. In the
example, B and C are variables that are used
in the program. Executing the DEF statement defines the function. User defined
functions can be redefined by executing
another DEF statement for the same
function. "V" is called the dummy variable.
Execution of this statement following the
above would cause Z to be set to 3/B+C,
but the value of V would be unchanged.

100 Z=FNA(3)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

DIM

DIM variable (size 1, [size 2...])
Allocates space for matrices. All matrix
elements are set to zero by the DIM
statement.

113 DIM A(3),B(10)

Matrices can have from one to 255
dimensions.

114 DIM R3(5,5),
D$(2,2,2)

Matrices can be dimensioned dynamically
during program execution. If a matrix is
not explicitly dimensioned with a DIM
statement, it is assumed to be a single
dimensioned matrix of whose single
subscript may range 0 to 10 (eleven
elements).

115 DIM Q1(N),Z(2*I)

If this statement was encountered before a
DIM statement for A was found in the
program, it would be as if a DIM A(10)
had been executed previous to the execution of line 117. All subscripts start at
zero (0), which means that DIM X(100)
really allocates 101 matrix elements.

117 A(8)=4

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

END

END
Terminates program execution without
printing a BREAK message. (See STOP.)
CONT after an END statement causes
execution to resume at the statement after
the END Statement. END can be used
anywhere in the program, and is optional.

999 END

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

FOR

FOR variable = expression to expression
[STEP expression] (See NEXT statement)
V is set equal to the value of the expression
following the equal sign, in this case 1. This
value is called the initial value. Then the
statements between FOR and NEXT are
executed. The final value is the value of the
expression following the TO. The step is
the value of the expression following STEP.
When the NEXT statement is encountered,
the step is added to the variable.

300 FOR V=1 TO 9.3
STEP .6

If no STEP was specified, it is assumed to
be one. If the step is positive and the new
value of the variable is <= the final value
(9.3 in this example), or the step value is
negative and the new value of the variable

310 FOR V=1 TO 9.3

is => the final value, then the first statement following the FOR statement is
executed. Otherwise, the statement
following the NEXT statement is executed.
All FOR loops execute the statements
between the FOR and the NEXT at least
once, even in cases like FOR V=1 TO 0.
Note that expressions (formulas) may be
used for the initial, final and step values
in a FOR loop. The values of the expressions are computed only once, before the
body of the FOR...NEXT loop is
executed.

315 FOR V=10*N TO
3.4/Q STEP SQR(R)

When the statement after the NEXT is
executed, the loop variable is never equal
to the final value, but is equal to whatever
value caused the FOR...NEXT loop to
terminate. The statements between the
FOR and its corresponding NEXT in both
examples above (310 and 320) would be
executed nine times.

320 FOR V=9 TO 1
STEP -1

Error: do not use nested FOR...NEXT
loops with the same index variable.

330 FOR W=1 TO 10:
FOR W=1 TO 5:NEXT
W:NEXT W

FOR loop nesting is limited only by the
available memory. (See Appendix C.)
STATEMENT

SYNTAX/FUNCTION

EXAMPLE

GOSUB

GOSUB line number
Branches to the specified statement (910)
until a RETURN is encountered; when a
branch is then made to the statement after
the GOSUB. GOSUB nesting is limited
only by the available memory.

10 GOSUB 910

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

GOTO

GOTO line number
Branches to the statement specified.

50 GOTO 100

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

IF...GOTO

IF expression GOTO line number ...
Equivalent to IF...THEN, except that
IF...GOTO must be followed by a line
number, while IF...THEN can be
followed by either a line number or
another statement.

32 IF X<=Y+23.4
GOTO 92

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

IF...THEN

IF expression THEN line number ...

IF X<10 THEN 5

Branches to specified statement if the
relation is True.
Executes all of the statements on the
remainder of the THEN if the relation
is True.

20 IF X<0 THEN PRINT
"X LESS THAN 0"

WARNING: The "Z=A" will never be
executed because if the relation is true,
BASIC will branch to line 50. If the
relation is false BASIC will proceed to
to the line following line 25.

25 IF X=5 THEN 50:Z=A

In this example, if X is less than 0, the
PRINT statement will be executed and
then the GOTO statement will branch to
line 350. If the X was 0 or positive,
BASIC will proceed to execute the lines
after line 26.

26 IF X<0 THEN PRINT
"ERROR, X NEGATIVE":
GOTO 350

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

LET

[LET] variable = expression
Assigns a value to a variable,

300 LET W=X

"LET" is optional.

310 V=5.1

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

NEXT

NEXT [variable] [,variable] ...
Marks the end of a FOR loop.

340 NEXT V

If no variable is given, matches the most
recent FOR loop,

345 NEXT

A single NEXT may be used to match
multiple FOR statements. Equivalent
to NEXT V:NEXT W.

350 NEXT V,W

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

ON...GOSUB

ON expression GOSUB line [,line] ...
Identical to "ON...GOTO," except that
a subroutine call (GOSUB) is executed
instead of a GOTO. RETURN from the
GOSUB branches to the statement after
the ON...GOSUB.

110 ON I GOSUB 50,60

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

ON...GOTO

ON expression GOTO line [, line] ...
Branches to the line indicated by the
I'th number after the GOTO. That is:

100 ON I GOTO 10,20,
30,40

IF
IF
IF
IF

I=1,
I=2,
I=3,
I=4,

THEN
THEN
THEN
THEN

GOTO
GOTO
GOTO
GOTO

LINE
LINE
LINE
LINE

10
20
30
40.

If I=0, or I attempts to select a nonexistent
line (>=5 in this case), the statement after
the ON statement is executed. However, if
I is >255 or <0, an FC error message will
result. As many line numbers as will fit on
a line can follow an ON...GOTO.
This statement will branch to line 40 if the
expression X is less than zero, to line 50 if
it equals zero, and to line 60 if it is greater
than zero.

105 ON SGN(X)+2
GOTO 40,50,60

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

REM

REM any text
Allows the programmer to put comments
in his program. REM statements are not
executed, but can be branched to. A REM
statement is terminated by end of line, but
not by a ":".

500 REM NOW SET
V=0

In this case the V=0 will never be executed
by BASIC.

505 REM SET V=0:
V=0

In this case V=0 will be executed,

505 V=0: REM SET
V=0

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

RESTORE

RESTORE
Allows the re-reading of DATA statements,
After a RESTORE, the next piece of data
read will be the first piece listed in the first
DATA statement of the program. The
second piece of data read will be the second
piece listed in the first DATA statement,
and so on as in a normal READ operation.

510 RESTORE

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

RETURN

RETURN
Causes a subroutine to return to the statement after the most recently executed
GOSUB.

50 RETURN

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

STOP

STOP
Causes a program to stop execution and to
enter command mode.

900 STOP

Prints BREAK IN LINE 900. (As per this
example.) CONT after a STOP branches
to the statement following the STOP.
STATEMENT

SYNTAX/FUNCTION

EXAMPLE

USR

USR (argument)
Calls the user's machine language subroutine
with the argument. See PEEK and POKE in
Subject 303, and Appendix F.

200 V=USR(W)

SYMBOL

SYNTAX/FUNCTION

EXAMPLE

WAIT

WAIT (address, mask [, select] )
This statement reads the contents of the
addressed location, does an Exclusive-OR
with the select value, and then ANDs the
result with the mask. This sequence is
repeated until a non-zero result is obtained,
at which time execution continues at the
statement that follows WAIT. If the WAIT
statement has no select argument, the
select value is assumed to be zero. If you
are waiting for a bit to become zero, there
should be a "one" in the corresponding
bit position of the select value. The select
value (K) and the mask value (J) can range
from 0 to 255. The address (I) can range
from 0 to 65535.

805 WAIT I,J,K
806 WAIT I,J

305

INPUT/OUTPUT STATEMENTS

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

DATA

DATA item [, item...]
Specifies data, read from left to right.
Information appears in data statements in
the same order as it will be read in the
program.

10 DATA 1,3,-1E3,.04

Strings may be read from DATA statements. If you want the string to contain
leading spaces (blanks), colons (:) or

20 DATA "FOO",Z1

commas (,), you must enclose the string
in double quotes. It is illegal so have a
double quote within string data or a
string literal. (""BASIC"" is illegal.)
STATEMENT

SYNTAX/FUNCTION

EXAMPLE

INPUT

INPUT [!] ["prompt string literal";]
variable [, variable] ...
Requests data from the keyboard (to be
typed in). Each value must be separated
from the preceeding value by a comma (,).
The last value typed should be followed by
a carriage return. A "?" is displayed as a
prompt character. Only constants may be
typed in as a response to an INPUT statement, such as 4.5E-3 or "CAT." If more
data was requested in an INPUT statement
than was typed in, a "??" is printed and
the rest of the data should be typed in. If
more data was typed in than was requested,
the warning "EXTRA IGNORED" will be
displayed. Strings must be input in the
same format as they are specified in DATA
statements.

3 INPUT V,W,W2

Optionally displays a prompt string
("VALUE") before requesting data from
the keyboard. If RETURN is typed to an
input statement, BASIC returns to comcommand mode. Typing CONT after an
INPUT command has been interrupted
will cause execution to resume at the
INPUT statement.

5 INPUT "VALUE";V

If the optional character ! is included
following INPUT, then the prompts from
the INPUT statement and the user's entries
will be printed (even if the printer is
turned off) and displayed.

15 INPUT! "VALUE";V

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

POS

POS (expression)
Gives the current position of the cursor on
the display. The leftmost character position
on the display is position zero. A dummy
operand--0 or 1--must be used.

260 PRINT POS(I)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

PRINT

PRINT [!] expression [, expression]
Prints the value of expressions on the
display/printer. If the list of values to be
printed out does not end with a comma
(,) or a semicolon (;), then a carriage
return/line feed is executed after all the
values have been printed. Strings enclosed
in quotes (") may also be printed. If a
semicolon separates two expressions in
the list, their values are printed next to
each other. If a comma appears after an
expression in the list, and the print head
is at print position 11 or more, then a
carriage return/line feed is executed. If
the print head is before print position 11,
then spaces are printed until the carriage
is at the beginning of the next 10 column
field. If there is a blank string enclosed in
quotes, as in line 370 of the examples,

360
370
380
390
400

PRINT
PRINT
PRINT
PRINT
PRINT

X,Y;Z
" "
X,Y;
"VALUE IS";A
A2,B,

then a carriage return/line feed is
executed.
"VALUE IS" will be displayed and printed.

410 PRINT ! "VALUE
IS";A

String expressions may be printed.

420 PRINT MID$(A$,2);

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

READ

READ variable [, variable]
Read data into specified variables from a
DATA statement. The first piece of data
read will be the first piece of data listed in
the first DATA statement of the program.
The second piece of data read will be the
second piece listed in the first DATA
statement, and so on. When all of the data
have been read from the first DATA statement, the next piece of data to be read will
be the first piece listed in the second DATA
statement of the program. Attempting to
read more data than there is in all the
DATA statements in a program will cause
an OD (out of data) error.

490 READ V,W

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

SPC

SPC (expression)
Prints I space [or blank) characters on the
terminal. May be used only in a PRINT
statement. I must be =>0 and <=255 or
an FC error will result.

250 PRINT SPC(I)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

TAB

TAB (expression)
Spaces to the specified print position
(column) on the printer. May be used
only in PRINT statements. Zero is the
leftmost column on the termainl, 19 the
rightmost. If the carriage is beyond pos
position I, then no printing is done. I must
be =>0 and <=255.

240 PRINT TAB(I)

If I is greater than 19, the printer will skip
the required number of lines to arrive at
the specified position.
306

STRING FUNCTIONS

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

ASC

ASC (string expression)
Returns the ASCII numeric value of the
first character of the string expression X$.
See Appendix E for an ASCII/number
conversion table. An FC error will occur
if X$ is the null string.

300 PRINT ASC(X$)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

CHR$

CHR$ (expression)
Returns one character, the ASCII equivalent of the argument (I) which must be a
number between 0 and 255. See Appendix E.

275 PRINT CHR$(I)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

GET

GET string variable

10 GET A$

Inputs a single character from the keyboard.
If data is at the keyboard, it is put in the
variable specified in the GET statement.
If no data is available, the BASIC program
will continue execution.
GET can only be used as an indirect
command.
STATEMENT

SYNTAX/FUNCTION

EXAMPLE

LEFT$

LEFT$ (string expression, length)
Gives the leftmost I characters of the string
expression X$. If I<=0 or >255 an FC
error occurs.

310 PRINT LEFT$(X$,I)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

LEN

LEN (string expression)
Gives the length of the string expression X$
in characters (bytes). Non-printing characters and blanks are counted as part of the
length.

220 PRINT LEN(X$)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

MID$

MID$ [string expression, start [, length])
MID$ called with two arguments returns
characters from the string expression X$
starting at character position I. If
I>LEN(X$), then MID$ returns a null
(zero length) string. If I<=0 or >255,
an FC error occurs,

330 PRINT MID$(X$,I)

MID$ called with three arguments returns
a string expression composed of the
characters of the string expression X$
starting at the Ith character for J characters.
If I>LEN(X$), MID$ returns a null string.
If I or J <=0 or >255, an FC error occurs.
If J specifies more characters than are left
in the string, all characters from the Ith on
are returned.

340 PRINT MID$(X$,
I,J)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

RIGHT$

RIGHT$ (string expression, length)
Gives the rightmost I characters of the
string expression X$. When I<=0 or
>255 an FC error will occur. If
I>=LEN(X$) then RIGHT$ returns all
of X$.

320 PRINT RIGHT$
(X$,I)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

STR$

STR$ (expression)
Gives a string which is the character representation of the numeric expression X.
For instance, STR$(3.1)="3.1."

290 PRINT STR$(X)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

VAL

VAL (string expression)
Returns the string expression X$ converted
to a number. For instance.
VAL("3.1")=3.1. If the first non-space
character of the string is not a plus (+) or
minus (-) sign; a digit or a decimal point (.)
then zero will be returned.

280 PRINT VAL(X$)

307

ARITHMETIC FUNCTIONS

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

ABS

ABS (expression)
Gives the absolute value of the expression
X. ABS returns X if X>=0, -X otherwise.

120 PRINT ABS(X)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

ATN

ATN (expression)
Gives the arcTangent of the expression X.
The result is returned in radians and ranges
from -PI/2 to PI/2 (PI/2=1.5708). If you
want to use this function, you must provide
the code in memory. See Appendix H for
implementation details.

210 PRINT ATN(X)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

COS

COS (expression)
Gives the cosine of the expression X.
interpreted as being in radians.

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

EXP

EXP (expression)
Gives the constant "E" (2.71828) raised so
the power X (E^X). The maximum argument that can be passed to EXP without
overflow occurring is 88.0296.

150 PRINT EXP(X)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

INT

INT (expression)
Returns the largest integer less than or
equal to its expression X. For example:
INT(.23)=0, INT(7)=7, INT(-.1)=-1,
INT(-2)=-2, INT(1.1)=1.

140 PRINT INT(X)

X is

200 PRINT COS(X)

The following would round X to 0 decimal
places:
INT(X*10^D+.5)/10^D
STATEMENT

SYNTAX/FUNCTION

EXAMPLE

LOG

LOG (expression)
Gives the natural (Base E) logarithm of its
expression X. To obtain the Base Y
logarithm of X use the formula LOG(X)/
LOG(Y). Example: The base 10 (common) log of 7 = LOG(7)/LOG(10).

160 PRINT LOG(X)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

RND

RND (parameter)
Generates a random number between 0
and 1. The parameter X controls the
generation of random numbers as follows:

170 PRINT RND(X)

X<0 starts a new sequence of random
numbers using X. Calling RND with the
same X starts the same random number
sequence. X=0 gives the last random
number generated. Repeated calls to
RND(0) will always return the same
random number. X>0 generates a new
random number between 0 and 1.

Note that (B-A)*RND(1)+A will
generate a random number between
A and B.
STATEMENT

SYNTAX/FUNCTION

EXAMPLE

SGN

SGN (expression)
Gives 1. If X>0, 0 if X=0, and -1 if
X<0.

230 PRINT SGN(X)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

SIN

SIN (expression)
Gives the sine of the expression X. X is
interpreted as being in radians. Note:
COS(X) =SIN(X+3.14159/2) and that
1 Radian = 180/PI degrees = 57.2958
degrees; so that the sine of X degrees=
SIN(X/57.2958).

190 PRINT SIN(X)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

SQR

SQR (expression)
Gives the square root of the expression X.
An FC error will occur if X is less than zero,

180 PRINT SQR(X)

STATEMENT

SYNTAX/FUNCTION

EXAMPLE

TAN

TAN (expression)
Gives the tangent of the expression X.
interpreted as being in radians.

200 PRINT TAN(X)

X is

DERIVED FUNCTIONS
The following functions, while not intrinsic to BASIC, can be calculated using the existing BASIC
functions:
FUNCTION

FUNCTION EXPRESSED IN TERMS OF BASIC FUNCTIONS

SECANT

SEC(X) = 1/COS(X)

COSECANT

CSC(X) = 1/SIN(X)

COTANGENT

COT(X) = 1/TAN(X)

INVERSE SINE*

ARCSIN(X) = ATN(X/SQR(-X*X+1))

INVERSE COSINE*

ARCCOS(X) = -ATN(X/SQR(-X*X+1))+1.5708

INVERSE SECANT*

ARCSEC(X) = ATN(SQR(X*X-1))+(SGN(X)-1)*1.5708

INVERSE COSECANT*

ARCCSC(X) = ATN(1/SQR(X*X-1))+(SGN(X)-1)*1.5708

INVERSE COTANGENT*

ARCCOT(X) = -ATN(X)+1.5708

HYPERBOLIC SINE

SINH(X) = (EXP(X)-EXP(-X))/2

HYPERBOLIC COSINE

COSH(X) = (EXP(X)+EXP(-X))/2

HYPERBOLIC TANGENT

TANH(X) = -EXP(-X)/(EXP(X)+EXP(-X))*2+1

HYPERBOLIC SECANT

SECH(X) = 2/(EXP(X)+EXP(-X))

HYPERBOLIC COSECANT

CSCH(X) = 2/(EXP(X)-EXP(-X))

HYPERBOLIC
COTANGENT

COTH(X) = EXP(-X)/(EXP(X)-EXP(-X))*2+1

*These functions require the user-defined ATN function.

See Appendix H for details.

FUNCTION

FUNCTION EXPRESSED IN TERMS OF BASIC FUNCTIONS

INVERSE HYPERBOLIC
SINE

ARGSINH(X) = LOG(X+SQR(X*X+1))

INVERSE HYPERBOLIC
COSINE

ARGCOSH(X) = LOG(X+SQR(X*X-1))

INVERSE HYPERBOLIC
TANGENT

ARGTANH(X) = LOG((1+X)/(1-X))/2

INVERSE HYPERBOLIC
SECANT

ARGSECH(X) = LOG((XQR(-X*X+1)+1)/X

INVERSE HYPERBOLIC
COSECANT

ARGCSCH(X) = LOG((SGN(X)*SQR(X*X+1)+1)/X)

INVERSE HYPERBOLIC
COTANGENT

ARGCOTH(X) = LOG((X+1)/(X-1))/2

A

ERROR MESSAGES

If an error occurs, BASIC outputs an error message, returns to command level and displays the
cursor. Variable values and the program text remain intact, but the program can not be continued
and all GOSUB and FOR context is lost.
When an error occurs in a direct statement, no line number is printed.
Format of error messages:
Direct Statement

?XX ERROR

Indirect Statement

?XX ERROR IN YYYYY

In both of the above examples, "XX" will be the error code.
number where the error occured for the indirect statement.

The "YYYYY" will be the line

The following are the possible error codes and their meanings:
ERROR CODE

MEANING

BS

Bad Subscript. An attempt was made to reference a matrix element
which is outside the dimensions of the matrix. This error can occur
if the wrong number of dimensions are used in a matrix reference;
for instance, LET A(1,1,1)=Z when A has been dimensioned DIM
A(2,2).

CN

Continue error, Attempt to continue a program when none exists, an
error occured, or after a new line was typed into the program.

DD

Double Dimension. After a matrix was dimensioned, another DIM
statement for the same matrix was encountered. This error often
occurs if a matrix has been given the default dimension 10 because
a statement like A(I)=3 is encountered and then later in the program
a DIM A(100) is found,

FC

Function Call error, The parameter passed to a math or string function was out of range. FC errors can occur due to:
1.

A negative matrix subscript (LET A(-1)=0)

2.

An unreasonably large matrix subscript (>32767)

3.

LOG-negative or zero argument

4.

SQR-negative argument

5.

A^B with A negative and B not an integer

6.

A call to USR before the address of the machine language

subroutine has been patched in
7.

B

Calls to MID$, LEFT$, RIGHT$, WAIT, PEEK, POKE,
TAB, SPC or ON...GOTO with an improper argument.

ID

Illegal Direct. You cannot use an INPUT, DEF or GET statement as
a direct command.

LS

Long String. Attempt was made by use of the concantenation operator
to create a string more than 255 characters long.

NF

NEXT without FOR. The variable in a NEXT statement corresponds
to no previously executed FOR statement.

OD

Out of Data. A READ statement was executed but all of the DATA
statements in the program have already been read. The program tried
to read too much data or insufficient data was included in the
program.

OM

Out of Memory. Program too large, too many variables, too many
FOR loops, too many GOSUB's, too complicated an expression, or
any combination of the above. (see Appendix B)

OV

Overflow. The result of a calculation was too large to be represented
in BASIC's number format. If an underflow (too small result) occurs,
zero is given as the result and execution continues without any error
message being printed.

RG

RETURN without GOSUB. A RETURN statement was encountered
without a previous GOSUB statement being executed,

SN

Syntax error. Missing parenthesis in an expression, illegal character in
a line, incorrect punctuation, etc.

ST

String Temporaries. A string expression was too complex.
into two or more shorter expressions.

TM

Type Mismatch. The left side of an assignment statement was a
numeric variable and the right side was a string, or vice versa; or, a
function which expected a string argument was given a numeric
one or vice versa.

UF

Undefined Function. Reference was made to a user function which
has never been defined.

US

Undefined Statement. An attempt was made to GOTO, GOSUB or
THEN to a statement which does not exist.

/0

Division by Zero

Break it

SPACE HINTS

In order to make your program smaller and save space, the following hints may be useful.
1.

Use multiple statements per line. There is a five-byte of overhead associated with each
line in the program. Two of these five bytes contain the line number of the line in binary.
This means that no matter how many digits you have in your line number (minimum line
number is 0, maximum is 63999), it takes the same number of bytes. Putting as many
statements as possible on a line will cut down on the number of bytes used by your
program.

2.

Delete all unnecessary spaces from your program.

For instance:

10 PRINT X, Y, Z
uses three more bytes than
10 PRINTX,Y,Z
Note:

All spaces between the line number and the first non-blank character are ignored.

3.

Delete all REM statements. Each REM statement uses at least one byte plus the number
in the comment text. For instance, the statement 130 REM THIS IS A COMMENT uses
24 bytes of memory.
In the statement 140 X=X+Y: REM UPDATE SUM, the REM uses 14 bytes of memory
including the colon before the REM.

4.

Use variables instead of constants. Suppose you use the constant 3.14159 ten times in
your program. If you insert a statement
10 P=3.1.4159
in the program, and use P instead of 3.14159 each time it is needed, you will save 40
bytes. This will also result in a speed improvement.

5.

A program need not end with an END, so an END statement at the end of a program
may be deleted.

6.

Reuse variables. If you have a variable T which is used so hold a temporary result in one
part of the program and you need a temporary variable later in your program, use it
again. Or, if you are asking the terminal user to give a YES or NO answer to two different questions at two different times during the execution of the program, use the same
temporary variable A$ to store the reply.

7.

Use GOSUB's to execute sections of program statements that perform identical actions.

8.

Use the zero elements of matrices; for instance, A(0), B(0,X).

STORAGE ALLOCATION INFORMATION
Simple (non-matrix) numeric and strong variables like V use 7 bytes; 2 for the variable name, and
5 for the value. Simple non-matrix string variables also use 7 bytes; 2 for the variable name, 1 for
the
length, 2 for a pointer, and 2 are unused.
Matrix variables require 7 bytes to hold the header, plus additional bytes to hold each matrix element.
Each element that is an integer variable requires 2 bytes. Elements that are string variables or
floating
point variables require 3 bytes or 5 bytes, respectively.
String variables also use one byte of string space for each character in the string. This is true
whether the string variable is a simple string variable like A$, or an element of a string matrix
such as Q1$(5,2).
When a new function is defined by a DEF statement, 7 bytes are used to store the definition.
Reserved words such as FOR, GOTO or NOT, and the names of the intrinsic functions such as
COS, INT and STR$ take up only one byte of program storage. All other characters in programs
use one byte of program storage each.
When a program is being executed, space is dynamically allocated on the stack as follows:

C

1.

Each active FOR...NEXT loop uses 22 bytes.

2.

Each active GOSUB (one that has not returned yet) uses 6 bytes.

3.

Each parenthesis encountered in an expression uses 4 bytes and each temporary result
calculated in an expression uses 12 bytes.

SPEED HINTS

The hints below should improve the execution time of your BASIC program. Note that some of
these hints are the same as those used to decrease the space used by your programs. This means
that in many cases you can increase the efficiency of both the speed and size of your programs at
the same time.
1.

Delete all unnecessary spaces and REM's from the program. This may cause a small
decrease in execution time because BASIC would otherwise have to ignore or skip
over spaces and REM statements.

2.

THIS IS PROBABLY THE MOST IMPORTANT SPEED HINT.
Use variables instead of constants. It takes more time to convert a constant to its
floating point representation than it does to fetch the value of a simple or matrix
variable. This is especially important within FOR...NEXT loops or other code that
is executed repeatedly.

D

3.

Variables which are encountered first during the execution of a BASIC program are
allocated at the start of the variable table. This means that a statement such as
5 A=0:B=A:C=A, will place A first, B second, and C third in the symbol table
(assuming line 5 is the first statement executed in the program). Later in the program,
when BASIC finds a reference to the variable A, it will search only one entry in the
symbol table to find A, two entries to find B and three entries to find C, etc.

4.

Use NEXT statements without the index variable. NEXT is somewhat faster than
NEXT I because no check is made to see whether the variable specified in the NEXT
is the same as the variable in the most recent FOR statement.

CONVERTING BASIC PROGRAMS NOT WRITTEN FOR AIM 65 BASIC

Though implementations of BASIC on different computers are in many ways similar, there are some
incompatibilities which you should watch for if you are planning to convert some BASIC programs
that were not written in AIM 65 BASIC.
1.

Matrix subscripts. Some BASICs use "[" and "]" to denote matrix subscripts.
BASIC uses "(" and ")".

AIM 65

2.

Strings. A number of BASICs force you to dimension (declare) the length of strings
before you use them. You should remove all dimension statements of this type from
the program. In some of these BASICs, a declaration of the form DIM A$(I,J) declares
a string matrix of J elements each of which has a length I. Convert DIM statements of
this type to equivalent ones in AIM 65 BASIC: DIM A$(J).
AIM 65 BASIC uses "+" for string concatenation, not "," or "&".
AIM 65 BASIC uses LEFT$, RIGHT$ and MID$ to take substrings of strings. Other
BASICs uses A$(I) to access the Ith character of the string A$, and A$(I,J) to take a
substring of A$ from character position I to character position J. Convert as follows:
OLD

AIM 65

A$(I)

MID$(A$,I,1)

A$(I,J)

MID$(A$,I,J-I+1)

This assumes that the reference to a substring of A$ is in an expression or is on the
right side of an assignment. If the reference to A$ is on the left hand side of an
assignment, and X$ is the string expression used to replace characters in A$, convert
as follows:

3.

OLD

AIM 65

A$(I)=X$

A$=LEFT$(A$,I-1)+X$+MID$(A$,I+1)

A$(I,J)=X$

A$=LEFT$(A$,I-1)+X$+MID$(A$,J+1)

Multiple assignments. Some BASICs allow statements of the form:
This statement would set the variables B & C to zero.

500 LET B=C=0.

In AIM 65 BASIC this has an entirely different effect. All the "='s" to the right of the
first one would be interpreted as logical comparison operators. This would set the
variable B to -1 if C equaled 0. If C did not equal 0, B would be set to 0. The easiest
way to convert statements like this one is to rewrite them as follows:
500 C=0:B=C
4.

Some BASICs use "/" instead of ":" to delimit multiple statements per line.
occurrences of "/" to ":" in the program.

Change all

E

5.

Programs which use the MAT functions available in some BASICs will have to be
re-written using FOR...NEXT loops to perform the appropriate operations.

6.

A PRINT statement with no arguments will not cause a paper feed on the printer.
generate a paper feed (blank line), use PRINT "space"

ASCII CHARACTER CODES

DECIMAL
------000
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042

CHAR.
---NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
HT
LF
VT
FF
CR
SO
SI
DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESCAPE
FS
GS
RS
US
SPACE
!
"
#
$
%
&
'
(
)
*

LF=Line Feed
F

To

DECIMAL
------043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085

FF=Form Feed

CHAR.
---+
,
.
/
0
1.
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U

DECIMAL
------086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127

CR=Carriage Return

CHAR.
---V
W
X
Y
Z
[
/
]
^
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
DEL
DEL=Rubout on TTY

ASSEMBLY LANGUAGE SUBROUTINES

AIM 65 BASIC allows a user to link to assembly language subroutines, via the USR(W) function.
This function allows one parameter to be passed between BASIC and a subroutine.
The first step is to allocate sufficient memory for the subroutine. AIM 65 BASIC always uses all
RAM memory locations, beginning at decimal location 530 (hex location 212), unless limited by
the user. You can limit BASIC's memory useage by answering the prompt MEMORY SIZE? (see
Subject 100) with some number less than 4096, assuming a 4K system. This will leave sufficient
space for the subroutine as the top of RAM.
For example, if your response to MEMORY SIZE? is "2048", 1518 bytes at the top of RAM
will be free for assembly language subroutines.

Parameter (W), passed to a subroutine by USR(W), will be converted to floating-point accumulator
located at $A9. The floating-point accumulator has the following format:
ADDRESS

CONTENT

$A9

Exponent + $81 ($80 if mantissa = 00)

$AA-$AD

Mantissa, normalized so that Bit 7 of MSB is set.
$AA is MSB, $AD is LSB.

$AE

Sign of mantissa

A parameter passed to an assembly language subroutine from BASIC can be truncated by the subroutine to a 2-byte integer and deposited in $AC (MSB) and $AD (LSB). If the parameter is
greater than 32767 or less than -32768, an FC error will result. The address of the subroutine
that converts a floating-point number to an integer is located in $B006, $B007.
A parameter passed to BASIC from an assembly language subroutine will be converted to floatingpoint. The address of the subroutine that performs this conversion is in $B008, $B009. The
integer MSB ($AC) must be in the accumulator; the integer LSB ($AD) must be in the Y register.
Prior to executing USR, the starting address of the assembly language subroutine must be stored
in locations $04 (LSB) and $05 (MSB). This is generally performed using the POKE command.
Note that more than one assembly language subroutine may be called from a BASIC program,
by changing the starting address in $04 and $05.
Figure F-1 is the listing for a BASIC program that calls an assembly language subroutine located at
$A00. Here's what the BASIC program does:
*

Line 10 - Stores the starting address of the assembly language subroutine ($A00) into
locations $04 and $05, using POKE.

*

Line 20 - Asks for a number "N".

*

Line 30 - Calls the subroutine, with N as the parameter.

*

Line 40 - Upon return from the subroutine, the BASIC program prints X, the parameter
passed from the subroutine to the BASIC program.

*

Line 50 - Loops back to get a new N
ROCKWELL AIM 65
<5>
MEMORY SIZE? 2048
WIDTH?
1518 BYTES FREE
AIM 65 BASIC V1.1
OK
10 POKE 04,0: POKE 05
,10
20 INPUT"NUMBER";N
30 X=USR(N)
40 PRINTX
50 GOTO 20

Figure F-1.

BASIC Program That Calls Assembly Language Subroutine

The assembly language subroutine (Figure F-2) performs these operations:
*

Prints the floating-point accumulator ($A9-$AE), using Monitor subroutines NUMA
($EA46), BLANK ($E83E) and CRLF ($E9F0),

*

Converts the floating-point accumulator to an integer, using the subroutine at $BF00.
The address $BF00 was found in locations $B006, $B007. (Address $BF00 may vary
with different versions of BASIC. Be sure to check locations $B006 and $B007 for the
correct address.)

*

After conversion, the program again prints the floating point accumulator,

*

The program then swaps the bytes of the integer.

*

Finally, the program converts the result to floating point and returns to BASIC (JMP
C0D3). Address $C0D3 was found in locations $B008, $B009. (Address $C0D3 may
vary with different versions of BASIC. Be sure to check locations $B008 and $B009
for the correct address.
<1>
0A26
0A00
0A02
0A04
0A06
0A09
0A0C
0A0D
0A0F
0A11
0A14
0A16
0A13
0A18
0A1C
0A1F
0A22
0A23
0A25
0A26

A0
A2
B5
20
20
E8
E0
D0
20
C0
F0
A5
A4
4C
20
C8
D0
00

*=A00
LDY #00
LDX #00
LDA A9,X
JSR EA46
JSR E83E
INX
CPX #06
BNE 0A04
JSR E9F0
CPY #00
BEQ 0A1F
LDA AD
LDY AC
JMP C0D3
JSR BF00
INY
BNE 0A02
BRK

Figure F-2 Assembly Language Subroutine
Figure F-3 shows the print-out for various values of "N".
<6>
OK
RUN
NUMBER? 128
88 80 00 00 00 00
88 00 00 00 80 00
-32768
NUMBER? 1
81 80 00 00 00 00
81 00 00 00 01 00
256
NUMBER? 4097
8D 80 06 00 00 00
8D 00 00 10 01 00
272
NUMBER? 256
89 80 00 00 00 00
89 00 00 01 00 00
1
Figure F-3.
G

Output for Example

STORING AIM 65 BASIC PROGRAMS ON CASSETTE

AIM 65 BASIC Programs can be stored on cassette tape by using BASIC's SAVE and LOAD
commands, or by using the AIM 65 Editor. Before employing either procedure be sure to carefully observe the recorder installation and operation procedures given in Section 9 of the
AIM 65 User's Guide.
RECORDING ON CASSETTE USING THE BASIC SAVE COMMAND
The procedure to store a BASIC program is:
1.

Install a cassette in the recorder, and manually position the tape to the program record

position.

Be sure to initialise the counter at the start of the tape.

Note: Since remote control must be used to retrieve a BASIC program, observe the
tape gap CAUTION in Section 9.1.5 (Step 1) of the AIM 65 User's Guide.
2.

While in BASIC, type in SAVE.

BASIC will respond with:

OUT=
3.

Enter a T (for "Tape").

BASIC will display:

OUT=T F=
4.

Enter the file name (up to five characters).
display:

If the file name is FNAME, BASIC will

OUT=T F=FNAME T=
5.

Put the recorder into Record mode.

6.

Enter the recorder number (1 or 2) and type RETURN.

7.

If remote control is being used, observe the procedures outlined in Section 9.1.5 of
the AIM 65 User's Guide.

8.

When recording has been completed, BASIC will display the cursor.

9.

Switch the recorder out of record mode.

RETRIEVING A PROGRAM FROM CASSETTE USING THE BASIC LOAD COMMAND
The procedure to retrieve a BASIC program is:
1.

Install the cassette in the recorder., and manually position the tape to about five counts
before the beginning of the desired file.
Note:

2.

Remote control must be used when retrieving a file via BASIC.

While in BASIC, type in LOAD.

BASIC will respond with:

IN=
3.

Enter a T (for "Tape").

BASIC will display:

IN=T F=
4.

Enter the file name.

If the file name is FNAME, BASIC will display:

IN=T F=FNAME T=
5.

Enter the recorder number (1 or 2) and type RETURN.

6.

Put the recorder into play mode. Be sure to observe the procedures outlined in
Section 9.1.6 of the AIM 65 User's Guide.
While the file is being read, each line will be displayed (and printed, if the printer is on).
If the printer is on, the tape gap ($A409) will probably have to be increased.
The file being loaded will not overlay any BASIC statements already entered unless
the statement numbers are the same.

7.

When loading has been completed.

BASIC will display the cursor.

8.

Switch the recorder out of play mode.

CASSETTE OPERATIONS USING THE AIM 65 EDITOR
AIM 65 BASIC programs can also be stored and retrieved from cassette using the AIM 65 Editor.
However, if the program is to be retrieved by BASIC at some future time, one rule must be

observed:
When BASIC stores a program on cassette, it inserts a CTRL/Z after the last line. The
AIM 65 Editor will strip off the CTRL/Z when it retrieves the program. Therefore,
before storing a BASIC program from the Editor, the user must insert a CTRL/Z
following the last line of the program.
H

ATN IMPLEMENTATION

The ATN function (see Subject 307) can be programmed in RAM using the AIM 65 Mnemonic
Entry (I) and Alter Memory Locations (/) commands, as shown below. The program is written
for the AIM 65 with 4K bytes of RAM. The ATN function can be relocated elsewhere in memory
by changing the starting addresses of the instructions and constants, the conditional branch
addresses, the vector to the constants start address and the vector to the ATN function starT
address.
ATN FUNCTION CONSTANTS ENTERED BY ALTER MEMORY 
 = 0F80
 = 0F80

0F84

0F88

0F8C

0F90

0F94

0F98

OF9C

0FA0

0FA4

0FA8

0FAC

0FR0

0FB4

0FR8

0FBC

XX
0B
BD
F4
83
7C
CA
CB
64
B7
7D
7E
99
CC
AA
81
00

XX
76
D3
A6
FC
0C
7C
C1
70
EA
63
7E
3A
91
AA
00

XX
83
79
F5
B0
1F
DE
7D
4C
51.
30
92
7E
C7
AA
00

XX
83
1E
7B
10
67
53
14
7D
7A
88
44
4C
7F
13
00

Constants Starting Address = 0F80

8

ATN FUNCTION INSTRUCTIONS STORED BY MNEMONIC ENTRY (I)

XXXX
0FBD
0FBF
0FC0
0FC2
0FC5
0FC7
0FC8
0FCA
0FCC
0FCE
0FD0
0FD3
0FD5
0FD7
0FDA
0FDB
0FDD
0FDF
0FE1
0FE3
0FE6
0FE7
0FE9
0FEC
0FEC

*=0FBD
A5 LDA
48 PHA
10 BPL
20 JSR
AS LDA
48 PHA
C9 CMP
90 BCC
A9 LDA
A0 LDY
20 JSR
A9 LDA
A0 LDY
20 JSR
68 PLA
C9 CMP
90 BCC
A9 LDA
A0 LDY
20 JSR
68 PLA
10 BPL
4C JMP
60 RTS

AE

Instructions Starting Address = 0F8D

0FC5
CCB8
A9
#81
0FD3
#FB
#C6
C84E
#80 \
#0F /
CD44

Starting Address of Constants = 0F80

#81
0FE6
#4E
#CE
C58F
0FEC
CCB8

BASIC INITIALIZATION FOR ATN FUNCTION
BASIC memory must be initialized below the memory allocated to the ATN function. The ATN
vector in RAM must also be changed from the address of the FC error message to the starting

address of the ATN function instructions.
<5>
MEMORY SIZE? 3968
WIDTH?
3438 BYTES FREE
AIM 65 BASIC V1.1
POKE 188,189
POKE 189,15
?ATN (TAN(.5))
.5

This can be done using BASIC initialization, as follows:

Limit BASIC to F80

16

Change ATN function vector low to $BD
Change ATN function vector high to $0F
Test case to verify proper ATN function program
Expected answer = .5

SAVING ATN OBJECT CODE ON CASSETTE
The object code for the ATN function can be saved on cassette by dumping addresses $00BB
through $00BD (Jump instruction to ATN) and $0F80 through $0FEC (constants and instructions)
after the function is initially loaded and verified.
The ATN function can then be loaded from cassette by executing the Monitor L command after
BASIC has been initialized via the 5 command. After the ATN function has been loaded, reenter
BASIC with the 6 command.

###



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.2
Linearized                      : No
Page Count                      : 257
Creator                         : Microsoft Word 8.0
Create Date                     : 2004:06:27 10:32:06
Title                           : 
Author                          : Shirl
Producer                        : Acrobat PDFWriter 3.0.1 for Power Macintosh
Subject                         : 
EXIF Metadata provided by EXIF.tools

Navigation menu