• Please review our updated Terms and Rules here

Tek 405x web-browser emulator

Philcogrump

Experienced Member
Joined
Jan 15, 2005
Messages
62
Location
Texas
Branching this thread off the "Saving ROM data from Tek 4052" to specifically discuss Tek 405x emulation. As far as I know, there have been two approaches, one is documented in another thread titled "Tek 4051 BASIC simulator" that was written in C++ by Brad-4051 and runs on Windows, and the second approach is a Javascript based emulator that runs in a web browser and does a native emulation of the actual 4051 hardware with an emulated 6800 running binaries from actual ROM dumps, started by daver2?

Dave - could you place the code in some repository that supports version tracking, github perhaps, to make it easier for multiple contributors (even if it's just us two) and post a link here for this thread.

Last month I skimmed through mc6800.js and TEKTRONIX4051.js. Today I spent several hours reviewing mc6800.js to better understand how the processor emulation is done, at least it's a good excuse for me to finally learn 6800 assembly and understand the processor's features. I've been adding more comments, documentation, and reorganizing a few functions around in mc6800.js. Eventually I will add placeholders for the Tek extended instructions to the Instruction Register case statement list so once we can locate documentation that describes what they do, we can flesh those out to support the 4052/54 emulation. Is there any reason to add an argument to the 6800 function to specify if it should ignore Tek extended instructions for 4051 emulation? I suspect it shouldn't be a problem to support those instructions because the 4051 ROM binaries will not even use those extended instructions at all.

One general question or complaint, I'm not sure why we need to use "this" in front of everything, if the 6800 function is called then all these "this.whatever" variables and functions become global to the window accessible by all other javascript functions? I'm wondering why that is necessary, I'd think all 6800 internal registers and functions should remain within the 6800 and inaccessible for other Javascript code outside of the 6800?

Dave - did you ever hear back from the guy who might have the documentation on the Tek extended instructions? Worst-case we probably could reverse engineer the 4052/54 processor microcode to figure out what the extended instructions do but that would be a real painful challenge.
 
Another question or feedback on the TEKTRONIX4051.js code, I notice all ROM images are explicitly documented in this file as a big array of bytes for each individual ROM. I assume a script was used to convert from the raw binary files to this format? Couldn't we have Javascript just read in a single binary file or at least a single separate Javascript file with all the individual ROM images prearranged together as a continuous block? This would be a good way to verify the assembled ROM file is correct if we ever want to make a modern replacement ROM that can cover the entire address space for repairing actual machines.
 
I went ahead and created a GitHub repository for the Tek 405x emulator here so anyone can contribute and we have version tracking:

https://github.com/jonbstanley/Tek405xEmulator

As of today, the content in there is exactly the same as in Dave's Google drive. I've made some progress in the past several weeks cleaning up and reorganizing the Javascript code, but in the process I broke the GPIB program load. Once I figure that out, I'll submit my recent changes. Currently the emulator only does the 4051. My goal is to finish cleaning up the code so it's more readable and maintainable, and then build onto it for 4052/54 emulation.
 
I haven't forgotten about your PM, honest!

I have just been too busy with work. I have some leave coming up shortly, so I will send you a PM to explain how I coded some of the stuff up!

Thanks for creating the GitHub project.

Regards,

Dave
 
I love your emulator! I just contributed two Tek programs to the Github site - after joining Github:)

One program is a May 78 Byte Magazine "Hidden Line" program I ported to a 4051 in the USAF in the 70's.
Second program is my creation - Vipers on Patrol

Based on old Vintage Computer website (still on archive.org) article about Tektronix in Battlestar Galactica. The article had a picture of a computer plot of Vipers on Patrol - which he indicated came from a Battlestar Galactica demo tape.

I printed, then digitized one of the Vipers with my 4052 and saved the data points to a tape file. Yesterday after running the Hidden Line program successfully on the emulator, I copied all the data into the main program since I couldn't figure out how to get the emulator to load another file. I used the emulator to find out whether the READ statements were limited to one DATA statement - which I was lead to believe from reading the programmers guide. Answer - no, a READ of a dimensioned variable will keep reading DATA statements until the variable is satisfied. This resulted in a great speedup on my original program. It only takes one DRAW statement to draw the X/Y array of lines, then the loop changes the VIEWPORT to scale and locate the next Viper.

Vipers on Patrol.jpg
 
I just added one more program - my Artillery program - to the Github. This program is now 40 years old, but I still find it addictive - and I like Angry Birds too :)
I did have to make a couple of changes when I typed the program in from a thermal printout - it seems like the graphics scaling is a little off, and control-G should beep the speaker.

I found my treasure trove of program listings from that era - so until I get my 4052 or 4054 running again, I plan to comb through the listings and input the best to the program folder on Github.

Monty
 
I don't know if forking the Github code to add my changes is the best way - I'm learning :)

I just uploaded changes to TEKTRONIX4051.js to double the line width and quadruple the size of the text characters. I also changed the cursor from bright blue to light green. I also uploaded a modified ARTILLERY that moved the text into the viewport. I tried a couple of the original programs like Startrek - I think they look more like the real 4051 screen now.

Monty
 
One more emulator update.

I doubled the line drawing width and doubled the character length and width and uploaded a new Tektronix4051.js file. I also uploaded some text position changes to my Artillery program to the program folder. I ran a couple of other programs in the folder like LINES and STARTREK, and I think it looks better.

What do you guys think?

Monty
 
1982 Tektronix 4050 Series Basic Reference Guide

1982 Tektronix 4050 Series Basic Reference Guide

Branching this thread off the "Saving ROM data from Tek 4052...

Dave - did you ever hear back from the guy who might have the documentation on the Tek extended instructions? Worst-case we probably could reverse engineer the 4052/54 processor microcode to figure out what the extended instructions do but that would be a real painful challenge.

I found a box in my attic with 4052/4054 to 4052A/4054A upgrade boards. Included with the instructions was a 1982 Tek 4050 Series Basic Reference Guide (61 pages).
I scanned it into a searchable PDF and put it on my Google Drive https://drive.google.com/open?id=1_MZTHyYnmz_dWrLHjnNYWh4qx_FSwbKl

The guide has all the instructions for the 4051 and has highlighted new instructions for 4052 and 4054 in gray.

Here is a list from the guide of all the Basic Keywords - click the link for the full size image, not the thumbnail.

http://astromech.net/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=119336&g2_serialNumber=1&g2_GALLERYSID=85401f941db742027164650b03b1a359

Monty
 

Attachments

  • 2pages.jpg
    2pages.jpg
    9.9 KB · Views: 2
Last edited:
Maybe I misunderstood the question about the 4052/4054 instructions.

I have the 4052/4054 (includes A versions) Service Manual and Parts and Schematics manuals.

Appendix A in the Service Manual is the list of Firmware instructions - Hex Code / Opcode / Address Mode.
I had gone through this list years ago - comparing to the 6800 instructions and saw that 44 instructions were not in the 6800.

Should I scan that opcode list? Its six pages.

Monty
 
Is this live anywhere?

This being the 4051 Emulator? Yes - see the third post in this thread for the Github location. There is a small Programs folder - I have contributed three programs to the folder, and just added a change to one of the emulator files to increase the character size and vector size - although that change hasn't been accepted into the main branch yet.

The emulator requires an HTML-5 compatible browser - I use Chrome.

Monty
 
Last edited:
That's the git repo, which I saw previously in the thread (and I appreciate), but you can't run it directly from there without pulling it and setting it up locally unless there's a link there I missed.

Just click the green clone/download button and download as a zip - unzip it and select the jsTektronix4051.html file and it will be running locally in your browser. The Readme has instructions. Basically click the Start button, then choose a file (navigate to the programs folder). Then go to the top of the black window and type old@1: This will load the program you chose into memory. When the cursor returns to the next line type run

As Dave says in the instructions - he created the emulator on a Mac - so some of the keys are a bit tricky.

old is easy, for a PC keyboard then type ' (left single quote - next to the 1 key above Tab) for the @, then 1, then type ' (right single quote - next to the Enter) for the : then press Enter to load the selected program.

Here is a screenshot of my Artillery program running with my updates for bigger fonts and thicker lines:

Artillery.jpg
 
Last edited:
Latest Tektronix 4051 Emulator Update

Latest Tektronix 4051 Emulator Update

I've made more updates to the emulator - but my pull request hasn't been accepted by Jon yet.

In the meantime - you could download my work in progress fork of the emulator including new StarTrek game at https://github.com/mmcgraw74/Tek405xEmulator

Download the zip - extract to your favorite folder - run the .html file and voila - latest emulator.

I've doubled the character height and width, doubled the vector line width, and added function keys, edit keys, plus Page, Break (press Break twice to stop the program, then load another one and run).
I've changed the cursor from blue to light green - and added blink.
Still have a bug since my blink is asynchronous to the emulator CPU code, 50% of characters you type will have a light green background, the rest will be no background.

Use the github readme for instructions to start the emulator, select a file to run, then type old21: (with the readme indicated keys), hit return.
After you see the blinking cursor on the next line type run.

Here is the Startrek screenshot with my changes - this game is almost impossible to win (for me).


Tek 4051 starttrek in latest HTML5 emulator.jpg
 
Thanks Monty for the interest in this project. The instructions that needed explanation were the 4052/54 assembly rather than the BASIC. For the 4052/54, Tektronix made their own 6800-compatible processor that also supported 16-bit data accesses and special functions to significantly speed up processing power over the 4051. I spent some time updating and restructuring the original code and added these instructions but they currently do nothing since we don't know how the processor handled them exactly. Supposedly someone has documentation on this, or we'll have to reverse engineer the processor microcode and technical manual documentation.

I have been away from this project for at least a month as other projects are competing for my attention and time. I did email Dave my latest restructured code for his review before I post it in Github. Haven't heard back yet, but I'd be very interested in merging your display improvements with my changes. I'm hoping to get feedback very soon so our code changes don't diverge so much that merging will be a PITA.
 
Thanks Monty for the interest in this project. The instructions that needed explanation were the 4052/54 assembly rather than the BASIC. For the 4052/54, Tektronix made their own 6800-compatible processor that also supported 16-bit data accesses and special functions to significantly speed up processing power over the 4051. I spent some time updating and restructuring the original code and added these instructions but they currently do nothing since we don't know how the processor handled them exactly. Supposedly someone has documentation on this, or we'll have to reverse engineer the processor microcode and technical manual documentation.

I have been away from this project for at least a month as other projects are competing for my attention and time. I did email Dave my latest restructured code for his review before I post it in Github. Haven't heard back yet, but I'd be very interested in merging your display improvements with my changes. I'm hoping to get feedback very soon so our code changes don't diverge so much that merging will be a PITA.

See my post 15 above for a link to my scans of part of my 4052 Service Manual with 4052 bitslice opcodes and how the addressing modes work for each type of instruction http://www.vcfed.org/forum/showthread.php?61636-Tek-405x-web-browser-emulator&p=505628#post505628

Monty
 
Back
Top