• AA – 4G LTE Marine Pack* ™ (US, Int’l) – $976.30 (Router only $564.30)
  • AA – Marine Package: 4G LTE and 3G System Ready to Go for Sail and Motor Yachts … $848.45
  • AA 3G Marine with Voice – $440.70 (Marine Pack* ™ $852.70
  • About Alan Spicer
  • Computer Networking
  • Cradlepoint MBR 3G/4G
  • Livewire Access Controller FB-10
  • Marine 3G/4G Antenna – and people that know how to install them
  • Peplink Multi-WAN/Internet Routers – Marine Internet Control
  • The “Unobtainium 4G LTE Router” Router alone – $564.00 + Shipping, Marine Pack (+ $412.00) = $976.00 + Shipping.
  • The Life of a Hurricane
  • Yacht Cellular Internet 4G-3G
  • About ASMT
  • The Marine 4G LTE Alliance
  • Contact US
  • About: Privacy
  • Ericsson W35 – Marine Cellular
  • WiFi Yacht – Marine WiFi
  • Services
  • Solutions
  • Sales (Products)
  • Page Rank Check
4G For Yachts – Alan Spicer Marine Telecom

Daily Archives: 19. November 2010

You are browsing the site archives by date.

This is no Fushigi anti-gravity ball, but it does have a Night Rider Lights display + Newtons Cradle Display

19. November 2010 03:12 / Leave a Comment / Alan Spicer


* I thought I did an updated blog post on this around December 2010, but I can’t find it. I did some more work on this in December and put all of the “features” into it that I had done seperately. I learned a bit trying to do the whole thing in fairly tight assembler code – I ended up using “CALL” to get everything squeezed in there with the limited # of CPU registers in the 8080 (and Z80). I originally wanted to add more than 1 light at a time rotating, in Lawrences program. Everyone says it should be easy. That’s the Axiom of doing something. But nobody did what somebody could do (?) I just had to put in some time. It became very tight code, very modular, and even creeping features creeped in. So I added in Random Lights, the old Counting in Binary that I had done before, the Newtons Cradle thing, and the original desire to be able to change the number of LED lights rotating from 1, to 2, 3, 4. So I’ve put the most recent version on here for download. You need Z80pack which has the Altair 8800 and the Imsai 8080 Simulators using FrontPanel as the graphical driver. It runs on Linux … I used Ubuntu Desktop. I probably won’t do anything more with this … but it does make you appreciate assembly code and then machine code running freely – with no brakes! and how to steer things around based upon an input, in this case the Programmable Input switches of the Imsai 8080 Computer. This was the computer used in the famous “War Games” movie. It was one of the two major player Personal Computers – Micro Computers – in the era when Bill Gates, Paul Allen, and gang wrote “Basic” on Paper Tape punch and sold it to Imsai for use on this machine. Later these machines had Floppy Drives, Monitor Screens, and other peripherals … all which lead up to the modern PC we know today. It’s nostalgic, it’s retro, … but it makes you appreciate things … and it’s a good thing for brusing up on Hexadecimal Numbering and such – which is how I came into this gig in the first place. I was looking for something that gave a ”visual” or lighted indication of numbering in Hexadecimal. I got much more than I bargained for … dabbled in Binary, Octal, and Hexidecimal with this thing. So now back onto the original post …

Earlier I posted about my re-coding Lawrence Woodman’s program from his article:

Writing My First Program To Toggle In To The IMSAI 8080

http://techtinkering.com/articles/?id=11

… so that it could be compiled with the Z80asm which comes with Z80pack (for Linux) and could be re-loaded from a file instead of having to manually toggle in the program in binary or hexadecimal each time in order to run it. It implements what I called the “Night Rider” lights on the Programmed Output LEDs on the simulator (and on actual Imsai 8080 hardware.) I also made “random lights” and “count binary” lights programs derived from it. But I wanted to be able to not only rotate 1 LED back and forth in the display – I wanted to be able to flip toggle switches and change the display from 1, 2, 3, maybe even 4 lights being rotated back and forth. I have now accomplished this as well as adding an “Easter Egg” of a sort of “Newtons Cradle” perpetual motion display option. You’ve probably seen those hardware (game?) gadgets on someones desk – with the 6 silver balls suspended – where if you start on end to swinging into the pack of silver balls it will start a sort of perpetual motion where the center silver balls knock off the end on causing it to perpetuate going back and forth for quite awhile. Well I’ve done this with 4 LEDs since I though that would give the best visual. We don’t really have room for 6 on this display of 8 LED’s where it would look the best. So I’ve done it with 4 LEDs along with the option of Zero, One, Two, Three, or Four lights rotating in the display.

This is my latest mod to the Night Rider led lights display for the Imsai 8080 Simulator that comes with Z80pack. This is no Fushigi anti-gravity ball but it does have a sort of Newtons Cradle light display as an Easter Egg to the also added 0, 1, 2, 3, and 4 lights switchable display. Showing more of what can be done with the Programmable Input and Output lights and toggle switches. The speed of the lights – and the number of lights rotated – are now isolated from each other – so that changing the pattern doesn’t change the speed. Left 4 = speed, right 4 switches = the pattern. 1001 or “9″ decimal is the Easter Egg. (Dec. 2010 latest has Random Lights by default, Count Binary, Newtons Cradle, and Variable # of LED’s rotation.)

;——————————————————————–
; Night Rider Rotating LED Display for Imsai 8080 Computer and
; Z80pack – ImsaiSim – Imsai 8080 Simulator
; The right 4 switches change the # of LEDs Rotated
; the left 4 (only) control the speed of rotation.
; Turn ON any “0″, “1″, “2″, “3″, or “4″ red PI switches
;——————————————————————-
; * Originally by: Lawrence Woodman:
; http://techtinkering.com/articles/?id=11
;——————————————————————-
; Modifications by: Alan Spicer:
; Z80 Assembler re-coding, Crazy Lights, Count Binary (other versions)
; and this rewrite with 0,1,2,3,4 lights toggle…
; http://blog.marinetelecom.net – 11/18/2010
;——————————————————————-
; Easter Egg: Toggle the binary number 1001, or 9 in decimal and get
; a sort of “Newtons Cradle” display using 4 lights – like those toys
; that adorn the Geek Executives desk at your office.
; … and 2 new Easter Eggs for the Holidays December 2010!
; Toggle “0000″ for a Randy – Random Lights display, and “1010″ or 10
; decimal for the old Count Binary routine.
; ——————————————————————
; Now all my eggs are in one basket – but it does show how being modular
; using “Call” allows me to plug these things in relatively easily.
; ——————————————————————
;
ORG     0
;
;———————————–
; Initialize the register variables
;———————————–
;
; B = OLD switches
; C = Current Switches
; D = Left Border
; E = Right Border (Right Border also = Pattern: 0,1,2,3,4 lights
; H = Current Position
; L = Direction
;
MAIN:  LD B,0   ; Set old SW = 0 (Default)
LD C,0   ; Set Current SW = 0 (Default)
LD D,0   ; Left Border (Default)
LD E,0   ; Right Border (Default)
LD H,0   ; * Current Position of Lights *
LD     L,00FFh    ; Direction…
;
LOOP: CALL SWCHK ; Check for Programmed Input Switch Changes
; Or Fall Through to (the rest of) LOOP ; … if they are the same
;—————————————–
; Move the recorded position of the light
;—————————————–
;
LD     A,H                   ; Load Position into Accumulator
CP     D       ; CP to Left Border “D”
JP     Z,SWDIR               ; Position = Left Border?
CP     E       ; CP to Right Border “E”
JP     NZ,MOVEPOS            ; Position != Right Border?
; Position = (E)? Then fall through
; to SWDIR directly below…
;
; Switch the direction of the light
;
SWDIR:  LD     A,L                   ; Load Direction into Accumulator
CPL                          ; Compliment the accumulator
LD     L,A                   ; Store result back in the Direction
MOVEPOS: LD     A,L                   ; Load Direction into Accumulator
CP     0                     ; Direction != left?
JP     NZ,MOVERT
;
; Move position Left
;
LD     A,H                   ; Load Position into Accumulator
RLA                          ; Rotate left
LD     H,A                   ; Store result back in the Position
CALL     OUTPLGHT
JP     LOOP
;
; Move position Right
;
MOVERT: LD      A,H                  ; Load Position into Accumulator
RRA                          ; Rotate right
LD     H,A                   ; Store result back in Position
CALL     OUTPLGHT
JP     LOOP
;
CHGED: LD B,C   ; Save C in B as OLD SW
LD A,C   ; make sure we still have in A
AND 15   ; Bit Mask it – Get Right 4 bits
; Jump to setting the parameters based on the right 4 (red) switches)
CP      0
;JP      Z,ZERO
JP      Z,RANDY   ; # Let’s default to something Randy.
CP      1
JP      Z,ONE
CP      2
JP      Z,ONE
CP      3
JP      Z,THREE
CP      4
JP      Z,ONE
CP      5
JP      Z,THREE
CP      6
JP      Z,THREE
CP      7
JP      Z,SEVEN
CP      8
JP      Z,ONE
CP      9
JP      Z,NEWT   ; “1001″ 8 + 1 = #Newtons Cradle
CP      10
;JP      Z,THREE
JP      Z,COUNT   ; Seems like a nice # for COUNT BINARY.
CP      11
JP      Z,SEVEN
CP      12
JP      Z,THREE
CP      13
JP      Z,SEVEN
CP      14
JP      Z,SEVEN
CP      15
JP      Z,FIFTN
; And here are So Many Places to jump to …
;;;;;;;;;;;;;;; ZERO LIGHTS
ZERO:  LD      D,0                           ; Border Left
LD      E,0                             ; Border Right
LD H,0   ; * Current Position of Lights *
LD     L,00FFh    ; Direction…
JP     LOOP
;;;;;;;;;;;;;;; 1 LIGHT
ONE:  LD      D,128                           ; Border Left
LD      E,1                             ; Border Right
LD H,1   ; * Current Position of Lights *
LD     L,00FFh    ; Direction…
JP     LOOP
;;;;;;;;;;;;;;; 2 LIGHT
THREE:  LD      D,192                           ; Border Left
LD      E,3                             ; Border Right
LD H,3   ; * Current Position of Lights *
LD     L,00FFh    ; Direction…
JP     LOOP
;;;;;;;;;;;;;;; 3 LIGHT
SEVEN:  LD      D,224                           ; Border Left
LD      E,7                             ; Border Right
LD H,7   ; * Current Position of Lights *
LD     L,00FFh    ; Direction…
JP     LOOP
;;;;;;;;;;;;;;; 4 LIGHT
FIFTN:  LD      D,240                           ; Border Left
LD      E,15                            ; Border Right
LD H,15   ; * Current Position of Lights *
LD     L,00FFh    ; Direction…
JP     LOOP
;;;;;;;;;;;;;;; Newtons Cradle
NEWT:  LD H,60
CALL OUTPLGHT
LD H,156
CALL OUTPLGHT
LD H,60
CALL OUTPLGHT
LD H,57
CALL OUTPLGHT
CALL  SWCHK                   ; check for sw changes
JP NEWT
;;;;;;;;;;;;;;; Count Binary
COUNT:  LD H,0                     ; * Current Position of Lights *
CALL OUTPLGHT
ADDME: INC H   ; H=H+1 counting binary…
CALL OUTPLGHT
CALL  SWCHK   ; check for sw changes
LD A,H
CP 255   ; All 1′s = 255.
JP NZ,ADDME  ; Add more to ME (H)
JP COUNT   ; or zero and count again
;;;;;;;;;;;;;;; (Pseudo) Random Lights
RANDY:  LD A,R   ; Load “R” register – Z80 memory refresh
LD H,A   ; must load it into A first…
CALL OUTPLGHT
CALL SWCHK   ; Are we done yet???
JP RANDY
;
SWCHK:  IN A,(00FFh)  ; Get the current SW
LD C,A   ; and save it in C
CP B   ; IS NEW SAME AS LAST ?
JP NZ,CHGED  ; NO it is not, SWITCHES HAVE CHANGED
RET
;
;———————————————–
; Output the light to PROGRAMMED OUTPUT display
;———————————————–
;
OUTPLGHT:    LD      A,H             ; Load Position into Accumulator
CPL                          ; Compliment Accumulator due to…
OUT     (00FFh),A            ; Output to PROGRAMMED OUTPUT
;
;———————–
; User controlled Delay
;———————–
IN      A,(00FFh)            ; User delay from PROGRAMMED INPUT
AND 240       ; Get only the Left 4 switches
INC     A                    ; Make sure 0 is minimum delay
LD C,255
DELAY:  DEC C
JP NZ,DELAY
LD C,255
DELAY1: DEC C
JP NZ,DELAY1
DEC     A                    ; Decrement Accumulator
JP     NZ,DELAY            ; Loop until Register A = 0
RET
;
END

ASM, BIN, HEX, LIS Files for Night Rider for Z80pack-ImsaiSim – This is the very latest, August 2011 – Note: newnewnew.* is the December 2010 version that was here before, newnewnew-2.* is from August 2011 and I added the Kill The Lights or Kill the Bit (BIT.ASM) into the NightRider program … the instructions are in the Source Code. Bit.asm and Test1 and Test2 programs from the Imsai 8080 Owners Manual are included in Z80 source and .bin object files for the Z80pack – ImsaiSim system. Udo Munks FTP.UNIX4FUN.ORG is down – but others are taking over the mirroring of the downloads – so you can still get Z80pack and all. I’m asking that my programs be added to the archive on the mirror(s) so we’ll see what happens.

* The programs highlighted on the real hardware here:

are from the Imsai Owners Manual. They are here in Z80 Assembler:

;
; Test Program #1 from the Imsai 8080 Manual. When a switch is thrown UP in
; the Programmable Input Switches – the corresponding LED is (inverted) turned OFF of
; Programmable Output LEDs. This is an 8-bit computer with 16-bit addressing.
; ———————–Alan Spicer 08/08/2011 —————————–
; THIS ONE … Does not compliment the accumulator – so the lights and switches are reversed!!!!
;
ORG     0
LOOP:   IN      A,(00FFh)               ; Get the current PIO Switches
OUT     (00FFh),A               ; Output to PROGRAMMED OUTPUT
JP      LOOP                    ; in the book they Jumped to a
; specific adress Hex 00 00
;  or 0000 0000 0000 0000 a 16-bit addr.
; which is the beginning of the program.
; We do that with a label “LOOP”. The
; code the comes out of the compiler is
; the same.
;
END

* Here is Imsai 8080 Test Program #1 in Hex for loading in Z80Pack/ImsaiSim

:07000000DBFFD3FFC300008A
:00000001FF
;
; Test Program #2 from the Imsai 8080 Manual. When a switch is thrown UP in
; the Programmable Input Switches – the corresponding LED is lit in the
; Programmable Output LEDs. This is an 8-bit computer with 16-bit addressing.
; ———————–Alan Spicer 08/08/2011 —————————–
;
ORG     0
LOOP:   IN      A,(00FFh)               ; Get the current PIO Switches
CPL                             ; Compliment the accumulator
OUT     (00FFh),A               ; Output to PROGRAMMED OUTPUT
JP      LOOP                    ; in the book they Jumped to a
; specific adress Hex 00 00
;  or 0000 0000 0000 0000 a 16-bit addr.
; which is the beginning of the program.
; We do that with a label “LOOP”. The
; code the comes out of the compiler is
; the same.
;
END

* Here is Imsai 8080 Test Program #2 in Hex for loading in Z80Pack/ImsaiSim

:08000000DBFF2FD3FFC300005A
:00000001FF

* And here is the Game Program, not officially called Test Program #3, but it is, from the Imsai 8080 Owners Manual. It is called “Kill the Lights” in other Imsai 8080 (later documentation? 1999 Thomas Fischer) Documentation – and some seem to call it “Kill the Bit”. I was going to recode the thing myself from the manual listings … they never did seem to give it completely (properly) in ASM code for anyone that had an ASSEMBLER program. This version is derived from “bit.asm” which came with the sample programs as part of the Z80Pack/ImsaiSim package. It came as 8080 ASM Code in Z80pack/ImsaiSim which seems strange. They assembled it with an Intel Assembler and provided Hex code as well. They did the same with Test Program #1 and #2 above. I didn’t notice that and completely recreated Program #1 and Program #2 (as shown above) in Z80 ASM Code. On this 3rd Program I converted the 8080 ASM code to Z80 ASM code. I introduced a bug causing it to not run once compiled awhile back. In August 2011 I found some “JP Z” instructions that should have been “JP NZ” instructions and re-compiled (assembled) it and was delighted to be presented with a working and reloadable Kill The Lights (or Kill the Bit) Game Program.  I went into this whole thing just to brush up on Binary and Hexadecimal a little bit. I got more than I bargained for. I got drawn into Lawrence’s “Writing my First Program to Toggle into the Imsai 8080″:

http://techtinkering.com/2008/11/05/writing-my-first-program-to-toggle-in-to-the-imsai-8080/

… and ended up wanting to Rotate more than one light, and be able to Select how many to Rotate. I ended up doing quite a few more different displays that could be selected. And now in August 2011 after seeing some YouTube videos of a fellow showing the original Owners Manual Programs, I wanted to provide the code for doing all 3 Test Programs – including the Game Program. The idea being to be able to LOAD them without having to Toggle Switch them in each time. (But then again… you don’t learn as much about the computer, binary – octal – and Hex without getting down in the Console Switches and Toggling a Program in. You could at minimum – Examine one of these programs and see how well it matches the Imsai Manual originals.)

;
; REGISTER B   = CURRENT LIGHT CONTENTS
; REGISTER C   = SWITCH DEBOUNCE INDICATOR
;                (HAVE SWITCHES CHANGED SINCE LAST LIGHT SHIFT)
;                 0 = NO, HAVE NOT CHANGED, CHANGES WILL BE RECOGNIZED
;                 1 = YES, ONE CHG OCCURED, FURTHER CHANGES IGNORED
; REGISTER D   = LAST SWITCH SETTING
; REGISTER E   = CURRENT SWITCH SETTING
; REGISTER H,L = DELAY COUNTER
; REGISTER SP  = DELAY COUNTER INCREMENT
;
ORG     0
;
START:  XOR     A               ;A=0
LD     H,A             ;SET DELAY COUNTER TO ZERO
IN      A,(00FFh)      ; READ THE SWITCHES
LD     L,A             ;SAVE THE INCREMENT VALUE AS INITIAL VALUE
LD      SP,HL          ;SAVE THE INCREMENT IN SP
;
; SEE IF SWITCHES HAVE CHANGED SINCE LAST LIGHT SHIFT (BASED ON FLAG IN C)
;
; ONLY ONCE SWITCH CHANGE (THE FIRST) PER LIGHT SHIFT IS RECOGNIZED,
; FURTHER SWITCH CHANGES ARE IGNORED
;
LOOP:   XOR     A               ;A=0
ADD     A,C             ;A=C, THE DEBOUNCE FLAG
JP     NZ,TESTROT         ;DEBOUNCING, IGNORE SW CHGS, TEST FOR ROTATE
;
; SWITCHES HAVE NOT CHANGED SINCE LAST LIGHT SHIFT,  GET THE SWITCH VALUE
; AND SEE IF THEY HAVE CHANGED
;
GETSW:  LD     D,E             ;LAST SWITCH SETTING = CURRENT SWITCH SETTING
IN      A,(00FFh)      ; READ THE SWITCHES
LD     E,A             ;NEW CURRENT SWITCH SETTING
XOR     D               ;IS NEW SAME AS LAST ?
JP     NZ,CHANGED         ;NO, SWITCHES HAVE CHANGED
;
; SWITCHE CHGS BEING IGNORED, SEE IF IT’S TIME TO ROTATE THE LIGHTS
;
TESTROT:ADD     HL,SP          ;ADD INCREMENT IN SP TO COUNTER IN H,L
JP     NC,LOOP            ;DID THE COUNTER OVERFLOW ?
;
; IT’S TIME TO SHIFT THE LIGHTS LEFT
;
ROTATE: LD     A,B             ;GET THE LIGHT PATTERN
RLC     A              ;SHIFT IT LEFT
LD     B,A             ;SAVE IT AS THE NEW LIGHT PATTERN
OUT     (00FFh),A      ;WRITE THE LIGHTS
XOR     A               ;GET A ZERO
LD     C,A             ;SHOW NO SWITCH CHGS SINCE LAST SHIFT
JP     LOOP            ;CONTINUE
;
;THE SWITCHES HAVE CHANGED, REVISE THE DISPLAY AND CONTINUE
;
CHANGED:XOR     B               ;FORM THE NEW DISPLAY
LD     B,A             ;SAVE IT
OUT     (00FFh),A      ;WRITE IT TO THE LIGHTS
XOR     A               ;NOW A=0
LD     H,A             ;CLEAR DELAY COUNTER
CPL                     ;NOW A=0FFH
LD     C,A             ;SHOW THAT SWITCHES JUST CHANGED
JP     LOOP            ;GO TO DEBOUNCE LOOP
;
END     START
* And baked for you fresh this morning (08/10/2011) here is the Hex code for loading into Z80Pack/ImsaiSim or whatever you can load it into …

:20000000AF67DBFF6FF9AF81C2130053DBFF5FAAC2220039D2060078CB0747D3FFAF4FC334
:0D0020000600A847D3FFAF672F4FC30600AF
:00000001FF
—

Alan Spicer

Alan Spicer Marine Telecom and WiFiYacht.net

http://www.marinetelecom.net – http://www.wifiyacht.net

+1 954-683-3426

communications @ marinetelecom.net

Posted in: Main

Important Pages on ASMT Blog

  • AA – 4G LTE Marine Pack* ™ (US, Int’l) – $976.30 (Router only $564.30)
  • AA – Marine Package: 4G LTE and 3G System Ready to Go for Sail and Motor Yachts … $848.45
  • AA 3G Marine with Voice – $440.70 (Marine Pack* ™ $852.70
  • About Alan Spicer
  • About ASMT
  • About: Privacy
  • Computer Networking
  • Contact US
  • Cradlepoint MBR 3G/4G
  • Ericsson W35 – Marine Cellular
  • Livewire Access Controller FB-10
  • Marine 3G/4G Antenna – and people that know how to install them
  • Page Rank Check
  • Peplink Multi-WAN/Internet Routers – Marine Internet Control
  • Sales (Products)
  • Services
  • Solutions
  • The “Unobtainium 4G LTE Router” Router alone – $564.00 + Shipping, Marine Pack (+ $412.00) = $976.00 + Shipping.
  • The Life of a Hurricane
  • The Marine 4G LTE Alliance
  • WiFi Yacht – Marine WiFi
  • Yacht Cellular Internet 4G-3G

Blogroll

  • Boater Exam
  • Independent Operational Support for Mega Yachts in the Mediterranean
  • o2.co.uk
  • Panbo: The Marine Electronics Weblog
  • Power Line Noise
  • The Boaters TV
  • The Red Eye Radio Network

Recent Posts

  • Yacht 4G Cellular (Bahamas, Caribbean) – L.I.M.E. answers regarding 4G 26. April 2013
  • Amateur Radio: Some recent contacts, nice colorful QRZ.COM images 26. April 2013
  • Prayers to the Boston Marathon and West Texas affected families, also Being Social in the Face of Disaster … (InformationWeek Brian Lasusa) 21. April 2013
  • We will be testing an Ericsson L21 in Miami, Florida on a yacht … 18. April 2013
  • Yacht Cellular: Ericsson MBR L21 (B17/B4) 4G LTE Router – Available 12. April 2013

Categories

Site Posts Calendar

November 2010
M T W T F S S
« Oct   Dec »
1234567
891011121314
15161718192021
22232425262728
2930  

Admin Login / Wordpress

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
© Copyright 2013 - 4G For Yachts - Alan Spicer Marine Telecom
Infinity Theme by DesignCoral / WordPress