Lion system now has 2 basic channels of sound and 1 channel of noise all mixed in one output.
Sounds are generated by writing a word at I/O ports 8,10.
the format of the word is: DDFF FFFF FFFF FFFF
the 14 lower bits define a divider of the 100Khz base frequency: Freq=100khz/(F+1)
The 2 higher bits define the duration, 0=2 sec 1=1s 2=0.5s 3=0.25s
By reading I/O port 9 you can find out if a channel still plays a sound, if the result is 0 there is no sound.
Bit 0 is 1 when channel 1 is active, bit 1 is 1 when channel 2 is active.
To add noise to any active sound channel use OUT 11,1 and to disable it OUT 11,0
From tiny Basic you can also use the command
BEEP num,dur F=100Khz/(num+1) dur=0 2 sec, dur=1 1 sec, dur =2 0.5 sec, dur=3 0.25 sec
BEEP 99,2 will produce a 1Khz sound for 0.5 seconds.
I added two Atari compatible joystick ports.
Their state can be read as a word from I/O port 22.
the lower byte has the state of the first joystick.
the higher byte has the state of the second joystick.
the byte has the form: 0 0 0 Right Left Up Down Button
In tiny basic functions JOY1 and JOY2 return the joystick status.
10 J=JOY1
20 IF J=16 PRINT "RIGHT"
30 IF J=1 PRINT "FIRE BUTTON PRESSED"