Gameshow System
I built a simple gameshow card for the Apple II. The system supports up to 32 users. A buzzer is wired to each student's desk.
Four 74LS244 buffers connect the buzzer lines to the data bus. A PAL is used for the chip select. The buzzers are located at addresses $C0C0 through $C0C3 (8 buzzers to an address). The code scans the addresses until it detects a buzzer going off, then displays the number of that buzzer.
The board was done primarily with wire-wrap.
Here's the code I wrote for it:
[tt]100 C = 0
105 FOR V=49344 TO 49346
110 A = PEEK(V)
115 GOSUB 200
120 IF (R <> 0) THEN GOSUB 300
125 C = C + 8
130 NEXT V
135 GOTO 100
200 B = 128
205 I = 8
210 FOR Q = 1 TO 8
220 IF (A >= THEN RETURN
225 B = B / 2
230 I = I - 1
235 NEXT Q
240 R = 0
245 RETURN
300 PRINT R
305 INPUT =T$
310 HOME : RETURN[/tt]
This was originally meant as just a test program, but I never got around to writing something more advanced.
There are only 20 students in the class, so this code doesn't bother to scan the last eight buzzers. There's no good way scan bits in BASIC, which is why we have this inelegant routine with the division. If anybody would like to rewrite this in assembly or improve the interface (maybe add some graphics and sounds), that would be fantastic.
It looked really nice before I hooked 60 cables up to it! This is not the way to do a patch panel.
To save money, I used telephone wire, which wasn't a lot of fun to crimp.
The buzzers are three-terminal lever switches, duct-taped upside down. This works pretty well.
Wires snake across the floor and up the arms of each chair.
Comments
Great job.
It is good to see innovative educators doing innovative things with older hardware. Excellent job. What kind of latency do you get with this system?
Slow
It will often take half a second for a buzzer-click to register. This is because of the software (the constant division), not the hardware. Rewritten in assembly, I doubt there would be any discernable lag.
XOR?
Does Applesoft basic include the XOR command? Running a tight loop using that to apply the 8 possible bit masks to the value returned from the memory location would probably be faster then divisions.
--Peace
Nope
There's no XOR command, unfortunately.
Send me the details of your card and I'll send you assy
Hello,
I'll write assembly routines with an & command
interface for your "gameshow" buzzer card.
write me if interested
Rich
aiiadict AT gmail DOT com
The desgin uses three 74LS244
The desgin uses three 74LS244 tri-state buffers, providing 32 inputs. These are at addresses $C0C0, $C0C1, $C0C2, $C0C3. The buzzers are wired directly to the 74LS244 ICs, so if users 0, 2, and 7 are pressing their buzzers, the value of $C0C0 will be:
10100001
assembly code for gameshow
It isn't pretty but it should work. You could make it alot faster
still by using a loop instead of having code for each button on each chip.
CALL 768+32. You get 768 to 768+31 filled with status of
buttons. 768 = button1, 769 = button2, etc.
CALL768+32
e=768
for i = 0 to 31
if peek(e+i) = 1 then print "player # ";i;" pressed the button"
next i
org $0300
first8 equ $c0c0
second8 equ $c0c1
third8 equ $c0c2
fourth8 equ $c0c3
buttons ds 32
but1 dfb #00000001
but2 dfb #00000010
but3 dfb #00000100
but4 dfb #00001000
but5 dfb #00010000
but6 dfb #00100000
but7 dfb #01000000
but8 dfb #10000000
ldx #00 ;offset to buttons storage area
start lda first8
jsr bchk
lda second8
jsr bchk
lda third8
jsr bchk
lda fourth8
jsr bchk
rts
bchk AND but1 ;is button 1 ON?
beq noton1 ;no
ldy #1 ;yes, store a 1 in the correct location
sty buttons,x
jmp bchk2 ;skip the "no code"
noton1 ldy #00 ;no ---> store a zero in the location
sty buttons,x
bchk2 inx
AND but2
beq noton2
ldy #1
sty buttons,x
jmp bchk3
noton2 ldy #00
sty buttons,x
bchk3 inx
AND but3
beq noton3
ldy #1
sty buttons,x
jmp bchk4
noton3 ldy #00
sty buttons,x
bchk3 inx
AND but3
beq noton4
ldy #1
sty buttons,x
jmp bchk4
noton4 ldy #00
sty buttons,x
bchk4 inx
AND but4
beq noton5
ldy #1
sty buttons,x
jmp bchk5
noton5 ldy #00
sty buttons,x
bchk5 inx
AND but5
beq noton6
ldy #1
sty buttons,x
jmp bchk6
noton5 ldy #00
sty buttons,x
bchk6 inx
AND but6
beq noton6
ldy #1
sty buttons,x
jmp bchk7
noton6 ldy #00
sty buttons,x
bchk7 inx
AND but7
beq noton4
ldy #1
sty buttons,x
jmp bchk8
noton7 ldy #00
sty buttons,x
bchk8 inx
AND but8
beq noton8
ldy #1
sty buttons,x
jmp bEND
noton8 ldy #00
sty buttons,x
bEND INX
RTS
assembly
Need to STA in a temp location
before JSR BCHECK, and LDA TEMP
after the AND instructions.
Rich
Schematics?
Could we possibly have schematics for this? How did you interface this to the port inside the Apple?
Re: Gameshow System
I'm mighty late out of the gate, but here's a hunk of assembly (well, disassembly) that will scan the group of bytes indefinitely for a set bit. Upon finding one, it will return with the index (0 through 31) of the bit within the group in the accumulator and memory location 6. If desired the BMI 300 (30 EE) at 310 may be replaced with a couple of NOPs (EA EA), which will make it scan once, and return FF if nothing was found.
Hopefully one of the other solutions sufficed; but this might be closer to the actual need (and faster).
Meanwhile, it occurs to me that your card is probably usable in slot 3 without conflicting with 80 column function, as it has no firmware. ☺