Blinkenlights Program

409 views
Skip to first unread message

HAL 9000

unread,
Jun 10, 2018, 11:13:45 PM6/10/18
to altair...@googlegroups.com
I wrote this to show off the blinkenlights. You can see I obviously learned from "Kill the Bit" by Dean McDaniel,. 
You can change the patterns by flipping sense switches

A10 A9  A8  
 0   0   0  = 0 "Rotate bit(s) left"
 0   0   1  = 1 "Rotate bit(s) right"
 0   1   0  = 2 "Knight Rider"
 0   1   1  = 3 "Xor Left Shift"
 1   0   0  = 4 "Xor Right Shift"
 1   0   1  = 5 "Cross Eyed"

3,4, and 5 can introduce new bits to the pattern.
2 will not work properly unless there is exactly one bit in the pattern.
Clicking "Reset" will put 1 bit back in the pattern at any time.
You can come up with some interesting patterns by moving back and forth between modes.
  

000 041 lxi h,0
001 000
002 000
003 026 mvi d,1
004 001
005 001 lxi, 016
006 036 ;Speed
007 000
010 032 ldax d
011 032 ldax d
012 032 ldax d
013 032 ldax d
014 011 dad bc
015 322 jnc 010
016 010
017 000
020 333 in 0xff
021 377
022 346 ani 007
023 007 ;mask bits
024 306 adi 047 ;Location of lookup table
025 047
026 006 mvi b,0 ;Part of bc address
027 000
030 117 mov c,a
031 012 ldax bc
032 107 mvi b,a
033 001 lxi bc,047 ;Load address from lookup table
034 047
035 000
036 062 sta 042 ;Get address of subroutine
037 042
040 000
041 315 call 0xFF ;Call subroutine
042 377 ; will be overwritten
043 000
044 303 jmp 005 ;Loop back to where we initialized b
045 005
046 000
047 057 ; jump table
050 064
051 071
052 123
053 133
054 151
055 057
056 057 ;end jump table
057 172 mov a,d ;Left Shift sub
060 007 rlc
061 127 mov d,a
062 137 mov e,d
063 311 ret
064 172 mov a,d ;Right Shift sub
065 017 rrc
066 127 mov d,a
067 137 mov e,d
070 311 ret
071 172 mov a,d ;KITT sub
072 007 rlc ; will be overwritten
073 127 mov d,a
074 326 sui 1 ; limit
075 001
076 312 jz 116 ; go left
077 116
100 000
101 172 mov a,d
102 036 mvi e,0xFF
103 377
104 172 mov a,d ; for test
105 326 sui 200
106 200
107 300 rnz ; ret not zero
110 076 mvi 017
111 017
112 062 sta 072 ; write shift instruction
113 072
114 000
115 311 ret
116 076 mvi 007 ; shift instruction
117 007
120 303 jmp 112 ; to wirte shift instruction
121 112
122 000
123 172 mov a,d ;Invert Left
124 007 rlc
125 356 xri 001
126 001
127 127 mov d,a
130 036 mvi e,0xFF
131 377
132 311 ret
133 172 mov a,d ;Invert Right
134 356 xri 001
135 001
136 017 rrc
137 127 mov d,a
140 036 mvi e,0xFF
141 377
142 311 ret
143 201 ;data for eyes
144 102
145 044
146 030
147 044
150 202
151 173 mov a,e ;eyes
152 376 cpi, 6 ; e<6?
153 006
154 322 jnc 170
155 170
156 000
157 306 adi 143
160 143
161 006 mvi b,0
162 000
163 117 mov c,a
164 012 ldax b
165 127 mov d,a
166 034 inr e
167 311 ret
170 036 mvi e,0
171 000
172 303 jmp 151
173 151
174 000


jcad...@gmail.com

unread,
Jun 11, 2018, 9:53:42 AM6/11/18
to Altair-Duino
Did you enter it using the front panel!

Jean-Claude 

HAL 9000

unread,
Jun 11, 2018, 1:30:42 PM6/11/18
to Altair-Duino
Yep. The good news is you can save the toggled program as explained by Dave here:

HAL 9000

unread,
Jun 11, 2018, 1:44:39 PM6/11/18
to altair...@googlegroups.com

jcad...@gmail.com

unread,
Jun 11, 2018, 4:41:21 PM6/11/18
to Altair-Duino
Hi Hal,

Congratulations !!!

I just wanted to know if you did it like a real man :-)
I hope you got it right the first time, that's quite a few bytes.
Does it run in 64K memory? Once I read that the Kill a Bit does not run if you have 64k and you must reduce the memory size.
It looks cool on the video.

Jean-Claude

HAL 9000

unread,
Jun 11, 2018, 10:31:49 PM6/11/18
to Altair-Duino
It's hand assembly, so I largely trial and errored my way through while transcribing.
It runs on my 64k Arduinotair. Off of the top of my head,I can't imagine why it wouldn't work.

Don Blake

unread,
Mar 8, 2020, 8:07:53 PM3/8/20
to Altair-Duino
I added the Blinkenlights program to the list of functions that can be selected via AUX1 down.

The following modifications to the Arduino Due Altair8800 software (https://github.com/dhansel/Altair8800) were necessary:

prog_games.h - add:

  uint16_t prog_games_copy_blinkenlights( );

prog_games.cpp - add:

  static const byte PROGMEM blinkenlights[ ] = {
    0041, 0000, 0000, 0026, 0001, 0001, 0036, 0000,
    0032, 0032, 0032, 0032, 0011, 0322, 0010, 0000,
    0333, 0377, 0346, 0007, 0306, 0047, 0006, 0000,
    0117, 0012, 0107, 0001, 0047, 0000, 0062, 0042,
    0000, 0315, 0377, 0000, 0303, 0005, 0000, 0057,
    0064, 0071, 0123, 0133, 0151, 0057, 0057, 0172,
    0007, 0127, 0137, 0311, 0172, 0017, 0127, 0137,
    0311, 0172, 0007, 0127, 0326, 0001, 0312, 0116,
    0000, 0172, 0036, 0377, 0172, 0326, 0200, 0300,
    0076, 0017, 0062, 0072, 0000, 0311, 0076, 0007,
    0303, 0112, 0000, 0172, 0007, 0356, 0001, 0127,
    0036, 0377, 0311, 0172, 0356, 0001, 0017, 0127,
    0036, 0377, 0311, 0201, 0102, 0044, 0030, 0044,
    0202, 0173, 0376, 0006, 0322, 0170, 0000, 0306,
    0143, 0006, 0000, 0117, 0012, 0127, 0034, 0311,
    0036, 0000, 0303, 0151, 0000
  };

also to prog_games.cpp - add:

  uint16_t prog_games_copy_blinkenlights( )
  {
    if ( prog_copy_to_ram( 0x0000, blinkenlights, sizeof( blinkenlights ) ) )
    {
      return 0x0000;
    }
    else
    {
      return 0xFFFF;
    }
  }

to prog.cpp - add the following to the programs array in the get_prog_info function:

  {PSTR("Blinkenlights"),              prog_games_copy_blinkenlights, true},

I believe if you're running on the Altair-Duino Pro, you also need to make the following change (needed for the VT100 Emulator) to host_due.h:

  #define USE_SERIAL_ON_A6A7 1


Don
KD2GXH
Reply all
Reply to author
Forward
0 new messages