Congratulations and welcome to the exciting new world of micro-
computers! As the owner of a KIM-1 Microcomputer Module, you now have at
your disposal a completely operational, fully tested, and very capable
digital computer which incorporates the latest in microprocessor tech-
nology offered by MOS Technology, Inc. By selecting the KIM-1 module,
you have eliminated all of the problems of constructing and debugging a
microcomputer system. Your time is now available for learning the opera-
tion of the system and beginning immediately to apply it to your specific
areas of interest. In fact, if you will follow a few simple procedures
outlined in this manual, you should be able to achieve initial operation
of your KIM-1 module within a few minutes after unpacking the shipping
container.
Your KIM-1 module has been designed to provide you with a choice of
operating features. You may choose to operate the system using only the
keyboard and display included as part of the module. Next, you may add
a low cost audio cassette tape recorder to allow storage and retrieval
of your programs. Also, you may add a serial interfaced teleprinter to
the system to provide keyboard commands, hard-copy printing, and paper
tape read or punch capability.
1
At the heart of your KIM-1 system is an MCS 6502 Microprocessor
Array operating in conjunction with two MCS 6530 arrays. Each MCS 6530
provides a total of 1024 bytes of Read-only Memory (ROM) , 64 bytes of
Random Access Memory (RAM), 15 Input/Output pins, and an Interval Timer.
Stored permanently in the ROM's of the MCS 6530 arrays are the monitor
and executive programs devised by NOS Technology, Inc. to control the
various operating modes of the KIM-1 system.
The KIM-1 system is intended to provide you with a capable micro-
computer for use in your real-world" application. Accordingly, the
system includes a full 1024 bytes of RAM to provide data and program
storage for your application program. In addition, you are provided
with 15 bidirectional input/output pins to allow interface control of
your specific application. Finally, one of the interval timers included
in the system is available for generation of time base signals required
by your application.
Your KIM-1 system comes to you complete with all components mounted
and tested as a system. You need not worry about timing signals (we've
included a 1MHz crystal oscillator on the module), interface logic or
levels between system components, or interface circuitry to peripheral
devices. In fact, you need only apply the indicated power supply voltages
to the designated pins to achieve full operation of your KIM-1 system.
We recommend that you read all of this manual before applying power
to or attempting to operate your KIM-1 module. In the order presented,
you will find:
Chapter 2 - "hints and kinks" to help you achieve initial
system operation
Chapter 3 - a more detailed description of the KIM-1 system
hardware and software
Chapter 4 - operating procedures for all system modes
Chapter 5 - an example of a typical application program
using all of the features of the KIM-1 system.
2
At some future time, you may find it desirable to expand the KIM-1
system to incorporate more memory, different types of memory, or addi-
tional input/output capability. Again, we have tried to make system
expansion as simple as possible with all required interface signals
brought out to a special connector on the module. Watch for:
Chapter 6 - a guide to system expansion for increasing
both memory and input/output capability
Despite our best efforts to provide you with a fully operable
and reliable system, you might encounter some difficulties with your
KIM-1 module. If so, refer to:
Chapter 7 - some guidance on warranty and service
procedures for your KIM-1 module
Following the basic text of this manual, you will find a series of
Appendices intended to provide you with detailed information on certain
specialized subjects of interest to you in understanding the operation
of the KIM-1 system.
Lastly, since this manual cannot presume to provide all of the
technical information on the hardware or programming aspects of the
MCS 6502 microprocessor array, we are including with your KIM-1 system
two additional manuals for your reference. The Hardware Manual defines
the various elements of the system, their electrical and interface
characteristics, and the basic system architecture and timing. The
Programming Manual provides the detailed information required to write
effective programs using the MCS 6502 instruction program set.
So much for introductory comments! Now lets get started and see
if we can get your KIM-1 Microcomputer Module doing some real work for you.
3. The jumper wire from A-21 to A-V is used to define for the
KIM-1 system that a teleprinter will be used as the only
input/display device for the system. If you expect to use
both TTY and the KIM-1 keyboard/display, you should install
the switch shown instead of the jumper. Now, the switch,
when open, will allow use of the keyboard and display on
the KIM-1 module and, when closed, will select the tele-
printer as the input/display device. (of course, you may
use a clip-lead instead of the switch if you desire).
4. Be sure pins A-21 and A-V are connected. Reinstall con-
nector (A) and return power to the system. Turn-on the TTY.
5. Press the [RS] key on the KIM-1 module then press
the [RUB OUT] key on the TTY. This step is most important
since the KIM-1 system adjusts automatically to the
bit rate of the serial teleprinter and requires this
first key depression to establish this rate.
18
If everything is working properly you should immediately observe a
message being typed as follows:
KIM
This is a prompting message telling you that the TTY is on-line and the
KIM-1 system is ready to accept commands from the TTY keyboard.
Should the prompting message not be typed press the [RS] key on the
KIM-1 keyboard and then the [RUB OUT] key on the TTY. If the "KIM" message
still is not typed, recheck all connections and the TTY itself and try
again. If the problem persists, refer to Appendix C, (In Case of Trouble).
6. Assuming that the TTY is operable, you may now try a simple
group of operations to verify correct system operation:
Press Keys See On Display Step #
KIM
xxxx xx 1
0002 0002 2
[SPACE] 0002 xx 3
18. 18. 4
0003 xx 5
A5. A5. 6
0004 xx 7
[LF] 0003 A5 8
[RUB OUT] KIM
xxxx xx 9
Step 1 shows the "KIM" prompting message. In Step 2, an address
(0002) is selected followed by a space key in Step 3. The address cell
0002 together with the data stored at that location (xx) is printed.
Step 4 shows the "modify cell" operation using the [.] key and the hex
data keys preceding. Step 5 shows the incrementing to the next address
cell (0003) after the [.] key. Note that the modification of cell 0002
also occurs. Steps 6 and 7 show the modification of data in cell 0003
and the incrementing to cell 0004. Step 8 shows the action of the [LF] key
in backing up one cell to 0003 where we can see from the printout that
the correct data (A5) has been stored at that location. Step 9 shows the
reaction to the [RUB OUT] key in resetting the system and producing a new
"KIM" prompting message. Note, by the way, that in this example you have
repeated a portion of the program entry exactly as you did in Section 2.4
but this time using the TTY.
19
So much for now! If all of the operations have occurred properly,
you may be certain that your TTY and KIM-1 module are working together
correctly. We will describe in detail all of the other operations pos-
sible with the TTY in a later section of the manual.
If you have reached this point without problems, you now have
completed all of the required system tests and may be confident that
the KIM-1 module and your peripheral units are all working correctly.
Our next task is to learn more about the KIM-1 system and its operating
programs.
Up to this point you have been engaged in bringing up your KIM-1
system and verifying its correct operation. Now it's time to learn more
about the various parts of the KIM-1, how the parts work together as a
system, and how the operating programs control the various activities of
the system. The diagrams included in this section together with your
full sized system schematic will be helpful in understanding the elements
of your KIM-1 module.
3.1 KIM-1 SYSTEM DESCRIPTIONFigure 3-1 shows a complete block diagram of the KIM-1 system. You
should note first the presence of the MCS 6502 Microprocessor Array which
acts as the central control element for the system. This unit is an 8
bit microprocessor which communicates with other system elements on three
separate buses. First, a 16 bit address bus permits the 6502 to address
directly up to 65,536 memory locations in the system. Next, an 8 bit,
bidirectional data bus carries data from the 6502 array to any memory
location or from any memory location back to the 6502 array. Lastly, a
control bus carries various timing and control signals between the 6502
array and other system elements.
21
Associated with the 6502 array is a 1 MHz crystal which operates with
an oscillator circuit contained on the 6502 array. This crystal control-
led oscillator is the basic timing source from which all other system
timing signals are derived. In particular, the þ2 signal generated by
the 6502 array and used either alone, or gated with other control signals,
is used as the system time base by all other system elements.
The 6502 microprocessor is structured to work in conjunction with
various types of memory. In the KIM-1 system, all memory may be consid-
ered to be of the Read-only (ROM) or Read/Write (RAM) variety. The ROM
portion of the memory provides permanent storage for the operating progams
essential to the control of the KIM-1 system. You will note the inclusion
of two devices, labelled 6530-002 and 6530-003. Each of these devices
include a 1024 byte (8 bits per byte) ROM with different portions of the
operating program stored permanently in each ROM.
RAM type memory is available at three locations in the system.
Again, each of the 6530 arrays include 64 bytes of RAM primarily used for
temporary data storage in support of the operating program. In addition,
a separate 1024 byte RAM is included in the KIM-1 system and provides
memory storage for user defined application programs and data.
Input/output controls for the system also are included within the
6530 arrays. Each 6530 array provides 15 I/O pins with the microprocessor
and operating program defining whether each pin is an input pin or output
pin, what data is to appear on the output pins, and reading the data appear
ing on input pins. The I/O pins provided on the 6530-002 are dedicated to
interfacing with specific elements of the KIM-1 system including the key-
board, display, TTY interface circuit, and audio tape interface circuit.
The 15 I/O pins on the 6530-003 are brought to a connector and are avail-
able for the user to control a specific application.
22
Finally, each 6530 array includes an interval timer capable of count-
ing a specific number of system clocks to generate precise timing gates.
The exact time interval is preset under program control. The interval
timer on the 6530-003 array is available for a user defined application
program and is not required by the operating programs.
Figure 3-1 shows a major block labelled Control Logic. Included
under this category are an address decoder used for generation of chip
select signals for the 6530 arrays and the static RAM. Also included is
the logic required to debounce the keys for system reset (RS key) and pro-
gram stop (ST key). Lastly, special logic is included to allow operation
of the system in a "single instruction" mode to facilitate program de-
bugging.
Figure 3-1 shows the keyboard/display logic interfacing with the I/O
pins of the 6530-002. Also shown are the interface circuits for trans-
mission of data to and reception of data from the TTY and audio tape units.
Figure 3-2 shows the detailed interconnections between the MCS 6502
and the two NCS 6530 arrays.
Figure 3-3 shows detailed logic and schematics for the control logic.
Figure 3-4 shows a detailed schematic of the static RAM.
Figure 3-5 and 3-6 show the detailed schematic of the keyboard and
display logic and circuits.
Figure 3-7 details the schematic of the TTY interface circuits.
Figure 3-8 details the schematic of the audio tape cassette interface
circuits.
Figures 3-9 and 3-10 provide a summary of all signals available on
either the Application connector or the Expansion Connector.
The fold-out system schematic shows all of the elements of the system
connected together and all signals appearing on the module connectors.
You may refer to the Hardware Manual included with your KIM-1 module
for additional details on the operating characteristics of the 6502 and
6530 arrays as well as detailed information on system timing.
Referring to Figure 3-12, note that the memory map shows a block of
8192 address locations all existing in the lowest address space within
the possible 65,536 address locations. This address space is further
divided into eight blocks of 1024 locations each. Each 1024 block is
further divided into four pages of 256 locations each. The "K"
reference defines a specific block of 1024 locations and refers to the
"K" number of the address decoder included within the system control
logic. The "page" reference defines a specific group of 256 addresses.
A total of 32 pages (0 to 31) are included in the 8192 address locations.
The hex codes for certain addresses are shown at strategic locations in
the memory map.
Beginning from the highest address location of the 8192, note that
the first 1024 block (K7) is assigned to the ROM of the 6530-002 and the
second 1024 block (K6) is assigned to the ROM of the 6530-003. The entire
operating program of the KIM-1 system is included in these two blocks.
Next in order, a portion of the K5 block is dedicated to the RAM,
I/O, and Timer locations of the two 6530 arrays. An expanded view of
this address space is shown in Figure 3-12. Note that the RAM addresses
for the 6530-002 (Hex 17EC to 17FF) are reserved for use by the operating
program and shouldnot appear in a user generated application program.
The same is true for the I/O and Timer locations of the 6530-002 which
also are reserved for use by the operating programs.
The next four blocks in order (K4, K3, K2, Kl) are reserved for
additional memory in an expanded system. In Section 6, the methods for
adding memory will be discussed.
Finally, the lowest 1024 address locations (K0) are assigned to the
static RAM included within the KIM-1 system. You should note that within
this block, Page 0 and Page 1 have special significance. Page 1 is used
as the system stack onto which return addresses and machine status words
are pushed as the system responds to interrupts and subroutine commands.
Page 0 has significance for certain of the special addressing modes avail-
able when programming for the 6502 microprocessor array.
35
Figure 3-12 shows an expanded view of Page 0 and Page 1. Note that
17 addresses (00EF to 00FF) are reserved for use by the operating program
and must never appear in the user generated application program. Also,
note the comment that a maximum of eight locations may be required on the
stack (Page 1) to service operating program interrupts.
In summary, the user generated application program may make use of
the following areas of memory:
1. All of Page 0 except 00EF to 00FF
2. All of Page 1 (remember that the stack will extend an
extra 8 bytes deep to accommodate the operating program).
3. All of Page 2 and Page 3.
4. In Page 23:
- All I/O locations from 1700 to 173F
- All 64 bytes of RAM from 1780 to l7BF
- An additional 44 bytes of RAM from 17c0 to l7EB
3.3 KIM-1 OPERATING PROGRAMSFigure 3-14 shows a simplified flow chart of the KIM-1 operating
programs. This section provides a brief explanation of these programs
to assist you in understanding the various operating modes of the system.
First, you should note that when power is first applied to your
KIM-1 module and the [RS] (reset) key is depressed, control of the system
automatically is assumed by the operating program. This is true, as well,
for any succeeding depression of the reset key.
For each depression of the reset key, the system is initialized.
At this time, stack pointer values are set, the I/O configuration is
established, and essential status flags are conditioned. Next the
program determines whether the system is to respond to TTY inputs or
is to operate with the keyboard and display on the KIM-1 module.
If the TTY mode has been selected, the program halts and awaits a
first key depression from the TTY (the RubOut Key). Upon receipt of this
key depression, the program automatically performs a bit rate measurement
and stores the correct value for use in receiving and decoding succeeding
data transfers from the TTY. Note that this bit rate measurement is per-
formed after each depression of the reset key.
The program will proceed immediately to a routine causing the
prompting message ("KIM") to be typed on the TTY. Now, the program halts
at the loop called "Get Character". As each key is depressed on the TTY,
the coded data is accepted and analyzed in the routine called "Execute Key".
The various keys depressed will cause the program to branch to the appro-
priate subroutines required to perform the desired operation. Upon com-
pletion of the individual key executions, the program returns to the "Get
Key" loop and awaits the next key depression.
Exit from the TTY processing loop will occur in response to:
1. A depression of the reset key,
2. A depression of the G key which initiates execution of
the application program, or
3. A change in the mode from TTY to Keyhoard/Display.
If, after system reset and initialization, the Keyboard/Display
mode (KB) is determined to be in effect, the program will proceed dir-
ectly to display, and keyboard scan routines. The program will cause the
display scan to occur continuously ("Display Cell") until one of the keys
on the keyboard is depressed (AK?). Key validation is performed during
an additional scan cycle. If the key is truly depressed (not noise), the
program proceeds to the routine called "Get Key" in which the exact key
depressed is defined. Next, the program moves to the "Execute Key"
routine where branches to appropriate execution routines will be per-
formed. Finally, after key execution, the program returns to the "Display
Cell" routine and waits for the key to be released. When no key is de-
pressed, the program returns to the normal "Display Cell" routine and
awaits the next key depression.
In either the TTY or KB modes, the audio tape load or dump routines
may be executed using appropriate commands from the selected keyboards.
In either case, completion of the tape load or dump routine allows the
program to return to the "Start" position which will, as usual, activate
the KIM-1 display or cause the "KIM" prompting message on the TTY.
You should note the use of the Stop key to activate the non-maskable
interrupt input (NMI) of the 6502 microprocessor array. Depression of
this key causes an unconditional termination of program execution, a
saving of machine status registers on the stack, and a return to the
control of the operating program.
A second interrupt input is available and referred to as IRQ. This
interrupt may be defined by the user and will cause the program to jump to
any location defined by the user in his program.
By counting the total machine cycles occurring between each
toggle of PAØ, an equation for the square wave frequency can be developed.
The actual frequency is determined by the position of the seven switches,
the number of machine cycles between each toggle of PAØ, and the basic
clock rate (1 MHz) of the KIM-1 system. Figure 5-3 shows the waveform
of the PAØ square wave and the derived equations for computing the
exact frequency.
The source code contained in your assembly language program
(Figure 5-2) is entered into the table first. A column is provided to
allow you to define the specific address at which an instruction is
located. The Instruction column provides space for defining one, two,
or three byte instructions. (Please refer to Appendix B of the Program-
ming Manual or to your Programming Card for specific Op Codes).
63
As an example, the first source instruction is LDA #$01 which,
when translated, means load the accumulator with the byte stored in the
next program location (hex 01). This is the "immediate" addressing
mode defined by the "#" symbol. The Op Code for LDA# is A9. This
value is entered in the first column under the heading, Instruction.
The next column contains the hex 01 value defined by the source state-
ment. The initial address for the program is inserted in the "Address"
column as 0200 (an arbitrary selection). The total instruction LDA #$01
now occupies address locations 0200 and 0201.
The next available address is 0202 which is inserted in the
"Address" column for the next source instruction. In this manner, you
will proceed through all of the source statements decoding each and
entering one, two, or three bytes of machine code as required in the
"Instruction" column. The "Address" column will contain the address of
the first byte of machine code (the Op Code) for each source statement.
In cases where the operand of the source statement is a symbol,
the address to which the symbol has been equated should be filled in as
the proper machine code. For example, the source statement "INC PAD"
requires the incrementing of data stored at a location "PAD" defined in
our assembly programs to have the address: PAD = 1700. Therefore, the
address 1700 is entered as the second and third bytes of the source
statement "INC PAD". (See Figure 5-4). Note also that when entering
an address, such as 1700, the low order byte (00) is entered first and
immediately after the Op Code and the high order byte (17) is entered
next as the third byte of the instruction.
When dealing with branch instructions (BPL, BMI, etc.), you
will need to calculate the exact value of the offset which may be either
positive (branch forward) or negative (branch backward). You should refer
to Section 4.1.1 of the Programming Manual to explore "Basic Concept of
Relative Branching." As an example, the source statement "BMI START" (See
Figures 5-2 and 5-4) requires a branch backward by (-15) locations to the
address labelled "START" (from address 0213 backward to 0205 inclusive).
address of the I/O port used for your sample program is 1700.
Press [AD] [1] [7] [0] [0] and the display will show the hex
code corresponding to the settings of your selector switches.
If you change the positions of your selector switches, you will
see the hex code change in the data field of the display.
Now, leave the same address (1700) selected and press
the [DA] key. If you press any of the hex keys [0] to [F]
you will write the data to the I/O port (1700). Since seven
of the pins of this I/O port are defined as inputs, only one
(PA0) will act as an output and will respond to the data
entered by you from the keyboard. Try alternating rapidly
between the [0] and [1] keys and you should hear clicking in
the speaker indicating that you are successfully toggling
the PA0 pin.
This concept of using the KIM-1 keyboard and display
to exercise and verify the operation of I/O ports is a
generally useful technique for debugging the hardware
portions of most specific applications.
A word of caution is in order when you decide to add memory to your
system. You have noticed the inclusion of the line receivers for the
AB10, AB11, and AB12 signals, (See Figure 6-2). These devices are
included because of loading limitations placed on the address bus lines
of the 6502 array (Each such line is capable of driving one standard
TTL load and l3Opf of capacity. See Appendix G).
As an example, assume that you have connected the K65 "Vector Select"
line to the K0 line. When a RST occurs, the 6502 array generates a fetch
from locations FFFC and FFFD. These addresses cause K65 to be selected
which, in turn, accesses the K0 field of the memory and causes the actual
fetch of the RST vector from locations 03FC and 03FD. (Had you chosen to
connect K65 to K7, the fetch of the reset vectors would occur from
locations 1FFC and 1FFD).
In this way, the highest six addresses of any 1K block of memory may
be used to supply the interrupt vectors for the system. If desired, a
switch could be installed to allow you to select different areas of memory
as the source locations for the interrupt vectors. (By the way, we
selected the 75145 type decoders in Figure 6-2 specifically to allow the
"wire-or" of K65 with any other K. This is possible because the 75145
decoder is provided with open-collector outputs which allows "wire-or"
of several states using an external load resistor.)
An even simpler arrangement using the "Vector Select" approach is
shown in Figure 6-3. Here, the KIM-1 system is assumed to have only the
lower 8K of memory in place. The address decoder (U4) is de-selected
using the AB15 signal which becomes "true" whenever an interrupt vector
fetch is initiated by the system. The same signal (AB15) is inverted and
"wire-or'd" through a switch to the K0 or the K7 chip select lines. Now,
depending upon the position of the switch, interrupt vectors will be
fetched from the top 6 addresses of either block K0 or K7. K0 in the
KIM-1 system is the RAM and K7 is the ROM in the 6530-002 array (the
operating program). In this way, you may have two different sets of inter-
rupt vectors in your system and may select which set is to be used with a
simple switch.
SYMPTOM: Display Not Lit
1. Test +5 volt power supply. Using a VOM check for +5
volts between Pin E-21 and E-22. Also check for +5
volts between Pin A-A and Pin A-1. KIM-1 power supply
should be set at +5v ñ 5%.
2. Test KB/TTY option wiring (Figure 2-4). Pin A-21 should
not be connected to Pin A-V.
3. Make sure decoder is enabled. See Figure 2-2 and insure
that Pin A-K is connected to ground.
4. Depress the reset key and check all other keys to insure
that no key is stuck.
5. Place a VOM between Pin E-21 (+5v) and Pin E-7 (Reset).
Alternately depress and release the reset key checking to
see if the voltage swings from (>4v) to (<1v).
6. Test Pin E-V (è2) with an oscilloscope and insure 1 MHz
operation.
SYMPTOM: Cannot Dump to Audio Tape
Cannot Load From Audio Tape
1. Test +12 volt power supply. Using a VOM check for +12
volts between Pin A-N (+12v) and Pin A-1 (GND). Set
power supply to +12v ñ 5%. (See Figure 2-2).
2. Check volume control on the tape recorder (Set at half
way point).
C-1
3. Make sure that you are using the proper tape output pin.
See Figure 2-3.
4. Check the tape interface circuit by disconnecting the
tape recorder and shorting Pin A-P (Audio Out High) to
Pin A-L (Audio In). Set up KIM-1 monitor to dump a
section of memory. Using an oscilloscope observe data
at Pin E-X (PLL TEST). See Appendix E for correct data
format and calibration procedure.
5. Record voice on a section of tape and play it back to insure
that the tape recorder is working. Connect another tape
recorder to the system or try another cassette.
6. Make sure Status Register (Location 00F1) has been loaded
with data value "00".
7. Make sure Tone Control is set to High.
SYMPTOM: TTY Interface Problems
1. Make sure that Pin A-21 is connected to Pin A-V (Figure 2-4)
to allow TTY operation.
2. Compare the connections on Figure 2-4 with interface
schematics in your TTY manual ( or any other serial
teleprinter ).
3. Depress the reset key on the KIM-1 keyboard followed by
a rub out character from the TTY.
Data is stored out onto your audio cassette recorder in a specific
format designed to insure an error free recovery. In the unlikely event
that a playback error does occur, several "ERROR DETECTION" methods are
incorporated to warn you of this condition.
Data is transmitted to the tape recorder in the form of serial
"ASCII" encoded characters (seven data bits plus Parity bit). Data
retrieved from the memory is converted into this form by separating each
byte into two half bytes. The half bytes are then converted into their
ASCII equivalents.
Each record transmitted begins with a leader of one hundred "SYN"
characters (ASCII 16) followed by a * character (ASCII 2A). During
playback, this pattern allows your micro-computer to detect the start of
a valid data record and synchronize to the serial data stream. Following
the *, the record identification number (ID), and starting address low
(SAL) and the starting address high (SMI) are transmitted. The data
specified by the starting (SAL, SAH) and ending limits (EAL, EAH) is
transmitted next followed by a "/" character (ASCII 2F) to indicate the
end of the data portion of the record. Following the "/" two "CHECK-SUM"
bytes are transmitted for comparison with a calculated check-sum number
during playback to further insure that a proper data retrieval has taken
place. Two "EOT" characters (ASCII ø4) mark the end of record transmission.
E-1
Each transmitted bit begins with a 3700 hertz tone and ends with
a 2400 hertz tone. "Ones" have the high to low frequency transition
at one-third of the bit period. "Zeros" have the transition at two-
thirds of the period. During playback the 565 phase locked loop locks
to, and tracks these two frequencies producing (through the 311
comparator) a logic "1" pulse of one-third the bit period for a "One".
A pulse two thirds the bit period is likewise produced for a "Zero".
Your microcomputer uses a software controlled algorithm for converting
this signal into eight bit data words.
The frequency shift keyed phase lock loop method of data recovery
is relatively insensitive to amplitude and phase variations. The "FREE
RUNNING" frequency of the phase lock loop has been adjusted at the factory
to a frequency half way between the two data frequencies (called the Center
Frequency). This adjustment is accomplished by strapping Pin A-P (Audio
Out High) to Pin A-L (Audio In). A program starting at address 1A6BHEX
provides the center frequency reference that allows the loop to be
adjusted by potentiometer VR1. Pin E-X (PLL TEST) is monitored with a
voltmeter while the pot is rotated until the voltmeter reading is at the
transition point between a logical "1" (+5v) and "0" (GND).
THIS ADJUSTMENT HAS BEEN FACTORY PRESET AND SHOULD ONLY REQUIRE
ADJUSTMENT DUE TO COMPONENT REPLACE0NT.'
The paper tape LOAD and DUMP routines store and retrieve data in
a specific format designed to insure error free recovery. Each byte
of data to be stored is converted to two half bytes. The half bytes
(whose possible values are 0 to FHEX) are translated into their ASCII
equivalents and written out onto paper tape in this form.
Each record outputted begins with a ";" character (ASCII 3B) to
mark the start of a valid record. The next byte transmitted (18HEX) or
(2410) is the number of data bytes contained in the record. The record's
starting address High (1 byte, 2 characters), starting address Lo (1 byte,
2 characters), and data (24 bytes, 48 characters) follow. Each record is
terminated by the record's check-sum (2 bytes, 4 characters), a carriage
return (ASCII OD), line feed (ASCII øA), and six "NULL" characters
(ASCII øø).
The last record transmitted has zero data bytes (indicated by ;00)
The starting address field is replaced by a four digit Hex number repre-
senting the total number of data records contained in the transmission,
followed by the records usual check-sum digits. A "XOFF" character ends
the transmission.
;180000FFEEDDCCBBAA0099887766554433221122334455667788990AFC;0000010001
F-1
During a "LOAD" all incoming data is ignored until a ";" character
is received. The receipt of non ASCII data or a mismatch between a
records calculated check-sum and the check-sum read from tape will cause
an error condition to be recognized by KIM. The check-sum is calculated
by adding all data in the record except the ";" character.
The paper tape format described is compatible with all other
MOS Technology, Inc. software support programs.
Clocks (ø1, ø2)
The MCS 6502 is supplied with an internal clock generator. The
frequency of this clock is crystal controlled.
Address Bus (A0-A15)
These outputs are TTL compatible, capable of driving one standard
TTL load and 130pf.
Data Bus (D0-D7)
Eight pins are used for the data bus. This is a bi-directional bus,
transferring data to and from the device and peripherals. The
outputs are tri-state buffers capable of driving one standard
TTL load and 130pf.
Ready (RDY)
This input signal allows the user to single cycle the microprocessor
on all cycles except write cycles. A negative transition to the low
state during or coincident with phase one (þ1) will halt the micro-
processor with the output address lines reflecting the current
address being fetched. This condition will remain through a
subsequent phase two (þ2) in which the Ready signal is high. This
feature allows microprocessor interfacing with low speed PROMS as
well as fast (max 2 cycle) Direct Memory Access (DMA). If Ready
is low during a write cycle, it is ignored until the following
read operation.
G-1
Interrupt Request (IRQ)
This TTL level input requests that an interrupt sequence begin
within the microprocessor. The microprocessor will complete the
current instruction being executed before recognizing the request.
At that time, the interrupt mask bit in the Status Code Register
will be examined. If the interrupt mask flag is not set, the
microprocessor will begin an interrupt sequence. The Program
Counter and Processor Status Register are stored in the stack.
The microprocessor will then set the interrupt mask flag high
so that no further interrupts may occur. At the end of this
cycle, the program counter low will be loaded from address FFFE,
and program counter high from location FFFF, therefore trans-
ferring program control to the memory vector located at these
addresses. The RDY signal must be in the high state(for control
to the memory vector) located at these addresses. The RDY signal
must be in the high state for any interrupt to be recognized.
A 3Kþ external register should be used for proper wire-OR operation.
Non-Maskable Interrupt (NMI)
A negative going edge on this input requests that a non-maskable
interrupt sequence be generated within the microprocessor.
NMI is an unconditional interrupt. Following completion of the
current instruction, the sequence of operations defined for IRQ
will be performed, regardless of the state of the interrupt mask flag.
The vector address loaded into the program counter, low and high,
are locations FFFA and FFFB respectively. The instructions
loaded at these locations causes the microprocessor to branch to
a non-maskable interrupt routine in memory.
NMI also requires an external 3KOhm resistor to Vcc for proper
wire-OR operations.
G-2
Inputs IRQ and NMI are hardware interrupts lines that are sampled
during ø2 (phase 2) and will begin the appropriate interrupt
routine on the ø1 (phase 1) following the completion of the
current instruction.
Set Overflow Flag (S.O.)
This TTL level input signal allows external control of the
overflow bit in the Status Code Register.
SYNC
This output line is provided to identify those cycles in which
the microprocessor is doing an Op Code fetch. The SYNC line
goes high during ø1 of an Op Code fetch and stays high for the
remainder of that cycle. If the RDY line is pulled low during
the þ1 clock pulse in which SYNC went high, the processor will
stop in its current state and will remain in the state until
the RDY line goes high. In this manner, the SYNC signal can be
used to control RDY to cause single instruction execution.
RESET
This input is used to reset or start the microprocessor from a
power down condition. During the time that this line is held
low, writing to or from the microprocessor is inhibited. When
a positive edge is detected on the input, the microprocessor
will immediately begin the reset sequence.
After a system initialization time of six clock cycles, the mask
interrupt flag will be set and the microprocessor will load the
program counter from the memory vector locations FFFC and FFFD.
This is the start location for program control.
After Vcc reaches 4.75 volts in a power up routine, reset must
be held low for at least two clock cycles.
When the reset signal goes high following these two clock cycles,
the microprocessor will proceed with the normal reset procedure
detailed above.
The MCS 6530 is designed to operate in conjunction with the MCS 650X
Microprocessor Family. It is comprised of a mask programmable 1024 x 8
ROM, a 64 x 8 static RAM, two software controlled 8 bit bi-directional
data ports allowing direct interfacing between the microprocessor unit
and peripheral devices, and a software programmable interval timer
with interrupt, capable of timing in various intervals from 1 to 262,144
clock periods.
A block diagram of the internal architecture is shown in Figure H-1
The NCS 6530 is divided into four basic sections, RAM, ROM, I/O and TIMER.
The RAM and ROM interface directly with the microprocessor through the
system data bus and address lines. The I/O section consists of 2 8-bit
halves. Each half contains a Data Direction Register (DDR) and an I/O
Register.
ROM 1K Byte (8K Bits)
The 8K ROM is in a 1024 x 8 configuration. Address lines A0-A9,
as well as RSO are needed to address the entire ROM. With the
addition of CS1 and CS2, seven NCS 6530's may be addressed, giving
7168 x 8 bits of contiguous ROM.
RAM 64 Bytes (512 Bits)
A 64 x 8 static RAM is contained on the MCS 6530. It is addressed
by Aø-A5 (Byte Select), RSø, A6, A7, A8, A9 and CS1.
Internal Peripheral Registers
There are four internal registers, two data direction registers
and two peripheral I/O data registers. The two data direction
registers (A side and B side) control the direction of the data
into and out of the peripheral pins. A "1" written into the Data
Direction Register sets up the corresponding peripheral buffer pin
as an output. Therefore, anything then written into the I/O Register
will appear on that corresponding peripheral pin. A "0" written into
the DDR inhibits the output buffer from transmitting data to or from
the I/O Register. For example, a "1" loaded into data direction
register A, position 3, sets up peripheral pin PA3 as an output.
If a "0" had been loaded, PA3 would be configured as an input and
remain in the high state. The two data I/O registers are used to
latch data from the Data Bus during a Write operation until the
peripheral device can read the data supplied by the microprocessor
array.
H-4
During a read operation the microprocessor is not reading the I/O
Registers but in fact is reading the peripheral data pins. For
the peripheral data pins which are programmed as outputs the
microprocessor will read the corresponding data bits of the I/O
Register. The only way the I/O Register data can be changed is by
a microprocessor Write operation. The I/O Register is not affected
by a Read of the data on the peripheral pins.
Interval Timer
1. Capabilities
The KIM-1 Interval Timer allows the user to specify a preset count
of up to 25610 and a clock divide rate of 1, 8, 64 or 1024 by writing
to a memory location. As soon as the write occurs, counting at the
specified rate begins. The timer counts down at the clock frequency
divided by the divide rate. The current timer count may be read at
any time. At the user's option, the timer may be programmed to generate
an interrupt when the counter counts down past zero. When a count of
zero is passed, the divide rate is automatically set to 1 and the
counter continues to count down at the clock rate starting at a count
of FF (-1 in two's complement arithmetic). This allows the user to
determine how many clock cycles have passed since the timer reached
a count of zero. Since the counter never stops, continued counting
down will reach 00 again, then FF, and the count will continue.
2. Operation
a. Loading the timer
The divide rate and interrupt option enable/disable are programmed
by decoding the least significant address bits. The starting count for
the timer is determined by the value written to that address.
H-5
Writing to AddressSets Divide Ratio ToInterrupt Capability Is
1704 1 Disabled
1705 8 Disabled
1706 64 Disabled
1707 1024 Disabled
170C 1 Enabled
170D 8 Enabled
170E 64 Enabled
170F 1024 Enabled
b. Determining the timer status
After timing has begun, reading address location 1707 will provide
the timer status. If the counter has passed the count of zero, bit 7
will be set to 1, otherwise, bit 7 (and all other bits in location 1707)
will be zero. This allows a program to "watch" location 1707 and
determine when the timer has timed out.
c. Reading the count in the timer
If the timer has not counted past zero, reading location 1706 will
provide the current timer count and disable the interrupt option;
reading location 170E will provide the current timer count and enable
the interrupt option. Thus the interrupt option can be changed while
the timer is counting down.
If the timer has counted past zero, reading either memory location
1706 or 170E will restore the divide ratio to its previously programmed
value, disable the interrupt option and leave the timer with its current
count (not the count originally written to the timer). Because the timer
never stops counting, the timer will continue to decrement, pass zero,
set the divide rate to 1, and continue to count down at the clock
frequency, unless new information is written to the timer.
H-6
d. Using the interrupt option
In order to use the interrupt option described above, line PB7
(application connector, pin 15) should be connected to either the
IRQ (Expansion Connector, pin 4) or NMI (Expansion Connector, pin 6)
pin depending on the desired interrupt function. PB7 should be
programmed as in input line (it's normal state after a RESET).
NOTE: If the programmer desires to use PB7 as a normal I/O line,
the programmer is responsible for disabling the timer
interrupt option (by writing or reading address 1706)
so that it does not interfere with normal operation
of PB7. Also, PB7 was designed to be wire-ORed with
other possible interrupt sources; if this is not desired,
a 5.1K resistor should be used as a pull-up from PB7 to
+5v. (The pull-up should NOT be used if PB7 is connected
to NMI or IRQ.)
CARD # LOC CODE CARD
3 ; 666666 555555 333333 000000
4 ; 6 5 3 0 0
5 ; 6 5 3 0 0
6 ; 666666 555555 333333 0 0
7 ; 6 6 5 3 0 0
8 ; 6 6 5 3 0 0
9 ; 666666 666666 666666 000000
10 ;
11 ;
12 ;
13 ; 000000 000000 333333
14 ; 0 0 0 0 3
15 ; ------ 0 0 0 0 3
16 ; ------ 0 0 0 0 333333
17 ; ------ 0 0 0 0 3
18 ; 0 0 0 0 3
19 ; 000000 000000 333333
20 ;
21 ;
22 ;
23 ;
24 ;
25 ; COPYRIGHT
26 ; MOS TECHNOLOGY, INC
27 ; DATE: OCT 18, 1975 REV-D
28 ;
29 ;
30 ;
31 ; 6530-003 I.C. IS AN AUDIO CASSETT TAPE
32 ; RECORDER ENTENSION OF THE BASIC
33 ; KIM MONITOR
34 ;
35 ; IT FEATURES TWO BASIC ROUTINES
36 ; LOADT-LOAD MEM FROM AUDIO TAPE
37 ; DUMPT-STOR MEM ONTO AUDIO TAPE
38 ;
39 ; LOADT
40 ; ID=00 IGNORE ID
41 ; ID=FF IGN. ID USE SA FOR START ADDR
42 ; ID=01-FE IGN.ID USE ADDRESS ON TAPE
43 ;
44 ; DUMPT
45 ; ID=00 SHOULD NOT BE USED
46 ; ID=FF SHOULD NOT BE USED
47 ; ID=01-FE NORMAL ID RANGE
48 ; SAL LSB STARTING ADDRESS OF PROGRAM
49 ; SAH MSB
50 ; EAL ENDING ADDRESS OF PROGRAM
51 ; EAH MSB
52 ;
PAGE 3
CARD # LOC CODE CARD
54 ;
55 ; EQUATES
56 ; SET UP FOR 6530-002 I/O
57 ;
58 SAD =$1740 6530 A DATA
59 PADD =$1741 6530 A DATA DIRECTION
60 SBD =$1742 6530 B DATA
61 PBDD =$1743 6530 B DATA DIRECTION
62 CLK1T =$1744 DIV BY 1 TIME
63 CLK8T =$1745 DIV BY 8 TIME
64 CLK64T =$1746 DIV BY 64 TIME
65 CLKKT =$1747 DIV BY 1024 TIME
66 CLKRDI =$1747 READ TIME OUT BIT
67 CLKRDT =$1746 READ TIME
68 ;
69 0000 *=$00EF
70 ; MPU REG. SAVX AREA IN PAGE 0
71 ;
72 00EF PCL *=*+1 PROGRAM CNT LOW
73 00F0 PCH *=*+1 PROGRAM CNT HI
74 00F1 PREG *=*+1 CURRENT STATUS REG
75 00F2 SPUSER *=*+1 CURRENT STACK POINTER
76 00F3 ACC *=*+1 ACCUMULATOR
77 00F4 YREG *=*+1 Y INDEX
78 00F5 XREG *=*+1 X INDEX
79 ;
80 ; KIM FIXED AREA IN PAGE 0
81 ;
82 00F6 CHKHI *=*+1
83 00F7 CHKSUM *=*+1
84 00F8 INL *=*+1 INPUT BUFFER
85 00F9 INH *=*+1 INPUT BUFFER
86 00FA POINTL *=*+1 LSB OF OPEN CELL
87 00FB POINTH *=*+1 MSB OF OPEN CELL
88 00FC TEMP *=*+1
89 00FD TMPX *=*+1
90 00FE CHAR *=*+1
91 00FF MODE *=*+1
92 ;
93 ; KIM FIXED AREA IN PAGE 23
94 ;
95 0100 *=$17E7
96 17E7 CHKL *=*+1
97 17E8 CHKH *=*+1 CHKSUM
98 17E9 SAVX *=*+3
99 17EC VEB *=*+6 VOLATILE EXECUTION BLOCK
100 17F2 CNTL30 *=*+1 TTY DELAY
101 17F3 CNTH30 *=*+1 TTY DELAY
102 17F4 TIMH *=*+1
103 17F5 SAL *=*+1 LOW STARTING ADDRESS
104 17F6 SAH *=*+1 HI STARTING ADDRESS
105 17F7 EAL *=*+1 LOW ENDING ADDRESS
PAGE 4
CARD # LOC CODE CARD
106 17F8 EAH *=*+1 HI ENDING ADDRESS
107 17F9 ID *=*+1 TAPE PROGRAM ID NUMBER
108 ;
109 ; INTERRUPT VECTORS
110 ;
111 17FA NMIV *=*+2 STOP VECTOR (STOP=1C00)
112 17FC RSTV *=*+2 RST VECTOR
113 17FE IRQV *=*+2 IRQ VECTOR (BRK= 1C00)
114 ;
PAGE 5
CARD # LOC CODE CARD
116 1800 *=$1800
117 ;
118 ; INIT VOLATILE EXECUTION BLOCK
119 ; DUMP MEM TO TAPE
120 ;
121 1800 A9 AD DUMPT LDA #$AD LOAD ABSOLUTE INST
122 1802 8D EC 17 STA VEB
123 1805 20 32 19 JSR INTVEB
124 ;
125 1808 A9 27 LDA #$27 TURN OFF DATAIN PB5
126 180A 8D 42 17 STA SBD
127 180D A9 BF LDA #$BF CONVERT PB7 TO OUTPUT
128 180F 8D 43 17 STA PBDD
129 ;
130 1812 A2 64 LDX #$64 100 CHARS
131 1814 A9 16 DUMPT1 LDA #$16 SYNC CHAR'S
132 1816 20 7A 19 JSR OUTCHT
133 1819 CA DEX
134 181A D0 F8 BNE DUMPT1
135 ;
136
137 181C A9 2A LDA #$2A START CHAR
138 181E 20 7A 19 JSR OUTCHT
139 ;
140 1821 AD F9 17 LDA ID OUTPUT ID
141 1824 20 61 19 JSR OUTBT
142 ;
143 1827 AD F5 17 LDA SAL OUTPUT STARTING
144 182A 20 5E 19 JSR OUTBTC ADDRESS
145 182D AD F6 17 LDA SAH
146 1830 20 5E 19 JSR OUTBTC
147 ;
148 1833 AD ED 17 DUMPT2 LDA VEB+1 CHECK FOR LAST
149 1836 CD F7 17 CMP EAL DATA BYTE
150 1839 AD EE 17 LDA VEB+2
151 183C ED F8 17 SBC EAH
152 183F 90 24 BCC DUMPT4
153 ;
154 1841 A9 2F LDA #'/ OUTPUT END OF DATA CHAR
155 1843 20 7A 19 JSR OUTCHT
156 1846 AD E7 17 LDA CHKL LAST BYTE HAS BEEN
157 1849 20 61 19 JSR OUTBT OUTPUT NOW OUTPUT
158 184C AD E8 17 LDA CHKH CHKSUM
159 184F 20 61 19 JSR OUTBT
160 ;
161 ;
162 1852 A2 02 LDX #$02 2 CHAR'S
163 1854 A9 04 DUMPT3 LDA #$04 EOT CHAR
164 1856 20 7A 19 JSR OUTCHT
165 1859 CA DEX
166 185A D0 F8 BNE DUMPT3
167 ;
PAGE 6
CARD # LOC CODE CARD
168 185C A9 00 LDA #$00 DISPLAY 0000
169 185E 85 FA STA POINTL FOR NORMAL EXIT
170 1860 85 FB STA POINTH
171 1862 4C 4F 1C JMP START
172 ;
173 1865 20 EC 17 DUMPT4 JSR VEB DATA BYTE OUTPUT
174 1868 20 5E 19 JSR OUTBTC
175 ;
176 186B 20 EA 19 JSR INCVEB
177 186E 4C 33 18 JMP DUMPT2
178 ;
179 ; LOAD MEMORY FROM TAPE
180 ;
181 ;
182 1871 0F 19 TAB .WORD LOAD12
183 1873 A9 8D LOADT LDA #$8D INIT VOLATILE EXECUTION
184 1875 8D EC 17 STA VEB BLOCK WITH STA ABS.
185 1878 20 32 19 JSR INTVEB
186 ;
187 187B A9 4C LDA #$4C JUMP TYPE RTRN
188 187D 8D EF 17 STA VEB+3
189 1880 AD 71 18 LDA TAB
190 1883 8D F0 17 STA VEB+4
191 1886 AD 72 18 LDA TAB+1
192 1889 8D F1 17 STA VEB+5
193 ;
194 188C A9 07 LDA #$07 RESET PB5=0 (DATA-IN)
195 188E 8D 42 17 STA SBD
196 ;
197 1891 A9 FF SYNC LDA #$FF CLEAR SAVX FOR SYNC CHAR
198 1893 8D E9 17 STA SAVX
199 ;
200 1896 20 41 1A SYNC1 JSR RDBIT GET A BIT
201 1899 4E E9 17 LSR SAVX SHIFT BIT INTO CHAR
202 189C 0D E9 17 ORA SAVX
203 189F 8D E9 17 STA SAVX
204 18A2 AD E9 17 LDA SAVX GET NEW CHAR
205 18A5 C9 16 CMP #$16 SYNC CHAR
206 18A7 D0 ED BNE SYNC1
207 ;
208 18A9 A2 0A LDX #$0A TEST FOR 10 SYNC CHARS
209 18AB 20 24 1A SYNC2 JSR RDCHT
210 18AE C9 16 CMP #$16
211 18B0 D0 DF BNE SYNC IF NOT 10 CHAR, RE-SYNC
212 18B2 CA DEX
213 18B3 D0 F6 BNE SYNC2
214 ;
215 ;
216 18B5 20 24 1A LOADT4 JSR RDCHT LOOK FOR START OF
217 18B8 C9 2A CMP #$2A DATA CHAR
218 18BA F0 06 BEQ LOAD11
219 18BC C9 16 CMP #$16 IF NOT , SHOULD BE SYN
PAGE 7
CARD # LOC CODE CARD
220 18BE D0 D1 BNE SYNC
221 18C0 F0 F3 BEQ LOADT4
222 ;
223 18C2 20 F3 19 LOAD11 JSR RDBYT READ ID FROM TAPE
224 18C5 CD F9 17 CMP ID COMPARE WITH REQUESTED ID
225 18C8 F0 0D BEQ LOADT5
226 18CA AD F9 17 LDA ID DEFAULT 00, READ RECORD
227 18CD C9 00 CMP #$00 ANYWAY
228 18CF F0 06 BEQ LOADT5
229 18D1 C9 FF CMP #$FF DEFAULT FF, IGNORE SA ON
230 18D3 F0 17 BEQ LOADT6 TAPE
231 18D5 D0 9C BNE LOADT
232 ;
233 18D7 20 F3 19 LOADT5 JSR RDBYT GET SA FROM TAPE
234 18DA 20 4C 19 JSR CHKT
235 18DD 8D ED 17 STA VEB+1 SAVX IN VEB+1,2
236 18E0 20 F3 19 JSR RDBYT
237 18E3 20 4C 19 JSR CHKT
238 18E6 8D EE 17 STA VEB+2
239 18E9 4C F8 18 JMP LOADT7
240 ;
241 18EC 20 F3 19 LOADT6 JSR RDBYT GET SA BUT IGNORE
242 18EF 20 4C 19 JSR CHKT
243 18F2 20 F3 19 JSR RDBYT
244 18F5 20 4C 19 JSR CHKT
245 ;
246 ;
247 18F8 A2 02 LOADT7 LDX #$02 GET 2 CHARS
248 18FA 20 24 1A LOAD13 JSR RDCHT GET CHAR (X)
249 18FD C9 2F CMP #$2F LOOK FOR LAST CHAR
250 18FF F0 14 BEQ LOADT8
251 1901 20 00 1A JSR PACKT CONVERT TO HEX
252 1904 D0 23 BNE LOADT9 Y=1 NON-HEX CHAR
253 1906 CA DEX
254 1907 D0 F1 BNE LOAD13
255 ;
256 1909 20 4C 19 JSR CHKT COMPUTE CHECKSUM
257 190C 4C EC 17 JMP VEB SAVX DATA IN MEMORY
258 190F 20 EA 19 LOAD12 JSR INCVEB INCREMENT DATA POINTER
259 1912 4C F8 18 JMP LOADT7
260 ;
261 1915 20 F3 19 LOADT8 JSR RDBYT END OF DATA, COMPARE CHKSUM
262 1918 CD E7 17 CMP CHKL
263 191B D0 0C BNE LOADT9
264 191D 20 F3 19 JSR RDBYT
265 1920 CD E8 17 CMP CHKH
266 1923 D0 04 BNE LOADT9
267 1925 A9 00 LDA #$00 NORMAL EXIT
268 1927 F0 02 BEQ LOAD10
269 ;
270 1929 A9 FF LOADT9 LDA #$FF ERROR EXIT
271 192B 85 FA LOAD10 STA POINTL
PAGE 8
CARD # LOC CODE CARD
272 192D 85 FB STA POINTH
273 192F 4C 4F 1C JMP START
274 ;
PAGE 9
CARD # LOC CODE CARD
276 ;
277 ; SUBROUTINES FOLLOW
278 ;
279 ; SUB TO MOVE SA TO VEB+1,2
280 ;
281 1932 AD F5 17 INTVEB LDA SAL MOVE SA TO VEB+1,2
282 1935 8D ED 17 STA VEB+1
283 1938 AD F6 17 LDA SAH
284 193B 8D EE 17 STA VEB+2
285 193E A9 60 LDA #$60 RTS INST
286 1940 8D EF 17 STA VEB+3
287 1943 A9 00 LDA #$00 CLEAR CHKSUM AREA
288 1945 8D E7 17 STA CHKL
289 1948 8D E8 17 STA CHKH
290 194B 60 RTS
291 ;
292 ; COMPUTE CHKSUM FOR TAPE LOAD
293 ; RTN USES Y TO SAVEX A
294 ;
295 194C A8 CHKT TAY
296 194D 18 CLC
297 194E 6D E7 17 ADC CHKL
298 1951 8D E7 17 STA CHKL
299 1954 AD E8 17 LDA CHKH
300 1957 69 00 ADC #$00
301 1959 8D E8 17 STA CHKH
302 195C 98 TYA
303 195D 60 RTS
304 ;
305 ; OUTPUT ONE BYTE USE Y
306 ; TO SAVX BYTE
307 ;
308 195E 20 4C 19 OUTBTC JSR CHKT COMPARE CHKSUM
309 1961 A8 OUTBT TAY SAVX DATA BYTE
310 1962 4A LSR A SHIFT OFF LSD
311 1963 4A LSR A
312 1964 4A LSR A
313 1965 4A LSR A
314 1966 20 6F 19 JSR HEXOUT OUTPUT MSD
315 1969 98 TYA
316 196A 20 6F 19 JSR HEXOUT OUTPUT LSD
317 196D 98 TYA
318 196E 60 RTS
319 ;
320 ; CONVERT LSD OF A TO ASCII
321 ; OUTPUT TO TAPE
322 ;
323 196F 29 0F HEXOUT AND #$0F
324 1971 C9 0A CMP #$0A
325 1973 18 CLC
326 1974 30 02 BMI HEX1
327 1976 69 07 ADC #$07
PAGE 10
CARD # LOC CODE CARD
328 1978 69 30 HEX1 ADC #$30
329 ;
330 ; OUTPUT TO TAPE ONE ASCII
331 ; CHAR USE SUB'S ONE + ZRO
332 ;
333 197A 8E E9 17 OUTCHT STX SAVX
334 197D 8C EA 17 STY SAVX+1
335 1980 A0 08 LDY #$08 START BIT
336 1982 20 9E 19 CHT1 JSR ONE
337 1985 4A LSR A GET DATA BIT
338 1986 B0 06 BCS CHT2
339 1988 20 9E 19 JSR ONE DATA BIT=1
340 198B 4C 91 19 JMP CHT3
341 198E 20 C4 19 CHT2 JSR ZRO DATA BIT=0
342 1991 20 C4 19 CHT3 JSR ZRO
343 1994 88 DEY
344 1995 D0 EB BNE CHT1
345 1997 AE E9 17 LDX SAVX
346 199A AC EA 17 LDY SAVX+1
347 199D 60 RTS
348 ;
349 ;
340 ; OUTPUT 1 TO TAPE
351 ; 9 PULSES, 138 MICROSEC EACH
352 ;
353 199E A2 09 ONE LDX #$09
354 19A0 48 PHA SAVX A
355 19A1 2C 47 17 ONE1 BIT CLKRDI WAIT FOR TIME OUT
356 19A4 10 FB BPL ONE1
357 19A6 A9 7E LDA #126
358 19A8 8D 44 17 STA CLK1T
359 19AB A9 A7 LDA #$A7
360 19AD 8D 42 17 STA SBD SET PB7=1
361 19B0 2C 47 17 ONE2 BIT CLKRDI
362 19B3 10 FB BPL ONE2
363 19B5 A9 7E LDA #126
364 19B7 8D 44 17 STA CLK1T
365 19BA A9 27 LDA #$27
366 19BC 8D 42 17 STA SBD RESET PB7=0
367 19BF CA DEX
368 19C0 D0 DF BNE ONE1
369 19C2 68 PLA
370 19C3 60 RTS
371 ;
372 ;
373 ; OUTPUT 0 TO TAPE
374 ; 6 PULSES, 207 MICROSEC EACH
375 ;
376 19C4 A2 06 ZRO LDX #$06
377 19C6 48 PHA SAVX A
378 19C7 2C 47 17 ZRO1 BIT CLKRDI
379 19CA 10 FB BPL ZRO1
PAGE 11
CARD # LOC CODE CARD
380 19CC A9 C3 LDA #$C3
381 19CE 8D 44 17 STA CLK1T
382 19D1 A9 A7 LDA #$A7
383 19D3 8D 42 17 STA SBD SET PB7=1
384 19D6 2C 47 17 ZRO2 BIT CLKRDI
385 19D9 10 FB BPL ZRO2
386 19DB A9 C3 LDA #195
387 19DD 8D 44 17 STA CLK1T
388 19E0 A9 27 LDA #$27
389 19E2 8D 42 17 STA SBD RESET PB7=0
390 19E5 CA DEX
391 19E6 D0 DF BNE ZRO1
392 19E8 68 PLA RESTORE A
393 19E9 60 RTS
394 ;
395 ; SUB TO INC VEB+1,2
396 ;
397 19EA EE ED 17 INCVEB INC VEB+1
398 19ED D0 03 BNE INCVE1
399 19EF EE EE 17 INC VEB+2
400 19F2 60 INCVE1 RTS
401 ;
402 ; SUB TO READ BYTE FROM TAPE
403 ;
404 19F3 20 24 1A RDBYT JSR RDCHT
405 19F6 20 00 1A JSR PACKT
406 19F9 20 24 1A JSR RDCHT
407 19FC 20 00 1A JSR PACKT
408 19FF 60 RTS
409 ;
410 ; PACK A=ASCII INTO SAVX
411 ; AS HEX DATA
412 ;
413 1A00 C9 30 PACKT CMP #$30
414 1A02 30 1E BMI PACKT3
415 1A04 C9 47 CMP #$47
416 1A06 10 1A BPL PACKT3
417 1A08 C9 40 CMP #$40
418 1A0A 30 03 BMI PACKT1
419 1A0C 18 CLC
420 1A0D 69 09 ADC #$09
421 1A0F 2A PACKT1 ROL A
422 1A10 2A ROL A
423 1A11 2A ROL A
424 1A12 2A ROL A
425 1A13 A0 04 LDY #$04
426 1A15 2A PACKT2 ROL A
427 1A16 2E E9 17 ROL SAVX
428 1A19 88 DEY
429 1A1A D0 F9 BNE PACKT2
430 1A1C AD E9 17 LDA SAVX
431 1A1F A0 00 LDY #$00 Y=0 VALID HEX CHAR
PAGE 12
CARD # LOC CODE CARD
432 1A21 60 RTS
433 1A22 C8 PACKT3 INY Y=1 NOT HEX
434 1A23 60 RTS
435 ;
436 ; GET 1 CHAR FROM TAPE AND RETURN
437 ; WITH CHAR IN A USE SAVX+1 TO ASM CHAR
438 ;
439 1A24 8E EB 17 RDCHT STX SAVX+2
440 1A27 A2 08 LDX #$08 READ 8 BITS
441 1A29 20 41 1A RDCHT1 JSR RDBIT GET NEXT DATA BIT
442 1A2C 4E EA 17 LSR SAVX+1 RIGHT SHIFT CHAR
443 1A2F 0D EA 17 ORA SAVX+1 OR IN SIGN BIT
444 1A32 8D EA 17 STA SAVX+1 REPLACE CHAR
445 1A35 CA DEX
446 1A36 D0 F1 BNE RDCHT1
447 ;
448 1A38 AD EA 17 LDA SAVX+1 MOVE CHAR INTO A
449 1A3B 2A ROL A SHIFT OFF PARITY
450 1A3C 4A LSR A
451 1A3D AE EB 17 LDX SAVX+2
452 1A40 60 RTS
453 ;
454 ; THIS SUB GETS ONE BIT FROM
455 ; TAPE AND RETURNS IT IN SIGN OF A
456 ;
457 1A41 2C 42 17 RDBIT BIT SBD WAIT FOR END OF START BIT
458 1A44 10 FB BPL RDBIT
459 1A46 AD 46 17 LDA CLKRDT GET START BIT TIME
460 1A49 A0 FF LDY #$FF A=256-T1
461 1A4B 8C 46 17 STY CLK64T SET UP TIMER
462 ;
463 1A4E A0 14 LDY #$14
464 1A50 88 RDBIT3 DEY DELAY 100 MICROSEC
465 1A51 D0 FD BNE RDBIT3
466 ;
467 1A53 2C 42 17 RDBIT2 BIT SBD
468 1A56 30 FB BMI RDBIT2 WAIT FOR NEXT START BIT
469
470 1A58 38 SEC
471 1A59 ED 46 17 SBC CLKRDT (256-T1)-(256-T2)=T2-T1
472 1A5C A0 FF LDY #$FF
473 1A5E 8C 46 17 STY CLK64T SET UP TIMER FOR NEXT BIT
474
475 1A61 A0 07 LDY #$07
476 1A63 88 RDBIT4 DEY DELAY 50 MICROSEC
477 1A64 D0 FD BNE RDBIT4
478 ;
479 1A66 49 FF EOR #$FF COMPLEMENT SIGN OF A
480 1A68 29 80 AND #$80 MASK ALL EXCEPT SIGN
481 1A6A 60 RTS
CARD # LOC CODE CARD
545 ;
546 ;
547 ;
548 ; COPYRIGHT
549 ; MOS TECHNOLOGY INC.
550 ; DATE OCT 13 1975 REV E
551 ;
552 ; KIM :TTY INTERFACE
553 ; :KEYBOARD INTERFACE
554 ; :7 SEG 6 DIGIT DISPLAY
555 ;
556 ;
557 ; TTY CMDS:
558 ; G GOEXEC
559 ; CR OPEN NEXT CELL
560 ; LF OPEN PREV. CELL
561 ; . MODIFY OPEN CELL
562 ; SP OPEN NEW CELL
563 ; L LOAD (OBJECT FORMAT)
564 ; Q DUMP FROM OPEN CELL ADDR TO HI LIMIT
565 ; RO RUB OUT - RETURN TO START (KIM)
566 ; ((ALL ILLEGAL CHARS ARE IGNORED))
567 ;
568 ; KEYBOARD COMMANDS:
569 ; ADDR SETS MODE TO MODIFY CELL ADDRESS
570 ; DATA SETS MODE TO MODIFY DATA IN OPEN CELL
571 ; STEP INCREMENTS TO NEXT CELL
572 ; RST SYSTEM RESET
573 ; RUN GOEXEC
574 ; STOP $1C00 CAN BE LOADED INTO NMIV TO
575 ; USE STOP FEATURE
576 ; PC DISPLAY PC
577 ;
578 ; CLOCK IS NOT DISABLED IN SIGMA 1
579 ;
580 ;
581 ;
582 ;
PAGE 16
CARD # LOC CODE CARD
584 *=$1C00
585 ;
586 ;
587 1C00 85 F3 SAVE STA ACC KIM ENTRY VIA STOP (NMI)
588 1C02 68 PLA OR BRK (IRQ)
589 1C03 85 F1 STA PREG
590 1C05 68 PLA KIM ENTRY VIA JSR (A LOST)
591 1C06 85 EF STA PCL
592 1C08 85 FA STA POINTL
593 1C0A 68 PLA
594 1C0B 85 F0 STA PCH
595 1C0D 85 FB STA POINTH
596 1C0F 84 F4 STY YREG
597 1C11 86 F5 STX XREG
598 1C13 BA TSX
599 1C14 86 F2 STX SPUSER
600 1C16 20 88 1E JSR INITS
601 1C19 4C 4F 1C JMP START
602 ;
603 1C1C 6C FA 17 NMIT JMP (NMIV) NON-MASKABLE INTERRUPT TRAP
604 1C1F 6C FE 17 IRQT JMP (IRQV) INTERRUPT TRAP
605 ;
606 1C22 A2 FF RST LDX #$FF KIM ENTRY VIA RST
607 1C24 9A TXS
608 1C25 86 F2 STX SPUSER
609 1C27 20 88 1E JSR INITS
610 ;
611 ;
612 1C2A A9 FF LDA #$FF COUNT START BIT
613 1C2C 8D F3 17 STA CNTH30 ZERO CNTH30
614 1C2F A9 01 LDA #$01 MASK HI ORDER BITS
615 1C31 2C 40 17 DET1 BIT SAD TEST
616 1C34 D0 19 BNE START KEYBD SSW TEST
617 1C36 30 F9 BMI DET1 START BIT TEST
618 1C38 A9 FC LDA #$FC
619 1C3A 18 DET3 CLC THIS LOOP COUNTS
620 1C3B 69 01 ADC #$01 THE START BIT TIME
621 1C3D 90 03 BCC DET2
622 1C3F EE F3 17 INC CNTH30
623 1C42 AC 40 17 DET2 LDY SAD CHECK FOR END OF START BIT
624 1C45 10 F3 BPL DET3
625 1C47 8D F2 17 STA CNTL30
626 1C4A A2 08 LDX #$08
627 1C4C 20 6A 1E JSR GET5 GET REST OF THE CHAR, TEST CHAR
628 ;
629 ;
630 ;
631 ;
632 ;
633 ;
634 ; MAKE TTY/KB SELECTION
635 ;
PAGE 17
CARD # LOC CODE CARD
636 1C4F 20 8C 1E START JSR INIT1
637 1C52 A9 01 LDA #$01
638 1C54 2C 40 17 BIT SAD
639 1C57 D0 1E BNE TTYKB
640 1C59 20 2F 1E JSR CRLF PRT CR LF
641 1C5C A2 0A LDX #$0A TYPE OUT KIM
642 1C5E 20 31 1E JSR PRTST
643 1C61 4C AF 1D JMP SHOW1
644 ;
645 1C64 A9 00 CLEAR LDA #$00
646 1C66 85 F8 STA INL CLEAR INPUT BUFFER
647 1C68 85 F9 STA INH
648 1C6A 20 5A 1E READ JSR GETCH GET CHAR
649 1C6D C9 01 CMP #$01
650 1C6F F0 06 BEQ TTYKB
651 1C71 20 AC 1F JSR PACK
652 1C74 4C DB 1D JMP SCAN
653 ;
654 ; MAIN ROUTINE FOR KEY BOARD
655 ; AND DISPLAY
656 ;
657 1C77 20 19 1F TTYKB JSR SCAND IF A=0 NO KEY
658 1C7A D0 D3 BNE START
659 1C7C A9 01 TTYKB1 LDA #$01
660 1C7E 2C 40 17 BIT SAD
661 1C81 F0 CC BEQ START
662 1C83 20 19 1F JSR SCAND
663 1C86 F0 F4 BEQ TTYKB1
664 1C88 20 19 1F JSR SCAND
665 1C8B F0 EF BEQ TTYKB1
666 ;
667 1C8D 20 6A 1F GETK JSR GETKEY
668 1C90 C9 15 CMP #$15
669 1C92 10 BB BPL START
670 1C94 C9 14 CMP #$14
671 1C96 F0 44 BEQ PCCMD DISPLAY PC
672 1C98 C9 10 CMP #$10 ADDR MODE=1
673 1C9A F0 2C BEQ ADDRM
674 1C9C C9 11 CMP #$11 DATA MODE=1
675 1C9E F0 2C BEQ DATAM
676 1CA0 C9 12 CMP #$12 STEP
677 1CA2 F0 2F BEQ STEP
678 1CA4 C9 13 CMP #$13 RUN
679 1CA6 F0 31 BEQ GOV
680 1CA8 0A DATA ASL A SHIFT CHAR INTO HIGH
681 1CA9 0A ASL A ORDER NIBBLE
682 1CAA 0A ASL A
683 1CAB 0A ASL A
684 1CAC 85 FC STA TEMP STORE IN TEMP
685 1CAE A2 04 LDX #$04
686 1CB0 A4 FF DATA1 LDY MODE TEST MODE 1=ADDR
687 1CB2 D0 0A BNE ADDR MODE=0 DATA
PAGE 18
CARD # LOC CODE CARD
688 1CB4 B1 FA LDA (POINTL),Y GET DATA
689 1CB6 06 FC ASL TEMP SHIFT CHAR
690 1CB8 2A ROL A SHIFT DATA
691 1CB9 91 FA STA (POINTL),Y STORE OUT DATA
692 1CBB 4C C3 1C JMP DATA2
693 ;
694 1CBE 0A ADDR ASL A SHIFT CHAR
695 1CBF 26 FA ROL POINTL SHIFT ADDR
696 1CC1 26 FB ROL POINTH SHIFT ADDR HI
697 1CC3 CA DATA2 DEX
698 1CC4 D0 EA BNE DATA1 DO 4 TIMES
699 1CC6 F0 08 BEQ DATAM2 EXIT HERE
700 ;
701 1CC8 A9 01 ADDRM LDA #$01
702 1CCA D0 02 BNE DATAM1
703 ;
704 1CCC A9 00 DATAM LDA #$00
705 1CCE 85 FF DATAM1 STA MODE
706 1CD0 4C 4F 1C DATAM2 JMP START
707 ;
708 1CD3 20 63 1F STEP JSR INCPT
709 1CD6 4C 4F 1C JMP START
710 ;
711 1CD9 4C C8 1D GOV JMP GOEXEC
712 ;
713 ;
714 ; DISPLAY PC BY MOVING
715 ; PC TO POINT
716 ;
717 1CDC A5 EF PCCMD LDA PCL
718 1CDE 85 FA STA POINTL
719 1CE0 A5 F0 LDA PCH
720 1CE2 85 FB STA POINTH
721 1CE4 4C 4F 1C JMP START
722 ;
723 ; LOAD PAPER TAPE FROM TTY
724 ;
725 1CE7 20 5A 1E LOAD JSR GETCH LOOK FOR FIRST CHAR
726 1CEA C9 3B CMP #$3B SMICOLON
727 1CEC D0 F9 BNE LOAD
728 1CEE A9 00 LDA #$00
729 1CF0 85 F7 STA CHKSUM
730 1CF2 85 F6 STA CHKHI
731 ;
732 1CF4 20 9D 1F JSR GETBYT GET BYTE CNT
733 1CF7 AA TAX SAVE IN X INDEX
734 1CF8 20 91 1F JSR CHK COMPUTE CHKSUM
735 ;
736 1CFB 20 9D 1F JSR GETBYT GET ADDRESS HI
737 1CFE 85 FB STA POINTH
738 1D00 20 91 1F JSR CHK
739 1D03 20 9D 1F JSR GETBYT GET ADDRESS LO
PAGE 19
CARD # LOC CODE CARD
740 1D06 85 FA STA POINTL
741 1D08 20 91 1F JSR CHK
742 ;
743 1D0B 8A TXA IF CNT=0 DONT
744 1D0C F0 0F BEQ LOAD3 GET ANY DATA
745 ;
746 1D0E 20 9D 1F LOAD2 JSR GETBYT GET DATA
747 1D11 91 FA STA (POINTL),Y STORE DATA
748 1D13 20 91 1F JSR CHK
749 1D16 20 63 1F JSR INCPT NEXT ADDRESS
750 1D19 CA DEX
751 1D1A D0 F2 BNE LOAD2
752 1D1C E8 INX X=1 DATA RECORD
753 ; X=0 LAST RECORD
754 1D1D 20 9D 1F LOAD3 JSR GETBYT COMPARE CHKSUM
755 1D20 C5 F6 CMP CHKHI
756 1D22 D0 17 BNE LOADE1
757 1D24 20 9D 1F JSR GETBYT
758 1D27 C5 F7 CMP CHKSUM
759 1D29 D0 13 BNE LOADER
760 ;
761 1D2B 8A TXA X=0 LAST RECORD
762 1D2C D0 B9 BNE LOAD
763 ;
764 1D2E A2 0C LOAD7 LDX #$0C X-OFF KIM
765 1D30 A9 27 LOAD8 LDA #$27
766 1D32 8D 42 17 STA SBD DISABLE DATA IN
767 1D35 20 31 1E JSR PRTST
768 1D38 4C 4F 1C JMP START
769 ;
770 1D3B 20 9D 1F LOADE1 JSR GETBYT DUMMY
771 1D3E A2 11 LOADER LDX #$11 X-OFF ERR KIM
772 1D40 D0 EE BNE LOAD8
773 ;
774 ; DUMP TO TTY
775 ; FROM OPEN CELL ADDRESS
776 ; TO LIMHL,LIMHH
777 ;
778 1D42 A9 00 DUMP LDA #$00
779 1D44 85 F8 STA INL
780 1D46 85 F9 STA INH CLEAR RECORD COUNT
781 1D48 A9 00 DUMP0 LDA #$00
782 1D4A 85 F6 STA CHKHI CLEAR CHKSUM
783 1D4C 85 F7 STA CHKSUM
784 ;
785 1D4E 20 2F 1E JSR CRLF PRINT CR LF
786 1D51 A9 3B LDA #$3B PRINT SEMICOLON
787 1D53 20 A0 1E JSR OUTCH
788 1D56 A5 FA LDA POINTL TEST POINT GT OR ET
789 1D58 CD F7 17 CMP EAL HI LIMIT GOTO EXIT
790 1D5B A5 FB LDA POINTH
791 1D5D ED F8 17 SBC EAH
PAGE 20
CARD # LOC CODE CARD
792 1D60 90 18 BCC DUMP4
793 ;
794 1D62 A9 00 LDA #$00 PRINT LAST RECORD
795 1D64 20 3B 1E JSR PRTBYT 0 BYTES
796 1D67 20 CC 1F JSR OPEN
797 1D6A 20 1E 1E JSR PRTPNT
798 ;
799 1D6D A5 F6 LDA CHKHI PRINT CHKSUM
800 1D6F 20 3B 1E JSR PRTBYT FOR LAST RECORD
801 1D72 A5 F7 LDA CHKSUM
802 1D74 20 3B 1E JSR PRTBYT
803 1D77 4C 64 1C JMP CLEAR
804 ;
805 1D7A A9 18 DUMP4 LDA #$18 PRINT 24 BYTE COUNT
806 1D7C AA TAX SAVE AS INDEX
807 1D7D 20 3B 1E JSR PRTBYT
808 1D80 20 91 1F JSR CHK
809 1D83 20 1E 1E JSR PRTPNT
810 ;
811 1D86 A0 00 DUMP2 LDY #$00 PRINT 24 BYTES
812 1D88 B1 FA LDA (POINTL),Y GET DATA
813 1D8A 20 3B 1E JSR PRTBYT PRINT DATA
814 1D8D 20 91 1F JSR CHK COMPUTE CHKSUM
815 1D90 20 63 1F JSR INCPT INCREMENT POINT
816 1D93 CA DEX
817 1D94 D0 F0 BNE DUMP2
818 ;
819 1D96 A5 F6 LDA CHKHI PRINT CHKSUM
820 1D98 20 3B 1E JSR PRTBYT
821 1D9B A5 F7 LDA CHKSUM
822 1D9D 20 3B 1E JSR PRTBYT
823 1DA0 E6 F8 INC INL INCR RECORD COUNT
824 1DA2 D0 02 BNE DUMP3
825 1DA4 E6 F9 INC INH
826 1DA6 4C 48 1D DUMP3 JMP DUMP0
827 ;
828 1DA9 20 CC 1F SPACE JSR OPEN OPEN NEW CELL
829 1DAC 20 2F 1E SHOW JSR CRLF PRINT CR LF
830 1DAF 20 1E 1E SHOW1 JSR PRTPNT
831 1DB2 20 9E 1E JSR OUTSP PRINT SPACE
832 1DB5 A0 00 LDY #$00 PRINT DATA SPECIFIED
833 1DB7 B1 FA LDA (POINTL),Y BY POINT AD=LDA EXT
834 1DB9 20 3B 1E JSR PRTBYT
835 1DBC 20 9E 1E JSR OUTSP PRINT SPACE
836 1DBF 4C 64 1C JMP CLEAR
837 ;
838 1DC2 20 63 1F RTRN JSR INCPT OPEN NEXT CELL
839 1DC5 4C AC 1D JMP SHOW
840 ;
841 1DC8 A6 F2 GOEXEC LDX SPUSER
842 1DCA 9A TXS
843 1DCB A5 FB LDA POINTH PROGRAM RUNS FROM
PAGE 21
CARD # LOC CODE CARD
844 1DCD 48 PHA OPEN CELL ADDRESS
845 1DCE A5 FA LDA POINTL
846 1DD0 48 PHA
847 1DD1 A5 F1 LDA PREG
848 1DD3 48 PHA
849 1DD4 A6 F5 LDX XREG RESTORE REGS
850 1DD6 A4 F4 LDY YREG
851 1DD8 A5 F3 LDA ACC
852 1DDA 40 RTI
853 ;
854 1DDB C9 20 SCAN CMP #$20 OPEN CELL
855 1DDD F0 CA BEQ SPACE
856 1DDF C9 7F CMP #$7F RUB OUT (KIM)
857 1DE1 F0 1B BEQ STV
858 1DE3 C9 0D CMP #$0D NEXT CELL
859 1DE5 F0 DB BEQ RTRN
860 1DE7 C9 0A CMP #$0A PREV CELL
861 1DE9 F0 1C BEQ FEED
862 1DEB C9 2E CMP #'. MODIFY CELL
863 1DED F0 26 BEQ MODIFY
864 1DEF C9 47 CMP #'G GO EXEC
865 1DF1 F0 D5 BEQ GOEXEC
866 1DF3 C9 51 CMP #'Q DUMP FROM OPEN CELL TO HI LIMIT
867 1DF5 F0 0A BEQ DUMPV
868 1DF7 C9 4C CMP #'L LOAD TAPE
869 1DF9 F0 09 BEQ LOADV
870 1DFB 4C 6A 1C JMP READ IGNORE ILLEGAL CHAR
871 ;
872 1DFE 4C 4F 1C STV JMP START
873 1E01 4C 42 1D DUMPV JMP DUMP
874 1E04 4C E7 1C LOADV JMP LOAD
875 ;
876 1E07 38 FEED SEC
877 1E08 A5 FA LDA POINTL DEC DOUBLE BYTE
878 1E0A E9 01 SBC #$01 AT POINTL AND POINTH
879 1E0C 85 FA STA POINTL
880 1E0E B0 02 BCS FEED1
881 1E10 C6 FB DEC POINTH
882 1E12 4C AC 1D FEED1 JMP SHOW
883 ;
884 1E15 A0 00 MODIFY LDY #$00 GET CONTENTS OF INPUT BUFF
885 1E17 A5 F8 LDA INL INL AND STORE IN LOC
886 1E19 91 FA STA (POINTL),Y SPECIFIED BY POINT
887 1E1B 4C C2 1D JMP RTRN
888 ;
889 ; END OF MAIN LINE
PAGE 22
CARD # LOC CODE CARD
891 ; SUBROUTINES FOLLOW
892 ;
893 ;
894 ;
895 ; SUB TO PRINT POINTL,POINTH
896 ;
897 1E1E A5 FB PRTPNT LDA POINTH
898 1E20 20 3B 1E JSR PRTBYT
899 1E23 20 91 1F JSR CHK
900 1E26 A5 FA LDA POINTL
901 1E28 20 3B 1E JSR PRTBYT
902 1E2B 20 91 1F JSR CHK
903 1E2E 60 RTS
904 ;
905 ; PRINT STRING OF ASCII CHARS FROM
906 ; TOP+X TO TOP
907 ;
908 1E2F A2 07 CRLF LDX #$07
909 1E31 BD D5 1F PRTST LDA TOP,X
910 1E34 20 A0 1E JSR OUTCH
911 1E37 CA DEX
912 1E38 10 F7 BPL PRTST STOP ON INDEX ZERO
913 1E3A 60 RTS
914 ;
915 ; PRINT 1 HEX BYTE AS TWO ASCII CHAR'S
916 ;
917 1E3B 85 FC PRTBYT STA TEMP
918 1E3D 4A LSR A SHIFT CHAR RIGHT 4 BITS
919 1E3E 4A LSR A
920 1E3F 4A LSR A
921 1E40 4A LSR A
922 1E41 20 4C 1E JSR HEXTA CONVERT TO HEX AND PRINT
923 1E44 A5 FC LDA TEMP GET OTHER HALF
924 1E46 20 4C 1E JSR HEXTA CONVERT TO HEX AND PRINT
925 1E49 A5 FC LDA TEMP RESTORE BYTE IN A AND RETURN
926 1E4B 60 RTS
927 ;
928 1E4C 29 0F HEXTA AND #$0F MASK HI 4 BITS
929 1E4E C9 0A CMP #$0A
930 1E50 18 CLC
931 1E51 30 02 BMI HEXTA1
932 1E53 69 07 ADC #$07 ALPHA HEX
933 1E55 69 30 HEXTA1 ADC #$30 DEC HEX
934 1E57 4C A0 1E JMP OUTCH PRINT CHAR
935 ;
936 ; GET 1 CHAR FROM TTY
937 ; CHAR IN A
938 ; X IS PRESERVED AND Y RETURNED = FF
939 ;
940 1E5A 86 FD GETCH STX TMPX SAVE X REG
941 1E5C A2 08 LDX #$08 SET UP 8-BIT CNT
942 1E5E A9 01 LDA #$01
PAGE 23
CARD # LOC CODE CARD
943 1E60 2C 40 17 GET1 BIT SAD
944 1E63 D0 22 BNE GET6
945 1E65 30 F9 BMI GET1 WAIT FOR START BIT
946 1E67 20 D4 1E JSR DELAY DELAY 1 BIT
947 1E6A 20 EB 1E GET5 JSR DEHALF DELAY 1/2 BIT TIME
948 1E6D AD 40 17 GET2 LDA SAD GET 8 BITS
949 1E70 29 80 AND #$80 MASK OFF LOW ORDER BITS
950 1E72 46 FE LSR CHAR SHIFT RIGHT CHAR
951 1E74 05 FE ORA CHAR
952 1E76 85 FE STA CHAR
953 1E78 20 D4 1E JSR DELAY DELAY 1 BIT TIME
954 1E7B CA DEX
955 1E7C D0 EF BNE GET2 GET NEXT CHAR
956 1E7E 20 EB 1E JSR DEHALF EXIT THIS RTN
957 ;
958 1E81 A6 FD LDX TMPX
959 1E83 A5 FE LDA CHAR
960 1E85 2A ROL A SHIFT OFF PARITY
961 1E86 4A LSR A
962 1E87 60 GET6 RTS
963 ;
964 ; INITIALIZATION FOR SIGMA
965 ;
966 1E88 A2 01 INITS LDX #$01 SET KB MODE TO ADDR
967 1E8A 86 FF STX MODE
968 ;
969 1E8C A2 00 INIT1 LDX #$00
970 1E8E 8E 41 17 STX PADD FOR SIGMA USE SADD
971 1E91 A2 3F LDX #$3F
972 1E93 8E 43 17 STX PBDD FOR SIGMA USE SBDD
973 1E96 A2 07 LDX #$07 ENABLE DATA IN
974 1E98 8E 42 17 STX SBD OUTPUT
975 1E9B D8 CLD
976 1E9C 78 SEI
977 1E9D 60 RTS
978 ;
979 ; PRINT 1 CHAR CHAR IN A
980 ; X IS PRESERVED Y RETURNED = FF
981 ; OUTSP PRINTS 1 SPACE
982 ;
983 1E9E A9 20 OUTSP LDA #$20
984 1EA0 85 FE OUTCH STA CHAR
985 1EA2 86 FD STX TMPX
986 1EA4 20 D4 1E JSR DELAY 10/11 BIT CODE SYNC
987 1EA7 AD 42 17 LDA SBD START BIT
988 1EAA 29 FE AND #$FE
989 1EAC 8D 42 17 STA SBD
990 1EAF 20 D4 1E JSR DELAY
991 1EB2 A2 08 LDX #$08
992 1EB4 AD 42 17 OUT1 LDA SBD DATA BIT
993 1EB7 29 FE AND #$FE
994 1EB9 46 FE LSR CHAR
PAGE 24
CARD # LOC CODE CARD
995 1EBB 69 00 ADC #$00
996 1EBD 8D 42 17 STA SBD
997 1EC0 20 D4 1E JSR DELAY
998 1EC3 CA DEX
999 1EC4 D0 EE BNE OUT1
1000 1EC6 AD 42 17 LDA SBD STOP BIT
1001 1EC9 09 01 ORA #$01
1002 1ECB 8D 42 17 STA SBD
1003 1ECE 20 D4 1E JSR DELAY STOP BIT
1004 1ED1 A6 FD LDX TMPX RESTORE INDEX
1005 1ED3 60 RTS
1006 ;
1007 ; DELAY 1 BIT TIME
1008 ; AS DETERMEND BY DETCPS
1009 ;
1010 1ED4 AD F3 17 DELAY LDA CNTH30 THIS LOOP SIMULATES
1011 1ED7 8D F4 17 STA TIMH DETCPS SECTION AND WILL DELAY
1012 1EDA AD F2 17 LDA CNTL30 1 BIT TIME
1013 1EDD 38 DE2 SEC
1014 1EDE E9 01 DE4 SBC #$01
1015 1EE0 B0 03 BCS DE3
1016 1EE2 CE F4 17 DEC TIMH
1017 1EE5 AC F4 17 DE3 LDY TIMH
1018 1EE8 10 F3 BPL DE2
1019 1EEA 60 RTS
1020 ;
1021 ; DELAY 1/2 BIT TIME
1022 1EEB AD F3 17 DEHALF LDA CNTH30 DOUBLE RIGHT SHIFT OF DELAY
1023 1EEE 8D F4 17 STA TIMH CONSTANT FOR A DIV BY 2
1024 1EF1 AD F2 17 LDA CNTL30
1025 1EF4 4A LSR A
1026 1EF5 4E F4 17 LSR TIMH
1027 1EF8 90 E3 BCC DE2
1028 1EFA 09 80 ORA #$80
1029 1EFC B0 E0 BCS DE4
1030 ;
1031 ; SUB TO DETERMINE IF KEY IS
1032 ; DEPRESSED OR CONDITION OF SSW
1033 ; KEY NOT DEP OR TTY MODE A=0
1034 ; KEY DEP OR KB MODE A NOT ZERO
1035 ;
1036 ;
1037 1EFE A0 03 AK LDY #$03 3 ROWS
1038 1F00 A2 01 LDX #$01 DIGIT 0
1039 ;
1040 1F02 A9 FF ONEKEY LDA #$FF
1041 1F04 8E 42 17 AK1 STX SBD OUTPUT DIGIT
1042 1F07 E8 INX GET NEXT DIGIT
1043 1F08 E8 INX
1044 1F09 2D 40 17 AND SAD INPUT SEGMENTS
1045 1F0C 88 DEY
1046 1F0D D0 F5 BNE AK1