Below is a program I wrote which uses the pc speaker to simulate harmony. It allows multiple simultaneous keys to be pressed.
;This is an assembly language program written by Myron Berg.
;It demonstrates the polling of the keyboard for more
;than one key at a time. It also demonstrates the use of the pc speaker
;to simulate harmony.
;Each key that is pressed is added to the list of currently played keys.
;When a scan code contains a 1 in the 7th bit, then the key is being released
;so the key is removed from the currently played keys list.
;To achieve the harmony sound, since the pc speaker can play only one
;pitch at a time, the pitches are rapidly cycled. Too rapid cycling produces
;static sound. The vibrato rate can be increased by pressing the grey +
;key and decrease by pressing the grey - key on the keypad.
;To prevent this vibrato from changing too much from machine to machine,
;I created a procedure to count how many cycles are performed in 1 machine
;cycle (1/18th of a second). This number is stored in the variable
;counter and is used to determine how many cycles must be performed before a
;change in pitch is allowed. When more keys are pressed at the same time,
;a faster vibrato rate is needed to make the sound correct,
;so the number of cycles is decreased.
E-Mail: Myron Berg (Myron_Berg@eagle.dsu.nodak.edu)
Floating Point input and output into Assembly Language
Myron Berg's Home Page
Computer Science Education- End Beseen Hit counter -->