Files
x86-bare-metal-examples/pc_speaker.S
Ciro Santilli fb3c7e04c4 Move all documentation to README.adoc
This includes both separate .md files, and documentation that was on the
head of the .S source files.

Retest everything as this was done, and fix a few easy things.
2018-05-13 22:13:19 +01:00

36 lines
714 B
ArmAsm

#include "common.h"
BEGIN
/* Chanel 2, square wave, load TODO?, binary */
mov $0xb6, %al
out %al, $0x43
/* Set frequency of Channel 2. */
.equ div, 1193181 / 1000
mov div, %ax
out %al, $0x42
mov %ah, %al
out %al, $0x42
/* Dummy read of System Control Port B. TODO why? */
in $0x61, %al
/* Enable timer 2 output to speaker.
* THIS is where the sound begins.
*/
mov $0x03, %al
out %al, $0x61
/* Loop forever to keep hearing it. */
loop:
nop
jmp loop
/* This is how a sound can be stopped.
* This code never reached in this example.
* unless you hack it up.
*/
in $0x61, %al
mov $0x00, %al
out %al, $0x61