Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,3 @@
---
from: http://rosettacode.org/wiki/Terminal_control/Ringing_the_terminal_bell
note: Terminal control

View file

@ -0,0 +1,11 @@
[[Terminal Control::task| ]]
;Task:
Make the terminal running the program ring its "bell".
On modern terminal emulators, this may be done by playing some other sound which might or might not be configurable, or by flashing the title bar or inverting the colors of the screen, but was classically a physical bell within the terminal.   It is usually used to indicate a problem where a wrong character has been typed.
In most terminals, if the &nbsp; [[wp:Bell character|Bell character]] &nbsp; (ASCII code '''7''', &nbsp; <big><code> \a </code></big> in C) &nbsp; is printed by the program, it will cause the terminal to ring its bell. &nbsp; This is a function of the terminal, and is independent of the programming language of the program, other than the ability to print a particular character to standard out.
<br><br>

View file

@ -0,0 +1,23 @@
.cr 6800
.tf bel6800.obj,AP1
.lf bel6800
;=====================================================;
; Ring the Bell for the Motorola 6800 ;
; by barrym 2013-03-31 ;
;-----------------------------------------------------;
; Rings the bell of an ascii terminal (console) ;
; connected to a 1970s vintage SWTPC 6800 system, ;
; which is the target device for this assembly. ;
; Many thanks to: ;
; swtpc.com for hosting Michael Holley's documents! ;
; sbprojects.com for a very nice assembler! ;
; swtpcemu.com for a very capable emulator! ;
; reg a holds the ascii char to be output ;
;-----------------------------------------------------;
outeee = $e1d1 ;ROM: console putchar routine
.or $0f00
;-----------------------------------------------------;
main ldaa #7 ;Load the ascii BEL char
jsr outeee ; and print it
swi ;Return to the monitor
.en

View file

@ -0,0 +1,14 @@
.model small
.stack 1024
.data
.code
start: mov ah, 02h ;character output
mov dl, 07h ;bell code
int 21h ;call MS-DOS
mov ax, 4C00h ;exit
int 21h ;return to MS-DOS
end start

View file

@ -0,0 +1,73 @@
.model small
.stack 1024
.data
.code
start:
mov al,7
call PrintChar
mov ax,4C00h
int 21h ;return to DOS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PrintChar: ;Print AL to screen
push cx
push bx
push ax
cmp al,7
jne skipBEL
call RingBell
jmp done_PrintChar
skipBEL:
mov bl,15 ;text color will be white
mov ah,0Eh
int 10h ;prints ascii code stored in AL to the screen (this is a slightly different putc syscall)
done_PrintChar:
pop ax
pop bx
pop cx
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RingBell:
push ax
push cx
push dx
;if BEL is the argument passed to PrintChar, it will call this function and not actually print anything or advance the cursor
;this uses the built-in beeper to simulate a beep
mov al,10110110b ;select counter 2, 16-bit mode
out 43h, al
mov ax,0C00h ;set pitch of beep - this is somewhat high but isn't too annoying. Feel free to adjust this value
out 42h,al
mov al,ah
out 42h,al
mov al,3
out 61h,al ;enable sound and timer mode
mov cx,0FFFFh
mov dx,0Fh ;set up loop counters
beepdelay: ;delay lasts about half a second
loop beepdelay
mov cx,0FFFFh
dec dx
jnz beepdelay
mov al,0 ;mute
out 61h,al ;cut the sound
; mov bl,15
; mov ax,0E20h ;print a spacebar to the terminal
; int 10h ;uncomment these 3 lines if you want the BEL to "take up space" in the output stream
pop dx
pop cx
pop ax
ret
end start

View file

@ -0,0 +1,3 @@
BEGIN {
print "\a" # Ring the bell
}

View file

@ -0,0 +1,22 @@
PROC Wait(BYTE frames)
BYTE RTCLOK=$14
frames==+RTCLOK
WHILE frames#RTCLOK DO OD
RETURN
PROC Main()
BYTE
i,n=[3],
CH=$02FC ;Internal hardware value for last key pressed
PrintF("Press any key to hear %B bells...",n)
DO UNTIL CH#$FF OD
CH=$FF
FOR i=1 TO n
DO
Put(253) ;buzzer
Wait(20)
OD
Wait(100)
RETURN

View file

@ -0,0 +1,7 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Latin_1;
procedure Bell is
begin
Put(Ada.Characters.Latin_1.BEL);
end Bell;

View file

@ -0,0 +1,3 @@
@echo off
for /f %%. in ('forfiles /m "%~nx0" /c "cmd /c echo 0x07"') do set bell=%%.
echo %bell%

View file

@ -0,0 +1,6 @@
#include <iostream>
int main() {
std::cout << "\a";
return 0;
}

View file

@ -0,0 +1,8 @@
// the simple version:
System.Console.Write("\a"); // will beep
System.Threading.Thread.Sleep(1000); // will wait for 1 second
System.Console.Beep(); // will beep a second time
System.Threading.Thread.Sleep(1000);
// System.Console.Beep() also accepts (int)hertz and (int)duration in milliseconds:
System.Console.Beep(440, 2000); // default "concert pitch" for 2 seconds

View file

@ -0,0 +1,5 @@
#include <stdio.h>
int main() {
printf("\a");
return 0;
}

View file

@ -0,0 +1,13 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. mf-bell.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 bell-code PIC X USAGE COMP-X VALUE 22.
01 dummy-param PIC X.
PROCEDURE DIVISION.
CALL X"AF" USING bell-code, dummy-param
GOBACK
.

View file

@ -0,0 +1,4 @@
void main() {
import std.stdio;
writeln('\a');
}

View file

@ -0,0 +1,7 @@
program TerminalBell;
{$APPTYPE CONSOLE}
begin
Writeln(#7);
end.

View file

@ -0,0 +1,2 @@
(ding) ;; ring the bell
(beep) ;; the same thing

View file

@ -0,0 +1,3 @@
open System
Console.Beep()

View file

@ -0,0 +1,3 @@
USING: io strings ;
7 1string print

View file

@ -0,0 +1,4 @@
' FB 1.05.0 Win64
Print !"\a"
Sleep

View file

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Print("\a")
}

View file

@ -0,0 +1,3 @@
procedure main ()
write ("\7") # ASCII 7 rings the bell under Bash
end

View file

@ -0,0 +1,2 @@
10 PRINT "";: REM ^G IN QUOTES
20 END

View file

@ -0,0 +1 @@
7{a. NB. noun a. is a complete ASCII ordered character vector.

View file

@ -0,0 +1,9 @@
public class Bell{
public static void main(String[] args){
java.awt.Toolkit.getDefaultToolkit().beep();
//or
System.out.println((char)7);
}
}

View file

@ -0,0 +1 @@
println("This should ring a bell.\a")

View file

@ -0,0 +1,5 @@
// version 1.1.2
fun main(args: Array<String>) {
println("\u0007")
}

View file

@ -0,0 +1,10 @@
Module CheckIt {
After 300 {beep}
Print "Begin"
for i=0 to 100 {
wait 10
Print i
}
Print "End"
}
CheckIt

View file

@ -0,0 +1,10 @@
Module CheckIt {
After 300 {Tone 200}
Print "Begin"
for i=0 to 100 {
wait 10
Print i
}
Print "End"
}
CheckIt

View file

@ -0,0 +1,10 @@
Module CheckIt {
After 300 {Tune 300, "C3BC#"}
Print "Begin"
for i=0 to 100 {
wait 10
Print i
}
Print "End"
}
CheckIt

View file

@ -0,0 +1,13 @@
Module CheckIt {
Score 1, 500, "c@2dc @2ef"
Play 1, 19 ' attach a music score to an organ
Print "Begin"
for i=0 to 100 {
wait 10
Print i
}
Print "End"
\\ stop play, remove this and music continue, in console prompt
Play 0
}
CheckIt

View file

@ -0,0 +1,13 @@
using System.Console;
module Beep
{
Main() : void
{
Write("\a");
System.Threading.Thread.Sleep(1000);
Beep();
System.Threading.Thread.Sleep(1000);
Beep(2600, 1000); // limited OS support
}
}

View file

@ -0,0 +1,21 @@
/* NetRexx */
options replace format comments java crossref symbols binary
runSample(arg)
return
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method runSample(arg) private static
do
BEL = 8x07
jtk = java.awt.toolkit.getDefaultToolkit()
say 'Bing!'(Rexx BEL).d2c
Thread.sleep(500)
say 'Ding\x07-ding\u0007!'
Thread.sleep(500)
say 'Beep!'
jtk.beep()
catch ex = Exception
ex.printStackTrace()
end
return

View file

@ -0,0 +1,3 @@
\\ Ringing the terminal bell.
\\ 8/14/2016 aev
Strchr(7) \\ press <Enter>

View file

@ -0,0 +1 @@
print(Strchr(7)); \\ press <Enter>

View file

@ -0,0 +1,3 @@
declare bell character (1);
unspec (bell) = '00000111'b;
put edit (bell) (a);

View file

@ -0,0 +1,3 @@
(phixonline)-->
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"\x07"</span><span style="color: #0000FF;">)</span>
<!--

View file

@ -0,0 +1,39 @@
/*REXX program illustrates methods to ring the terminal bell or use the PC speaker. */
/*╔═══════════════════════════════════════════════════════════════╗
Note that the hexadecimal code to ring the terminal bell
is different on an ASCII machine than an EBCDIC machine.
On an ASCII machine, it is (hexadecimal) '07'x.
" " EBCDIC " " " " '2F'x.
*/
if 3=='F3' then bell= '2f'x /*we are running on an EBCDIC machine. */
else bell= '07'x /* " " " " " ASCII " */
say bell /*sound the bell on the terminal. */
say copies(bell, 20) /*as above, but much more annoying. */
/*╔═══════════════════════════════════════════════════════════════╗
Some REXX interpreters have a built-in function (BIF) to
to produce a sound on the PC speaker, the sound is specified
by frequency and an optional duration.
*/
/* [↓] supported by Regina REXX: */
freq= 1200 /*frequency in (nearest) cycles per second. */
call beep freq /*sounds the PC speaker, duration= 1 second.*/
ms= 500 /*duration in milliseconds. */
call beep freq, ms /* " " " " " 1/2 " */
/* [↓] supported by PC/REXX & Personal REXX:*/
freq= 2000 /*frequency in (nearest) cycles per second. */
call sound freq /*sounds PC speaker, duration= .2 second. */
secs= .333 /*duration in seconds (round to nearest tenth).*/
call sound freq, secs /* " " " " 3/10 " */
/*stick a fork in it, we're done making noises.*/

View file

@ -0,0 +1,4 @@
#lang racket
(require (planet neil/charterm:3:0))
(with-charterm
(void (charterm-bell)))

View file

@ -0,0 +1,3 @@
fn main() {
print!("\x07");
}

View file

@ -0,0 +1 @@
java.awt.Toolkit.getDefaultToolkit().beep()

View file

@ -0,0 +1,6 @@
$ include "seed7_05.s7i";
const proc: main is func
begin
write("\a");
end func;

View file

@ -0,0 +1 @@
puts -nonewline "\a";flush stdout

View file

@ -0,0 +1,4 @@
#!/bin/sh
# Ring the terminal bell
# echo "\a" # does not work in some shells
tput bel

View file

@ -0,0 +1,9 @@
;Assemble with: tasm; tlink /t
.model tiny
.code
org 100h ;.com files start here
start: mov ah, 02h ;character output
mov dl, 07h ;bell code
int 21h ;call MS-DOS
ret ;return to MS-DOS
end start

View file

@ -0,0 +1,2 @@
code ChOut=8;
ChOut(0,7)