AY-3-8912 Sound Hex Loader

Developer(s): Rene Bruneau
Date: 1994
Type: Program
Platform(s): ZX81, TS 1000
Tags: Sound

The hex loader (Figure 4) for Rene Bruneau’s AY-3-8912 sound board for the ZX81, which adds PLAY, MUSIC and SOUND commands (about 600 bytes of code in a REM) and a joystick port. W writes: give the start and finish addresses, then type each row of 8 bytes in hex and its total; R reads memory back as hex rows with totals.

Line 1 is a PRINT of zeros joined by plus signs; POKE 16513,234 turns it into the REM that holds the code, as lines 2-4 say. The machine code (Figure 5, 16514-17074) and the music demo (Figure 6) are typed in, checked against the printed row totals and ready to run as AY-3-8912 Music Demo. As printed, line 310 sends a correct row back to the same INPUT without advancing, so only the first row can be entered.

Published in Sinc-Link July-August 1994 (Sound for the ZX81).

Image Gallery

Source Code

1 PRINT 0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0
2 REM ** ENTER 80 ZEROS WITH
         PLUS SIGNS BETWEEN
3 REM ** POKE 16513,234
4 REM ** RUN HEX LOADER
90 PRINT "READ OR WRITE (R/W)"
95 INPUT M$
100 CLS
110 PRINT "START ADDRESS"
120 INPUT S
130 PRINT "FINISH ADDRESS"
140 INPUT F
145 IF M$="R" THEN GOTO 400
150 FOR N=S TO F STEP 8
160 LET T=0
170 SCROLL
180 PRINT N;" - ";
190 INPUT A$
200 PRINT A$;" = ";
210 INPUT TOT
220 PRINT TOT
230 LET Z=0
240 FOR K=1 TO LEN A$ STEP 2
250 LET C=(CODE A$(K)-28)*16+CODE A$(K+1)-28
270 LET T=T+C
280 POKE N+Z,C
290 LET Z=Z+1
300 NEXT K
310 IF TOT=T THEN GOTO 340
320 SCROLL
330 PRINT "ERROR - PLEASE INPUT AGAIN"
340 GOTO 190
350 NEXT N
360 STOP
400 FOR N=S TO F STEP 8
405 LET T=0
410 SCROLL
420 PRINT N;" - ";
430 FOR B=0 TO 7
440 LET C=PEEK (N+B)
445 LET T=T+C
450 LET F$=CHR$ (INT (C/16+28))
460 LET S$=CHR$ ((C-((CODE F$-28)*16))+28)
465 PRINT F$;S$;
470 NEXT B
480 PRINT " = ";T
490 NEXT N
495 STOP

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.