From ca9049cce5f2815c7f546c2edcd1ebfd0eb8194c Mon Sep 17 00:00:00 2001 From: ripsaw8080 Date: Sun, 14 Feb 2016 04:02:09 +0000 Subject: [PATCH] Implement BIOS beep sound for ASCII character 7. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3968 --- src/ints/int10_char.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/ints/int10_char.cpp b/src/ints/int10_char.cpp index a672d2ba..daf9c8ab 100644 --- a/src/ints/int10_char.cpp +++ b/src/ints/int10_char.cpp @@ -589,9 +589,21 @@ static void INT10_TeletypeOutputAttr(Bit8u chr,Bit8u attr,bool useattr,Bit8u pag Bit8u cur_row=CURSOR_POS_ROW(page); Bit8u cur_col=CURSOR_POS_COL(page); switch (chr) { - case 7: - //TODO BEEP - break; + case 7: /* Beep */ + // Prepare PIT counter 2 for ~900 Hz square wave + IO_Write(0x43,0xb6); + IO_Write(0x42,0x28); + IO_Write(0x42,0x05); + // Speaker on + IO_Write(0x61,IO_Read(0x61)|3); + // Idle for 1/3rd of a second + double start; + start=PIC_FullIndex(); + while ((PIC_FullIndex()-start)<333.0) CALLBACK_Idle(); + // Speaker off + IO_Write(0x61,IO_Read(0x61)&~3); + // No change in position + return; case 8: if(cur_col>0) cur_col--; break;