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
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.
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?
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.
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.
There's no XOR command, unfortunately.
Send me the details of your card and I'll send you assy
I'll write assembly routines with an & command
interface for your "gameshow" buzzer card.
write me if interested
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:
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.
for i = 0 to 31
if peek(e+i) = 1 then print "player # ";i;" pressed the button"
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
bchk AND but1 ;is button 1 ON?
beq noton1 ;no
ldy #1 ;yes, store a 1 in the correct location
jmp bchk2 ;skip the "no code"
noton1 ldy #00 ;no ---> store a zero in the location
noton2 ldy #00
noton3 ldy #00
noton4 ldy #00
noton5 ldy #00
noton5 ldy #00
noton6 ldy #00
noton7 ldy #00
noton8 ldy #00
Need to STA in a temp location
before JSR BCHECK, and LDA TEMP
after the AND instructions.
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. ☺