Attachment:
SECONDRUN.jpg [ 35.38 KiB | Viewed 1105 times ]
I took a different route in my work to reconstruct Focal-65 from source.
My goals are to preserve the original work as much as possible, to honor the work of the original author(s).
This means for me staying as close as possible to the original!
Only when that is looking good, I may make it better as derived work: adapt to video terminals, make it ROMmable (it has self modifying code), init data in zeropage, move code out of zeropage, add some nice patches as described in the User manual and several articles from the old days.
I took the listing I found, cleaned and cropped it to make it better readable and typed it in, exactly as it is on paper. Same labels, uppercase, comments verbatim, same line numbers.
Of course I had to adapt the assemble syntax a bit, the PAL-65 assembler (made with macro's in the DEC PDP assembler!) is not available to me.
Once it assembled I checked the binary output line for line to the listing. Amazing how many forgotten '#'s may get unnoticed on first sight!
The resulting binary tested in my TIM Simulator and seems OK.
Next I replaced the TIM I/O package with a KIM-1 I/O package and tested that on the KIM-1 Simulator, with success so far. I did not check yet if this is Focal-65E for the kIM-1 yet.
The source can now easily be used in any 6502 SBC, just add character I/O and fill in the IRQ/BRK vector.
This is the code for KIM TTY I/O package I use in my reconstructed Denver 6502 Group source.
Code:
0313 00A9 20 A0 1E OUT JSR OUTCH ; TTY OUTCH in KIM-1 ROM
0314 00AC 18 CLC
0315 00AD 60 RTS
0316 00AE ; KIM-1 echo (ignores ECHFLG for now)
0317 00AE E6 76 IN INC HASH ; SEED
0318 00B0 2C 40 17 BIT SBA ; KIM-1 6532 PIA A DATA REGISTER
0319 00B3 30 F9 BMI IN ; WAIT FOR INCOMING CHARACTER
0320 00B5 A5 6B LDA ECHFLG ; TEST IF WE ARE TO ECHO
0321 00B7 F0 08 BEQ NOECH ; BRANCH IF NOT
0322 00B9 AD 42 17 LDA SBD ; KIM-1 6532 PIA B DATA REGISTER
0323 00BC 29 FE AND #$FE ; INHIBIT ECHO VIA PB0
0324 00BE 8D 42 17 STA SBD
0325 00C1 20 5A 1E NOECH JSR GETCH ; GETCH IN KIM-1 ROM
0326 00C4 48 PHA
0327 00C5 AD 42 17 LDA SBD ; THE ECHO DEFEAT
0328 00C8 29 FE AND #$FE
0329 00CA 09 01 ORA #$01 ; RESTORE PIA PB0
0330 00CC 8D 42 17 STA SBD
0331 00CF 68 PLA
0332 00D0 18 CLC
0333 00D1 60 RTS
It works fine in the KIM-1 Simulator with the Focal V3D selected in Settings. Based upon this:
http://retro.hansotten.nl/6502-sbc/kim- ... im-1-echo/Note that when looking at the source, zeropage in the Denver Group 65 (distributed by the Program Exchange) is mostly zero's. Very few locations have a value.
Further note that the binary of the Aresco version, about 90% perhaps identical to the TIM version, where the disassembly work in this thread is based upon, comes from a dump I made in 2004 of a cassette tape that survived. The dump was not the original clean one as distributed by the Program Exchange, but from a copy made after running the interpreter. So the zeropage and perhaps the code dump is polluted with runtime information. Also the whole zeropage is dumped, which is of course too much.
I am afraid aiming to have source to output the same as the dump will be a bit polluted.
The reconstructed TIM (and KIM-1) versions are clean!
Also note that Wayne based his design upon the DEC Focal version. In the DEC-08-AJBB-DL Advanced FOCAL Technical Specification April 1969 you can find the flowcharts and symbols etc used in the Focal-65 source. Helps a lot to understand why it is written this way.
You can find my work at a page dedicated to Focal-65 here:
http://retro.hansotten.nl/6502-sbc/focal-65-v3d/