+; soundtest1.asm
+; Requires an AY-3-891x or YM2149, with address decoding making
+; a write/read to $50 a data write/read, a write to $51 an address write,
+; and any other combination being an AY Idle condition.
+; Supernaive bruteforce approach, with random delay values.
+; Produces a frequency sweep by counting down 0..255
+
+CPU Z80
+OUTPUT HEX
+
+* = $100
+START LD A, 7
+ OUT ($51), A
+ LD A, $FF
+ OUT ($50), A
+
+ LD A, 8
+ OUT ($51), A
+ LD A, 9
+ OUT ($50), A
+
+ LD A, 9
+ OUT ($51), A
+ LD A, 0
+ OUT ($50), A
+
+ LD A, $A
+ OUT ($51), A
+ LD A, 0
+ OUT ($50), A
+
+ LD A, 7
+ OUT ($51), A
+ LD A, $FE
+ OUT ($50), A
+
+ LD A, 1
+ OUT ($51), A
+ LD A, 1
+ OUT ($50), A
+
+ LD A, 0
+ OUT ($51), A
+
+ LD A, $FF
+LOOP1 OUT ($50), A
+ PUSH AF
+ LD A, 8
+ CALL DELAY
+ POP AF
+ DEC A
+ JR NZ, LOOP1
+
+ LD A, 7
+ OUT ($51), A
+ LD A, $FF
+ OUT ($50), A
+
+ RET
+
+; End of main code.
+
+;Start of delay routine..
+DELAY PUSH BC
+DLY_START LD C, 10
+DLY_LOOPO LD B, 0
+DLY_LOOPI DJNZ DLY_LOOPI
+ DEC C
+ JR NZ, DLY_LOOPO
+ DEC A
+ JR NZ, DLY_START
+ POP BC
+ RET