(see also the Microchess page)
Downloads:
The hex file MicroChessOut can be loaded directly into the KIM CLONE and run from $2000
Archive with source.
Following the header "Peter Jennings, www.benlo.com" I was pleasantly surprised to see the website still active: http://benlo.com/microchess/index.html http://benlo.com/files/Microchess6502.txt The source code Microchess6502.txt contains the additional note on line 35: "; Updated with corrections to earlier OCR errors by Bill Forster, August 2005." Line 73 comments on the cross-assembler used: "BMCC = $E5 ; was BCC (TASS doesn't like it as a label)" Looking for information about TASS led me to: https://www.c64-wiki.com/wiki/Cross_Assembler Reading from "64Tass/6502Tass: Another native "Turbo Assembler", developed for DOS (6502Tass), later also for Unix, Linux and Windows32 (64Tass)," I suspect the 1996-2002 code by Peter Jennings used the DOS version, but I am running Windows 10 on a modern laptop and I can't find a way to run 16-bit applications without using third party tools like DosBox or an emulator in VirtualBox. So I decided to try out Tass64. I found a link to the Windows version on sourceforge, https://sourceforge.net/projects/tass64/. The documentation is included in the zip file, and also here http://tass64.sourceforge.net/. Without really reading the documents, I just ran Microchess through the Assembler and got errors. Below are the errors I got, and how I fixed/hacked/patched each one. First Attempt: Error messages: 31 Warning messages: 3 Passes: 2 ....Oof..... Error Group 1: MicroChessSource:37:8: error: general syntax cpu 65c02 ^ MicroChessSource:38:9: error: general syntax page 0,132 ^ Correction: Change 37 to: .cpu "65c02" Change 38 to ; page 0,132 Line 38 is commented out because 'page' "gives an error on page boundary crossing, e.g. for timing sensitive code" and I am simply going to put my faith in Peter Jennings and hope for the best here. Line 37 can be changed to reflect the CPU you are using. I got my parts assembled by Bob, and leaving "65c02" as the cpu version works for me on the KIM CLONE. Error Group 2: MicroChessSource:729:6: error: general syntax db $2c ; used to skip over LDA #$20 ^ MicroChessSource:859:12: error: general syntax Hexdigdata asc "0123456789ABCDEF" Correction: For all the lines that use "db" or "asc," change the pseudo-op to ".text" Now I got: ----------------------------------------------------------------------------- C> 64tass.exe -o MicroChessOut MicroChessSource 64tass Turbo Assembler Macro V1.55.2200 64TASS comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; See LICENSE! Assembling file: MicroChessSource Error messages: None Warning messages: None Passes: 2 Memory range: $1000-$1524 $0525 Memory range: $1580-$15dc $005d ----------------------------------------------------------------------------- I think I'd like to run Microchess from $2000 up in one block, so I will modify line 95 and 869: Change line 95 to ";*= $1580" and comment out line 869. ----------------------------------------------------------------------------- Memory range: $2000-$2581 $0582 ----------------------------------------------------------------------------- Now the source will assemble, but it won't work yet. The Peter Jennings code with TTY was written for the "6551 Asynchronous Communications Interface Adapter (ACIA)," not the "standard TTY" routines built into the KIM monitor that we see in the First Book of KIM etc. http://archive.6502.org/datasheets/mos_6551_acia.pdf https://en.wikipedia.org/wiki/MOS_Technology_6551 First, I comment out the ACIA addresses from line 42. ;ACIADat = $7F70 ;ACIASta = $7F71 ;ACIACmd = $7F72 ;ACIACtl = $7F73 Then, I add in the addresses of the KIM monitor TTY routines for getting (blocking) and outputting 1 character. ; http://www.zimmers.net/cbmpics/cbm/kim1/kim-hints.txt - See "KIM SUBROUTINES" TTY_GETCH = $1E5A ; Register States: In to A, X preserved, Y = FF TTY_OUTCH = $1EA0 ; Register States: X preserved, Y = FF, A = FF Now, I move to line 822 and start making changes to the I/O Routines. (1) Comment Out the Init function 825-829, don't need. I leave the label and rts to allow it to work as a dummy sub routine rather than deleting all references to it in the code. (2) Replace the meat of "syskin" on 833 with code to push the affected registers, call TTY_GETCH, and restore affected registers. (3) Replace the meat of "syschout" on 842 to push the affected registers, call TTY_OUTCH, and restore affected registers. Now the code after line 822 looks like: ; ; 6551 I/O Support Routines ; Replaced with KIM Monitor Routines for KIM Clone - Neil 2020 ; ; Init_6551 ;lda #$1F ; 19.2K/8/1 ;sta ACIActl ; control reg ;lda #$0B ; N parity/echo off/rx int off/ dtr active low ;sta ACIAcmd ; command reg rts ; done ; ; input chr from ACIA1 (waiting) ; syskin ;lda ACIASta ; Serial port status ;and #$08 ; is recvr full ;beq syskin ; no char to get ;Lda ACIAdat ; get PHY JSR TTY_GETCH PLY RTS ; ; ; output to OutPut Port ; syschout ;PHA ; save registers ACIA_Out1 ;lda ACIASta ; serial port status ;and #$10 ; is tx buffer empty ;beq ACIA_Out1 ; no ;PLA ; get chr ;sta ACIAdat ; put character to Port PHA PHY JSR TTY_OUTCH PLY PLA RTS ; done IMPORTANT: I make use of the 6502 commands to push X and push Y, pop X, pop Y - PHX, PHY, PLY, PLX which work on the 65c02 but not the old-school 6502. This probably won't be an issue for the KIM Clone, but if it is, it will be necessary to change the way you push and pop using your favorite method from back in the day, of one of the examples here: http://6502.org/tutorials/register_preservation.html Now I re-assemble the source code, adding the flag to output INTEL HEX format. This is because Bob added support for intel hex to the [L] command on the KIM-1. There are programs on-line (somewhere) for converting and dealing with the KIM paper tape format, but being allowed to Load in INTEL HEX format allows us to output something the KIM CLONE can read without no trouble at all. ----------------------------------------------------------------------------- C> 64tass.exe --intel-hex -o MicroChessOut MicroChessSource 64tass Turbo Assembler Macro V1.55.2200 64TASS comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; See LICENSE! Assembling file: MicroChessSource Error messages: None Warning messages: None Passes: 2 Memory range: $2000-$256e $056e ----------------------------------------------------------------------------- Now, I could use SecureCRT or Tera Term or some other fancy terminal to send the file as ASCII when I press the [L]oad command on the KIM-1. Today, however, I will use the humble PuTTy terminal emulator. And simply copy the hex to my clipboard, and paste it in PuTTy after pressing the [L] command. KIM Clone v1.0B 237A 24 0000 :00000001FF52250D45350455220643330FCC8F02020299250B25010033250736340D3434CD KIM Clone v1.0B 0000 00 2000 2000 A9 G MicroChess (c) 1996-2005 Peter Jennings, www.benlo.com 00 01 02 03 04 05 06 07 ------------------------- |BP|**| |**|BP|**| |**|00 ------------------------- |**| |**| |**| |**| |10 ------------------------- |BB|WP| |**| |**| |**|20 ------------------------- |BP| |**| |**| |**| |30 ------------------------- |BP|**| |**| |**| |**|40 ------------------------- |**| |**| |**| |**| |50 ------------------------- | |**| |**| |**| |**|60 ------------------------- |**| |**| |**| |**| |70 ------------------------- 00 01 02 03 04 05 06 07 20 00 00 ?C MicroChess (c) 1996-2005 Peter Jennings, www.benlo.com 00 01 02 03 04 05 06 07 ------------------------- |WR|WN|WB|WK|WQ|WB|WN|WR|00 ------------------------- |WP|WP|WP|WP|WP|WP|WP|WP|10 ------------------------- | |**| |**| |**| |**|20 ------------------------- |**| |**| |**| |**| |30 ------------------------- | |**| |**| |**| |**|40 ------------------------- |**| |**| |**| |**| |50 ------------------------- |BP|BP|BP|BP|BP|BP|BP|BP|60 ------------------------- |BR|BN|BB|BK|BQ|BB|BN|BR|70 ------------------------- 00 01 02 03 04 05 06 07 CC CC CC Personal Notes: -The extended monitor on the KIM Clone has extra for string printing and more, so if I was doing a serious "KIM CLONE" port, I might look at rewriting a lot of the drawing functions. -It is really clunky how the screen re-draws after every CHARACTER -- which means I have to sit through 4 board redraws just to enter a move. I want to update that code, because I don't have pre-digital age patience. -My cross compiler of choice is ca65, part of the cc65 C compiler for the 6502. Maybe a ca65 port of the syntax is something I might try. There are great usage notes for this version of the game here: https://obsolescence.wixsite.com/obsolescence/kim-uno-microchess Too late now, but I notice he went through the exact same process changing the UART routines for his version of MicroChess for the Arduino KIM-1 emulator.
See also:
Part 4 Sorbus runs Wozmon, Apple 1 Basic, MCP
The first test run of the Sorbus computer can be done with two simple images: Wozmon with Apple 1 Basic and the MCP prog...
Sorbus computer part 3: the hardware
The hardware of the Sorbus computers could not be simpler. Designed with care to be as flexible as possible, fully progr...
Sorbus computer (part 2)
Soldering the PCBs
I got from Sven PCBs for the Sorbus and the Sorbus Junior. It took an afternoon to solder all part...
The Sorbus computers
A new development! A minimal 65(C)02 system, called Sorbus designed by Sven Oliver Moll (SvOlli).
Thank you Sven for th...