K-1008 Test programs

The manuals for the K-1008 contain test programs:

Links contain archives with source and binaries in papertape.

This is how the K-1008 Memory test program looks like in the KIM-1 Simulator

KIM-5

The KIM-5 ROM board can hold 8 6540 mask programmable ROMs.
Known are the 3x 6540 Resident Assembler/Editor ($200) and 1x 6540 KIMath (50$)

On this page:


Where is KIM Going?
Richard Simpson, KIM Forum, Kilobaud 1977

One of the questions most frequently asked me was “what are the future plans for KIM?” Most KIM owners are aware that MOS offers a KIM-2 4K RAM expansion board and a KIM-3 8K RAM expansion board. Either of these can be attached directly to a KIM-1. To expand further, a motherboard (KIM-4) must be added and MOS has planned a KIM-5 ROM expansion board, which will hold up to eight MCS6504 (2K by 8) mask-programmed ROMs (the ROMs are not provided with the KIM-5 but must be purchased separately). At present, there are two sets of software which are planned for release in ROMs – KIMath and a resident assembler/editor.

KIMath
KIMath will occupy a single ROM and consists of a set of subroutines for doing floating-point arithmetic. All calculations are done in BCD to avoid the round-off errors which are inherent in binary floatingpoint routines. The subroutine user can specify the precision (in decimal digits) of any calculation. The more precision specified, of course, the longer the computation time. The package will handle a maximum of sixteen decimal digits of precision plus a two digit exponent so numbers in the range of ±1 times 10E±98 can be handled. The subroutines occupy memory locations F800-FFF8 and were written so they could be used with any 650Xbased system – not just KIM. The subroutines include code for addition, subtraction, multiplication, division, square roots, logs, exponents, tangents and arctangents. All the other trig functions can be generated through the use of trigonometric identities. A subroutine is also provided for evaluating user-specified polynomials, so any continuous function can be approximated.The KIMath ROM should be available by the time you read this. If you don’t want to pay $50 for the ROM, the Programming Manual for KIMath is available for $15 and it includes a complete listing of both source and object code. The manual also contains thirtyseven pages of information on using the subroutines, including a worked-out sample application. If you want to use the ROM but balk at paying $80 for the KIM-5 board to hold it, you’ll be happy to know that the 6540 ROM can be attached directly to the KIM address and data busses, although you’ll need a couple of extra ICs to send the right signal to the KIM-1 Decode Enable line. I’ll provide an interface schematic for this in a future issue of the KIM forum.

The Resident Assembler /Editor
To create any large-scale software on a microcomputer, an assembler is a necessity. Industrial microcomputer users can use the crossassemblers available on several commercial timesharing systems, but the expense of going this route is too much for any but the most affluent hobbyist. Thus, the introduction of the KIM resident assembler should facilitate user software generation and make a lot more software available. The assembler and text editor are available as a set of three MCS6540 ROMs – a total of 6K of code. The $150 which MOS charges for the set may seem exorbitant until you realize that you don’t have to buy 6K of RAM to store it in (which would cost as much or more) and you’ll never have to load it or have it clobbered by errant statements in the program you are developing. Like KIMath, the Assembler/ Editor will work on any 650X-based system. Since the program has to do terminal I/O, locations are reserved in memory page zero to contain the address of the terminal input and output routines. These locations are automatically initialized for KIM owners; users of other 6500 systems (JOLT, TIM, Apple, Baby!, OSI, etc.) can preset those locations with the addresses for the device service routines of their own system. The Editor/Assembler occupies the memory space from E000 to F7FF; thus the editor, assembler, and KIMath fit together in the top 8K of memory.The text editor is a standard line-numbered text editor; it provides much the same editing capability you would find in a BASIC system. You can enter or insert new lines, replace old lines, resequence the line numbers, dump the text file to audio cassette or paper tape, list out lines in the file, and locate lines in the file which contain any specified text string. There is also a special command (actually, any command which begins with an X) to allow you to jump to a user-written subroutine so that you can extend the editor’s capabilities to meet your own needs. Naturally, both the editor and assembler require that you have a terminal connected to the serial port on the KIM-1.The assembler is a singlepass assembler; if your source text is on paper tape or audio cassette, you only have to feed it through once. Normally your source text will be in memory and the assembled code is always written to memory. The source code, symbol table, and object code can be located anywhere in memory you wish. You may have several different source files in memory simultaneously. If you have insufficient memory space to store a large source program, you can break it into several segments, store each segment on audio tape, then bring back one segment at a time for assembly. The assembler will assemble the successive segments until it encounters an “END” statement. It will then put out the symbol table and terminate assembly. Although the editor is fairly limited (it has no capability to edit within a given line, for instance) it is quite sufficient for editing assembly language programs. The assembler is very fast and with good error diagnostics. Perhaps its only serious fault is that the printed symbol table is not sorted alphabetically and no crossreferences are given.


MOS 6540 ROM
The MOS Technology 6540 is a 16k (2KByte) ROM. Factory burned. Mask options for specification of chip select equations. 5! chip selects, requires Phi2 6502 system clock. 24 pin, very uncommon for a small ROM.
A strange and uncommon device, AFAIK only used in the KIM-5 Resident Assembler/Editor and early PET computers. Has a bad reputation, and there are many replacement solutions with standard E(E)PROMs for PET computers.
The 6540’s in the KIM-5 Resident Assembler/Editor on a KIM-5 ROM board are in an excellent condition, dumping with the Backbit Pro chip tester was very easy.

MOS Technology 6540 preliminary datasheet 1977




KIM-5 ROM board
The 3 KIM-5 Resident Assembler/Editor ROMs as placed on the KIM-5 ROM board.
Besides the sockets for the ROMs is some glue logic, 2x 74125 buffers, 2x 7485 address decoders, a 7402 TTL IC and some DIP switches.
The KIM-5 ROM board is to be placed in the KIM-4 Motherboard. The manual is not available alas.

KIM-5 Resident Assembler/Editor available!

MOS Technology, part of Commodore in 1977, not only sold the KIM-1 SBC but added hardware and software as KIM System Products.

Not only hardware, a Motherboard (KIM-4), RAM memory expansions (KIM2, -3, -3B) and a prototype board (KIM-6) but also software, like KIM Math subroutines (KIMath), TIM (RRIOT + document).
This has been documented for quite some time now on this website with photos and manuals.

I have been looking for years for the KIM-5 Resident Assembler/Editor. Manuals on Assembler and Editor are already known. The software, delivered in 3 ROMs of type 6540, on a KIM-5 ROM board was never dumped before, and the existence, besides the pricelist shown here and some advertisements, doubted by many, including old Commodore employees.
Many years I searched on the internet on fora, websites and friends in the retro world, it did not lead to a dump of the KIM-5 ROMs.

A couple of years ago I saw a listing on ebay.de of a lot with a a KIM-5 with ROMs and a KIM-3B board. I was too late to bid. I could not contact the seller or buyer afterwards. But now I knew the KIM-5 did exist, and had some photos as proof.

A year later Stefan Hamann approached me to ask for information on KIM-1 material he bought from ebay. He was the buyer of the lot!
Stefan was so nice to lent me the KIM-5 (and KIM-3B) and the EPROMs he obtained. I have finally a KIM-5 in my hands with ROMs!

The ROMS have been dumped, tested in the (updated KIM-1 Simulator to 1.5.1) and source recreated. The KIM-5 Resident Assembler/Editor is preserved!

Read all about this on the newly organized and enhanced KIM System Products pages.


Resident Assembler/Editor at 9000-A7FF

KIM-3B

KIM-3B, a 16K memory module with 2114 SRAM ICs.

KIM-3B (Stefan Hamann)

KIM-3B (Stefan Hamann)

KIM-3B

User’s Manual Memory Expansion Module KIM-3B
User’s Manual Memory Expansion Module KIM-3B

KIM-2 KIM-3

KIM-2 offers 4K RAM with 2102 SRAM ICs. The KIM-3 has 8K RAM, also with 2102 SRAM ICs.

< MOS KIM-2-3-4 User Manual Expansion Modules

KIM-2 (photo by glitch)

KIM-3

KIM-5 Resident Assembler/Editor

On this page:


The KIM-5 Resident Assembler/Editor is a 6502 version of the MOS Technology Cross Assembler. See the pages on the MOS Technology/Commodore assemblers on pagetable.com

The Resident Assembler was written by Michael Corder (of MOS contractor COMPAS Microsystems) by hand-assembling the Cross-Assembler FORTRAN code to native 6502 assembly.
Consequently, both assemblers were compatible in that they understood the same source format, with the same math features and the same directives and options. That way, they defined the basic format supported by all future Commodore assemblers. This means that the Resident Assembler took uppercase ASCII source files.

John Feagans on the origin of the KIM-5 Resident Assembler/Editor:
As a grad student at Iowa State University, Ames, I had access to all the development of these KIM boards as the local contractor for MOS was Compass Microsystems. The original 6502 assembler was written in Fortran and available on Tymshare. First Michael Corder (aka The Cordless Electric Programmer) hand compiled the Fortran to 6502 assembler. Even the Fortran line numbers were used as labels. This became the basis of the MDT 650, an ICE for 6502, and the KIM assembler. Compass developed another product called the MiniMac–a 6502 development system on a plugin for a DEC PDP-11. I took Corders 6502 assembler and hand translated line by line from 6502 assembler to PDP-11 assembly. When I joined Commodore I ported the assembler one more time to become the PET assembler and later C64 assembler.

In 1977, Commodore announced the Resident Assembler/Editor for the KIM-1, which shipped in the form of the KIM-5 ROM board with three 6540 ROM chips (6 KB total) containing the assembler and a simple editor.
The manuals (see below) from 1977 do not mention the .DBYTE, .PAGE and .SKIP directives. In the source (see below) they seem to be recognized and lead to an error.
The assembler could read source from cassette tape or paper tape, but it could not write OBJ files; instead, it would write the binary to RAM.
If the source was too big to be placed in memory, the assembler could read source files from tape until the .END directive was encountered.



All described in the two manuals that I found:

MOS KIM Assembler Manual Preliminary (KIM-5)
MOS KIM Text Editor User Manual (KIM-5)


The KIM-5 Resident Assembler/Editor ROMs
Many years I searched on the internet on fora, websites and friends in the retro world, it did not lead to a dump of the KIM-5 ROMs. It was even doubted the KIM-5 with Assembler/Editor was ever sold, despite the adverts in magazines of that period.

A couple of years ago I saw a listing on ebay.de of a.o. a KIM-5 and a KIM-3B board. I was too late, could not contact the seller or buyer, but I knew the KIM-5 did exist!
A year later Stefan Hamann approached me to ask for information on KIM-1 material he bought from ebay. He was the buyer!
Stefan was so nice to lent me the KIM-5 (and KIM-3B) and the EPROMs he obtained. I have finally a KIM-5 in my hands with ROMs!
The KIM-5 Resident Assembler/Editor is placed in three 2K ROMs of type MOS 6540, and the KIM-5 board configured to show these in memory at E000-E7FF.

With the excellent Backbit Pro Chip Tester I managed to dump the 6540-007, -008, and 009 ROMs. 6540 are strange ROMs, see below. To my surprise the ICs were in excellent condition.
In the other EPROMs (2x 4K 2532) I found a copy of the KIM-5 Resident Assembler/Editor ROMs, nearly identical to the 6540’s. So the dumps are reliable.

ROM dump archives

This archive has the ROM dumps of the KIM-5 Resident Assembler/Editor for KIM-1 Mos Technology Commodore:

  • Dumps of original KIM-5 2K ROMs
    • 6540-007 E000 – E7FF
    • 6540-008 E800 – EFFF
    • 6540-009 F000 – F000
  • Combined to one binary
    (suitable for KIM-1 Simulator 1.5.1 or KIM-1 with ROM/RAM at E000-F7FF

    • kim5.bin E000-F7FF
  • EPROM dump (4K ROMs) (has valid KIM-1 Reset/NMI/IRQ vectors at high memory)
    Small changes like jmp to tape dump routine in the ROM (see sources)
    • KIM E000
    • KIM F000
  • Combined to one binary
    • kim e000-ffff

With the binaries dumped I have

  • loaded in the KIM-1 Simulator (version V1.5.0. with RAM at E000-F7FF added) and started the Editor. See the screenshots below (in which I did not configure the symbol table as instructed in the manual!).
  • disassembled and recreate assembler source which assembles to identical binary and documented as much as possible with the assembler sources on pagetable (PET, AIM 65)

Source of KIM-5 Resident Assembler/Editor
Recreated source of KIM-5 Resident Assembler/Editor with the aid of TASM32, result is binary identical with the ROM dumps.
Tables, data, jump tables, all recreated. A lot is commented, the editor part needs some attention. Assembles fine.
Eduardo Casino helped me to find the last location dependent statements, and now the program runs at other locations like $9000 after adjusting the .org directive and reassembly.
Eduardo Casino created a CC65 version of the source: Recreated source in CC65 Assembler format of KIM-5 Resident Assembler/Editor

Symbol table at $3000

Resident Assembler/Editor at 9000-A7FF


Assembling branch instructions
While working with the assembler Eduardo found weird behaviour by the assembler of the code generated.
Backward branches are done in the usual way. Forward branches generate an extra NOP instruction.
It is not doing any damage, it just wastes space and execution time.

See the next screenshots.


Difference in time count between R6532 and G65SC32

There is a subtle difference between the NMOS 6532 and the CMOS G65SC32 datasheet regarding the timer of 1 in elapsed time.

It is in the paragraph starting at ‘Once the time has counted down to 00000000, an interrupt will occur ….’
On the 6532 that takes 27T (T is the clock tick), on the G65SC32 28T.
That makes in the example the total elapsed time 443T on the 6532 and 444T on the G65SC32.

Look at these pages about the timer from the datasheets of the R6532 and 6G5SC32 (see below and here)

R6532 datasheet page 5


R6532 datasheet page 6


G65SC32 datasheet page 4

G65SC32 datasheet page 5

Rockwell R6532
GTE G65SC32

Different versions of KB9 Microsoft Basic for KIM-1?

MOS Technology 6502, 9 DIGIT BASIC by Microsoft, Copyright 1977. often nicknamed KB9, is an early version of Microsoft Basic adapted for the KIM-1. With 9 digit precision and the Microsoft version of Basic a very usable high-level language for a KIM-1 with 16K extra RAM and a videoterminal or teletype.
I bought my version in 1979, serial number 2167. Tape ID #01, 2000-4260. Start 4067.
It is a version that works around the missing ROR instruction on early 6502 CPU’s.
All versions of KB9 on the internet are from the cassette dump I made in 2006, including the brilliant source version on pagetable. Still have a lot of fun with it as well as all the KIM clone users.
I found a photo of MOS TECH 9 DIGIT BASIC FOR KIM, COPYRIGHT BY MICROSOFT 1977 2000-437D ID #101 ST. 4065 S/N 217 cassette of a much lower serial number.
What is interesting is the higher End address, 437D versus 4260.
Alas no dump of this cassette is known, so this stays a mystery. as is the illegal tape ID 101.

My MSBasic for the KIM-1 cassette

Another MOS TECH BASIC for KIM-1

RNB VAK-1 photos

Thanks to Eric Dennison I can show photos of the RNB Enterprises VAK-1 motherboard.

The large motherboard and the huge case with homebuilt 16K static RAM memory card are representative for the KIM-1 systems then!

Photo by Eric Dennison

Photo by Eric Dennison

Sorbus internals

The Sorbus concept looks simple. A 6502 CPU, a RP2040 controlling it and a backplane.
It delivers a 6502 system running at a clock speed of about 1 MHz.

On the software side there is much happening. Here some notes written by SvOlli

Meta mode
Pressing CTRL ] brings up the socalled meta mode.

Notes On Implementation in RP2040 Multicore Architecture

Core 0 runs the console and handles user interaction. Core 1 drives the bus for the CPU implementing the system. To have a rather efficient (fast as in ~1MHz) system, core 1 really has to come up with some tricks. So, every “event” aspect, such as timers, watchdog and other things will be run by an event queue. This means on every clock cycle there is a check if something was scheduled for this specific clock cycle. Again due to performance, only one event will happen during that clock cycle. If two events are scheduled for the same clock cycle, the second one scheduled will be delay by one clock cycle (and again until there is a free slot). The size of the queue is 32 event. This should be sufficiant, as there are not much things that could add to the event queue, and in most cases, a new event from the same source replaces the old one.

However: again due to performance the queue is not thread safe! So only core 1 is allowed to interact with it.

Core 0 on the other hand is allowed to do two things on the hardware side:

pull the RDY line low (to stop the CPU) and back high (to let the CPU continue)
pull the RESET line to low (but not back to high again), this may be only done if the RDY line is high, or immediately pulled high after the reset line was pulled low (immediately = in the next code line!)
If core 1 should want to use the RDY line for some reason, this should be implemented using “queue_uart_write” with characters > 0xFF. For performance/latency reasons it also does pull RDY low itself as well.

CPU Detection Routine

The Sorbus Computer can run any kind of 6502 variant that shares the same pinout. The small test and learn environment “Monitor Command Prompt” or MCP for short (pun very intended) can be used to learn all the details about each CPU up to a certain degree. (Not all pins are connected due to a limit amount of 30 GPIO pins of the RP2040.)

However, it is interesting to know which CPU the system is running on. The “Native Core” is the one with the most features, but does uses opcodes and features that are not available or buggy on an (old) NMOS 6502. This means that a 65C02 or any other CMOS variant is required. So, it should be a good idea to detect that CPU and print an error message that the system won’t work with one installed.

Also, there is another point where a CPU detection is very handy. If you search for cheap 65C02 processors, you typically find offerings on ebay or AliExpress for WDC W65C02S processors. However, none of those are original ones, but all of those are pulled out of machines, and then get relabeled. (At least the ones I’ve seen so far.) For this project using those would not be that bad, if they would not throw in NMOS 6502s in the mix as well. Those, as explained above, don’t fit the requirements.
Heree the source of the routine.

Read the rest of the notes on SvOlii’s github page.