Skip to main content

Full text of "6502 User Notes Newsletter Issue 13"

See other formats













PEER RTA ARIAT ISO ALOR RNE SEN OL SADDLES EDT LISI ICNT TELUS SEED MANTRA SCTE PDI IE APT AR PND ET A ONHELP OATES SH EMCARL VES TVS UNMET EMAC D PDI te aE INA EAS EPID SHAD SLEEP ORES! NBTAIGA GEE IEE NRA NEE a AE Hyde es, sae 


SOFTWARE FEATURE 
KIM Hexpawn (your KIM can learn to win) 


6502 OP CODES (arranged logically for easy look up) 


CASSETTE INTERFACE STUFF 
Tape Verify II 
Radio Tape Feedback 
Reliability Hint 
Help Relay Package Fixit 
Tape File Recovery Routine 
KIM Software On Cassette 


LANGUAGE LAB 
Focal 
1/O Mods 
Functions 


Basic 
I/O Mods 
A Basic Question 
Basic Timing & Comments 
KIM Basic Hint 
Basic Renumber Program 


Tiny Basic 
Two Tiny Basic Mods 
Ramblings About T.B. 


Forth 
Forth Comments & Example 


Assemblers 
Two Pass Patch To Aresco Assembler 
Mods To MSS Assembler 


DESIGN CORNER 
A 6522 1/0 Board 


KIM-4 BUS PINOUT 


VIDEO & GRAPHICS 
Video Displays 
Comments On "Visible Memory" 
TVT-6 Adventure 
TVT-6 RAM Expansion 
Polymorphics Video Board Mods 


DEBUG 
Slow Stepper IV 


LETTERS & COMMENTS 


SOFTWARE LIBRARY 
Multi-Mode Adder 
Psuedo-Random Number Generator 
ASCII Dump Program 
Keyboard Debounce Routine 
Sound Effects Program 
Melodies For The Music Box 
"Do Loops" For KIM 


INTERFACE 
Camera Speed Tester 
Low-Cost Modem Possibility 
RPN Calculator Chip Interface 
Power-On Reset 
The Outside World Connection 
More On The Opto-~-Isolator 


NEW PRODUCTS 





Robert C. Leedom 


Jim Butterfield 6 


Dr. Barry Tepperman 
Daniel Gardner 

John Watney 

Mike Firth 

Joel Swank 


10 


Editor 
Editor 


Marvin De Jong 
Editor 

F. E. Kempisty 
Micro-Z Company 
Harvey Herman 


Michael Day 
Lew Edwards 


John P. Oliver 


John Eaton 
Richard M, Bender 


16 


18 


19 
Editor 
Lew Edwards 
Dennia Chaput 
Michael Allen 
Editor 


21 
Lew Edwards 


22 


23 
Jim Butterfield 
H. T. Gordon 
Jim Zuber 
Thomas J. Rubens 
Bob Carlson 
Douglas Lyon 
Dave Skillman 


26 
Mike Firth 
Editor 
Editor 
George Hawkins 
Editor 
Dwight Egbert 


28 


EDITORIAL 


As you can tell already, we're back to using 
our old title. Although "USER NOTES: 6502 seemed 
like a good idea at first, old ties are herd to 
break ~ back to 6502 USER NOTES, It‘s easier to 
say anyway. 


Lots of new things have been happening with 
the 6502 - many more are in store. The software 
Situation has certainly gotten better - but there's 
still alot of room for improvement. 


One problem that has slowed software develop- 
ment a bit is the fact that there have been no 
hobby mainframe systems (such as Southwest Techs 
6800 machine and the IMSAI 8080 system) designed 
specifically for the 6502 to reach any level of 
popularity with aftermarket accessory manufactur- 
ers (which is a very good indication of market- 
place acceptance), 


By the way, I define “mainframe" as a back- 
plane (motherboard) and a power supply in a box 
without an integral CPU. 


Most 6502 hardware developers have gone their 
separate ways with regards to expansion capability. 
Witness the fact that there are now at least 6 bus 
oriented 6502 expansion systems which aren't the 
least bit compatible with each other. 


Everybody loses in this situation. The hob- 
byist loses because since he will end up being 
locked into whatever system he purchases, he has 
to be sure that particular system has,(or will 
have) everything he has decided he needs (or will 
need). A very difficult decision to 
make for someone just getting into this hobby, 

One that could drive sgme folks away from the 6502 
CPU altogether. 


The manufacturer loses because with so many 
different 6502 expansion methods available, no 
self-respecting aftermarket supplier of boards 
- would think of entering into such a diluted mark- 
et. He would most likely go to the S-100 (IMSAI) 
or S-50 (SWTP) marketplace because of the numbers 
involved, the proliferation of software, and 
psuedo~-standarization of hardware in those markets, 


At this point, there is only one expansion 
bus which is being supported by aftermarket sup- 
pliers. That's the S-44 KIMbus from MOS Technol- 


O8y- 


There are 6 companies (including MOS) sup- 
porting this bus in the form of accessory boards, 
That number is sure to increase since Synertek 
and Rockwell machines will also be using the S~44 
KIMbus. 


The 8-44 KIMbus seems to hold the only real 
hope of popularizing the 6502 CPU and providing 
the consumer with an "intelligent" alternative to 
the S-100 bus and multiple sources of accessory 
boards. 


When more than one company supports a partic- 
ular bus in the form of accessory boards ~ every- 
one wins. The consumer now has the ability to 
shop around and look for the best deal on a par- 
ticular board he has in mind. The supplier wins 
because as the market gets larger and broader - in 
its appeal, more consumers will enter into it and, 
as a result, more dollars will have a chance to 
reach him. 


It will be interesting to watch how things 
aevelop in this marketplace. 





6502 USER NOTES is published bimonthly (when- 
ever possible) by Eric C, Rehnke, POB 33093, North 
Royalton, Ohio 44133, Subscription rates for Vol- 
ume 3 are $13.00 (US and Canada) and $19.00 else- 
where. No part of 6502 USER NOTES may be copied 
for commercial purposes without the express writ- 
ten permission of the publisher. Articles herein 
may be freely reprinted by club newsletters as 
long as proper publication credit is given and the 


publisher is provided with a copy of the publica- 
tion. 


@ COPYRIGHT 1979 Eric C. Rehnke 





I think you’re gonna like our new format alot. 
We've organized that articles to make things eas- 
ler to find and are retypingall the articles (ex- 
cept for some program listings) to make things 
more consistent. Let me know your opinion. What 
would you like to see in our newsletter? I really 
enjoy feedback and look forward to YOUR comments, 





They certainly are some neat new 6502 based 
machines entering the marketplace. Of course, I'm 
referring to the SYM (formaly VIM) from Synertek, 
the AIM from Rockwell and the Challenger 1P from 
OSI. 


Phil Johnson (Johnson Computer) brought two 
OSI Challengers over to my place for a little 
demo so I could get an idea of what OSI was doing 


lately. I must say that I was impressed with the 
amount of capability built-in to these machines 
for the price. For example, for $350 you can get 


a machine wiih 8K Microsoft Basic on ROM, a 32 
character/line video interface, built-in cassette 
interface, a metal box with built-in full size 
ASCII keyboard, character graphics capability, 4K 
RAM (expandable to 8K on board), a machine language 
monitor that lets you examine/change memory, and 
expansion capability (to OSI's bus, of course). 
Whether or not you can live with a 32 character 
display (24 character if you use an RF modulator) 
is up to you, but for all the obvious benefits of 
such a machine, that may not be a critical disad- 
vantage. 


About the only thing really missing on the 
Challenger 1P is a user I/0 port and interval 
timer. These would have to be added to do any 
useful hacking. There is an expansion connector 
with the address, data and control busses but I 
don't know if the signals are buffered. I'll try 
to get more details on this for upcoming issues. 


In all fairness to you, the reader, I feel it 
should be mentioned that I have talked to a number 
of people who had complaints about the level of 
service and support they received from OSI. If 
any of you have dealt with OSI lately, I'd be in- 


terested in hearing about your experiences. 6 


The Synertek SYM certianly has some very in- 
teresting things to offer. 


Its list of good points include on-board RAM, 
EPROM, and 1/0 expansion capability, a powerful 
monitor and a high-speed (1500 baud) cassette in- 
terface. Obviously, SYM's creators were working 
to update and improve on the basic KIM design. 


I could tell by the number of on-board 
strapping options and software switching logic 
that this machine was meant to be as versatile as 
possible. 


How the SYM "“stacks-up" will be the subject 
of future articles. 


Rockwells bid for marketplace superiority is 
called the AIM 65. This is actually a two board 
machine ~ on one board is a full size ASCII style 
keyboard while the other holds the rest of the 
system. 


AIM is unique in that it contains a 20 col- 
umn thermal printer besides a 20 column alphanu- 
meric LED display, Like SYM, AIM has on-board 
EPROM and RAM expansion capability and an advanced 
monitor, Its on-board printer would make it a 
likely candidate for the process control and sys- 
tem monitoring environment. 


SYM and AIM both have expansion connectors 
configured to fit the standard KIM-4 motherboard, 


Articles on both these machines will be pub- 
lished in the next issue. 


Hudson Digital Electronics (see back cover) 
has been making great advances in S~44 KIMbus com- 
patible hardware and software products. The one 
thing I most admire about this firm is their way 
of introducing new products. 





continued on page 28 











software feature: KIM 


From Robert C. Leedom, 


I was relieved to see (in Issue #12) that 
nobody's yet published a version HEXPAWN for KIM. 
I got my KIM in April, wrote HEXPAWN in May, and 
today (16 Oct 78) finally finished typing the list- 
ing. HEXPAWN first appeared in SCIENTIFIC American 
(Vol. 206, No. 3, Martin Gardner's “Mathematical 
Games"). 


The game is played on a 3 X 3 board. 
Each of the two players has three pieces, 


(c) 
(a) 


which 
move as chess pawns (move one square forward to 
vacant square, capture by moving one square diag-~ 
onally to enemy piece's square). Object: get to 
your opponent's side of the board, or block him so 
that he cannot move, 


(e) 


This version was inspired by an article in 
the November 1975 BYTE, written by Bob Wier (with 
whom I corresponded on the subject of a "Super 
Star Trek" game in BASIC). Bob had written a HEX- 
PAWN program for a 16-bit machine, and it took 4218 
bytes ( I assume they were 8-bit bytes ), Unfor- 
tunately, (a) I have only the KIM-1l memory (and 
no access to an assembler), (b) the article only 
gave a general (top-level) flowchart and a move 
table, and (c) the article “Table of all Possible 
Board Positions and Moves" was both incomplete and 
incorrect, a fact I discovered only when I tried 
to play the game against my version of the pro- 
gram. Eventually, I solved problems (a), (b), 
(c); here's the result: 


Features of HEXPAWN for KIM-1 


(£) 


(g) 


and 


(h) 


(a) Board coordinate 0 2 KIM's Men at 0, 1, 2 


Sf 


5 

8 Your Men at 6, 7, 8 
From 
— 


3 
6 


(b) Display format 





KIM's Man 
(Flashing) 





Your Man 
(Solid) 
Moves 


14069 Stevens Valley Ct., 


Glenwood, MD 21738 


Program checks for {and only accepts) legal moves. 


earn When 
When the computer loses, KIM's losing move is 
removed from the move table. Therefore, even- 
tually (after 30 or so games) KIM should have 
only winning moves to select from! 


Two startup locations provided: 


(1) Full initialization -- all possible KIM 
moves restored to move table. 
(Start at $100). 

(2) New game initialization -- sets up board 


but retains knowledge 
(Start AT $200), 


to play next game, 
of previous bad moves, 


To allow tabulation/examination of the “learn- 
ing" sequence, press and hold DA (Data Anal- 
ysis) key at any time to display move # (0, 

1, or 2 - there are three possible moves stored 
for each board position), Board index (see 
table at $10F) and Game number. Resume play 
upon release, 


Press PC (Person Concedes) to concede game 
to KIM. 


After loading program, enter AD, 0100, GQ. 
At any time, to restart the current game, 
press GO. 


Have been using Radio Shack Supertape with a 
K-Mart (S.S. Kresge Co.) Model 6-33-01 cas- 
sette recorder (cost about $27) with 1002 
success using Hypertape program. However, in 
tape exchanges, others can only read my tapes 
about 75% of the time, and I have slightly 
less success reading theirs. 


t Page 0 locations used by program HEXPAWN 


0000 FLSHR RES 1 Timer for flashine KIv's men 
0001 DBD RES 3 Current board in Display format 
0004 MASK RES 3 Masks for flashing KIM'’s men 
0007 EBD RES 9 Current bd - Easy-to-read format 
0010 WINDO RES 6 Current 7-segment display 
0017 MOVTYP RES 1 KIM's last move (TO:FRCM) 
0018 TOG RES 1 On/off indicator for KIM's men 
0019 GAMNUM RES 1 Game number 
OO1A BDNDX RES 1 3*Bd # for model match/move select 
OO1B MOYNO RES 1 KIM’s last move # (0,1, or 2) 
OO1C PTO RES «1 Person's last "to" move 
001D FROM RES i If< 0, no “from” move yetys 
if70, is.equal to the “from” move 
OO1E TMP RES 1 
OO1F TMP1 RES 1 
0020 POINTER RES 1 
0021 POINTO RES 1 _ - Page # (ADH) of MOVES 
0022 MPOINT RES 1 
002 MPOIN1 RES i Page # (ADH) of messages | 
002 SSEBD RES 9 Beginning bd - Easy-formats 
03 = KIM 
00 = space 
O01 = Person 
002D MOVES RES 99 Table of possible moves is placed 
here by startup routine and 
is modified as KIM “learns.” 
: HEXPAWN for KIM-1. © Copyright May 1978 R.C,Leedom 
0100 A2 65 HXPNST LDX #368 Transfer moves, besinning 
0102 BD 7E O01 INLP LDA SPOINO,X board, and pointer ADH's 
0105 95 21 TA POINTO,X to page zero. 
0107 CA DEX 
0108 10 F8 BPL INLF 
O10A 85 19 STA GAMNUM Set game # to zero. 
010C 4¢ 00 O02 JMP INIT 


page l 


010F 
0112 
0115 
0118 
0118 
011E 
0121 
0124 
0127 
012A 
012D 
0130 
0133 
0136 
0139 
013¢ 
013F 
o1b2 
0145 
0148 
0148 
O14E 
0151 
0154 
0157 
O15A 
015D 
0160 
016% 
0166 
0169 
016C 
016F 


0172 
0175 
0178 
0178 


017E 
017F 
0180 


page 2 


00 
00 
O1 


$ The following are the 33 board positions that 
the HEXPAWN program will recognize after the 
The squares are num-~ 


human Opponent has 
bered according to the scheme shown in the 
comment field for CAPSET (location 03F8). 
Here, the pieces and spaces (K=KIM, 
are packed by column -= that is, 
(For segment- 
lighting, actual data is ordered 360,471,582.) 


and =space) a 


H 
, 
; 
H 
; 
; 
t in groups: 0,3,6; 
; 
, 
B 


DMDL KP_,K_P,K_P 


moved. 


154,73 2,5,8. 
Bd # BDNDX 
0 0 
1 3 
2 6 
r 9 

C 

5 F 

6 12 

c 15 

8 18 

9 1B 

A 1E 

B 21 

c ya 

D 27 

E 2A 

F 2D 

10 30 
11 33 
12 36 
1 39 
a 3C 
15 3F 
16 2 
17 45 
18 48 
19 4B 
1A LE 
1B 51 
1¢ 54 
1D 57 
1E 5A 
iF 5D 
20 60 


} End-game messages 


KWIN 
PWIN 


KWAD 
PWAD © 


DATA $3E, 60 ,$38 $3F,$6D,$79 
DATA 00,$54,31C,$78,%6D,00 


EQU @KWIN-$100 
EQU @PWIN-$100 


=Person, 


0181 
0184 
0187 
O18A 31 
018D 30 
0190 30 
0193 4o 
0196 31 
0199 
019C 
O19F 
01A2 
O1A5 
01A8 
O1AB 31 
O1AE 42 
01Bi 
01B4 
01B7 
O1BA 
O1BD 
01C0 
0103 
0106 
0109 
01CC 
O1CF 
01D2 
01D5 
01D8 
O1DB 
01DE 
O1E1 
01Eu 
01E7 
O1BA 


03 
co 
01 


00 
01 


51 
00 


; 
The following data is saved here for startup 


SPOINO $00 
SMPOIN $00 
SMPOI1 $01 


0200 
0202 
0204 
0206 
0207 
6209 
020B 
020D 
020F 
0211 
021 

021 

0216 
0218 
O21A 
021C 
O21E 
O21F 
0221 
022 

022 

0226 
0228 
022A 
0223 
022D 
022F 
0230 
0232 
0234 
0235 
0237 


0238 


2 07 


initialization. 
INIT LDX #507 

00 LDA #300 

10 INITLP STA WINDO,X 
DEX 

FB BPL INIT 

co LDA #SCO 

14 STA WINDO+4 

08 LDX #$08 

24 BDINIT LDA BGERD,Y% 

07 STA ERD,X 
DEX 

F9 BPL BDINIT 

1D STX FROM 

03 DISPLT LDX #503 

00 DSPLP LDA #$00 

00 STA FLSHR,X 
DEX 

F9 BPL DSPLP 

02 LDY #502 
CLC 

1E . NXDIG STY TEMP 

06 LDA #3506 

1E£ ADC TEMP 
TAX 

00 LDA #$00 

6A NXSEG ROR ROR 
ROR 

07 ORA EBD,X 

CA DEX DEX 
DEX 

F6 BPL NXSEG 

01 00 STA DBD,Y 
DEY 

E? BPL NXDIG 


Initialize right 


side 
of display 


52 SMVTBL 


03 SBGEPD DATA 03,03,03 


DATA 00,00,00 


DATA 01,01,01 

DATA $31,341,$52 BDNDX 0 
DATA $30,541,351 3 
DATA $30,$40,0 6 
DATA $40, $h2,869. 9 
DATA $31,$52,% C 
DATA sy eho ee F 
DATA $31,541,$51 12 
DATA $51,$64,$74 15 
DATA $51,342,0 18 
DATA $63,273,0 1B 
DATA $40,331,0 1E 
DATA epee 21 
DATA $42,0,0 2k 
DATA $42,352,0 27 
DATA $52,0,0 2A 
DATA $63,374,0 2D 
DATA $40,0,0 30 
DATA $51,$63,0 33 
DATA $31,$85,0 36 
DATA $63,374,0 39 
DATA $75,$85,0 3¢ 
DATA $42,%52,0 3F 
DATA $74,385,0 42 
DATA $63,$42,$52 4s 
DATA 374,231,0 48 
DATA $74 ,%51,0 LB 
DATA $30,0,0 LE 
DATA $42,%85,0 51 
DATA $30,$40,$85 54 
DATA $30,340,$42 5? 
DATA 0,0,0 5A 
DATA 0,0,0 5D 
DATA $63,$40,0 60 


(plus MOVTIM, MOVTYP) 


to await 
person's 
move. 


Transfer beginning board (in 
Easy-format) to current 


board. 


Indicate no “from” 


Clear the 


"Display-format" 


board and 


move yet. 


the flasher-timer. 


Start with 3rd char of board. 


Set up X to start with 
lower segment for 


this character. 


Clear A so can OR sefments. 
In this loop, shift the 
segments into place. 


OR 3 for KIM, 
Point to next 


higher segment. 


1 for person. 


Loop till character done. 
Save completed char; g0 


do next one to 


the left. 











023D 
023F 
0241 
0243 
0245 
0247 
0249 
O2bA 
o24c 
O24E 
O24F 
0251 
0253 
0255 


0257 
0259 
O25B 
025D 
O25F 
0260 
0262 
0264 
0266 
0268 
O26A 
026C 
026D 


O26F 
0271 
0274 
0276 
0278 
0278 
027D 
0280 
0281 
0283 
0285 


0288 
0289 
028C 
O28F 
0291 
0293 
0296 
0298 
O29A 
029C 
O29E 
O2A0 
O2Al 
02A3 
O2A6 
O2A8 
O2AA 
O2AC 
O2AE 
O2B0 
O2B2 
02B4 
O2B6 
O2B9 
O2BB 
O2BD 
O2BF 
02C2 


02c4 
02C6 
02c8 
O2CA 
O2CC 
O2CE 


02D1 
02D3 
02D5 
02D7 
02D9 
O2DB 
O2DE 
02E0 
02E2 
O2E4 
02E6 
02E8 


O2EA 
O2ZEC 
O2EE 


00 
2E 
30 
00 


02 | 


01 


17 


00 
iF 


sO 


iF 
5D 


02 


rr 


03 


03 


02 


03 


3 Main loop begins here 


DISPLO 


GETNSK 


ZERMSK 


WNDSET 


DEC 
BPL 
LDA 
STA 
LDX 
LDA 
LSR 
AND 
STA 
DEX 
BPL 
LDX 
LDA 
EOR 


STA 
BMI 
LDA 
STA 
DEX 
BPL 


LDX #5 


LDA 
AND 
EOR 
STA 
DEX 
BPL 


FLSHR 
LITEST 


#E49 
MASK ,X 


GETMSK _ 


#B02 
TOG 


#380 
TOG 
WNDSET 
#500 
MASK ,X 


ZERMSK 


MASK , X 
WINDO,X 


WNDSET 


Time to flip KIM bits? 
No, just show current pattern. 
Yes. Reset 

timer. 
Form the 

flasher-mask 

patterns 

for 

the 

current 

board. 
Set X for next loop. 
Toggle to 

alternate 1's and O's 


for KIM's men. 
Go do O's, 


Clear masks so 
can do 
1*s. 


Use the 
masks 
to flip 
the bits. 


1 Output to KIM's 7-segment displays 
LITEST LDA #$7F 


LITE 


STA 
LDY 
LDX 
LDA 
STY 
JSR 
INY 
CPY 
BCC 
JSR 


; Keyboard 


KEYGET 


DACHK 


DALP 


GIPROG 


LMCHK 


NXFMCK 


FNMVLP 


CLD 
JSR 
JSR 
CMP 
BNE 
JMP 
CMP 
BNE 
LDX 
LDA 
STA 


BEQ 
LDX 
BNE 
JSR 
BPL 
LDA 
STA 
JOR 
BPL 


DEC 
LDA 
BPL 
STA 
STA 
JMP 


3 Continue 


TOMVCK 


LTMCHK 


LDA 


BPL 
STX 
LDA 
STA 
JSR 
BPL 
DEC 
LDA 
BPL 
STX 
BMI 


PADD 
#500 
#$09 
WINDO,Y 
TEMP 
CONVD+6 


#506 
LITE 
$1F3D 


Set directional 
registers. 


Start with leftmost char. 
Get character. 


Output character. 
Done all six yet? 


Not yet, continue. 
Turn off digits. 


input begins here 


KEYIN 
GETKEY 
#313 
DACHK 
INIT 
#511 
GIPROG 
#502 


GAMNUM,X 


INH,X 


DALP 
SCANDS 
KEYGET 
WINDO+4 
#5C0 
LITEST 
#$14 
KWLINK 
MOVTIM 
TIMEDS 
LEGMOV 
PERLM 
#508 
TMP 
LEGMOV 
TOMVCK 


TMP 
TMP 
LMC HK 
MOVTIM 
MOVTYP 
DISPLO 


GO key? 


Yes, start new game. 
DA key? 


Yes, display (for Data Analysis) 
from left to right: 
Move # (00,01, or 02), 
Board index (Bd # * 3), 
Game #. (2 digits each) 
Keep doing this till DA 
released; then resume play. 

Is game still 
in progress? 

No. Keep showing endgame msg. 

PC key? 

Yes, Person Concedes. 

Person's turn to move? 

No, gO time display. 

Yes. Did he make legal move? 

Yes. Go execute it. 

He didn*t make a legal move, 
dos he have one? Try 
each position to see. 


Try 
next 
position. 

Tried all, no luck, no legal 
moves possible. Set KIM 
win display after delay. 


looking for valid move for person 


FROM 
FNMVLP 
FROM 
#306 
TMP1 
LEGMOV 
OKMOV 
TMP1 
TMP1 
LTMCHK 
FROM 
NXFMCK 


Was valid move a "to" move? 
Yes, he can therefore move. 


_No. Given this “from" move, 


try all possible 
"to" moves. 
Find one? 
Yes. He’s got a move. 
Try 
next 
position. 
Tried all "to" moves; look 
for another “from" move. 


; Have found a possible “from-to" move for person. 


OKMOV 


LDA 
STA 
BMI 


#$FF 
FROM 
FNMVLP 


Has got a move he could make, 
so restore FROM and 
continue the game. 


page 3 


page 4&4 


02F0 
02F2 
O2F4 
O2F6 
O2F8 
O2FA 
O2FC 
02FE 
0300 
0302 
0305 
0307 
0309 
030B 
030D 
030F 
0311 


0313 
0315 
0318 
O31A 


031D 
031F 
0321 
0323 
0325 
0327 
0328 
032A 
032C 
032E 
0330 


0332 
0334 
0337 
0339 
033B 
033E 
0340 
0342 
0345 


0349 
03483 
034C 
O34E 


0350 
0353 
0355 
0356 
0358 
0359 
0353 
035D 
O35F 
0361 
0362 
0364 
0366 
0368 
036A 
036C 
036E 
0370 
0372 
0374 
0376 
0378 
0379 
0378 
037D 
037F 
0381 
0383 
0385 
0387 
0389 


0388 
038D 
038F 
0392 
0393 
0395 
0397 


E/ -iF 


E7 1F 
18 02 


OF 01 


10 O01 


11 01 


O4 17 
03 


01 


02 
1E 
1F 


LE 
20 
20 
30 
1E 
08 
1F 
ED 
02 
E7 
1A 


2D 
1B 
20 
00 
20 
78 
02 
72 
22 


05 
10 00 
F8 


19 
6F 02 


Person has entered 


PERLM 


TMINIT 
MAKMOV 


+ This 
FRMDIS 
DISX 


3 
TIMEDS 


KWC HK 


KWLINK 


LDA 
STA 
LDA 
BMI 
STX 
LDY 
LDA 
STA 
STY 
LDA 
STA 
LDY 
LDX 
STY 
LDA 
STA 
BMI 


#300 
WINDO+5 
FROM 
FRYDIS 
PTO 
#501 
#$FF 
MOVTIM 
EBD ,X 
DIGCOD,xX 
WINDO+5 
#$00 
FROM 
EBD,X 
#SFF 
FROM 
DISX 


a legal move. 


Clear tne “to" indication 
left from KIM‘s move. 
Was this a "from" move? 
Yes, display it; save move, 
No, save as person's “to", 
Set “person” indicator. 
set timer: not person's move. 
Save move-timer. 
Place piece on board. 
Get 7-segment code for 
“to"™ indication on board. 
Remove piece from 
previous 
board position. 
Prepare for next 
“from” move. 
Go show this "from" move. 


code displays "from" moves. 


STX 
LDA 
STA 
JMP 


LDA 
BMI 
DEC 
BNE 


LDA 
LSR 
CMP 
BPL 
LDA 
CMP 
BMI 


FROM 
DIGCOD,xX 
WINDO+3 
DISPLT 


TOG 

FNMVLP 
MOVTIM 
FNMVLP 


MOVTYP 


#3 30 
KIMWIN 
PTO 
#503 
PERWIN 


Save "from" move. 

Use “from"™ in X to get 7-seg 
indication. 

Return to main loop. 


Time to decrement move timer? 
Not yet, 

Yes. Ready for next move? 

Not yet. 


Has KIM moved 
to either 
6,7,0r 87 

Yes. KIM won. 

Has person. moved 
to 0,1,0r 27 

Yes. Person won. 


+ Try to match current board with stored model. 


MDLCHK 


NXBD 


+ Pick 
GOTMDL 


POK 


MVSLLP 
MVLP1 


PERWIN 


KIMWIWN 
STAD 


LpY #$ 


LDX 
CPX 
BNE 
LDX 
CPX 
BNE 
LDX 
CPX 
BEQ 
DEY 
DEY 
BPL 
BMI 


one 
LDA 
AND 
TAX 
BEQ 
DEX 
LDA 
STA 
STX 
LDA 
CLC 
ADC 
STA 
LDA 
BNE 
DEC 
BMI 
DEC 
BPL 
LDX 
BPL 
LOY 
CLC 
LDA 
ADC 
STA 
LDA 
STA 
LDA 
BPL 
LDA 


STA 


60 
BDMDL, Y 
DBD 

NXBD 
BDMDL+1,Y 
DBD+1 

NX BD 
BDMDL+2,Y 
DBD+2 
GOTMDL 
DEY 


MDLCHK 
PWMSG 


(#models - 1)*3 = 32*3 = 96 


First column match? 


.No, try next board model, 


Yes, does 

second column match? 
No, try next board model. 
Yes, does 

third column match? 
Yes, found model. Go get move, 
Point to 

next board model 

and keep comparing. 
No models found; have KIM 

concede the game. 


of the remaining moves for this position. 


TIMER 
#50 3 


POK 


#$02 
TMP 
TMP1 
ADMVTB 


TMP1 
POINTER 


(POINTER), 


GOTMOV 
TMP 
PERWIN 
TMP1 
MVLP1 
#502 
MVSLLP 
BDNDX 


ADMVTB 
MOVNO 
POINTER 
#$00 


(POINTER), 


PWAD 
STAD 
KWAD 
MPOINT 


b § 


Use the timer to " 
arbitrarily select 
move 0, 1, or 26 
(This code picks #2 
half the time.) 
Inititialize the counter for 
how many moves to try (3). 
Temporary move number. 


Set ADL of pointer to pick 
up this move. 


Y 


Got a valid move -- use it! 


No moves left; KIM resigns. 
Try next move 
in the set. (May try 
in order 2,1,0; 1,0,2; 
or O25 1) 
Person has won, 
Compute 
the ADL 
of KIt's 
last move. (POINTER+1 * 0) 
Wipe out the last 
move KIM made. 
Get address of “person won” 
message. 
Get “KIM won" msg address. 
Point to message address (ADL) 


RERREEEEEERR 


; Display end-of-game message 


FILWIN 


LDY 
LDA 
STA 
DEY 
BPL 
INC 
JMP 


#505 


(MPOINT),Y Store the six-letter 


WINDO,Y 


FILWIN 
GAMNUM 
LITEST 


message in the window, 


Increment game number. 
Show msg and wait for GO. 





3 Make KIM's chosen move 











039A 85 17 GOTMOV STA MOVTYP Save move for later checks. 
039C 84 1A STY BDNDX Save board pointer. 
O39E A6 1F LDX TMP1 “Pick up 
O3A0 86 1B STX MOVNO move # (=0,1, or 2). 
O3A2 48 4B PHA PHA Save 2 copies of move type. 
O3A4 4A 4A LSR LSR 
O3A6 YA 4A LSR LSR 
O3A8 AA TAX Place "to" move in X. 
O3A9 68 PLA 
O3AA 29 OF AND #$0F Extract and save 
O3AC 85 1D STA. FROM "from" move. 
O3AE AO 03 LDY #303 Indicate KIM move being made. 
03B0 68 4A PLA LSR Is upper half-byte of 
03B2 C9 30 CMP #530 move a 6,7, or 8? WOMAN MADHADRMNOOMOMD fy, 
O3B4 30 03 BMI NOKWIN No. KIM hasn't won. WDMNOONMKAGNHOO ME fh > 
03B6 4c FC 02 JMP TIMINIT Yes. Show winning move. fC Or} Of OO NOOOFHDON fe 
03B9 ee 00 NOKWIN LDA #$00 Indicate it’s person’s ee ee ee ee 
O3BB 4C FE 02 JMP MAKMOV move, and make KIM's. MO DWOWOWNNKCAVNOnAnRA 
3 Subroutine to test for legal player move. So ete ee 
; Call: with move ne SOA AdODOMAeOS © 
3 Returns: with X = GFF if illegal move 
i X = move if legal Aanhow oe los eco. 
O3BE 00 00 
03c0 c9 09 ~+=LEGMOV CMP #$09 Is move 0 to 8? Ht AODOONNDNONOOH * 
pace re 22 aa MOVNFG No, illegal. 2 Una AC aoe oss Cn 
eo 
03C5 BS 07 LDA EBD ,X Extract player indicator from ONDAR COONAN EPO MOD 
0307 6A 6A ROR ROR board: 1 player, 3 KIM. ee aN SAO OOO) rt 
03C9 10 27 BPL TOCHK Nobody here, but OK if "to". OmRKFtONnNORKHNOKOR?AM HAH 
03CB AS 1D LDA FROM Is this a “from” move? <P MUONS SS ROOM E 
O3CD 10 04 BPL PTCMOV No. Go see if legal “to”. SHO okmeOoto Seals 
O3CF BO 15 BCS MOVNFG Yes, but KIM's here! Bad. 
03D1 8A MOVOK TXA Return. Legal move was made One OHaAHUNSOMORE = 
03D2 60 RTS (or found possible). MADRWAMNODDAKO#O000 & 
03D3 BA PTOMOV TXA Place "to" move in A. AA MOOOW MN MS AMRAA 
03D4 90 10 BCC MOVNFG Person here! Can't capturel COCO HADRHLANHRODONEKEDAM 
O3D6 OA OA ASL ASL KIM here. A capture. Can PN ee Oe eevee SRO ee 
03D8 OA OA ASL ASL only be one of 8 possible ANWOHMKNNNODDHOOAS A 
03DA 05 1D ORA FROM moves. Format "TO:FROM", ee ee te 
O3DC AO 07 LDY #$07 and test against SAOs COMMAS H2OORA™ 
O3DE D9 F8 03 CAPCHK CMP CAPSET,Y each possibility. SHAG OnaGaesOe 
03E1 FO EE BEQ MOVOK Found it! Move is OK. AMeMaeIassumeouoe 
03E3 88 DEY 20 
03E4 10 F8 BPL CAPCHK OAIATASRSARLAOARE 
03E6 A2 FF MOVNFG LDX #$FF Move illegal. Set indicator. CODDDOODOOODODO000O 
03E8 60 RTS (Second of two return points.) 
O3E9 8A NOCAP TXA If here, not capture, C=0. 
O3BA 69 03 ADC #$03 Is move + 3 = FROM? 
O3EC CS . CMP FROM ; 
O3EE DO F BNE MOVNFS No, Illegal move. WO @ OO OR AND OA «e f10 
03FO FO DF BEQ MOVOK | ee ee eee 
late Au 1D TOCHK LDY FROM Space here. "To" move? BOCSOOLS ono Uo ae 
O3F4 30 FO BMI MOVNFG No. Illegal move. 
O3F6 10 Fi BPL NOCAP Yes, See if valid move. SS SOS RUNS SOONORE 
i SWOKRWNO BC OONODMNOWAN 
1 Set of all possible “capture” moves oy person, ARHROMHAOOHNMAAODOWO < 
: packed in “TOrFROM" format. Ne Boo sos el ooc ore 
; 
} Captures are from to Board format _ OAGODARNOONONNL WO 
O3F8 13 CAPSET DATA $13 > 41 ane aaa aaa OL SONSRSS Simona < 
O3F9 04 DATA $04 4 0 AO 8 A: 2 Pip nl Ser cps po aS) 
O3FA 24 DATA $24 4 2 ee ee ee ee Cee ne 
8 gS SI PES OG sericea tonsa 
3F 
O3FD 37 DATA $37. 7 3 es es ee SM HOAMOLONAMO Nea 
O3FE 57 DATA $57 tT 5 ! | t ! BCOHKONOANADROONAWO 
O3FF 48 DATA $48 8 4 r6:7:8:! OO Gh ODN ENO AN «gf 10 
. t ’ ! t 7 
: ee ert eee AAAS OORO AO HORS 
NOt KODNOMOHOWRON 
NADVOAMEHOHRORAE 
SOHODLONAT AUB 
HEXPAWN HEX DUMP 
AKRN BONN RMOMAWOAQMNIN 
O123456789ABCOD EF Raat tee anita a aR 
9100 A2 6E BD 7E 01 95 21 CA 10 F6 85 19 4c 00 02 43 OnKOKKMOOARRORNOS 
110 OB OB O38 OB 43 OB 43 OB C3 40 OB 40 C3 OB 43 48 Be 
0120 03 43 03 48 08 C3 43 C8 43 43 C3 08 43-43 43 CB KAHANHANOMOROOOS 
mene 4B 03 43 40 40 43 08 43 03 43 00 OB CO co 43 43 229990880990090900 
0140 40 40 CO 43 40 40 43 CO C3 CO 40 43 08 C3 00 43 NNUANAMNAROMN OR 
0150 OB 40 CO C3 CO 40 03 40 C3 00 00 C3 40 OB 00 43 SOOSDODODGODCOGCOOCOS 
0160 00 40 C3 OB 40 C3 03 4B 43:43 CB 43 00 43°00 C3 
0170 40 00 3E 00 38 3F 6D 79 00 54 1c 78 6D 00 00 00 
0180 O01 03 03 03 00 00 00 O1 O1 01 31 41 52 30 41 51 
0190 30 40 00 40 42 63 31 52 74 40 42 52 31 41 51 51 
O1A0 64 74 51 42 00 63 73 00 4O 31 00 31 41 51 42 00 
01B0 00 42 52 00 52 00 00 63 74% 00 40 00 00 51 63 00 
0100 31 85 00 63 74 00 75 85 00 42 52 00 74 85 00 63 
O1D0 42 52 74 31 00 74 51 00 30 00 00 42 85 00 30 4O 
O1EO 85 30 40 42 00 00 00 00 00 00 63 4a 00 


page 5 


page 6 


“TMM 
2 


ZPAG 


A2 





RTI 
PHA 
Ba ee 






-8 PLP 
ROLAA 


PLA SEI 


RTS 
DEY 


ROR“A____TXA 


i 
yp: 


BRANCHES —-O 





. oe | = = . | — = ar 


TYA 
US 


TAY 
TAK 


CLV 
ISK 


INY 
DEX 





SINGLE-BYTE Op Copes -0, -&, -A 


Another OP-CODE chart? Yes, 
there is a reason. 


but 


This chart groups the codes logic- 
ally. This way, you get three benefits. 


First, you get to see how the codes 
are classified and decoded. A glance at 
the chart shows that LDA and ADC, for 
example, are close cousins: same address- 
ing modes, same timing, and quite similar 
OP-CODES; on the other hand, LDA and LDX 
are noticeably different. The classifica- 
tion idea can be useful to those who want 
to dig into op-codes, say to write an 
assembler or a disassembler, 


it's handy for Looking up 
an OP-CODE-maybe easier than an alpha- 


Secondly, 


betical list. You'll very quickly learn 
to look at the right box and spot the 
code you want right away. As you get used 
to the groupings, you'll also develop a 
feel for the addressing modes that are 
allowed. 





Thirdly, you'll find it convenient 
for identifying an unknown op-code~-- 
("What the heck is CE, enyway?") 


Jim B. 


EDITORS NOTE: TI have found this chart to 
be extremely useful in designing opcode 
decode algorithms etc. 











cassette 


TAPE VERIFY (II) Dr. Barry Tepperman 
. 25 St. Mary St., #411 
Toronto, Ontario M4&Y 1R2 
Canada 


The only major disadvantage apparent in James 
Van Ornum's "Tape Verify" routine (from "First 
Book of KIM") is that, located as it is in the KIM 
monitor's "volatile execution block" of RAM, it 
must be manually loaded for each use rather than 
loaded from tape or relocated for use in ROM. The 
following is a modification of thia routine that 
treats "Tape Verify" as a block of data loaded as 
an array into VEB; it also appropriately zeros the 
checksums, so that (apart from loading this rou- 
tine and starting it up - in this example at 0200) 
the only manual loading required is to make sure 
that the correct file ID is in 17F9. TAPE VERIFY 
II can be loaded from tape, or, being fully relo- 
catable, be put into PROM for those of you (like 
me) whose expansion plans. for KIM include an ex- 
tended firmware operating system. As you might 
expect from description, data array PROG is a hex 
dump of the original TAPE VERIFY routine. 


VERIFY CLD 0200 D8 
LDA $#00 01 A9 00 
STA CHKL 03 8D E7 17 
STA CHKH 06 8D E8 17 
LDX $#0C 09 A2 OC 


LOADP LDA PROG,X OB BD 17 02 
STA VEB,X OE 9D EB 17 
DEX 11 CA 
BNE LOADP 12 DO F?7 
JMP S$#188C 14 4C 8C 18 
BRK 17 00 


data array: PROG 


0218 CD 00 00 DO 03 4C OF 19 4€ 29 19 O00 


comapre with original TAPE VERIFY: 


VEB CMP START 17EC CD O00 O00 
BNE FAILED EF DO 0Q3 
JMP LOADT12 Fl 4C OF 19 
FAILED JMP LOADT9 F4 4C€ 29 19 


Daniel Gardner 
11825 Beach Blvd. 
Stanton, Ca 90680 


RADIO TAPE FEEDBACK 


Here is an interesting way to verify that KIM 
has found your program when loading from audio 
tape. All you need is an A.M. transistor radio 
( a KIM and a cassette recorder would be helpful 
too ). Place the radio somewhere close to KIM and 
tune to a frequency where you can hear the "whine" 
of KIM's displays. Now, if you have already load- 
ed the I.D. of your program, you are ready to ver- 
ify a load. Enter AD 1 8 7 3, GO, and start your 
tape. You ahould now hear a buzz coming from the 
radio (you might have to fine tune it until you 
hear the buzz), mixed with the buzz are “clicks" 
as the microprocessor reads the synch. bytes. Af- 
ter awhile (100 synch bytes to be exact), if KIM 
ahs found your program the clicks will become more 
distinct, but if KIM didn't find your program the 
clicks will disappear. If you have ever waited 2 
Minutes for KIM to load a long program and found 
"she" didn't see it at all you'll appreciate this 
little trick. Thanks go to Scott Ogata for this 
idea. 


interface stuff: 


PB 


PB 


RELIABILITY HINT John Watney 
24133 Young Court 


Los Altos, Ca 94022 


1 have a hint that might be of interest to 
your readers. My cassette recorder gave unreli- 
able results (on KIM) which were traced to low 
frequency noise, 60Hz and the like. Reliability 
was greatly improved by cutting the low frequency 
response with a 100 ohm load on the audio input 
coupling capacitor C6. It was conveniently sol- 
dered to the board between the junction of C6 and 
R8&8 and VCC at the junction of R14 and R15. In my 
system the attenuation of the 2.4 KHZ component 
of the play back signal brought it to the same 
level as the 3,7 KHZ component. 


Mike Firth 
104 N. St, Mary 
Dallas, Tx 75214 


HELP relay package fixit 


If you purchased the HELP Relay package from 
THE COMPUTERIST, you should know that the veraion 
of the circuit which has three relays will prob- 
ably not work as shown in the wiring diagram, (An 
early version used two, until it was determined 
that a signal exists on the output to the record- 
er, which has to be interrupted.) 


The diagram supplied with the set of parts 
ahows a 7404 driving two relays. The relays I 
received draw about 1l4ma each, while the 7404 has 
a maximum rating of l6ma. The golution is to get 
another 1N914 for the third relay and follow the 
changed wiring below, which simply uses another 
buffer in the 7404, Other solutions using other 
chips are also possible. I have made the change 
(after burning out a 7404) and my unit now works. 


READ REMOTE 





WRITE REMOTE 






AUDIO OUT LO 


A et ee 


CASSETTE 


page 7 


TAPE FILE RECOVERY ROUTINE 


Joel Swank 
4655 SW 142nd #186 
Beaverton, Or 97005 


Ever have a tape file with a dropout? One 
that fails on the same byte every time. There 
must be good data behind that dropout, but how to 
get at it? 


The normal tape read routine quits when it 
gets an invalid character. Instead the recovery 
routine flags the error by storing an asterisk({*) 
in memory, and begins reading bits looking for a 
valid character. When it gets one it wvesumes 
reading the file. The only problem is that there 
is no way of telling whether the first valid char- 
acter is the first half of a byte or the last half 
of a byte. To overcome this problem the routine 
uses an external flag byte (HALF) to determine 
what to do with the first valid character after a 
dropout. A bit is ahifted out of the high order 
end of HALF each time a recovery is attempted. 

If the bit is zero the first valid character is 
ignored, If it is ome the first valid character 


is used to form the first valid byte. Upon each 
entry into recovery mode the counter ERRC is in- 
cremented. If it wraps to zero the program is 
aborted. 


To recover a file initialize $17F5-$17F9 as 
usual and set HALF ($C8) to $00. Start the pro- 
gram at $200. When SFFFF appears look at ERRC 
($C7). If the count is low then examine the data 
to find the errors marked '*' ($2A). Determine 
where the data is a half byte out of sync and set 
one bits in HALF accordingly. Rerun the program 
and the data, minus the dropouts should be in mem- 
ory. I have recovered files with two dropouts, 
it should work for as many as 8. 


If you have a file that has a dropout in the 
Sync pattern and won't sync-up it may be recevered 
by using SCAN ($298) as entry point, effectively 
starting in recovery mode. You must first initial- 
lize VEBB (S$L7EC) with $8Dnnnn60, where nnnn is the 
address where the data is to be stored. Also zero 
ERRC. The ID and start address will be read and 
stored like data. It is also possible to begin 
reading files in the middle in this manner. The 
routine also performs the special tape read func- 
tions (ID=00 or FF). Thanks to Jim Butterfield 
for use of his synchronizaiton code. 


1298 ZERO PACE STORAGE 
1782 : 
1112 HALF .OL #@8C8 
1128 FRAC .DL @eC7? ERROR COUNT 
1138 INH .OL @BF9 
1148 : 
1158 : EXTERNAL LABELS 
1168 ‘ 
1178 VEBB .fL 17EC 
118B SAL ,DL 17F5 
1198 SAH .DL 17F6 
1208 EAL .DL 17F7? 
12128 EAH .DL 17F8 
1228 ID 2OL 17F9 
1234 INTV .DL 1932 
1248 FNO@ .DL 1925 
1250 ENDF .CL 1929 
1268 INVE .OL 1932 
12768 RDSY .DL 19F3 
1280 ROCH .DL 1A24 
1298 CHKT .OL 194C 
1308 INCt .OL 19EA 
1318 SED .DL 1742 
1328 PAKT .DL 1A00 
133¢ ROBT .OL 1AQ41 
1348 CHKL .DL 17E7 
1358 CHKH .CL 1768 
1360 : 
1378 : ENTRY POINT 
1380 Hs 
1398 B@20B2B AS ESC RECV LDA BC OPCONE FOR STA 
1408 @28@2 8D EC 17 STA VE@B INTO VEBB 
14128 B285 AO BB LCA @@ 
1426 B28? 85 C? STA *ERRC INIT COUNT 
14308 82289 C9 FF CMP QFF 
144@ @2p6 28 32 19 JSR INVE INIT VESB 
1458 B28E AD B? LDA @7? CIRECTIONAL HEG 
146@ 6218 80 42 17 STA SBO 
1470 @213 20 41 1A SYN’ JSR RDBT CET A BIT 
1480 8216 46 F9 LSA *INH 
1498 @218 £5 F9 ORA * INH SHIFT INTC LEFT OF INH 
15@0 @21A B85 FI STA * INH 
1518 #@21C C9 16 TST CMP 16 SYNC CHAHACTER? 
15208 P2116 OB F3 RNE SYN NO = KEEP LOOKIN 
1538 9228 28 24 1A JSR HOCH GET A CHARACTER 
1542 90223 C6 FI DEC * INH COUNT 22 SYNCS 
1558 @225 18 FS PPL TST 
1568 @227 C9 2A CNP ‘°* * FLAGS STAKT OF RECORD 
1578 0229 DB F 1 HNE TST IF NOT - THEN MUST RE SYNC 
1588 #226 20 F3 19 JSR ROBY CET BYTE 
1598 @22F Cb FIX 17 CVvP ID CORRECT RECORD? 
1688 9231 FB 18 FEQ LGAD YES = READ IT 
1618 £233 AD F9 197 LDA ID IDeQ? 
1626 86236 FO 13 BEQ LOAD YES = HEAD IT ANYWAY 
163@ 86238 C9 FF CMP BFF IDeFF? 
164B 923A £28 C7 APNE SYN NO TAY NEXT 
1658 @23C 28 F3 19 JSR BRDBY YES IGNORE SA OF TAPE 
1668 623F 28 4C 19 JSR CHKT 
1678 @242 26 F3 19 JSR ROBY 
1680 8245 26 ac 19 JSA CHKT 
1698 €248 38 SEC 
1760 #2249 £8 12 ecs PYTE HELATIVE JUMP 
17128 @248 28 F3 19 LOAD JSR ADEY READ START ADDHESS AND SAVE 
172B @24E BD ED 17 STA VEBER+01 
1738 0251 286 aC 19 JSR CHKT 
1742 8254 28 F3 19 JSR ACBY 
eee 1758 8257 8D EE 17 STA VEPB+22 














176B B25A 28 4C 19 JSR CHKT 

177@ B25D Ae Be OYTE 1OX #2 INDUCX TG BFAD 2 CHAR BYTES 
1782 @25F 28 24 1A CHAAR JSR HPCH CET A CHAHACTER 

1979@ @262 79 2F CMP °/ / FLAGD END OF RATA 

1022 B264 FB 13 hEQ CHEK 

1810 @266 22 @O 1A JSR PAKT CONVERT TO HEX NYPBLE 
192B 8269 08 21 INE PADC INVALID CHAHACTER 

1932 826C CA MEX 

1848 B826C CB F1 PNE CHAR 

1850 B26E 28 4C 19 JSA CHKT COMPUTE CHECKSUM 

1868 #271 28 FC 17 JSR VEEN STORE PYTE 

1872 #274 20 EA 19 JSA INCt NEAT. RYTE 

1688 @277 2B F4 ENE CYTE 

1898 : GET CHECKSUM AND COMPARE TO COMPUTED VALUE 
190B #279 2@ F3 19 CHEK JSR ROBY 

1918 @27C CO £7 17 CMP CHKL 

192@ @27F DE 2n ENE [TADS 

193B @2€1 28 F3 19 JSR ROBY 

1948 8284 CO FB 17 CMP CHKH 

1958 @287 08 25 BNE ‘ADS 

196B #289 4C 25 19 JVP ENCO NORVAL EXIT 

1978 ATTEMPT AECOVERY AFTOA FAROR 

198@¢@ @28C AD 2A CADC LDA '* FLAG MAD IYTE 

19908 @28—E 2B EC 17 JSR VEBR 

2028 £291 28 CA 19 JSR INCt 

2012 B294 E6 C? INC *ERAC CDUNT ERROR 

28028 8296 FB 16 REQ PADS ERROR COUNT CVERFLOW 

2832 @298 28 41 14 SCAN JSA ACBT SET A MIT 

2048 8298 46 F9 SR *INH 

2852 2290 BS FO CRA * INH SHIFT IR 

2068 B29F 85 FY STA *INH 

2078 B2A1 2B OB 1A JSR PAKT COT A VALIO CHARACTER YET? 
2982 A2A4 Of F2 PNE SCAN NCO KEEP TRYIN 

2098 B2A6 B6 CB ASL *HALF TEST NEXT SKIP BIT 

2108 @2A8 90 2 PEG CYTE IGNORE THIS CHAHACTER 
2118 @2AA K2 Bl (OX B61 ELSE USE IT AS FIRST HALF 
2128 B2AC 0B F1 PNE CHAR AND CO READ 2NN HALF 

2138 @2AE 4C 29 19 PADS JMP ENDF SHCW FRRDR 

2148 ENDS .EN 








tm 
AIM 


tm 
KIM 


om 


SYM OWNERS ! USE YOUR OWN BUS: { 


FELEFEFEEEEEEEEE EE EE EEEE EEE EEE EEE EE EEE EEE EF EEE FEF HF 
+ PREMIUM 8K RAM AT BELOW S - 100 PRICES + 
FEEEEEEFEE EEE EEE EEE EEE EE ELE EE FEE EEEE EEE EEE EEE TEE E TH 


cfsttrs HR HIE HE KH EK ettectereinrs 
$ 169 ! HDE 8K STATIC RAM 3 for $ 465 ! 
ress HHRRH RRR R RR EK EEE Sea a ees 

HUDSON DIGITAL ELECTRONICS (HDE ) DM 816-M8-8k 
Fully assembled industrial/commercial quality : 100 
hour high temperature burn-in 3; 90 day parts/labor 
warranty low power : KIM bus compatible pin for pin 

Super quality and reliability at below S-100 prices 
(COMMERCIALLY rated S-100 8K hoards cost 25-75% more). 


When you expand your system, expand with the bus opti- 
mized for 8 bit CPU's, the Commodore-MOS 22/44 pin KIM 
bus, now supported by Synertek, MTU, Rockwell, Problem 
Solver Systems, EDE, the Computerist, RNB, and others ! 


KIM-1 COMPUTER $ 179 = = = = KIM-4 MOTHERBOARD $ 119 
HYDE Pile Oriented Disk System (FODS) for KIM & 
other 6502 systems Powerful editor/disk commands : 


two pass assembler & text editor compatible with ARESCO 
source files KIM bus compatible interface board : 
Simple, powerful disk interface uses parallel ports 
Fuli size flcppy disks - NO speed limitation whatsoever 
in data transfer rate - 6502 handles transfer at maxi- 
mun speed with well over 100% safety margin. Single 
density IBM format for high reliability. The best 6502 
developement system available. Patches to BASIC. 

single drive $ 1995 ; dual $ 2750 (45 day delivery) 
MC/Visa, COD's, check, orders - add 5% for shipping. 
Irree shipping on orders prepaid with cashier's check ! 


P,: O-. Box L712 


- Plainsman Micro Systems : 
Phone (205) 745 - 7735 - 


~ Auburn, Alabama 36830 


Commodore HDE OSI Altos 


Compucolor 





WARE ON CASSETTE 


Here, by popular demand, are the first of a 
series of cassette software offerings by the 
NOTES. Many of you have asked that some of the 


longer programs which are published in our news- 

letter be made available on cassette so that your 
time could be spent doing things besides punching 
in programs. 


All cassettes will be original recordings 
(not copies) dumped directly from memory using the 
standard KIM recording format. 


Besides HEXPAWN (our software feature) we al- 
so have KIMATH which is a 2K math subroutine pack- 
age which was to be released in ROM from MOS Tech- 
nology a couple of years ago ~ and wasn't. The 
KIMATH manual, which includes a complete source 
listings of the $F800 version (same as the $2000 
version ‘cept for the addresses) is available for 
$15.00 from sources that I know of. 


Johnson Computer 
P.O. Box 523 
Medina, Ohio 44256 
216-725-4560 


AB Computers 

Box 104 

Perkasie, Pa 18944 
215-257-8195 


The KIMATH manual is not included with the 
cassette and must be purchased separately from one 
of the above sources. 


An errata sheet will be included with each 
cassette with some corrections for the manual, 
By the way, we have the ability to reassemble KIM- 
ATH anywhere in memory for $5.00 extra. 


Each cassette will have a 30 second "SYNC" 
leader which can be used for aligning your head 
(no, the one on your cassette) or PLL. The heads 
of the machines which will be used to record your 
cassette have been aligned from a Recording stud- 
io cassette which was set up with an alignment 
"standard", 


KIMATH (specify $2000 or $F800 version) $12.00 
HEXPAWN CSO1O0O—SOSFF ) in civ ese sae eee tied $.00 
U.S. funds only. Overseas customers please 


include $1.00 extra for postage. page 9 


LANGUAGE LAB: 
focal 


At this point in time, FOCAL is the most doc- 
uméented of the high level languages which run on 
Our beloved 6502. Having a complete source liat- 
ing is definitely invaluable, 


This openness on the part of the implementor 
has made it so easy to fidget around with FOCALs 
internala and even fix a problem or two. 


One of the things that did sort of annoy me 
was the almost 1 character delay encountered when 
typing in FOCAL program text from a hard-copy term- 
inal, {I have the Aregco version). 


As it turns out, thanks to the source listing, 
I found that FOCALs author did some elaborate arm 
which has been input to the TTY port. No small 
feat, I might add, since KIM echoes the tty input 
in hardware (not software!). 


(If you're wondering how = FOCAL makes the 
terminal think that the character getting echoed 


is a RUBOUT character - which the terminal ignores). 


Anyhow, I don't quite know why FOCAL bothers 
to do this ~ the character ends up getting echoed 
in software anyway. (There is a function which 
does enable to echo to be shut off completely). 


Make the following changes to FOCAL. This 
patch was found in the FOCAL User Manual ($12.00 
from the 6502 Program Exchange) and was apparently 
an update for FCL-65E. 


34AA 84 A5 OUT STY SAVYR 
; save "yy" 
34AC 20 AO ILE JSR OUTCH 
34AF A4 A5 LDY SAVYR 
;restore "Y" 
34B1 18 CLC 
; indicate success 
34B2 60 RTS 
; return 
34B3 E6 76 IN INC HASH 
;bump random seed 
34B5 2C 40 17 BIT SAD 
: ; test input port 
34B8 30 6FY BMI IN 


; loop ‘til start bit 
LDA ECHFLG 
; get echo flag 


34BA A5 6B 


34BC DO 03 BNE NOECH 
; branch for no echo 
34BE 4C 5A LE JMP GETCH 
; get character with 
echo 


34C1 AD 42 17 NOECH LDA SBD 
>; Bet port status 


3404 29 «FE AND #FE 

; turn off bit 
34C6 8D 42 17 STA SBD 
34C9 20 SA IE JSR GETCH 
34CC 48 PHA 

; save character 
34CD AD 42 17 LDA SBD 

; get port status 
34D0 09 Ol ORA #01 

> turn on bit 
34D2 8D 42 17 STA SBD 

; make echo a rubout 
34D5 AQ9 00 LDA #0 

; get a null character 
34D6 20 AQ 1E JSR OUTCH 

» echo it 
34D9 68 PLA 

; restore input char. 
34DA 18 CLC 

; indicate success 
34DB 60 RTS 


5 return 
Page 10 


28F2 EA EA EA was 20 02 29 
35B4 B3 was A5 


Faster typists will really notice a difference. 


A really neat feature of FOCAL is the fact 
that you can add specialized functions. 


Function calls consist of four (or fewer) let- 
ters beginning with the letter "F" and followed by 
a parenthetical expression which may contain an 
argument to be passed to the function, 


There are a number of functions which are in- 
cluded in FOCAL, such as: 

FINT - returns the integer portion of a 
number 

FABS - returns the absolute value of a 
number 

FMEM - allows one to examine or deposit 
into a memory location. 


FOCAL decides which function is being called 
by performing a "HASHING" of the function name and 
searching for that value in a function dipatch 
table. Using hash codes simplifies the lookup 
table design structure quite a bit. It may even 
speed things up a bit also. 


If you wish to install your own functions, the 
hash code for the particular function name and the 
function address must be installed in the extra 
space provided in the lookup table. 





Figuring out the hash code for your function oO 
is not so easy, however, unless you use FOCAL it- : 
self to do the computation, 


In version 3D, place a BRK or JMP KIM at lo- 
cation $29EF. Then execute the following command: 
SET X = F2??7(1) 
where F??? is your new function 
name (FADC for example) and (1) 
is there because you need a par- 
ameter of some sort. 


Program control will then be returned to KIM, 
or wherever your BRK vector pointed, and the hash 
code will be found in location $0065 as well as 
the Accumulator and the "X" register. 


Several readers are preparing articles on FO- 
CAL additions and modifications, so we have alot 
to look forward to in this section. 


I just saw the latest Dr. Dobbs Journal at 
the newstand (computer store newstand, that is) 
and noticed that they published a rather large 
FOCAL program. (I don't recall the issue number). 


Do YOU have any FOCAL articles or programs 
that you'd like to see in print? Then send ‘em in. 


I highly recommend the $12.00 FOCAL USER MAN- 
UAL from the 6502 Program Exchange to those who 
are learning to program in this language as well 
as those who are just curious and perhaps want to 
see how FOCAL compares to BASIC, 


At the present time, FOCAL for the 6502 is 
available from two sources. Write to them for 
pricing and availablity. 





ARESCO 6502 Program Exchange 

PO BOX 43 2920 Moana 

Audobon, PA Reno, Nevada 89509 
19407 











basic 


Microsoft a-little-over 8K Basic is available 
from two sources for about $100. 


Johnson Computer Micro-Z Company 

P.O. Box 523 Box 2426 

Medina, Oh 44256 Rolling Hills, Ca 
90274 


Both outfits are basically handling the same 
package except Micro-Z has added a facility to 
save data as well as programs through Basic and, 
has Hypertape built-in. I don't know if this in- 
creases the size of the Basic interpreter or not. 


Neither of there two Basics is promable but 
Johnson Computer has indicated they have a prom- 
able version available for about $100. You have 
to give up SIN, COS, ARC and TAN though. This 
gets the size down to below 8K. 


BASIC 1/0 MODS 


Marvin L. DeJong 
The School of the Ozarks 
Point Lookout, Mo 65726 


I had to agree with much of what Don J. 
Latham had to say about Microsoft Basic. The pro- 
gram modifies itself and that is a real pain as 
far as I am concerned, because if you want to do 
anything else, or if you blow something, you have 
to reload it. Once you get it running its nice, 
but I sure hate to sit around waiting and hoping 
for a tape to read. 


Johnson Computer publishes some documentation. 
I wanted to convert Microsoft Basic to run on my 
KEM and MVM 1024 Video module, and without listings 
it can be difficult. For others who may want to 
sue Microsoft with a parallel ASCII keyboard and 
a CRT as opposed to a TTY system, you should be 
aware that changes must be made. I.wrote a little 
routine following the suggestion of Gene Zumchak 
of Riverside Electronics, to find all the I/O lo- 
cations in the program. For the 9 digit version 
these are: 


INPUT $2AE5 and $2456 (call KIM-1 input routine) 
OUTPUT $2A51 (call KIM-1 output routine) 


which must be changed to call the users’ own rou- 
tines for his keyboard and CRT. 


Also, there is a break routine at about $26DF. 
To be precise, address $26DF must be changed from 
30 to 10. (ED. NOTE:Thia mod did'nt work on my KIM) 


Now, if someone could tell me where to look 
to make the program list 16 lines of a program at 
once, rather than whizzing X number of lines past 
my CRT and showing me only the last 16, I would be 
grateful, 


P.S. The Johnson Computer people have been very 
cooperative in working out some of my tape 
problems with the BASIC tapes. 


A BASIC QUESTION from the Editor 
Does anyone know how to make Basic always 

come up in the SIN, COS, & TAN mode without having 

to answer the question with a "Y" everytime? As 

you may know, if you plan on saving programs, BASIC 

must be in the same mode when you load a program 

as when you saved it. 


KkKKKKKK 


Got a note from Joe Donato, (193 Walford East, 
Sudbury, Ontario Canada P3E 2G8) who says he has 
subroutine for KIM 9 digit Basic (Microsoft) which 
permits the user to store programs on tape using 
I.D. numbers (Basic doesn't normally permit this). 
This subroutine contains HYPERTAPE and runs from 
O2EF to O3E3. It is available from Joe for $4.00. 


KIM BASIC HINT 


BASIC TIMING 





F. E. Kempisty 
1149 Garner Ave. 
Schenectady, NY 12309 





I have Johnson Computer's Microsoft 9-digit 
Basic. I disassembled it and found 2 extra com- 
mands GET and STEP which were not listed. 


To speed up SAVEing programs. At location 
$275C change 4C 00 18 to 4C 00 02 and then locate 
Hypertape at $0200. Microsoft uses page one 
($0100). My benchmark timing comparisons of Micro- 
soft 9-digit Basic and Tom Pittman's Tiny Basic 
using the programs from Kilobaud #10. 
Pittman’s Tiny Basic 


noe am eT OR RON we amare Hy LRN ERS Na te NN, 


Aah RA Sh SCR RA rE a 


Program 1 - 1.5 seconds 2 seconds 

Program 2 - 10.3 ” i 28 seconds 
Program 3 ~ 18.5 4 51 " 46 ij 
Program 4 - 20.5 i 53 ae 47 " 
Program 5 - 22 " 62 ie 

Program 6 - 31.7 “ 

Program 7 - 49 si 


Speed is in the Top 5 - Good Huh! 


from the MICRO-Z CO, 


The standard KIM BASIC will cause your BASIC 
program to stop running, and an "OK" to be typed, 
if you only hit "RETURN" in response to an INPUT 
query ("?"),. Sometines, this can be annoying be- 
cause the program must be re-run, or a “CONT must 
be typed, if only the “RETURN" key is pressed in- 
advertently. 


However, this can be changed by adding the 
following line early in your program: 


XXXX POKE 10920, 169 


With this change, when only the "RETURN" key 
is pressed in answer to a "?", a zero (0) is in- 
serted in the variable and your BASIC program ad- 
vances to the next line just as if you had entered 


a number. Of course, if you wish to leave your 
program in the middle, and go back to BASIC, you 
can always press the "ST" button on the KIM and 
re-enter through the “warm start" location (press 
space bar to get 0000 4C, then press “G")., 


Incidentally, don't forget to insert the fol- 
lowing command near the end of the program, to put 
BASIC back the way it was: 


YYYY POKE 10920, 165 


The first command inserts and A9 (169 decimal) 
into location $2AA8 Hex (10920 decimal), and the 
second command replaces the A5 (165 decimal) that 
was originally there. 


Since I last wrote you, we have modified our 
BASIC "DATA/SAVE" commands to record and playback 
both ‘strings’ and ‘data’ that are inserted while 
running a program. Previously, we only recorded 
the numerical data, 


We are in the process of contacting all those 
who purchased our BASIC and are supplying them 
with the updated commands. However, I would ap- 
preciate a note in the USER NOTES: 6502 - asking 
those who purchased their BASIC from us to write 
Micro-Z, Box 2426, Rolling Hills, Ca 90274 - if 
they haven't heard from us as yet. 


These commands will only work with the Micro- 
Z version of the Microsoft KIM BASIC so it would 
not be of any value to those who purchased their 
BASIC elsewhere. We are thinking of providing a 
package of the User Manual and a cassette of the 
added data for those who are not using our BASIC- 














page 11 


BASIC RENUMBER PROGRAM from 





Harvey Herman 
2512 Berkley Pl. 
Greensboro, NC 27403 


The following BASIC renumbering program may 
be of interest to your réaders who use Microsoft 
8K BASIC (9 digit version) on KIM. It is an adap- 
tion of a PET program which appeared in PET User 
Notes (Vol. 1 #5, July/Aug. 1978). RENUMBER, as 
it's name implies, renumbers the current program 
in memory. It converts both statement numbers and 
references in GOTO, GOSUB, and THEN statements. 


The program can be utilized in severai dif- 
ferent ways. It can be loaded before beginning 
program development (an example follows). It can 
be loaded at any time using paper tape, if avail- 
able, or even by hand (ugh!). It can be appended 
at any time if BASIC is modified (send SASE for 
details). I have written the program so that only 
the renumbered program remains after running. If 
this is not desired eliminate the POKES in lines 
63950 and 63955. 


The program: has one restriction which I am 
aware of. When the new number in a reference has 
more digits than the old one, the first character 
or token preceding the old number will be replaced 
by the first digit of the new number. Line numbers 
present no problem as they always occupy two bytes. 
However, line number references have no specific 
number of characters (one thru five) and it is poss-~ 
ible that tokens or commas, not spaces will be re- 


I have used another program which has no re- 
strictions but requires a paper tape punch for 
intermediate storage of the renumbered program, 
Since many people are using KSR type terminals, 
without punches, {I felt the following program 


would be more useful. @ 


Program Notes (underlined letters were typed 
by the user): 


1. DIM L% can be decreased if space is a 
problem. Decimal 120/121 (hex 78/79) is 
the pointer location for the start of 
BASIC programs in this version of BASIC, 


2. L% (0) was used to store the new pointer 
to the end of BASIC programs as it was 


Ht 


not “iost" after the first POKE in 63955. 


3. The renumber program is deleted by POKE 
ing )'s at the end of the renumbered pro- 
gram. 


4. The last two POKE's reset the pointer to 
the end of the renumbered BASIC program. 
CLEAR resets all other pointers. 


5. In this example we see that the pointer 
at hex 7A/7B was set properly to hex 
$4078, two more than the 3rd zero at the 
end of the renumbered program. 


(Editors Comment - Maz, Heaman also mentioned 
that he has put together an enhancement package 
for 9 digit MicazoSo§t KIM BASIC which includes 
fast save & Load, a rzeak time clock, the GET com- 





placed, Where this occurs the lines will have to mand, paper tape contazokl etc. He's asking $15.00 
be manually re-entered. Remember to leave some for the package ox a SASE for more detatka, 1'L2 
space in front of each line number references and nevaew 4% fon the next 4s4ue. 
you won't have any problem. (see the example). 
OK RENUMBER 
4.QAD 
KIM 
0000 4c g a 
L@ADED 
AIST 
@) 63900 CLEARrDIML2(500) :DEFFNRCX)=PEEK (CX) +256ePEEK (X41) 8L=FNRC 120) 
6390) INPUT "STARTING LINE # AND INCREMENTS STs IN 
63902 DEFFNMCX)SINTCCST+IN&X) £256) 
63905 N=FNRCL) tX=FNRCL42) ts IF X<63900THENA=A41 tLZ2CABXItLaNn1G@TB63905 
63907 ENZ#L2EHZ=INTCCL4+3) 256) tEL 2 =L4+3-2564EH% 
(2) 63908 L%¢0>=EHZ 
63910 L=FNRC120) tF ORB=OTBA-12N=2=FNRC(L) tPQOKEC(L4+3) oF NMCB) 
63912 POKECL4+2)5ST+IN*B-256aF NMCB) 
63915 F=O08tF ORC=L+4T@N-1 tP=PEEK(CC) 2 IF P=1360RP=1 400RP=161 THENF=121G68T96395* 
wo. 
63920 IFF<>OTHENIFP> 47ANDP<58 THEND= 1 0%D+P- 48 1G=G+ 1 2G8T@63950 
63925 IFF=O0RD=0G80T@63950 
63930 FORE=1 TOA: IFD=L2¢(E2G@TB639 40 
63935 NEXTE:D=0:G=0:G8T@63950 
63940 D=Oz2ES=STRSEC CE-“1)#4IN+ST)+" *sH=LENCES)=4:8C=C-GtIFH>GTHENC#C-1 
63942 IFH>GTHENGSH 
63945 FORI=1TO@GtPOKECsASCC(CMIDS CES, 14+151))>2C=C4+1 1NEXTI#G=0 
63950 NEXTCEL=NtPRINTBs tNEXTBtP@KEENZ,0:PQKECENZ419.0 
63955 POKE1L22,EL%2:POKE123,L2¢(0) sCLEARIEND 
-RUN 6.3900 
STARTING LINE # AND INCREMENT? 100210 
0 1 2 3 4 
OK 
KIM 
List 0000 4C 7A. 
(5) OO7A 78 
100 REM 007B 40 4073. 
110 G@T@100 4073 80 
120 G@SUB110 4074 00 
190 BN A THENIO0,1102120 4075 00 be 
ai40 END 4076 00 @ 


page 12 








tiny basic 


Michael E. Day 
2590 DeBok Rd, 
West Linn, Or 97068 


Tom Pittman's TINY BASIC TB651K V.1K may have 
a bug!!! 


The following program has the ability to lock 
you out of your computer: 


1 RUN 


What happens, is that when you type RUN, TINY 
begins execution, and the first statement it sees 
is RUN; which causes TINY to begin execution again. 
During all of this there is no test for a BREAK, 
which leaves the computer running away happily ig- 
noring you. 


This is no big deal, unless your computer 
happens to be located in a remote location (Like 
across town!), then it becomes a pain. 


I found this bug late one night when nothing 
else was going right, (MY keyboard has not been 
the same since) and I typed it in by mistake. 


Normally, I wouldn't care about it, but due 
to the circumstances it ‘bugged’ me, so I decided 
to do something about it. The following is the 
cure, and is located in the execute routine (XQ). 


053F A5 2A LDA 2A Get IL pointer (ADL) 
0541 85 C4 STA C4 Save it 

0543 A5 2B LDA 2B Get IL pointer (ADH) 
0545 865 C5 STA C5 Save it 

0547 4C OF 05 JMP OSOF GOTO NX routine 

054A EA NOP Not used 

O54B EA NOP Not used 


This replaces the previous data, and allows 
a break test on execution. 


The multiple statements per line modifica- 


tions consists of changing the address of the 
Branch End routine to the new address, changing 
the name of the old NX IL code to NS (address re- 
mains the same), and the addition of the new NX 
IL code and address. NX retains the old meaning 
and description of Next Line. The new NS code 
searches for the Next Statement by looking for a 
colon (:) or carriage return, and passing control 
depending on what it has found. 


The ML routine for the NS code is a modifi- 
cation of the old NX routine with a subroutine 
located at SOAE8. This routine causes execution 
of the next statement if a colon igs found, it goes 
to the next line if a carriage return is found and 
in the run mode, otherwise it returns to the com- 
mand mode, 


The new ML routine for the BE code tests for 
a carriage return or colon to indicate statement 
end, 


A modification to the IL is needed at SO9B4 
in order to use the colon (:) as a terminator, as 
this character is used to produce an X-OFF (DC3) 
after a print statement. This is modified to pro- 
duce the X-OFF on an exclamation point (!) instead, 


Another modification to the IL must be made 
at $O9F5. This is required to make TINY begin 
execution on the next line rather than next state~- 
ment following GOSUB RETURN. This is required due 
to the fact that TINY only remembers the line num- 
ber for the return link, so if the GOSUB was not 
the first statement in the line, a hard loop would 
be set up. With this modification however, exe- 
cution will begin on the next line, and not the 
next statement after a GOSUB has been executed. 


_ A modification is made to the IL at $0A26 
which causes execution to begin on the next line 
after a REM statement. instead of beginning with 


the next statement. This allows colona to be in 
REM statements. It allows for more powerfull IF 
THEN statements. I.E.: IF A@0 THEN REM: LET 
A=1: PRINT A,: GOTO 20. In the above example 


if A is equal to 0, then execution begins on the 


next line, otherwise the rest of the present line 
1s executed, 


The colon may not be used in a print state- 
ment that is the second part of an IF THEN state- 
ment, since if the test is not true, then a search 
for the next statement is begun, and termination 
of the search will be prematurely done upon de- 
teciton of the colon in the print statement. The 
colon may be in any other print statement however, 
even on the same line as the IF THEN statement. 

It just can not be used as the second part of an 
IF THEN statement, 


The GOSUB will always be the last statement 
executed ina line, I.E.: 
IF A=0 THEN GOSUB 20: LET Al: PRINT A: GOTO 10 
In the above example if A is equal to 0, then the 
GOSUB 20 is executed, and execution continues with 
the next line following the example upon RETURN 
from the GOSUB. If A tits not equal to 0, then the 
GOSUB is skipped, and the rest of the line is exe- 
cuted. 


IL ADDRESS CHANGES 


CHANGE TO WAS 
022C F2 FD 
022D OA 03 Branch End (BE) 
025A EO 9F 
025B OA 05 Next Line (NX) 


Old IL code NX now becomes NX (Next Statement) 
there is no address change however. 


IL ROUTINE CHANGES 

O9B4 83 Al t X-OFF On (!) exclamation 
(3) BC O9B8 point instead of (:) colon 

O9F5 IE NX NX on Return instead of NS 

ML ROUTINE ADDITIONS 

NEW NX ROUTINE 

OAEO 20 14 04 JSR 0414 Search for "CR" 

OAE3 DO FB BNE OAEO Con'tt until found 

OAES 4c OB 05 JMP O50B Get new line 

NEW NS ROUTINE 


OAE8 201404 JSR 0414 Search for terminator 


OAEB FO O4 BEQ OAF1l Return if "CR" 

OAED C9 3A CMP #3A Return if “:" 

QOAEF DO F?7 BNE QAE8 Otherwise try again 
OAF1 60 RTS 


NEW BE ROUTINE 


OAF2 20 25 0&4 JSR 0425 Read BASIC character 


OAF5 CS OD CMP #0D Lf 1t is: a: “CR” 
OAF7 FO FB BEQ OAF1l Return 

OAF9 C9 3A CMP #3A or: a. s" 

OAFB FO F4 BEQ OAFl Return 


OAFD 4C 64 03 JMP 0364 Otherwise go branch 


ML ROUTINE CHANGES 


NS ROUTENE 

0506 20 E8 OA JSR OAE8 Find terminator 
0509 BO OC BCS 0517 End line? 

OSOB A5 BE LDA BE 

o50D FO 23 BEQ 0532 Run mode? 


page 13 


RAMBLINGS ABOUT PITTMAN TINY BASIC by 
Lew Edwards 


Bought Tom Pittman's TINY BASIC, also his 
"“Experimenter's Kit". Perhaps you might be inter- 
ested in the following comments. 


Things "not in the book" or at least not too clear. 


Saving and loading basic programs using KIM 
cassette routines---Use the values in $0020 & $0021 
for SAL & SAH and use the values in $0024 & $0025 
for EAL & EAH when dumping to cassette. When load- 
ing the saved programs, transfer the values in 
S17ED & $I7EE to $0024 & $0025 and enter TINY via 
the "warm start", Of course before loading the 
tape, you should have previously done a "cold start" 
to initialize the basic pointers, etc. Expect your 
whole system to crash if you try to make program 
changes without setting 24 & 25 to the correct 
values. You can append a second program to the one 
in memory if the second program has line numbers 
higher than the first. I have written a line re- 
numbering program if anyone is interested. The 
second program is loaded in starting at the address 
in $0024 & $0025 minus four. Again, transfer values 
from $17ED & EE to $0024 & 25. I am using a tape 
loading subroutine callable as a USER function, 
which directly uses 24 & 25 as a pointer for stor- 
ing recovered data so that it is automatically set 
up as end pointer for user programs. 


HOW TINY STORES PROGRAMS: 

User programs start at the address stored in 
$0020 & $0021 and lines are stored exactly as en- 
tered from the keyboard. The line number is stored 
as two hex bytes, all the rest as ASCII, ending with 
the carriage return, OD(hex). All lines are stored 
in sequence as numbered, with TINY doing the edit- 





ing as each line ia entered (or deleted, or replaced), 


TINY stores a ZERO line number in the two bytes 
follwoing the CR in the last line of the program, 


When TINY responds to a CLEAR command, it puts the 
zero line number in the first two bytes of the user 


forth 


We're going to be hearing alot more about 
6502 FORTH. Looks like an ideal "hackers" lan- 
guage. 


That rumor I mentioned in #12 about there be- 
ing a FORTH User Group newsletter was true. I've 
received two issues of FORTH DIMENSIONS and they 
are quite informative. You won't believe how sinm- 
ple it is to make FORTH understand German. 


FORTH DIMENSIONS is available for $5.00/6 
issues from: Forth Interest Group, 787 Old County 
Rd., San Carlos, Ca 94070. 


I've been informed that the Decus Forth man- 
ual now costs $12.00. This manual provides the 
most implementation information I've found yet. 
Order manual 11-232 from DECUS, 126 Parker St., 
Maynard, Ma 01754. 


There seems to be a bit of controversy grow- 
ing over some of the versions of FORTH which are 
beginning to crop up. This controversy purportedly 
stems from the contention of the FORTH Interest 
Group that some of the languages which use the 
name "FORTH" don't implement all FORTH features. 


According to FIG, complete versions of FORTH 
should contain: 

1. indirect threaded code 

2. an inner and outer interpreter 

3. standard names for 40 major primitives 

4. words such as; CODE, BLOCK, DOES), 
(or 3:), which allow increased 
performance, 


FORTH is especially useful for real-time con- 
trol-type applications. Some of the programming 
examples I have seen indicate that programs tend 
to get very modular and structured because of the 
way FORTH operates, 


page 14 


Program space and initializes the pointers. If you 
Should accidently clear, say be using the "cold" 
start to re-enter basic, after having entered a 
Program; you can salvage the program by loading a 
value in the first byte of user memory equal (in 
hex) to the original line number of the first line. 
Of course, if the number is over 255, you'll have 
to put the high order value into the second byte. 
This will let you list and run the program, but if 
you want to make any changes, you'd better restore 
the pointer at 24 & 25, You can search through 
memory to find the right address using the follow- 
ing rules. First, line numbers are contained in 
the two bytes immediately following a carriage re- 
turn (ODhex). The last CR is followed by two zero 
value bytes. Add 5 to the address of the last CR 


Fe att atten 


and load the result into 24 & 25. 


MACHINE LANGUAGE SUBROUTINES: 

These can be used by calling a USER functions. 
If you want an ML subroutine to be included with 
your TB program, it can be “contained” within REM 
statements placed after the last line of your pro- 
gram. Make one or more REM statements using enough 
characters between the first REM and the last CR to 
accomodate your subroutine, The result will be 
garbage on a LIST, but that's immaterial. The ML 
subroutine can then be called by: X=USR(USR(S+20, 
36)+USR(S+20,37)*256-n) where X is the result re- 
turned from the subroutine in the A & Y registers, 
S is the starting address of TINY BASIC, and n is 
the number of bytes reserved for the machine lan- 


guage code +6. Ef the ML subroutine is to be called 
more than once, a variable may be set to the value 
within the opening and closing parentheses. Sec~ 
ond and third arguments may be included to pass 
parameters. The line renumber program I wrote in 

TB uses this technique to locate the line numbers. 

I had at first written it using only the TB built 

in USER routines for "peek" and "poke", but it ran 
too slowly to suit me. No, the renumber program 
does not renumber the goto's and the gosub's. 


ese CEH NEP 


KEEKKKEKEKKEEEE 


At the present time, there are at least 6 im- 
plementations of FORTH, or "forms" of FORTH on the 
6502. As for as I know, most of the 6502 FORTH 
implementations were done independently which in- 
dicates tremendous interest in this language from 
the 6502 fraternity. 


We'll be trying to keep up with this “FORTR" 
explosion and will report on these different inm- 
plementations when/if they become available, 


FORTH COMMENTS & EXAMPLE 





John P. Oliver 

P.O. Box 12248 
University Station 
Gainesville, Fl 32604 


I am currently running FORTH from Programma 
Consultants, 3400 Wilshire Blvd., LA, in my PET 
2001. I am convinced that FORTH is the ideal lan- 
guage for the hardware havker who needs to be able 
to program drivers for interfacing. FORTH 18 an 
interpreter, compiler, and assembler all at the 
same time. You can use a higher level language to 
do loops, blocks, arithmetic, and imbed assembler 
code or machine code at any point. Normal FORTH 
code runs about 50% of the speed of optimum ma-— 
chine code...much faster than BASIC. If FORTH 1s 
too slow in some time critical routine, simply 
imbed machine code. The following is an example 
of a FORTH program to point a telescope, select a 
blue filter, make a 20 second integration of the 
star brightness, store the result in the array DATA, 
and print the result: 


12 30 15 RA +72 36 12 DEC POINT BLUE FILTER 
20 SECS INTEGRATE DUP DATA ()©= PRINT 


I have routines in FORTH which access the PET in- 
ternal clock so that I can store the time and/or 
print it out etc. I expect to implement FORTH in 
my AIM-65 as soon as it arrives...I probably will 
not put FORTH in any of my KIM systems since it is 
not well adapted to the keypad and hex display of 
the KIM. 








KIM users who read a little german should be 
aware of the 65xx Micro Mag published by Raland 
Lohr, Hansdorfer Strasse 4, 2070 Ahrensburg, West 
Germany. The first two issuea have had a lot of 
very good systems software for KIM systems. Re- 
locatable loaders, fancy tape operating systems etc. 
The price appears to be DM 46 by surface mail to 
the US but Herr Lohr may also have an airmail rate 
for US. Amazingly, both issues have had discus- 
sions of the AIM-65 although I have not yet seen a 
discussion in a US hobby magazine. 





assemblers 


TWO PASS PATCH TO ARESCO ASSEMBLER 





John Eaton 
1126 N 2nd St. 
Vincennes, In 47591] 


Here is a patch to the ARESCO resident assemb- 
ler that will convert it into a two pass assembler. 
This change will give you source listings that 
contain all the program addresses (no**) and will 
even make the object code more efficient. The patch 
consists of the following code: 


257A 4C FO 30 
30FO Bl 52 AO 03 29 1F C9 10 
DO O1 88 AX O1 4C 7D 25 





MODS TO THE MICRO-SOFITWARE SPECIALISTS ASSEMBLER 


Richard M. Bender 
Box 276 RD 1 
Ebensburg, Pa 15931 





I am successfully using MSS's resident Assem- 
bler/Text Editor (ASM/TED). There is no compar- 
ison between this program and their previous re- 
lease as many of you may have experienced. Since 
I only have a TVT and no hard copy output I did 
have some difficulty in correcting errors in my 
source programs because of the lack of the ability 
to list single lines only. However with addition 
of the routines listed on the next page the ASM/ 
TED will now have this capability. One precaut- 
lon-~be sure to define the symbol table and text 
file sufficiently above the end of the ASM/TED 
program to allow room for the added routines. 


(listed in TED/ASM format) 


0100 ~OR 26F7 
0110 JSR NUMB 
0120 .OR 26AE 
0130 JMP REQT 
0200 : 


This will work in the version assembled at address 
$2000. You will have to change the absolute ad- 
dresses if you have the version at $EOOO. 


To use this patch you assemble a source pro- 
gram using the “A" command as normal. The printed 
listing you receive will probably contain several 
errors. That's all right since all the run did 
was to set up the symbol table. Now rerun the same 
program again starting the assembler at the warm 
start address of $2011. This time you will get a 
correct listing with no **'s, You may also notice 
that you can also use forward referencing with 
arithmetic operations which you can't do with the 
original assembler. 


The second pass through the assembler does not 
reset the error count or reenter any of the OPT's 
so if you want to disable the first printing and 
enable the secand one then you have to manually 
reset the flags that were set in page zero. 


Also, if you have the $2000 version of the 
assembler then change address $321A to 50 and 
$258D to 2D. That prevents the assembler from 


printing the line numbers as one plus their actual 
value, 


NOTES: This addition for the TED/ASM that is 
loaded from $2000 up. For ather locations you 
will have to change line numbers 0100, 0120, 0250, 
0270, 0300, 0320, 0460, 0470 and 0570 for proper 
relocation. 


I would recommend that lines 0100 thru 1030 be 
omitted until the assembly completes successfully, 
with no errors, then enter these four lines and 
reassemble. During assembly the object code is 
generated and LOADED into memory even though 
errors may be detected. Obviously an "R" command 
is not needed. Happy assemblying. 


area in TED/ASM to be changed 
extract desired line number 
another patch 

is current line the desired one? 


0210 ; ROUTINE EXTRACTS NUMBER FROM LINE REQUEST 


0220 : IN. LIST COMMANC 


0230 : (e.g. to list line 142, type LOQ142 and carriage rtn) 


0240 : 

0250 .OR 282D 
0260 NUMB LDY 01 
0270 JSR $245B 
0280 STA $0109 
0290 INY 

0300 JSR $245B 
0310 STA $0108 
0320 JMP $269F 
0400 : 


end of TED/ASM program 

get first two digits of line number 
convert to packed decimal form 

save in TED/ASM line buffer 

get pair of digits 

and do the same conversion 

-into line buffer also 

back to normal LIST command processing 


0410 : ROUTINE COMPARES CURRENT LINE WITH DESIRED LINE 


0420 : NUMBER AND IF THEY MATCH, 


0430 : 

0440 REQT LDA $0104 
0450 BNE HERE 
0460 PRNT JSR $27FA 
0470 JMP $26B1 
0480 HEKE LDY O00 

0490 LDA (LOCA),Y 
0500 LOCA .DL OOD5 
0510 CMP $0108 
0520 BNE NOPE no match 
0530 INY 

0540 LDA (LOCA),Y 
0550 CMP $0109 
0560 BEQ PRNT 


0570 NOPE JMP $26CF 


PRINT THIS LINE 


does a requested line number exist 
branch if yes 

no, print this line after a CR/LF 

to normal list operations 

lets match line numbers 

get current number from TED file 

TED file base address stored here 
against desired line number (2-digits) 


yes, check next 2-digits 


do they match too? 

yes, go CR/LF and print line 

no, go get another line in TED/ASM 
0589 PGEN .EN that's 


page 15 


i 


~ 0 S Q# 119 Hd 
> e/) =) 
z 1d a T# 114 = sd 
m ae D 
S 7 a ZH 1ta S 9G 
oo S| ie 

6d cH Lia ZG 


WE 


ond Viv 


ey PS pope , 


(S,22S9 VW OL) 7S) 


*pie0qg ZuUTyx1I0a 

B9q OF patytiaa pue usoys ve ATyDexXa dn JY{[tInq uxaq SYH AINA. dtyo anoj 

ay3 ‘fem ay Ag ‘inoy ue uey} ssaqtT ut dn paeoqg O/I [R}JAamod e pey pue pied 

ButdAjqojyoid gqyH ue uo sdtyo cay PeTTeysur Ayzuadsar J *azamod oO/{ 3eyI {Te 
pasu y,uop nod jt pie0g inodk uo s,77¢9 ANOZ [Le And of aay 3,uop nox 

ZUOTIUSAASQUT TOSsado0id ANY 3NOYIIA YIoOTS Buatuunr 

-38913 &@ a}ze1aUaZ ued dtyds sity} Jey. AMOUR NOK pIp---saiInjesy anbtun aio38H 671 

JO 9WOKG SZT[ TIN OF sMeIZOCId UOTJIeZTAeT{[mMeFZ ZZG9 amos SAPPY OST® [1,39m *939 

SIaATIp ABTA paqjiosse ‘1azTJTor,UODS DQy ue ‘andut q/y JTauueYyrs OT eB Se yous 
Sug{sap adsezraqut asainyny Jo YAPaY AYR WIOF [TIM pjzeog O/I 7ZZS9 STULL 


(jPeaput *dtys aTtaesisa y) °5339 Butyoqey, eyep andut ‘yauueys 

O/I [#t298 e f(Zutuunzr aaiz pue ‘joys-auo ‘ZutqQUuNOD. astnd se yons sapow 

Butzezado Jo AVBTACA & YITIM) SLAWTI [BAIIZUT YIQ QT OMY SUTEQUOD 7769 ayy 

‘“sauty, aye yspuBYy 4% pue Sjiod O/] TBUOTIISATIPIQ AIG B-Z2 SapIsag *‘Q7¢9 2Y3 
JO UOTSIBA padsURyUa Ue ST(Taqdepy adeziaqyoy a{TtTWesAaA) WIA 2269 FUL 


82619 AANHAY °D DIANA AM GCALHDIYAdOD ANV GENDISAA 


pieog 0/ "p 















Osh 


h# Lid 


G# 11a 


Q# LI 


/# Lt 


Sd Vive 











°pileoqg aue,Tdy2eq ACH Mau ay. pue 
(AZoToOuYyDa] SOK) v-WIWY 242 ut pa yerodiaosut 


st yotys snq utd yy ,prepuedis, 243 up 
ajeaado 03 paustsap uasaqg Sey parbog STY] 








J1907 LIdTIS J49Vd 
Q# LIg ssauddv 


6# Lia ssaudav 
OT# Lia ssauday 


IT# tla ssaudav 


7T# 11d ssaudav 
¢T# 11a ssaudav 
hI# 11a ssaudav 


CT# 118 ssaudav 


985TH | ep 


Age 





page 16 


*pajy2aTas St pieog 3x4} UsYyA 

AyTuo uayeq aq peau uvotjnes sty ‘asanod JQ *‘passardzse 9q [TH drys auo uey} 

aiow 30 amt, auc Aue je ysty aq dnoizd s31q-431q aya UT FuTT ssaippe auo ATUO 
JeYZ USHeT 3q YenwW vieDQ (ITZOT JIaTas aeed ayy Aq pautwmzajJap st xx) 


ATXX$S-OUXX$=d72769 AtXX$-O7XX$=97769 aAYXXS-OVXXS$=d7769 ABXX$-OB8XKX$=VZ7ZS9 
[8SMOT[O} SB passadoe aq TTIM 7769 Yr2ea ‘paingijuos sy 


-QuUvOg AHL ONISSAAaay 


qTS9 
JTS$3 
q{S) 
VIS) 





gS 
Su 
TSa 
OSY 
a 
Td 
At 
s( 
hd 
SO 
9d 
£0 


He 
sau 
Bul 
20 


GND 





AG+ 











CB 


OSU 


TSa 


CSu 


gS 





JTS) 


q{S) 


WISI 





hob 




















HOS ThZ 


Siu 


a 
— 


g# Lila ssaudav 


T# Lia ssaudav 


Z# Lid ssauddy 


¢# Lig ss3udav 


hH Lia ssaudav 


GH Lia ssauaav 


Qy LId ssauddv 


——< /# 11d ssauday 





Page 17 


page 18 





COMPONENT SIDE 


GROUND 

SYNCH 

RDY 

TRQ 

~16 Vv. UNREGULATED 
RST 

DATA BIT 7 

DATA BIT 6 


DATA BIT 5 1 O 
DATA BIT 4 11 


DATA BIT 3 12 
DATA BIT 2 13 
DATA BIT 1 14 
DATA BIT @ 15 
—«BDSEL *** (WC) AG 


+16 V. UNREGULATED 17 


OONOGAAND — 


” 18 | 
° mee oo 


+8 V, UNREGULATED 20 
+5 vy, *** (N/C) ? 1 


GROUND 99 


HERE IT 1S! THE 44 PIN STANDARD “KIM- 
BUS". THIS BUS DEFINITION IS APPLICABLE TO 
THE KIM-4 FRom MOS TECHNOLOGY AS WELL AS THE 
NEW BACKPLANE BOARD FROM HDE Inc, 


Pins 16. 2], and Y HAVE BEEN LEFT UN- 
COMMITTED ON ALL PRESENT KIM-4 BoarDs AS 
THESE SIGNALS (+5 anp BD SELECT) WERE USED 
ONLY WHEN A SINGLE BOARD WAS ADDED TO THE 
KIM-1 WITHOUT THE MOTHERBOARD. THESE PINS 
DO NEED TO BE DEFINED AS BUSABLE SIGNALS 
BEFORE SIGNAL INCOMPATIBLITY PROBLEMS ARISE 





N<x<xS<CHwvvuzerxXxcrnmooo> 


PINOUT 


WIRING SIDE 





GROUND 
ADDRESS BIT @ 
ADDRESS BIT 1 
ADDRESS BIT 2 
ADDRESS BIT 3 
ADDRESS BIT 4 
ADDRESS BIT 5 
ADDRESS BIT 6 
ADDRESS BIT 7 
ADDRESS BIT 8 
ADDRESS BIT 9 
ADDRESS BIT 18 
ADDRESS BIT 11 
ADDRESS BIT 12 
ADDRESS BIT 13 
ADDRESS BIT 14 
ADDRESS BIT 15 
@2 CLOCK 

RAW 

@2 crock 

$5 Vp OG) 


GROUND 


AS DID WITH THE S-l100 Bus. | FEEL THAT CLocK 
G1 SHOULD BE ADDED TO EASE THE PROBLEM OF 
ADDING DYNAMIC RAM TO THE SYSTEM AND PERHAPS 
THE REMAINING TWO SIGNALS COULD BE USED FoR 
SOME SORT OF INTERRUPT DAISY-CHAIN (LIKE ON 
THE PDP-8 or 11 Bus. THATS MY IDEA, 


ACCORDING TO souRCcES AT MOS TECHNOLOGY. 
A KEYWAY WILL BE INSTALLED BETWEEN PINS 18 
AND 19 TO ELIMINATE THE POSSIBILITY OF PLUG- 
GING BOARDS IN BACKWARDS. (GREAT IDEA}) 











VIDEO & GRAPHICS 


VIDEO DISPLAYS: ERIC 


STANDALONE vs MEMORY MAPPED 





It seems that there are a number of us who 
have purchased memory mapped video displays such 
as Polymorphics VTI-64 or Processor Tech's VDM 
boards for one reason or another and are quite 
shocked to find they need to write some software 
to get the thing to talk to KIM. This is unfor- 
tunate as it makes for a very frustrating time. 
Perhaps we should talk about what the KIM can & 
cannot do in the way of peripherals. And what is 
needed to hook up to a video display device. 


First of all, KIM is configured to communi- 
cate with a ASR-33 Teletype *™ which has a 20 ma 
loop and talks serially (which means that the data 
bits march down the wire one after another). Of 
course anything else that can fake KIM into think- 
ing it's a teletype will also work. This includes 
most standalone video terminals (such as made by 
Hazeltine and Lear~Siegler) and some other hard- 
copy terminals such as DECwriter etc. If it isn't 
serial and doesn't use a 20 ma loop - Forget it! 
You'll have to do sone converting to get your 
whatzit to talk to KIM. Oh yeah, your whatzit term- 
inal HAS to speak ASCII. 


A memory mapped video display, on the other 
hand, is a totally different animal! There's 
nothing parallel or serial about it. Except per- 
heaps the fact that its got a parallel address & 
data bus. To the computer, the video board looks 
like a block of memory - NOTHING MORE!! 


Some computers, such as PET, APPLE, and SOL, 
have programs built in to make these memory-mapped 
displays look like output devices - but the KIM 
DOES NOT! You would have to write programs to: 
clear the screen by initializing every screen lo- 
cation to an ASCII “space” character; form a cur- 
sor (usually a white square); and prudently place 
ASCII characters on the screen to make some sense; 
make sure the display does the proper thing in re- 
sponse to a carriage return; etc. 


Not an easy task for most beginners! 


And if you expect to be able to operate the 
KIM ROM monitor program from your memory-mapped 
display, FORGET IT!! There's no straightforward 
way to do it. You'd have to rewrite a completely 
new monitor program around your new display device. 


reece ate 


Sound like alot of trouble? Youre right! If 
you arent prepared (or able) to write a complete 
new monitor from scratch, or perhaps modify an 
existing monitor, such as XIM (Pyramid Data Systen, 
6 Terrace Ave, New Egypt, NJ 08533) to work with 
your display then I'd suggest you hold off this 
ambitious project at least until you can get some 
help. 


On the other hand, memory mapped video dis- 
plays are so much more versatile than serial dis- 
plays that the extra trouble to bring up this type 
of peripheral may be worth the extra trouble to 
you if you are at all talented in the software 
dept. Immediate access to any position in the dis- 
play area makes it possible to run real-time games 
such as Chase, animated LIFE generations, Break- 
out, Pong etc etc.- as well as performing double- 
duty as the more mundane video terminal style out- 
put device. 


Other possibilities for memory-mapped video 
include split screen displays where you effectively 
have two output devices. In a 64x16 video board, 
you could have two 64x8 scrolling displays each 
fully independent of the other. This could, of 
course, be extended to provide a number of such 
"windows" on your screen. Remember the cliche 
"you're only Limited by your imagination"? Well, 
it holds true here. 


If you're not into fun and games, then how 
about a fancy string edition (word processor) which 
could immediately display updated text as fast as 
you can modify it? 


I recently had an opportunity to play around 
with the "Electric Pencil" string editor (on an 
8080 system) and really enjoyed watching the text 
file open up right on the screen when new charac- 
ters were inserted and close up when characters 
were deleted. It must be seen to be appreciated. 


By now, it should be apparent that there are 
tradeoffs involved in any decision and this one's 
no different. It is hoped that by now, you'll have 
some idea of the pros and cons of each approach to 
video displays, and will be able to make an intel- 
ligent decision, 


nd rm 


video displays: RAMSEY ELECTRONICS Box 4072P, 
Rochester, NY 14610 716-271-6487 ( I've seen this 
64x16 display running and can recommend it)} OTTO 
ELECTRONICS P.O. Box 3066, Princeton, NJ 085405 
MICRO-~TERM INC P.O. Box 9387, St. Louis, Mo 63117 
314-645-3656 





a OARD 


COMMENTS ON THE. BOARD 
Lew Edwards 


“VISIBLE MEMORY'! VIDE‘ 
from 





I promised some comments on Hal Chamberlains 
“VISIBLE MEMORY" which I have running as a video 
display along with a parallel keyboard. The board 
(Micro Technology Unlimited K-1008) has worked 
perfectly since I first hooked it up back in April. 
The documentation is excellent as is the software 
for it from MTU. The VM board includes decoding 
to enable the KIM interrupt and reset vectors, s0 
you dont have to worry about that incase you want 
to add more memory. 


Had to wait about 5 weeks for the software, 
but that's no problem now. The software package 
is a beautiful job alao. The only drawback was 
that I had to program around the ROR instruction. 


Wrote a HEX dump routine that prints a page 
at a time on the screen and am using Steve Wozniak 
& Allen Baum's disassembler as published in Dr. 
Dobb's in Sept. ‘76. 


TVT-6 ADVENTURE 


Dennis Chaput 

Rockwell Hobby Computer Club 
12851 Olive St. 

Garden Grove, Ca 
714-892-2703 


I ordered my TVT-6 laat October and received 
it about ten days later. The assembly instruc- 
tions were a re-print of the article in "POPULAR 
ELECTRONICS", where I first read about the TVT-6. 
The unit went together OK. I mounted a 16 pin IC 
socket near C15 on the KIM-1 for the RAM connec- 
tions so that I could completely disconnect the 
KIM module, 


I loaded the 16 line by 32 character per line 
program and started the program, My old PENNY- 
CREST tube type TV came alive and locked-in with- 
out any adjustments. I have an RCA phono jack 
mounted on the rear cover with a slide switch to 
select TV or external input. 


Problem number 1. The right hand column of 
dots were missing on every character. I had to 
change C5 to a gmaller value. It took about three 
tcies before it worked right. Using an ASCII to 
HEX chart and the KIM keyboard, I could load any 
character I selected. Now I was ready for the 
cursor program. 


Problem number 2, I loaded the 16 by 32 
Full Performance Cursor Program and the IRQ in- 
terrupt vector address. With my ASCII keyboard 
connected, I was ready, but my system wasn't. No 
matter what I did, I could not interrupt KIM to 
get into the cursor program. After much time and 
in desperation I wrote a long letter to PAIA Elec- 
tronics explaining everything. I received a two 
line reply to enter the interrupt vector at 17FE- 
00 and 17FF-01. I had entered it at least 100 
times before, 


page 19 


I know very little about programming but can 
usually follow through one copied from "KUN" or 
"FIRST BOOK OF KIM", so back to the books. I ran 
across a code "CLI 58" Clear Interrupt Disable 
Bit. I hunted ali through the program but could 
not find one. I changed address 1780 NOP EA (two 
cycles) to 1780 CLI 58 (two cycles) and that fixed 
it. I've had no problems with IRQ interrupt since. 


Problem number 3. This one was much easier. 
The Erase to End of Screen (EOS) was dead, I 
changed the following address: O13E CMP C9 13 to 
013E CMP C9 12 and now it worked. This also made 
it agree with the chart at the top of the page. 
Also note that “SPARE HOOK" is also wrong. It 
should be: O13A CMP C9 13. 


Problem number 4, SCROLL UP would not work 
properly. It worked just enough to shew that it 
was close. It would give multiple cursors, repeat 
lines, modify characters and worst of all would 
"blow the program” very often, Change the follow- 
ing: 0184 LDA A9 01 to 0184 LDA A9 03, now it 
works OK. 


I imagine these problems would be obvious to 
most people but were very difficult for me. Maybe 
they will help another beginner. KEEP UP THE GOOD 
WORK. 

TVT-6 RAM EXPANSION, Michael Allen 
6025 Kimbark 
Chicago, Il 60637 





My article in User Notes #12 has prompted a 
number of inquiries regarding how I added S.D. 
Sales 4K memory board to KIM/TVT-6. The following 
description is how I did it. I stress the I be- 
cause I am not @ hardware expert. There may be a 
better way and I am unsure how to add more memory 
for addresses above 2000H. 


The S.D. Sales 4K board should be modified 
exactly as per the article in Kilobaud #4, KIM-1 
Memory Expansion, by: Bob Haas. -~ Except the — 
jumper between IC37 (pin 5) and 1C33 (pin 6) 
should be omitted. Instead connect a jumper from 
TVT-6 (pin 15) to 1¢37 (pin 5) and a jumper from 
TVT-6 (pin 16) to 1033 (pin 6). (Of course it is 
best to bring these connections to an unused pin 
on the RAM board edge connector to avoid direct 
jumpers. ) 


Then TVT-6 pins 7 through 14 (VD7-VDO) should 
be connected to each pin 12 of IC's 25 through 32 
on the RAM board. This is most easily accomplish- 
ed as tabulated below: 


TVT-6 Contact; 4K RAM PIN: 
(VD7) PIN 14 1043 

8 (VD6) PIN 12 I1C43 

9 (VDS) PIN 4 IC43 

10 (vD4) PIN 6 IC43 
11 (VD3) PIN 2 1043 
12 (vbD2) PIN 10 IC43 
13 (VD1) PIN 14 IC38B 
14 (VDO) PIN 12 IC3B 


All other connections between TVT~-6 and KIM 
should be as per TVT-6 instructions, including the 
removal of the ground connection to Application 
connector contact K (decode - enable). 


Fig. 1 is from Bob Haas‘ article: 
Cy ret & hed go set 
IL ad AZO SECTIONS: f ' ’ ' 


Te) is 
£80 aae , 
fivapn i aeaet teen Prema Bene w TON MP 


40°49 











} 
v7 


‘4 


poset ee) 


tT ete FE 











ran fo «ig 2a 
cs 





ae 





A vhrvnarace SRICET 32 
co i cs 


‘2 ub ee ve cctgy spain we. 





oe L. i “i Phra ibis 
a SECTIONS) 


ish [me £400 


(@ O72 ee 
- 

1 
et eee 


¥ . F ix ca oo : -- be iv 
eer = ee Se aa tS (Tia) 





NOTE 
(C  oIDENOTES Kim | Ce Pa SION si 
ADDRESS CONTE CYC Par HE tay tr ota) 
JUMPERS 


Page 20 


14 JOENOTES APPLICATION 
COMME tol Pin 


POLYMORPHICS VIDEO BOARD MODS ERIC 





VTI-64 owners! Now you can have your cake 
and eat it too! 


After using the Poly video board for a time 
it became obvious that for some applications it © } 
would be nice to have the facility for reverse % 
video in lieu of the graphics capability. As you 
know, the normal Poly board uses bit 7 to choose 
between alphanumerics and graphics, (The polarity 
of bit 7 is reversed from normal also, but we'll 
discuss that later). 





Fortunately, the solution to the problem was 
already at hand. It was in the form of a piece of 
documentation from the Solid State Music video 
board. This board uses a similar method of gen- 
erating graphics as the Poly card but also includ- 
ed the option to change from graphics mode to re-~ 
verse video mode by the flick of an on board 
switch. 


It then became a simple matter to transfer 
the mode switching logic over to the Poly board, 
and that's just what I did. 


Two traces on the board must be cut. One 
that goes from the data latch IC40 (74273) pin 19 
to the data multiplexess IC 33 & 36 pin 1 and the 
other one which runs from the shift register IC35 
(8274) pin 6 to the video output buffer IC 31 
(7407) pin 9. 


The circuit below is then connected to the 
Poly board (Rev F) 
connects to IC40 (74273) pin #19 
connects to 1035 (8274) pin #7 
connects to I1C35 (8274) pin #6 
connects to 1033 (74LS157) pin #1 
connects to IC31 (7407) pin #9 


MoO WwW Pp 


This mode also corrects Poly's design "acci- 


dent" of needing bit 7 set to "1" for normal ASCII 
and set to "0" for graphics. If you don't want to 
modify your board for the reverse video option but 
still want to have bit 7 act normally - no sweat. 
On the Rev F board there is a spare gate in U5 
(74LS132) that can be used to invert the signal 
coming from IC19 (74273) to 1€33 and 36 pin l, 
(Don't forget to cut the trace). 





Next issue will have a mod to adapt the Poly 
Video board to the KIM bus, It's not as easy as 
you might think, but, thanks to one of our readers, 
I now have the board running in my KIM-4 system. 





orci (aie ae ©) 
NY Is wo 
"te i 
ves fk a 
v u “ & 
n u 
3 8 eo 
Sa 9 yard 
* 28 
@ 


CLOSE FOR GRAPHICS MODE 





» 

O 

fe 4 

< 

a 

i a 
oe za 

3 

z 3 

rove é 
v oe™m™ P 
Yo 3 7 
2% 3 

53 § 

5>06—(«~éP 

2 3m 








debug 


SLOW STEPPER IV by Lew Edwards 
Slow stepper will automatically step through 
a program in the same manner as KIM's SST rou- 
tine. The stepping rate is under keyboard con- 
trol, and the program may be stopped at any point 
for examination and modification of registers, 
flags and memory data. Slow stepper is relocat- 
able if the NMI vector is re-directed to the new 
NEXT location by changing locations 0100 & 0105 
to the proper values. Slow stepper will fit into 
the RAM area starting at 1780 if the initializa- 
tion of 0100 to 0113 is performed manually or sep- 


arately, and the program is loaded starting at 
HALT, 


To use SLOW STEPPER, PB? (A-15 terminal) 





Also the current stack pointer is saved in its 
designated location. All of these stored values 
may be examined or changed via the monitor pro- 
gram using the KIM keyboard. Normally, when "GO" 
is pressed, the monitor will load the values in 
the storage registers into the 6502's registers 
and appropriate stack locations using the instruc- 
tions starting at 1DC8 (GOEXEC), jumping into the 
user program via the RTI instruction at 1DDA con- 
mencing at the location displayed on the address 
portion of KIM's display. If the SST switch is 
on, KIM's hardware will create an interrupt dur- 
ing the fetch of the first opcode after leaving 
the monitor progran. “This single instruction will 
be executed and with 1C00 as the NMI vector, con- 
trol is returned to the monitor program. KIM's 
hardware prevents interrupts from occuring while 
in the monitor program. To create a slow stepping 
routine, we must duplicate the SST action on a 
recurrent basis. Using the SST circuitry is not 
possible without hardware being added as the ex- 





must be jumpered to NMI (E- 6 terminal). To run isting hardware will interrupt every instruction 
SLOW STEPPER, enter the starting address 0100, not in the monitor, and there is no way to auto- 
press "GO", dievlay remains unchanged. Enter the matically return from the monitor. Our solution is 


starting pddvews of the program to be executed, 
press "ST" key and after a short delay the pro- 
gram will begin to run at the slowest speed. 
Pressing “AD” will stop execution and all the KIM 
monitor functions will be available. Pressing '0' 
will slow execution rate and pressing any other 
key (except "ST" & "RS") will speed up operation. 
"ST" will resume execution at whatever address is 
on the display, so be sure to hit "PC" to restore 
the program count to the display, first. Of 
course, you must be sure your program's use of 
memory does not conflict with SLOW STEPPER's 
(also timer use). Terminate your program with a 
BRK (00) instruction so it will stop when done. 


HOW IT WORKS 


When an interrupt occurs, the 6502 will com- 
plete the current instruction then save the pro- 
gram counter high byte, PC low byte and the pro- 
cessor status (flags) register on the stack in 
that order. The 6502 then jumps to the location 
specified by the interrupt vector and begins ex- 
ecuting instructions at that address. At the 
1C00 (SAVE) KIM monitor NMI entry point the moni- 
tor program will save all the processor registers 
in fixed zero page locations, including pulling 
and storing those that were pushed onto the stack. 


to use an interrupt vector pointing to a routine 
which duplicates the KIM monitor action in stor- 
ing registers, then waiting out a delay loop. 
Following this delay, a timer interrupt is set to 
go off immediately following the time interval it 
takes to jump to the monitor routine at 1DC8 
(GOEXEC) which restores the registers and then 
executes an RTI instruction. We set the timer for 
a 40 microsecond delay, which is exactly the cor- 
rect time for all of this to occur and create an 
interrupt on the next opcode fetch exactly as the 
SST hardware would do it. The instruction is ex- 
ecuted, the processor does its interrupt thing and 
jumps to 0119 (NEXT) in SLOW STEPPER which dupli- 
cates the KIM monitor "SAVE" procedures, complet~- 
ing the cycle. During the delay loop the program 
looks for an input from the keyboard, escaping to 
regular monitor functions in response to an "AD" 
key, slowing the step rate in response to a "Q" 
key or speeding up in response to any other key 
(except "ST" or "RS"), The rate of stepping is 
determined by the number of loops it takes to 
decrement "WAIT" to zero from the "SPEED" value, 
which varies from its initial value of FF (slow- 
est) to 01 (fastest). This value is changed by 
either dividing or multiplying by 2 in response to 
key entry. 





0100 AJ 19 START LDA #19 Set NMI vectors to halt address w 

0102 8D FA 17 STA NMIL bi 

0105 AQ O1 LDA #01 re) 

0107 8D FB 17 STA NMIH nd a a 

O10A A2 00 LDX #00 Initialize port to enable timer Pc e o 8 — 
010C 8E 03 17 STX PBDN interrupt * an ff 
010F 86 ED STX HOLD Start delay oS te Ss 8 
0111 CA DEX Sn ners Eee 
0112 86 EC STX SPEED Stepping speed count ae > as @ WE 
0114 C6 ED HALT DEC HOLD Negative is start/restart mode e és i ee jee ee 
0116 4c 16 1c JMP NOSAV To KIM without saving registers 2 c Sa oe aan eee = 
0119 2C 04 17 NEXT BIT RDCLK Timer interrupt, clear timer latch on @ FN Xd, had & 
011C 24 ED BIT HOLD Test for start or step mode S eos S ae eae 
O11E 10 06 BPL STEP Positive is step Sage cele ae ear a 
0120 68 68 68 PLA PLA PLA Negative is start, adfust stack Prone Be £ cd w Oo 
0123 38 SEC Ses easee § wou pone 
0124 BO 16 BCS NOSTEP Unconditional branch eux gars © te noos 
0126 85 F3 STEP STA .ACC Save all the reristers fust like Ae ee em ag aL 
0128 68 PLA KIM monitor Core fe ea: Ses. sae 
0129 85 Fl STA PREG go Bee ee nad a eae 
012B 68 PLA SH 8 SH heS fF De oo 
012C 85 EF STA PCL Beoataek c BS SoA 
012E 85 FA STA POINTI, mC" an 7 

0130 48 PLA 
J131 85 FO STA. CH a An aa 
0133 85 FB STA POINTH Hh Oe apa Snerd oxm 
0135 84 F4 STY YREG A AM CHOO<AZE wC 
0137 86 F5 STX XREG YQ De ee es 
0139 BA TSX MEM Ie A EO < 
eH 86 F2 STX SPUSER SAmaton4 hema aos 
013C A5 EC NOSTEP LDA SPEED Transfer value to counter for 

013E 85 EE STA WAIT controlling stepping rate . 

0140 A5 ED LDA HOLD Test mode = 

0142 10 07 BPL NODEC Skin delay if step oO Oo 

O144 20 19 1F XDELAY JSR SCAND Display and delay if start A 2 

0147 C6 ED DEC HOLD ae 
0149 DO F9 BNE XDELAY Wait out the count a a4 
014B D8 NODEC CLD Binary mode for keys OS: we HORROR BaAd- wos 
O14C 20 19 1F SPDLP JSR SCAND Display address & opcode HM CT OA hHARE NOOO 
O14F FO 19 BEQ NOKEY. No key, skin key routine INHTOAAHANDOCGCONO NMRAOH 
0151 20 6A 1F JSR JSR GETKEY Kev down HOMHZOOCNAOLEA AR aor 
0154 C9 10 CMP #10 AD key? AMOMCAMNnDAAONO NTH 
0156 FO BC BEQ HALT Yes, stop stepping & enter Monitor ee eee eee eek. 
0158 AA TAX For later test SSS Pee oes 2] SPO: Page et 


letters & comments 


John F. Cowan 
1150 Polk Ave. 


Dear Eric, Sunnyvale, Ca 94086 


I have been reading the KIM User Notea for 
some time now and enjoying them. Here are some 
ideas and comments which might be of interest to 
you and your readers. 


I purchased a 4K memory board from Solid State 
Sales in Cambridge, Ma and was very disappointed 
with it. 2 built it without sockets for the mem- 
ory chips, half of which later proved to be defec~ 
tive. I would discourage anyone from buying this 
board. If the board is purchased, sockets should 
definitly be used for all chips. 


I have purchased a 16K memory system, mother- 
board and KIM interface from Katherine Atwood Assoc. 
in Santa Ana, Ca and am very pleased with it. The 
4K memory boards are only $89, assembled, tested 
and guaranteed, a beautiful. idea. I have been run- 
Ning with the four boards for two months now and 
have yet to drop a bit. The motherboard kit costs 
$30, but is free if you buy four 4K boards. The 
KIM interface kit costs $24.50 and plugs right in 
to the KIM expansion connector. It allows memory 
addresses to be assigned at will and provides for 
memory protect. It is also a real bargain. I 
thought long and hard before purchasing this sys- 
tem rather than a KIMSI and I have not been dis- 
appointed. I am most happy with the fact that the 
system is compact (cards are 4%x7"), the bus is 
simple and straightforward and the system compon- 
ents are of industrial quality. Numerous other 
beards are uvailable, including 8K Prom, Prom 
burner, Analog in, Analog out and Digital out 
(64 lines using AMI 6820's for $56!). I highly 
recommend this system to all KIM users. 


Last, a few words about my activities. I 
have just Finished implementing a word processor 
system after interfacing a KIM to a Selectric I/0 
Writer; a tour de force lasting two and a hlf years. 
I have liked the KIM since day one. and grown to 
like that strange programmable beast, the 6502. 
This letter was written and edited with the word 
processor. If am considering making it available, 
perhaps via the 6502 Program Exchange. 


KKK KRERE 


RANDOM COMMENTS ABOUT KIM & SYM from- 


Bob Leedom 
14069 Stevens Valley Ct. 
Glenwood, Md. 21738 


Pet peeve -- Having to go through each line 
of a well-written, very useful "utility program" 
to determine where the program's variables are lo- 
cated in memory. lt has happened more than once 
that a utility program sneakily altered a location 
or two of a user program's variables. Moral - 
Document all memory used by a program! 


I was finaily able to play the ASTERUID game 
in First Book of KIM the other day! I circum- 
vented my bouncy keyboard (disastrous in ASTEROID!) 
with the super-cheap A/D in KUN #4 (p. 9) and a 
slide-type variable resistor, giving me a neat 
“spaceship controller". (My three little ones, 
aged 6, 4, and 4, are now veteran pilots.) But 
1 discavered an awful bug in the program as put- 
lished. Since only the ADL of the pointer is in- 
cremented at $2B), and since the asteroid field 
croésses a page boundary, there is a point at which 
the asteroids you're dodging are made up from the 

program code itself, and the field is impassable! 
In other words, the pointer is now pointing into 
the program, rather than at the stored field pat- 
tern. Easy fix (though to be honest, I haven't 
tried it -- I patched up the code) -- relocate the 
field entirely in page 3 and change 2CE and 2CF 

to point there. 


Dear fellow programmers, I will if you will: 
instead of referring to their location in memory. 
It makes your program much easier to read, dis- 
cuss, understand, modify, and/or relocate. JSR 
$Q1B2 drives me buggy: JSR DESPLAY makes me think 
I know what you're doing. 


page 22 


If. nobody else has mentioned it, I would like 
to say many thanks to Timothy Bennett for the in- 
dex to Volume 1 of KUN -~ I use it all the time, 
I hope that between Eric and Timothy, this will 
not be the last of the indexes (indices?)., 


Has anybody else had the unbelievably depres-~ 
sing j}0b of trying to help a friend with a SYM 
(formerly ViM)? A guy I know invested his bucks 
in the SYM, thinking he would get all the power 
of SUPERMON and the dual cassette outputs and the 
plug-in expansion memory, etc. plus the ability to 
use all the currently available KIM programs sim- 
ply by changing a few subroutine addresses accord- 
ing to the list in Appendix E of the SYM manual. 
Let me quote from paragraph E.2 of this manual: 
"Many of the routines do not perform identically 


in the two systems, however, and you should check 


their operat:on in Table 9-1 before using them." 


Folks, I'm here to tell you, it ain't all that 
simple. One little example: SYM's GETKEY returns 
ASCII code for the key depressed. That means ev- 
ery KIM program that uses a key from $6 to $F as 

an index or as a number has to have several extra 
lines of code patched in for SYM use so that the 
$30 can be stripped off of 30 through 39, and $36 
can be subtracted from the A through F keys. Don't 
get me wrong, the SYM-1 is a super little machine: 
but KIM compatibility is not straightforward. 


R. Bruce Harvey 
52 Spruce Drive 
Truro, N. S&S. 
Canada B2N 4X6 


COMMENTS ABOUT SYM 


"I bought my KIM-1 in August and have really 
been enjoying it since then. As I teach Physics 
in grade ll and 12 here and have had an electronics 
club in the school we decided this year to purchase 
ad micro computer for the electronics club. I de- 
cided to purchase the SYM-1 board and have it now. 
The advertisements were a bit deceptive to me and 
I thought that the KIM programs J] had prepared, 
mainly. from your notes were going to be easily mod- 
tified to work with the SYM. 


I have had no trouble in getting the programs 
to load and after altering them according to the 
conversion chart supplied with the SYM-1] manuals 
I still have not been able to get the programs to 
run. J realize that I am new at this, although I 
have been in amateur radio for a little over seven- 
teen years, and there are others who have probably 
not encountered my problems. 1 wonder if you would 
have any information that would help me to get 
these programs to run. [I had hoped that the pro- 
grams I have on tape could be used although it now 
seems that I will have to modify the written pro- 
grams before loading them into the SYM~-1] by hand. 
The information supplied with che SYM-] appears to 
be incomplete with regards to the use of KIM soft- 
ware, In particular the monitor does not seem to 
be operating. The clock program that was in the 
last issue of Micro is working well as well as are 
the varlous samples in the SY¥YM-l manual. Any in- 
formation you could provide me with would be very 
much appreciated." 


(EDITOR'S NOTE - I'm aware of the problems 
anvokved tn taying to convert KIM programs over 
to the SYM. At 444454 gkance, 4 seems that new 
scan noutines would have to be waitten to simu- 
Late KIM 1/0 on the SYM, but that's fuat my first 
observation (Aomewhat hurrced at that). Maybe one 
of our readers has already sgkved this problem. 
HOW ABOUT IT 77? HERE'S ANOTHER ARTICLE IDEA YEE!) 


ENVELOPE ARTWORK 
FROM DAVE HOLLE 














ale _ 








NPP OA 








[ ib Q22P 10 FI 
software library ies 
New RG Oa 
ae A231 19 9¢ 
Here's a useful addition to your software 0233 38 
Library. Now you don't need to spend $50 for that 0°%, A2 FD 
TI programmers calculator. Can you convert this 0236 A9 00 
to aun on a teamina£l ?77..... er 0738 FS DD 
_ 023A 95 DD 
MULTI-MODE ADDER 0230 £8 
Jim Butterfield 023N 20 F7 
Toronto 023F AS n2 
O?}:1 FO Ol 
This program adds and subtracts, in either decimal 0243 F8 
or hexadecimal... and will convert between the two O24 AO 17 
number systems. So if you hit keys DA (for set O26 06 DA 
Decimal), 123, AD (for set Hexadecimal), you'll O76 26 DR 
see the hex equivalent of 123 which is 7B. Hit O2hA 26 DC 
DA again and you're back to 123 decimal. O20 A? FD 
O2)E BS FC 
Negative numbers are held in complement form; s0 0250 75 Fc 
FFFFE9 is equal to minus 17 hexadecimal, or 999972 0252 95 FC 
would be minus 28 decimal. You can reverse the 025 £8 
sign On a number by hitting GO (for Clear) followed 0255 30 F7 
by PC (for subtract). 0257 88 
: . 0258 10 EC 
Meaning of the KIM keys is as follows: O25A AS D3 
GO = Clear ..set the total to 000000. oe a os 
AD = Hexadecimal mode .. convert display to 0261 10 9D 
Hexadecimal 9263 C9 1D 
DA = Decimal mode .. convert display to Decimal 0266 90 62 
PC = Subtract .. subtract last number entered 0267 C9 15 
from total 0269 FO 9% 
+ = Add .. add last number entered to total 026B Al, Tl 
0260 FO 71 
The Add and Subtract keys "chain" ..80 you can add O26F AS D2 
a number repeatedly if you wish .. or if you have 0271 FO 6h 
added an incorrect number in error, pressing Sub- 0273 AS FB 
tract (PC) will subtract it again. 0275 69 30 
: 0277 8&5 D3 
You should always begin by pressing GO (Clear) fol- 0279 10 05 
lowed by AD or Hexadecimal or DA for Decimal 0275 F8 
otherwise you won't know what wmode you're in. The 027C 20 3F 03 
Program does not warn of overflow, so be careful O27F D8 
if you're dealing with large numbers. 0289 AJ 00 
; 0282 A2 02 
All numbers are held in 24-bit binary in the com- O28) 95 D7 
puter .. they are translated to Hexadecimal or 0286 CA 
Decimal for the display. The program for trans- 0287 10 FB 
lating this is quite compact, and may be found at 0289 AO OS 
addresses 0243 to 0259, For converting Decimal q28R AY OO 
input to binary, a much longer program is located O28" 20 32 03 
at 0280 to 02C2. 0290 85 DE 
Example: a program starts at hex 0200 and goes to oe = 
0352. How many decimal locations does it occupy? 0297 RS D7 
GO (clear) AD (Hex) 0352 + 0200 PC (-); eee i 
display shows 0152; 029C 10 F9 
DA (Decimal); display shows 338 029E 20 LC 03 
1 + (since the numbers are inclusive); display 02A1 20 Le 03 
shows 339 locations. o2Al A2 FD 
O2A6 BS DA 
Note that the program uses Polish notation, i.e., O2A8 75 DD 
enter the number first, then the add or subtract Q2AA 95 DA 
code. : O2AC E68 
O2AD 30 F7 
The Clear (GO) key sets the total to 000000, and OPAF A2? FE 
transfers the previous total to the "chaining" 0281 AS D? 
register. Thus, you can restore the total by hit- 02E3 65 DE 
ting +, double the previous total by hitting + O2R5 8S D7 
twice, or complement the previous total by hitting 02B7 BS DA 
Subtract (PC). Q2B9 69 00 
0200 D& START CLD 02BB 95 DA 
0201 20 1F 1F JSR SCANDS - light display O2BD E8 
O20L 20 6A 1F JSR GETKEY O2EE 30 F? 
0207 cS DO CMe LAST same as last key? 02c0 8&8 
0209 FO F5 BEQ START yes, nothing . do 02C1 10 C8 
020B 85 DO STA LAST save new key ID 
020D C9 13 CMP #$13 GO=clear? oe - re 
O20F DO 52 BNE NOGO 0207 38 
0211 A2 02 LDX #2 02c8 A? FD 
0213 AO 00 Lny 40 —O2CA AY 00 
0215 BS Dl ML? LDA TOT,X move total to.. O2cc FS DA 
0217 95 D7 STA INC,X -.inmout area O2CE 95 DA 
0219 9 Dy STY TOT ,X and zero total 02D0 E8 
0218 CA DEX O2D1 30 F7 
021C 10 F? BPL MLP 02D3 10 OB 
O21E A900 HEXIC LMA 0 convert TOT (hex) to display ggns 99 11 
0220 85 Dl STA DISP displav-total flae 02D7 A2 02 
0222 A2 02 LOX #2 clear display... O2D9 BS F9 
022) Bh Dy DLP LDY TOT,X ~.and conv TOT to WORK O?2DB 95 D7 
0226 94 DA STY WORK,X O2DD CA 
0228 9 F9 STA INH zero display area O2DE: 10 F9 


vee ' P 


Wu? 


HEX OUT 
SWING 


HUFF 


BPL 


TOGO 


2077 


CL? 


NIG 


ILP 


ZL? 


FLAP 


NUML 
HEX IN 
HL? 


ney 

mr DL 
LMA TOT 42 
STA STAN 
PPT yp 
5% 

IDX 487) 
A #0 


SRC WORK+3,X 
STA WORK+3,X 


INX 
BMI WL? 
LOA MODE 
BEQ HEXOUT 
SED 

LOY #23 
ASL WORK 
ROL WCRK+1 
ROL WRRE+2 
LnX #8FD 
LMA 
ADC 
STA 
TNX 
PMI 
NEY 
RPI, 
LOA 
BPL 
JSR 


HUFF 


SWING 
STGN 
START 
FLIP 
START 
#810 
NUML 
As 
START 
DIS? 
OK 
MODE 
HEXIN 
POINTH 
#$30 
SIGN 
P07Z 


CMP 
ACS 
CMP 
BEC 
LDY 
BEQ 
LMA 
REQ 
LDA 
ADC 
STA 
EPL 
SED 
JSR FLIP 
#0 

#2 

INC, 


cL? 
LbDY #5 

LNA 40 
SeTn 
DIGIT 
ROLIN 
Inx 42 
TNC ,X 
VOR K .X 


ILP 
ROLIN 
ROLIN 
#$FD 
INC+3 ,X 


INC+3,X 


TL? 

4 FE 
INC 
DIGIT 
INC 

INC +3,X 
#0 
INC+3,X 


BMI 
NX 
LDA 
Ane 
STA 
LDA 
ADC 
STA 
INX 
BMI ZL? 
DEY 
BPL DIG 
LDA SIGN 
PPL. Ox 
SEC 
LDX #$FD 
LDA #0 
SBC 
STA 
INK 
BMI FLAP 
BPL OK 
BCC NUM 
LOX #2 
LDA INH,X 
STA INC, 
DEX 


3PL: HL? 


>OINTH+1,% 
>OTNTH+1,X 
POINTH+1,X 


WORK+3 ,X 


INC+3 ,X 
INC+3,X 


test sipn 


invert WORK 
-.3 Gifits 


hex display 
decimal. display 
2 bits to translate 


get most significant bit 
»-into carry 


Operation or Numeric? 

No key? 

already converted input? 

hex mode imut? 

decimal sign test 

positive number entered? 
invert negative input 

Dec-Hex conversion starts here 


Clear Hex innut area 


Six decimal digits to come 
Get highest dizit 


Multiply INC by two... 
.-and copy.. 

-»INCx2 into.. 

ORK; 


Multiply INC by four, 
eeGiving INCx8 
«then add INCx2 from WORK 


giving. . 
«+ INCx10 


Now add the new digit.. 
»»to INCx10 


» -propogating anv carrv 
»-into the higher digits 


on to next decimal digit 
~eif any 


STGN OK? 


no, re-invert 


Hex innut: 
copy to INC 


page 23 


O2EO A2 FD OK LX ASFD 


O2E2 AS DO LDA LAST 

O2E 29 OF AND #0F 

O2E6 C9 02 CMP #2 AD (Hex) or TA (Nec) key? 
O2E8 BO 10 RCS ACT mo .. must be PO or + 
O2RA 85 D2 STA MODE set mode to ‘lex or Nec 
O2EC AS Dl LMA DIS® total or entry? 

O2FE FO 07 ja mo OD total, do nothing 
O2FO BS NA TGP LDA INC+2,¥ entry, move to +otal 
O2F2 95 N7 STA TOT+2,X 

Nor =8 INX 

O2F5 30 F9 RMI TL? 

O2F7 hc 1E O02 EXIT JM! HEXDC 

O2FA NO OC AGP PN= NAN not + .. must he P> f/f.) 
O2Fc 18 CLe 

O2FD BS D7 Al, IDA TOT+3,X 

O2FF 75 DA ADC INC+3,¥ add (binary) 

0301 9 D7 STA TOT+3,X 

0303 EB INX 

030, 30 F7 BMI AL? 

0306 10 EF BPL EXiIt 

0306 c9 Oh NADD cM? #h 

0304 DO EB BNE. SXIT 

030C 38 SEC 

0300 BS D7? =6SLP ODA TOr+2,X 

O30F FS DA SBC INC+3,X subtract (binarv) 
0311 95 D7 STA TOT+3,X 

0212 E8 INX 

O31h 30 F7 BMI SL? 

0316 10 DF Bel EXIT 

0318 Al) Dl NUM LDY PISP first digit? 

O31A DO OA BNE ROLL no, shift it in 

C31lc 8 FA STY POINTL - zero into disnlav.. 
O31E 8) FB STY POINTH .-excent.. 

0320 85 F9 STA INH » new dipit 

0322 C6 Dl De Doe 

932 30 99 RT OUT unconfitional exit 
0326 20 32:03 ROLL JSR G®tTn make snace for new digit 
0329 AS DO LNA LAST -eand insert. it 

O32P Of F9 OFA TNH 

032D 85 FO STA INR 


O32F WC 00 02 OUT JUMP START 
3 subroutines 

0332 A2 03 GETD LDX #3 

0334 06 F9 GLP ASL INE 


move four bits 
through display 


0336 26 FA ROL POINTL 
0338 26 FB ROL POINTH 
O33A 2A ROL A 
033B CA DEX 
033C 10 & BPL GL? 
033E 60 RTS 

3 
033F 38 FLIP SEC complement, 
0340 A2 FD Lox ABFD the 
0342 A9 00 FLP LDA #0 contents 
O3hh FS FC SBC POINTH+1,xX of 
0346 95 Fc STA POINTH+1,X the 
0348 E6 TNX ad display 
0349 30 F? BMI FLP area 
O34B 60 RTS 

5 
0345 06 D7? = ROLIN ASL TNC maultioly 
AWE 26 DE ROT, INC+1 TN 
0350 26 n9 ROL INC+? bv 
0352 60 RTS e 
9203 and 


A PSEUDORANDOM NUMBER GENERATOR 


H. T. Gordon 
641 Paloma Avenue 
Oakland, Ca 94610 


This is the 6502 code of my 8080-coded pro- 
gram that will be published in BYTE. I am copy- 
righting the 6502 version with this "free-diffu- 
sion" clause: Any and all uses are authorized if 
(and only if) all software associated with the 
whole or any part of the following coding is de- 
clared to be equally available for unrestricted 
use by everyone. 


Subroutine MIXRND will generate 65K binary 
8-bit numbers before repeating. It uses 3 zero- 
page locations (in this case Cl, C2, and C3, but 
any other locations will do and they need not be 
in sequence), that need no initialization. The 
subroutine is fully relocatable. 

0110 E6 C3 MIXRND INC RND+2 (one of 256 se- 
quences) 
BNE SEQUEN (same sequence) 
ENC RND+1 (increment addend) 


12 DO 02 
14 E6 C2 


page 24 


0116 A5 C€l SEQUEN LDA RND (load seed) 


18 OA ASL A (X 2) 

19 OA ASL A (X 4) 

1A 18 CLC 

1B 65 Cl ADC RND (xX 5) 

1D 18 CLC 

l1E 69 28 ADC #$2B (add for next hs 
seed, S6B, SAB, @) 
or SEB also work) ae 

0120 85 Cl STA RND (store next seed) 

22 18 CLC 

23 65 C2 ADC RND+1 (add sequence ad- 
dend) 

25 24 Cl BIT RND (seed bit 7=N, bit 
6=V) 

27 30 03 BMI TESTV (N=1) 

29 50 05 BVC EXIT (V=0) 

2B B8 CLV (reset V) 

2€ 70 02 TESTV BVS EXIT (bypass comple- 
menting) 

2E 49 FF EOR #SFF (complement output 
in A} 

0130 60 EXIT RTS (pseudorandom # is 

in A) 


Subroutine SELBIT can be used to screen the 
MIXRND output and yield sequences of non~binary 
numbers. E.g., if RND+3 is pre-set to $A0O and 
RND+4 to $OA, SELBIT will exit with the carry 
clear if MIXRND has output one of the 100 BCD 
numbers from 00 to 99. If the carry is set, MIX- 
RND can be repeatedly called until it outputs a 
BCD. 


0131 c5 c4 SELBIT CMP RND+3 (compare hi nyb- 


ble) 
33. BO 06 BCS SELOUT(reject or =) 
35 48 PHA (save # in stack) 
36 25 OF AND #SOF (retain lo nybble) 
38 ¢5 ¢5 CMP RND+4& (compare) 
3A 668 PLA (restore # in A) 
013B 60 RTS (accept if carry 


clear) 


By using $DO and $0D, one would get a pair 
of "tridecimal" numbers to simulate playing cards. 
The "suit" could be established by using the 2 
low-order bits of the output for the high-nybble 
card, and of RND for the low-nybble card, with 
additional logic to eliminate duplications. 





ASCII DUMP PROGRAM 


Jim Zuber 
20224 Cohasset #16 
Canoga Park, Ca 91306 


This program is written for the KIM-1 to 
SWTPC PR-40 printer interface I described in issue 
#11 of the User Notes. This program will dump 
ASCII data from memory, decoding carriage returns 
(HEX OD) and a special end of data character that 
can be defined by the user. I am using this pro- 
gram to print mailing lists and have used this 
program as a subroutine in larger programs. (Just 
change location O0DO0 to 60) 


To use the program jsut do the following: 


t. Store the starting address of the 
ASCII data in OOOA and OOOB (low 
order first) 


2. Set the last character in the ASCII 
string to "@" (HEX 40)---Note:if you 
. Want to use a different character 
for the end of data marker set lo- 
cation OO8F to the HEX equivalent of 
the ASCII character you want to use. 


3. Start the program at 0080 and you 
will get an ASCII dump. 


emis kc aed aaa 


0080 A9 FF 8D 01 17 AX O01 8D 03 17 AD 
0OO8B OO Bi OA C9 40 FO 3E C9 OD FO IF 
0096 8D 00 17 AX O1 8D 02 17 CE O02 17 
OOAl EE 02 17 18 A5 OA 69 O1 85 OA A5 
OOAC OB 69 00 85 OB AX OO FO D7 AY OD 
OOB7 8D 00 17 A9 O1 8D 02 17 CE O02 17 
O00C2 EE 02 17 AD O02 17 29 02 FO FO AY 
OOCcD OO FO D& 4C 4F 1C 





MELODIES FOR THE MUSIC BOX 


KEYBOARD DEBOUNCE ROUTINE 





Thomas J. Rubens 125 Stratton Rd. 
851 California St. New Rochelle, N.Y. 10804 
San Francisco, Ca 94108 Everyone who owns a KIM should also own The 


First Book of KIM. If they don't, they should get 
one, 1t's worth it. On page 88 of the book you 











The following code performs seeming miracles will find Jim Butterfield's Music Box program, 
on nolsy keyboards. The standard implementation Load it. Mr. Butterfield wrote this program real 
of the KIM-1 monitor code wrongly assumes that well but he didn't include enough music for us 
inexpensive keyboards are not inherently noisy. music buffs! So hoad the following into KIM and 
ne! st you should get 1. Pop Goes the Weasel 2. Happy 
The code wee np i re? by Allen Anway's Pro-~ Birthday 3. London Bridges Falling Down 4. Ten 
ram Branch from "Notes 9 & 10. Little Indians and 5. a short version of the Ma- 
. . rine Hymn. The second hex dump is a more jazzed 
CTR 16 any convenient page zero address. up version of the Marine's Battle Hymn I'm sure 
you'll enjoy it. 
AQ 05 SCNO LDY #05 Set up safety net 
84 EE STY CTR s ; 
: 0020 2F A9 CO 80 80 80 FB 22 FC 02 FD 01 FE 56 56 CD 
C6 EE DEC CTR Make sure it 
' 0030 D6 CO @8 56 56 CD D6 DI CO 56 56 AI B2 CO E8 CD 
DO F? BNE SCNl Wasn't noise 0040 2F 2 2 0 80 80 80 
20 19 1F | SCN2._ JSR SCAND New key pressed? fae ee OU Be Oe ae ee 2) re oe ye ene vere 








eo FE BEQ SCNI” No 0050 FF SD 32 AF 39 32 AF 39 32 2F 29 AF B9 2F 29 2F 
aka ae JSR. SCAND: Yeo = check aveda 0060 32 39 32 AF 40 39 B2 39 32 AF 2F 29 2F 32 39 32 
are me Sircrcr mae 0070 AF CO AF 39 C8 00 80 80 80 80 80 80 80 80 FB 20 
pO) Bk AG ISR GETKEY Yeo-get key immage 0080 FC 02 FD 01 FE FF C8 48 48 C8 48 48 B9 2F 2F 39 


0090 40 C8 CO 40 40 CO 40 40 CD 40 40 4D 56 E2 CB 48 
OOAO 48 C8 48°48 B9 2F 39 4D C8 AF 32 32 39 39 CO C8 
STAR WARS BATTLE 0080 80 80 80 80 FB 30 FC 02 FD 03 FE FF 62 48 CO CO 
Sara pee 00CO CO CO CU 2F CO 4D 48 CO CO 48 D6 E2 E2 62 48 CO 


a Tuber 00D0 cO c0 CO CO 2F CO 4D 48 CO CO 48 D6 E2 E2 FF 00 


20224 Cohasset #16 
Canoga Park, Ca 91306 
Jazzed Up Marine's Hymn 
Want some wild sound effects for your KIM? 
I have combined Ron Kushniers space wars phaser 
sound program with Jim Butterfield's random num- 
ber generation to create sound effects from an en- 
tire battle scene out of Star Wars!! Interesting 
variations can be obtained by changing the mask 
byte for the random number. Location 0247 con- 
trols the number of repeats and 0254 controls the 
time of the phaser pulse. The program starts at 
0241 and the sound output is at PA-0O. 


0000 FB 30 FC 02 FD 03 FE FE 62 48 CO CO cO CO CO 2F 
0010 Cv 4D 48 CO CU 48 D6 E2 E2 62 48 CO CU CO CO CO 
0020 2F CO 4D D6 CU CO 48 D6 62 62 AF 32 B9 CB BI AE 
0030 CU 4D CO DF 32 B9 C8 39 AF CO 62 4D cO cO CO CO 
0040 cO 2F CO 4D 98 CO CO 40 AB AF 80 80 80 80 80 FF 
0050 OO. 


"DO LOOPS" FOR KIM 


Dave Skillman 








0200 AO 03 AJ 00 85 BE AQ 11 8D 06 17 9514 48th Ave. 
020B A9 01 8D 01 17 EE 00 17 A6 EE CA College Park, Md. 
0216 DO FD 2C 07 17 10 F3 E6 EE A5 EE 
0221 C9 FF FO 02 DO DF 88 FO 02 DO DA There is often a need to repeat a section of 
022C 60 D8 38 A5 13 65 16 65 17 85 12 code a given number of times. The following in- 
0237 A2 0& B5 12 95 13 CA 10 PY 60 20 structions show one way to perform the "do loop" 
0242 2D 02 A5 12 29 03 8D 01 O02 EF O01 function by executing a block of code N times. 
O24D 02 20 2D 02 A5 12 29 13 8D 07 02 
0258 EE 07 02 20 00 02 4C 41 02 LDA #00 load zero 
STA I ready do loop variable 
LOOP INC I increment loop variable 
LDA N get loop iteration limit 
SOUND EFFECTS PROGRAM CMP I compare to present value 
| BCC OUT branch away if I is greater 
Bob Carlson WA6QXX than N 


Block of instructions 


= : , 7 
I have been using KIM’S cassette audio out bu be exernead N £imee 


put port (SBD at $1742) for outputting music and 
modern programs. No external hardware aside from 

@ cassette player and an earphone or speaker are 
required, Simply plug the earphone or speaker into 
the monitor jack and push down the record button 
and high fidelity output will result. On my cas- 
sette player the tape doesn't even have to be mov- 
ing. I think this is the simplest interface for 
audio experimenting yet. 


JIMP LOOP loop back until done 
OUT BRK stop if job is done 


In complex programming situations it is often 
clarifying to code in a high level language first, 
and to translate that to assembly code as a second 
step. 





I came up with the following program which 
makes quite an interesting noise - similar to a 
police siren aor an alarm, using the above men- 
tioned output method. 


MORE ENVELOPE ART 





from T. Mc Fadden 





0100 A2 FF START LDX #S$FF Send 1's to 

0102 8E 42 17? STX SBD Output Port 

0105 A6é 00 LDX #$00 Load Freq Parameter 

0107 CA LOOP1 DEX Wait Loop For 

0108 DO FD BNE LOOP1 Waveform High Time 

Q10A A2 00 LDX #$00 Send 0's To 

010C 8E 42 1? STX SBD Output Port 

Ol1O0F A6é 00 LDX #$00 Load Freq Parameter 

0111 CA LOOP2 DEX Wait Loop For 

0112 DO FD BNE Waveform Low Time 

0114 Cé O00 DEC DEC Freq Once Each 
Loop 

@116 4c 00 Ol JMP. Start 





interface — 
CAMERA SPEED TESTER Toma oe aes 


Dallas, Tx 75214 


While it would probably not be a terrific 
idea to buy a KIM-1 just for use of the display, 
some projects can be carried out for a lot less 
money once you own one. 


A good example is the camera speed tester 
that eppeared in Popular Electronica. When you 
own a KIM-1, construction of this device is so 
triviel that it can be an instant breeze. You 
can do all the timing in software and not kuild 
the display, using KIM for that. 


The only piece of hardware you have to have 
is the photocell and a guarantee that the input 
will be logically on orf off. This can be done 
with a photo transiaster and a 7414 Schmidt trigger 
invertor. I bought a small photo transister from 
Radio Shack (276-130), wired a 330 obm resister in 
line, put glue on the leads for insulation and, 
after reaming out the hole a bit, slid it into the 
back end of an empty Bic pen. I used some black 
ink to darken the plastic. This is my general 
purpose phototransister tester. For the camera 
tester, I drilled a hole in a piece of wood the 
right size to take the pen and to fit where the 
film goes on the back of the camera. The circuit 
below shows the 7414 in use, the output simply 
being taken to one of the porte on KIM. 


Basically the programming consists of loading 
the timer when the shutter is openned and getting 
a value when the shutter closes. Because it is a 
countdown timer, the recovered value must be sub- 
tracted from the original. The program shown here 
will (in theory) measure from 1/1000 to & second. 
It outputs a hexadecimal value. Additions program 
(which I don't care to do, since I don't care 
aobut my camera speed that much) would go for spe- 
cific accuracy and conversion to decimal, 

After you have positioned the camera, with 
the photocell replacing the film, under a fairly 
bright light, push the GO button. The program 
sits in a loop, waiting for a change in the input 
value. Using bit 7 of the input port, as soon as 
the light hits the transister, we load the time 
and go into a new loop. When the light goes out, 
we unload the timer, subtract, store in F9 and 
loop through SCANDS., Hitting the reset button 
will automatically place you at the start of the 
program again. If the display does not come on, 
test the photocell by covering with your finger; 
it may not be getting enough light to switch. 
(Note that it is much more sensitive to incandes- 
cent than floreacent.) 


LDX FF 
A LDA PORT 
BPL A LOOP UNTIL MSBIT=1/NEGATIVE 
STX TIMERX1024 (SHUTTER OPEN) 
B LDA PORT 


BMI B LOOP UNTIL MSBIT=0 

LDA TIME (SHUTTER CLOSED) 
STAZ F9 TEMPORARY STORE 

TXA 


SBCZ F9 SUBTRACT END VALUE FROM START 
STAZ F9 
C JSR SCANDS LOOP IN DISPLAY 






CLC 
BCC C 
+$ 
7 B17 7 
MSB 
nw 1914 Sexmirr- 
A” TRIGGER 
TRANSISTOR. 
page 26 


LOW COST MODEM POSSIB 


usually | 
Modems aregexpensive, not readily available, 


and could be a real pain to get functioning cor- 





ERIC 





What we 6502 users need is a software approach 
to this problem instead of hardware methods. "Do- 
ing it in software" makes much more sense for hob- 
byists who have more time than money and want to 
learn the ins-and-outs of computing. 


Well, thanks to some TRS-80 users who seem to 
share our views on the software approach, we now 
have that alternative. 


It's the "MICKEY MODEM" and was published in 
the November '78 issue of Kilobaud (peg. 52). 


The "MICKEY MODEM" consists of only two I,C. 
amplifiers, a VU meter, and a telephone line iso- 
lation transformer. (Not to mention some assorted 
resistors, capacitors, switches etc). 


This low-cost circuit contains none of the 
usual modem thingamajigs such as frequency gener- 
ators, receiving filters, originate-answer mode 
switching etc., but interfaces directly to the 
phone line (instead of the usual acoustic coupling) 
and relies on the computer to generate the proper 
tones to transmit and decode the tones when re- 
ceiving. The utmost in simplicity. 


The only addition I would make would be a 
achmitt-trigger or comparator on the output of the 
interface to clean up the waveform and make it 
easier to decode. 


The driving software is completely open at 
this point. Initially I am looking at the Kansas 
City format (1200 Hz / 2400 Hz tones, 300 baud) 
since it is fairly straight forward to encode and 
decode and the high tone is well within the tele- 
phones 3000 Hz upper limit. 


Perhaps I'll have one of these in operation 
by the next issue. Any comments and/or ideas 
would be greatly appreciated, Let's hear what you 
think of this idea. 





RPN CALCULATOR CHIP INTERFACE ERIC 





Another interface design for the National 
MM57109 has been published, this time in Byte 
Magazine, August '78 (pg. 64). 


This interface looks like a perfect match to 
a 6520 or 6522 1/0 chip. 


The software driver presented was for the 
8080. 


I will be installing one of these calc chips 
on my 6522 1/0 board (see elsewhere in this issue) 
using this interface. 


This calculator interface would make an excel- 
lent addition to Tiny Basic or Focal since they 
do not have built in trig functions. 


Anyone up for the job??? 


POWER-ON_ RESET 





George W. Hawkins, NY 


A very simple power-on reset can be added to 
KIM by connecting a .68uf tantalum capacitor be- 
tween the bottom end of resistor R& (+), and the 
bottom end of resistor R13 (-). This was the 
smallest value that would work for me. The capac- 
itor is connected across the RS key when connected 
as described above. See page B-l to find the re- 
Bistors, which are to the left of the keyboard. 





i Donia oy gees eS 











ERIC 





When connecting KIM to outside world systems 
that have their own power supplies - it makes 
good sense to isolate the two systems and avoid 
ground loops and other problems. I have been us- 
ing a MONSANTO MCT-2 optoisolator to perform this 
task but other opto-isolators may work as well, 


3 Sea 


(6) nfe ALTK 


TO tN PuT 
PORT 





4 
(Oe fn (2) 
im 


KIM 
GROUND 


MoT] 








+V can be any reasonable positive dc voltage with 
R adjusted to allow about 20 ma (no more than 50 
ma) through the diode when its cathode is grounded. 


An open-collector transistor is a convenient 
device to trigger the LED. 







T@ 
ct 
ee 








, 
Paira 
serow 


as 


Pe 


SEPARATE 
K__ @Rounps 


Sree all 


This circuit has been used to successfully 
interface an active-filter RTTY (Radio Teletype) 
demodulator to KIM. The demodulator has an open- 
collector transistor output to connect to a 5- 
level teletype with a 60 ma. loop so hooking it to 
the opto-isolator was a breeze. 


The circuit may also be used in the output 
mode but an open-collector gate should be used to 
drive the opto-isolator since the KIM output port 
can't sink the required 20 ma. 


FeomM Kim 






TO OVTsidEe 
SNSTEM 





OCOPEN- Contecror 


As yOu can see, opto-isolators are simple to 
use and handy to have around, 


Next issue, we'll discuss the 555 IC timer 
and see how we can put it to work. 


MORE ON THE OPTO-ISOLATOR 





Dwight D., Egbert 
302 W. 109, #4 
NYC, NY 10025 


The following KIM-1 TTY to R§&232 converter 
circuit has proven to be very reliable, small, and 
easy to make. I have used it and KIM-1 with a 
DecWriter LA-36 (110 & 300 baud), a Tektronix 4012 
(110 through 2400 baud), and a Processor Technology 
3P+S 1/0 board (110 & 300 baud). The 3P+S uses the 
MC1488 and MC1489 RS232 interface IC's which are 
cammon to many devices. This converter should work 
with any RS232 device you have. 


KiIM-! 





A-S 


~“iZv 


NOTES: 

1. If you do not have +/- 12 volts on your KIM-1 | 
then your RS$232 device should have +/- voltage 
available. I would expect this circuit to operate 
properly with anything from about +/- 5 to +/- 15 
volts although you might have to adjust R2 and R3, 


2. I have not tried the following but it should 
work if you only have +5 and +12 volts and if your 
KIM-1l ground is not tied to the AC line voltage 
ground. IF YOU TRY THIS BE CAUTIOUS! Connect +12 
volts as shown. Connect +5 volts to the RS232 
ground (pin #7). Connect KIM=1 ground to the 
point shown for RS232 -12 volts. This makes the 
RS$232 output work at +7 and -5 volts relative. 


3. Alternatively, circuits are given in the two 
following references for conversion circuits which 
operate from only +5 volts. I have not tried them 
and don't know how reliable they are. With only 
+5 volts they cannot meet RS232 specs. even though 
they might work with some devices. 


BYTE, May 1076, "A DAte With KIM", page 10 
EDN, June 5, 1977, “Constructing A Low-Cost 
Terminal Interface", page 205 


4. Even though I used Monsanto MCT2 opto-isolators 
the following all have similar specs, and should 
work equally well; MCT12, MCT26@, MCT6 dual, 4N25, 
4N26, 4N27, 4N28, 4N35, and 4N37. Also, Darling- 
ton types like MCA230, MCA231, MCA255, 4N29, 4N30, 
4N31, 4N32, and 4N33 will work just fine. Radio- 
Shack offers a grab-bag of opto-~isolators and In- 
ternational Electronics Unlimited advertises MCT2's 
for 70¢ in June 1977 RADTO ELECTRONICS. I have 
recently become a fan of opto-isolators and recom- 
mend you experiment with them. They are great for 
practically any computer related conversion in- 
cluding AC switching when used with SCR'S, 


5. RS232 pin assignments as shown are proper if 
you want to plug KIM-1 directly into a terminal. 
Alternatively, if you want to plug KIM-1 into a 

modem you should reverse the connections to pins 


2 and 3. page 27 


new products 





Forethought Products (87070 Dukhobar Rd., 
Eugene, Or 97402) has announced immediate avail- 
ability of the 6502 Video Driver Routine (VDR). 
This software provides the necessary software 
Support for 64x16 random access video display 
boards (such as Polymorphics VTI, Kent Moore, 
Solid State Music etc) on systems using the 6502 
CPU. 


According to the literature, this software 
allows for complete cursor control, scrolling 
speed, line & page control, printer control and 
"“partitioning”" of the screen into protected areas, 


The package includes a 12 page manual with 
full source listing, and KIM compatible cassette. 
Two versions are available - one residing at $0200 
and the other at $DD00. Both are ROMable and oc- 
cupy %K of memory. Price is $9.50. For more in- 
fo, contact Forethovught, 





Synertek Systems announced a drop in price on 
their CP110 Super Jolt CPU boards from $375 to 
$195, 


This 4.5"x7" board contains a 6502, 1K RAM, 
a 6530 (which contains the ROM monitor, a timer 
and 1/0) and a Xtal clock. The monitor program ig 
identical to TIM (from MOS). Communication is 
handled through a serial port. 


Get more info from Synertek Systems, 150 §. 
Wolfe Rd., Sunnyvale, Ca 94086, phone 408-988-5682 


INTELLIGENT EPROM PROGRAMMERS 
FOR THE KIM-1 
(INCLUDES HARDWARE & SOFTWARE) 


EP-2A-K-01 Programs 2708 & 2716 EPROMS, 
QuaLITy IC, BURN-IN PROGRAMMING 
SOCKET. STock $59,95 


EP-2A-K-07 Programs 2708. 2716, TMS 
2716 anp TMS 2532 Proms, 
TEXTOOL ZERO FORCE PROGRAMMING 
SOCKET. Stock $79,95 


PROM STARTING ADDRESS. RAM STARTING 
ADDRESS AND NUMBER OF BYTES TO BE 
PROGRAMMED MAY BE EASILY SPECIFIED, 
SOFTWARE INCLUDES VERIFY MODE, 


ANALOG 1/0 802 
*412-15 V Power REQUIRED 














* 8 CHANNEL A/D coNVERTER-8 BITS 
* 2 LATCHED D/A CONVERTERS-8& BITS 
* 






GOLD PLATED EDGE CONNNECTOR: 
PRECISION METAL FILM RESISTORS, 

* INTERFACES TO 6520 or 6530 1/0 
Ports (2 Rea.) Stock-3 weeks $99, 


@e errr aapractruneeanrarreteeke nen aeneens 











ALL UNITS ASSEMBLED AND TESTED WITH 
CONNECTOR. GUARANTEE: our PRODUCTS 
ARE IN GOOD WORKING CONDITION WHEN 
YOU RECEIVE THEM & 90 DAY WARRANTY 
ON ALL PARTS, 
OPTIMAL TECHNOLOGY INC 

BLUE WOOD 127: EARLYSVILLE VA 22936 

PHONE 804-973-5482 









Page 28 


AN 8080 SIMULATOR FOR THE 6502 


Dann McCreary is pleased to announce his 8080 
Simulator for the 6502. It joins it's predeces-~ 
sor, the 1802 Simulator, Available now in a KIM-1 
version, the 8080 Simulator executes the entire 
8080 instruction set, All internal 8080 registers 
are maintained ready for convenient examination or 
modification of their contents. In it's minimum 
configuration on the KIM-1, the 8080 Simulator 
supports register single~step, program counter 
single-step and run modes. It also offers an in- 
put and an output port, breakpoint operation, and 
rejection of illegal op-codes. 





The 8080 Simulator runs in less than 1K of 
memory, leaving up to 224 bytes of 8080 programn- 
ming space on an unexpanded KIM-1. The simulator 
may be relcnated in ROM and can be adapted to 
other 6502 based systems. 


Well suited to all but time~sensitive appli- 
cations, the 8080 Simulator may be used to assist 
in the design and testing of 8080 software, used 
as a training aid or used for running most 8080 
application software. 


A complete 8080 Simulator package is now a- 
vailable for the KIM-l. It consists of a KIM-1 
format cassette tape, a user manual and complete, 
commented assembly level source/object listing. 
Priced at $18.00 + $1.50 postage & handling, it 
may be ordered from: Dann McCreary 

. Box 16435 
San Diego, Ca 92116 


Both 8080 and 1802 Simulators purchased at 
the same time (on the same cassette) are specially 
priced at $25.00 + $2.00 postage & handling. 


California residents please add 6% sales tax. 


EPROM PROGRAMMER 


Optimal Technology, Blue Wood 127, Earlys- 
ville, Va announces the EP-2A-79, EPROM Program- 
mer. Software for programming and verifying pro~ 
gramming 18 available for the 6800, 8080, Z-80, 
8085, 6502 (KIM-1), F-8, 1802, and 2650 based mi- 
crocomputers. Packaged in a sloping panel alum- 
inum case, the unit connects to microcomputer 
with a 14 pin ribbon cable thru 14 I/O ports. 
Software, supplied as a listing, requires approx- 
imately 256 bytes of RAM and includes instruc- 
tions on how to relocate. Personality modules 
which plug into the front panel-mounted socket, 
are available for programming the 2708, 2716, TMS 
2716, 2732, TMS 2708 and TMS 2532 EPROMS. Power 
requirements are 115 VAC 50/60 HZ at 15 watts. 
The EP-2A-79 is priced at $145.00 which includes 
1 set of software. Personality Modules are priced 
at $15.00 except the Personality Modules for the 
2732 and TMS 2532 which are $25,00. Available 
from stock. 


EDITORIAL (continued from inside front cover), 


For example, their full-size floppy disc sys- 
tem was up’and running for almost a year before it 
was announced to the world. I had the pleasure of 
using one of these systems for several months 
while I was still with MOS. This was still. months 
before anyone ever heard of HDE. 


This professional and responsible attitude on 
the part of HDE should be applauded and encouraged, 


It was this attitude and the quality of their 
products which led me to purchase an HDE disc sys~ 
tem and memory boards for my system. I will re- 
view these products in an upcoming issue, 


I. can remember, a while back, wondering what 
I was going to do with this micro-~computer now 
that I had it running and could successfully add 
two numbers together, 


Thats a laugh! Now I wish I had more time to 
do all the neat things that need doing. There's 
those mods to Focal, touch-tone software for that 
now music board, an enclosure for those new discs 
etc, etc, etc. The list is almost endless. I 
guess that's the fate of the computer hobbyist. 


ERIC 




















NOTES FROM JOHNSON COMPUTE Ra wn e ner enwn nn vvcoeved paid ad 


MICROSOFT BASIC for KIM is now availahle in a PROMable 
version which stores at 2000-3FFF. This is catalog 
KB-9P furnished on cassette or paper tape for $99.00, 
stock. The PROM version does not include SIN, COS, 
TAN or. ATN.. Note that it stores on an 8K PROM board 
such as our KM-8KRO board which plugs directly into a 
KIM-4 motherboard. The workspace in KB-9P begins at 
4000. Most of you have the KB=-9 version, which mins 
out of RAM located at 2000-4260, and does provide the 
trig functions. Both are. a full ANSI BASIC and hoth 
Provide 9 digit accuracy with a floating point math 
package. 


OHIO SCIENTIFIC's new low priced computer, madel C1IP, 
breaks all records for performance/price by offering, 
for only $349.00, a 4K fast 6502 system complete with 
the Microsoft 8K BASIC in ROM, 32 characters/line 
video, a full 53 key keyboard, 32 x 32 character 
graphics using (note this) 254 graphics characters, 
runs in either BASIC or machine code, has Kansas City 
cassette interface, and is housed in an attractive 
metal cabinet with internal power supply. Wow. The 
graphics are easy to program, fast, and provide an e- 
quivalent screen resolution of 256 x 256 lines. Did I 
mention upper and lower case? The direct access video 
display memory is in addition to the 4K user RAM. We 
don’t stop here. You can expand to &K with a 4K chip 
kit which just plugs into the same hoard. Switchable 
connections are provided for a 300 haud RS-232 modem 
port and an RS=-232 interfaced RO printer. And, if 
that were not enough, a 610 expansion hoard fits into 
the same cabinet with 8K more. And you have roam on 
the 610 for an additional 16K, putting you up to 32, 
The 610 also provides interface for up to two mini 
floppy drives and also opens the door to a Centronics 
779 printer interface and a cammunications port. A 
620 expansion adaptor plugs into an external OSI 
standard 8 slot motherboard for such things as A/D, 
More memory andseexa.e20On and on. This is a whale of 
a lot for the price. Please note that the $349.00 
takes you up through the first 4K only. By the way, 
OSI's new monitor/TV is only $115.00. Deliveries of 
the C1P will he limited in Decemher but. production is 
expected to hit full swing starting January. To be 
on the safe side, we are promising February. Color? 
Yup. Maybe about February. Prefer a 64 character 
line? No problem. Take a C2-4P for $599.00, 


RIVERSIDE ELECTRONICS' video board MVM-1024 is another 
very fast video system using 128 ASCII characters with 
a uniguely implemented blinking cursor, reversing and 
blinking screen with special cursor addressing and 
position reading. In full gear, this rig looks like 
downtown Las Vegas. Just do a STA to the position and 
bingo, fireworks. The computer can read the position 
of the cursor which is constantly stored on the 
MVM~1024. Writing a new cursor position overwrites 
the old. No address lines are used for cursor posi-~ 
tion and no address space of the microprocessor is 
used. All operations are controlled hy writing to 3 
bi-directional ports. Home? Just store a zero at 
ADH and ADL and zip. The MVM-1024 can be plugged 
directly into a KEM motherboard which mates directly 
to KIM with no special wiring. The KEM also accepts 
up to 4 S-100 boards (2 connectors come mounted) and 
there is space for 4K of PROM. Just connect a 
parallel ASCII keyboard to KEM and some power, then 
start punching. The video is 16 x 64 Because of 

all the neat contrl, this system is great for indus- 
try, labs and education. Write for camplete info. 


SUPERKIM by Micro Products is now available. This 
enhanced version of a KIM offers the KIM monitor and 
interfaces with 1K of RAM plus roam for on-board ex- 
pansion of an additional 4K and up to 16K user PROM. 
SUPERKIM features power-on-reset, RS-232 or 20 ma. 
loop, audio cassette interface, fully buffered address 
and data lines, a 6522 with roan for 3 more, 8 indi- 
vidually resetable latched interrupts, a high quality 
hex keyboard, address and data LED display. A proto 
area for your kluges and all of the power supply but 
the transformer are included on this 11.5 x 11.5 inch 
wonder. SUPERKIM will run all the KIM software too. 


$445.00, our stack. 


PET? Sure. We have the &K version at $795.00 and 
they include the manual. We also carry the CMC prin- 
ter interface for PET and the CMC word processor on 


cassette. 


SYM1 is now available from Johnson Computer. We carry 
the power supply also. Our Microsoft BASIC is also 
available on cassette for SYM. 


P.O. BOL 523 MEDINA, OHIO 44256 


(216) 725-4560 


HDE FLOPPY DISK for KIM is now available in the 5" 
mini as well as the &" version you have heard about. 
The single mini is $695.00 and the double is $1045.00. 
MNelivery of the mini will begin at the end of January. 
They use the Shugart drive and HDE interface, control- 
ler and file oriented disk operating system (FODS). 
Comes complete with power supply, ready to plug in. 
The 8" drives have been popular with our industrial 
KIM accounts and universities. The 8" system uses the 
very reliable Sykes drive and sells for $1995.00 for 
the single and $2750.00 for the double. For a pre- 
view, manuals for either system are availahle for a 
nominal charge. Interfacing to the KIMSI and the KEM 
are also now available. Just plug in, hoot up and 
that's it. Software to tie in with Microsoft BASIC is 
supplied at no extra cost. 


HDE 8K RAM hoards plug directly into a KIM~-4 or can be 
wired direct to the expansion connector. The DM816=-8 
uses the 1K x 4 4804 on a 4.5 x 6.5 inch card. [ndus- 
trial grade design and strict OC plus burn-in makes 
the DM816-8 super tough and super reliable. Card 
slides mount on the ends of the KIM-4 edge connectors 
for ridged suppot. Card guides are available at no 
extra cost, on request, one set per hoard. Price? A 
new low price will be effective by the time you read 
this line. Check with us. We have the boards in 
stock. Now you can afford to go to 32K, or whatever. 


MOS TECHNOLOGY 6502 in OEM quantities at factory 
prices is available from Johnson Computer and so 
also for the entire §500 family. Spec sheets on 
request. 


OHIO SCIENTIFIC BUSINESS SYSTEMS are available from 
us along with business software and high performance 
peripherals. The. proven Challenger III series offer 
3 different software switchable processors allowing 
operation of software written for the 6502, 6800, 
8080 or 280. Up to 56K of RAM, dual single sided 

or dual double sided floppy disk system and an op=- 
tional 74 megabyte fixed hard disk system canplete 
with a quality CRT terminal and high performance 
printer is available for as low as ahout $14,000.00 
and up, depending upon your requirements. Software 
is additional and starts at $975.00 for a canplete 
standard accounting package. OSI is now intro~ 
ducing a new concept in business software which 
provides remarkable flexibility and ease of system 
set-up. Contact us for more details. 


HAZELTINE 1400 CRT terminals in stock. 

HAZELTINE 1500 CRT terminals in stock. 

QUME letter quality full char. printers in stock. 
CENTRONICS 779 and 703 printers in stock. 
VEN-TEL. accoustical couplers in stock. 


MICRO TECHNOLOGY UNLIMITED's high resolution visible 
memory graphics opens a new challenge to mathematical- 
ly inclined programmers, The "visible memory” is an 
8K. dynamic RAM (MTU #K-1008, $235.00), the output of 
which displays each bit (not byte) as it 1s generated 
by the refresh circuit. The monitor is connected 
directly to a viden jack on the RAM board. If the 
K-1008 is set at 2000-3FFF, the upper left hand corner 
of the display is the 8 dots of data at address 2000 
and is followed to the right by the & dots of data at 
2001, continuing on with 329 dots to the line and 200 
dots vertically to fill the screen. Subroutines to 
connect any two points with a straight line provides 
fast high resolution graphics which are sheer fas- 
cination. Now that MTU has developed software to 
interface our Microsoft BASIC for KIM, you can program 
the graphics in either ASSEMBLY or BASIC and use the 
number crunching capability of BASIC to do the heavy 


stuff. In addition to personal and engineering 


graphics, math, physics, chem and EE profs will find 
it an absolute joy. The K~1008 also serves as usable 
memory when not dedicated to graphics.- A very low 
power 16K RAM noard is available for normal storage. 
All. this, plus the KIM, simply plugs into an MTU 
pre-wired rack and motherboard (K-1005, $68.00). 

Just connect the power to the harrier strip, connect 
the recorder, terminal and switches to the applica- 
tion connector (same as your present setup if you 
already have a KIM) and GO. MTU. provides a test 
pattern program with the K~1008 and, for $25.00 more, 
you can get a fist full of utility programs and 
cassette which provides a fascinating. "Swirl" 

program and some of the subroutines such as drawing 
a straight line between ay two sets of coordinates, 
etc. It saves a lot of key punching. Color is in 
the works. Interested in music? Write us for info 
on MTU four part harmony music synthesis on KIM, 








BOX 120 
ff, . ALLAMUCHY, N.J. 07820 
unl INC. 201-362-6574 


HUDSON DIGITAL ELECTRONICS INC. 


ANNOUNCING 





TWO NEW PRODUCTS FOR THE KIM-1 


DM816-CC15—MOTHER BOARD 


A 15 connector mother board for the KIM-1' microcomputer, with power-on reset and remote 
reset, stop, run and single step. Complete with all connectors in place, tested for reliable operation. 


The DM816-CC'15 is specifically designed for the HDE 61” X 4%" card and cannot be used 
with larger formats. Intended for the serious hobbyist and professional/industrial use. 


As above $315.00 
W/power supply in 19” card rack $495.00 
W/power supply in cabinet $675.00 


(Centronics printer interface available at extra cost) 


DM816-MD1—MINIFLOPPY DISK SYSTEM 


A small, but powerful companion to our full size floppy disk system. Includes the 
controller/interface card, power supply, disk drive, all connecting cables, ‘FODS’ software and 
manual. Deliveries begin February 1, 1979. Initial quantities limited. 


As above $ 695.00 
As above-Dual drive | $1050.00 


ORDER DIRECT OR FROM THESE FINE DEALERS: 


JOHNSON COMPUTER PLAINSMAN MICROSYSTEMS ARESCO 


Box 523 Box 1712 P.O. Box 43 
Medina, Ohio 44256 Auburn, Ala. 36830 Audubon, Pa. 19407 


216-725-4560 205-745-7735 215-631-9052