| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Aug | Oct » | |||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | |||
- 8. February 2012: Student Sends MIT (Admission) Letter to Near Space (Amateur Radio involved...)
- 8. February 2012: Amateur Radio: KP2Z Puerto Rico on 80M, ND State on 40M for Worked All States
- 6. February 2012: Official 2012 Honda CR-V Game Day Commercial - "Matthew's Day Off" Extended Version
- 6. February 2012: Madonna ~ Halftime Super Bowl XLVI (dolby surround) - 720P High Def Video
- 6. February 2012: Amateur Radio - working on WAS - Worked All States ... only 2 left! (48 States Confirmed)
- 6. February 2012: Sub-Tropical System Could Be Forming Near Cuba ... S. Florida area to be affected
- 6. February 2012: The NYG's won Superbowl, Madonna was awesome, Mathew Broderick Commercial ...
- 6. February 2012: Weather over S. Florida tries to satellite block my SuperBowl Sunday
- 5. February 2012: New Country, Amateur Radio Contact, TA3HM - Izmir, Turkey
- 4. February 2012: 2012 version 4.0 Livewire Access Controller FB-10 (former product known as Livewire Service Selector)
- February 2012
- January 2012
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
Speaking of Bouncing things… I made the Night-Rider Program into a Reloadable Hex Program File for the Z80pack Imsai Simulator
Previously I blogged about:
The retro computer simulators (important not only for historical signifigance but also an excellent way to prepare for the Hexadecimal codes used in the new Internet Protocol Version 6 (IPv6) that will start replacing IPv4 “IP Addressing” as soon as some time next year), one of which was Imsai 8080 in Z80pack by Udo Munk that runs in Linux, can be used to program and run 8080 and Z80 Machine Language “code” assembled (compiled) from 8080 or Z80 valid source code programs.
Lawrence Woodman, on http://techtinkering.com/articles/?id=11 created a bouncing light program for the Z80pack Imsai Simulator … titled: Writing My First Program To Toggle In To The IMSAI 8080. I also manually toggled that program into the simulator more than twice. At least once in binary and maybe a time or two more in Hexadecimal because I like the way the FrontPanel representation on the Imsai 8080 makes Hexadecimal and Octal (and Binary) notation more easily visually understandable. Does that make any sense? Looking at a bunch of A through F and 0 through 9 “numbers” is not very intuitive usually. But when you look at the front of an Imsai 8080 and realise that there are Octal and Hex “helpers” marked right on the panel it gets kind of exciting. Well to me anyway????
The Imsai 8080, on the front panel, has the Address and Data bus all laid out in LED lights with Hexadecimal and Octal “rulers” showing “8-4-2-1″ for Hex, and “4-2-1″ notation for Octal. So all a person has to do to program in Hex, for example, is to have a memory location to start in … and the Hexadecimal patterns to enter in. Let’s assume that the program starts at address “0″ (Zero) for simplicity. You just leave all of the switches down (this is the default at power on of the simulator) and hit “Examine” one time. The let’s say you have a pattern of “0EFF” to enter in. That’s a nice 16-bit number. You break it up into two sets of two hexadecimal digits “0E” and “FF”. Then you set about entering that into the panel on the right most 8 switches. Up is 1, down is 0. On and off. This will start at the 2nd set of BLUE switches on the panel. Under “Address Bus” and “Data Bus”. You can see the ruler right there with both “7-6-5-4-3-2-1-0″ and “8-4-2-1, 8-4-2-1″ as well as “2-1, 4-2-1, 4-2-1″. The 8-4-2-1 sequence is an aid in entering Hexidecimal into this computer. Starting at the first blue switch you want to figure out how “0E” will go in there? Well each hex digit is a “nibble” of 4 bits. So the zero “0″ goes in the first four switches and the 14 or “E” goes into the second four switches. What did I just say? “14″? Well yes, E in hexadecimal is 14 in decimal. So in the first four switches … none of them get turned ON. In the second 4 we want to reproduce the number 14 - so we add up from left to right the correct switches to add up to 14. That would be “8″ ON, “4″ ON, “2″ ON, and 1 stays OFF. And there you have it … you just toggled in an 8-bit piece of data representing “0E” into the computer. You would then hit the “DEPOSIT” switch and deposit that data (or program instruction code?) into memory - in which case your pattern would show up on the top DATA BUS LED lights. Then you can clear or turn OFF all 8 of those switches, and now you would want to enter in “FF”. Thats just “15″ and “15″ since F is 15 in Decimal. So 8+4+2+1 = 15, so all 4 switches would get flipped ON on both the Blue and the Red switches. And then you would hit DEPOST NEXT. Cool huh? It makes you appreciate life, right???? With our easy Apple Mac OS/X and Windows 7 or similar computers … all of this stuff is a thing of the past, right? Well for most people yes. Anyway that was basically the first line of instructions, that you would have just entered in above, for the Night Rider LED lights program. You would have a lot more of that switch flipping to do to enter in the rest of the program.
Anyway as Lawrence Woodman describes in his article:
Entering the program into the IMSAI 8080
The next bit is a little nerve racking and quite laborious. There are 0×40 bytes of code here, which is 512 bits. 512 ones and zeros that have to be entered exactly. 512 ones and zeros that if not entered correctly mean either re-entering the whole program again‚ or going back through them to check which were entered incorrectly. As well as this; if the program doesn’t work‚ is it because the program is wrong‚ or because I entered it in wrong? But now is not the time to worry, I have tested the program on paper, the design is sound, I need to grab the bull by the horns and enter this program.
[end of quote]
* It’s quite laborous to enter that program into the Z80pack Imsai 8080 Simulator, right???? So I got bitten by a bug … a computer problem bug … It bothered me that every time that I wanted to run that “Night Rider” flashing LED demo program I had to go through the whole 512 + switch flipping routine and hope I got it right. If not I was debugging the memory locations every time to see what switch entries I flipped wrong. You can go back a read the memory locations and see what’s in there … and see if it matchins Lawrences listing. Quite often you make a mistake. One little bit switch flipped in the wrong direction and the whole program can be NO GOOD. Now you know how computer programs crash. One little bit, a “1″ or a “0″ in the wrong place or at the wrong time … and it means a completely different thing. Close the window on your desktop no longer means close the window … it means “crash the computer”.
:-) Ha! ha! ha!
So instead of typing it again … let me paste in here my Z80 Assembler adaptation of Lawrences Program - which has the why and what of how I made it a loadable program that eliminates most of the toggle switching.
;——————————————————————–
; Here is your “Writing My First Program to Toggle into the Imsai
; 8080 (meaning the Z80Pack Frontpanel Imsai 8080 Emulator)
; Written by Lawrence Woodman on 5th November 2008 Techtinkering.com
; ——————————————————————-
; Your program listing reformatted 7 September 2010 by Alan Spicer -
; in an attempt to make the program reloadable by this simulator
; without having to toggle the whole thing in every time!
; ——————————————————————-
; Which brings us to … how can we save it so it can be loaded?
; The simulator will take “-xFILENAME” to load a hex or bin file
; and thus can load it at program run (Power On) and execute it with
; almost no toggle switching at all. But how do we make a hex or bin
; file out of this thing? We copy and paste your SOURCE listing …
; run it through a BUNCH of Unix/Linux utilties to try and get an
; Assembly Language Source File that *something* near to this sim
; can compile into bin or hex files. And so I did…
; ——————————————————————-
; I found out that there is Z80ASM that Udo Munk wrote that comes
; with Z80pack, and also Z80ASM for Linux available elsewhere.
; Which one will win the prize first and compile without tons of
; fatal errors? Udo Munk’s Z80asm won the prize. But not without a
; lot more work from me. Neither Z80ASM would take 8080 Assembler
; code, which is what Lawrence wrote this in. They wanted Z80
; Assembler Mnemonics and ways of doing things. So off to a trans-
; lator near you to try and switch it over. Lots more Unix utils
; used to switch things over, like the VI Editor.
;
; It also seemed that the Z80asm didn’t like certain length of
; LABELS in the program source code. They were not unique, it said.
; So fix that. And I still have 4 errors but it did compile to
; binary code. Both bin and hex files could be created. And they
; were. But something still seems to be wrong. The machine code
; that is generate does load into the sim machine. But it does not
; yet run. There still seems to be some bugs in a few spots where
; the Z80 machine code did NOT EQUAL the 8080 code? Or the hand
; code that you made? Did you really do this with no assembler?
; It’s awful strange how you came out with such a listing????
;——————————————————————-
; After much work re-assembling and trying to fix those errors -
; I finally figured out how to kill those 4 errors. 2 each were
; the same, The assembler seems to like “FF” in “00ffh” format,
; and the IN and OUT data, also “FF”’s had to be in parenthesis.
; Imagine all of that???? It loads ok now from a HEX file and
; your program works. The bin file? I might be still doing something
; wrong with that. But this has been a LONG NIGHT/MORNING.
;——————————————————————-
ORG 0
;
;———————————–
; Initialise the register variables
;———————————–
;
LD C,00FFh
LD D,1
;
;—————————————–
; Move the recorded position of the light
;—————————————–
;
LOOP: LD A,D ; Load Position into Accumulator
CP 128
JP Z,SWDIR ; Position = 128?
CP 1
JP NZ,MOVEPOS ; Position != 1?
;
; Switch the direction of the light
;
SWDIR: LD A,C ; Load Direction into Accumulator
CPL ; Compliment the accumulator
LD C,A ; Store result back in the Direction
MOVEPOS:LD A,C ; Load Direction into Accumulator
CP 0 ; Direction != left?
JP NZ,MOVERT
;
; Move position Left
;
LD A,D ; Load Position into Accumulator
RLA ; Rotate left
LD D,A ; Store result back in the Position
JP OUTPLGHT
;
; Move position Right
;
MOVERT: LD A,D ; Load Position into Accumulator
RRA ; Rotate right
LD D,A ; Store result back in Position
;
;———————————————–
; Output the light to PROGRAMMED OUTPUT display
;———————————————–
;
OUTPLGHT: LD A,D ; Load Position into Accumulator
CPL ; Compliment Accumulator due
; to way PROGRAMMED OUTPUT works
OUT (00FFh),A ; Output to PROGRAMMED OUTPUT
;
;———————–
; User controlled Delay
;———————–
;
IN A,(00FFh) ; User delay from PROGRAMMED INPUT
; port 0xFF
INC A ; Make sure 0 is minimum delay
DLYOUTR:LD B,02 ; Set register B loop delay to 2
DLYINR1:LD E,00FFh ; Set register E loop delay to 255
DLYINR2:DEC E ; Decrement Register E
JP NZ,DLYINR2 ; Loop until Register E = 0
DEC B ; Decrement Register B
JP NZ,DLYINR1 ; Loop until Register B = 0
DEC A ; Decrement Accumulator
JP NZ,DLYOUTR ; Loop until Register A = 0
;
;——————-
; Loop indefinitely
;——————-
;
JP LOOP
END
[end of that program listing]
night-rider-program-z80.txt
Here is the Z80 Assembler Source Code for this program in a dowloadable file
The hex file that this compiles into looks like the following. If you just want to avoid having to assemble it and just create a text file with the following 3 lines … you can load this into the Z80pack Imsai 8080 Simulator with: ./imsaisim -xFilename (where filename is whatever name you give the file with these 3 lines in it:
:200000000EFF16017AFE80CA0F00FE01C21200792F4F79FE00C21E007A1757C321007A1F65
:1B002000577A2FD3FFDBFF3C06021EFF1DC22C0005C22A003DC22800C30400CE
:00000001FF
* And “loop indefinitely” which is what most programs do. There is a program or routine looping right now over and over waiting for you to move your mouse … waiting for you to click on something … waiting for you to push a key on your keyboard. And it won’t stop looping indefinately until you close/kill the program or shut down your computer - in the case of a big program (system of program(s)) called an Operating System.
* Anyway the bottom line is that I translated his 8080 assembler instructions in hexadecimal into equivalent Z80 assembler instructions with their idiosyncracies … debugged it, aligned it, defined it, and set the color on track. As RCA used to say. And made it into a “compileable” or as they say in this type of program “assembleable” assembly language program. I ran it through the Z80asm - assembler provided by Udo Munk in the Z80pack kit … and loaded it into the Imsai Simulator. And it worked!!!! So now it is easy to reload the program each time you start the Simulator by just adding -xProgramName to the command line of starting the simulator.
Here is new video that I shot about my accomplishment:
Z80Pack Imsai 8080 Simulator Assembler Hacks - By Alan Spicer
—
Alan Spicer Marine Telecom
http://www.marinetelecom.net and http://www.wifiyacht.net
+1 954-683-3426
communications @ marinetelecom.net
Leave a Reply
You must be logged in to post a comment.