|
|
1.1 root 1: / sdsounds.s:
2: / various sounds that support the speaking device driver
3:
4: .text
5:
6: timer1: pushf
7: cli
8: mov eax,$0
9: outb $0x43
10: outb $0xe0
11: inb $0x40
12: movb ah,al
13: outb $0xe0
14: inb $0x40
15: outb $0xe0
16: xchg al,ah
17: popf
18: ret
19:
20: / Wait for timer1, edx ticks
21: t1wait:
22: / get initial value of timer 1
23: call timer1
24: xchg eax,ebx
25: next_t1:
26: call timer1
27: xchg ebx,eax
28: sub eax,ebx
29: jnc ?nowrap
30: add eax,$11932
31: ?nowrap: sub edx,eax
32: jnc next_t1 / not yet finished
33: ret
34:
35: / C interface to the above routine
36: .globl sdpause
37: sdpause:
38: push ebp
39: mov ebp,esp
40: mov edx,8[ebp]
41: push ebx
42: call t1wait
43: pop ebx
44: leave
45: ret
46:
47: / toggle the speaker.
48: / Do not change a thing if a tone is in progress.
49: toggle:
50: pushf
51: cli
52: inb $0x61
53: test al,$1
54: jnz notgl / cannot interrupt a tone with a click
55: xor al,$2
56: outb $0x61
57: notgl: popf
58: ret
59:
60: / the click of a character being put on the screen
61: .globl sdclick
62: sdclick:
63: push ebx
64: call toggle
65: mov edx,sdtm_click
66: call t1wait
67: call toggle
68: sndret: pop ebx
69: ret
70:
71: .globl sdcrsnd
72: sdcrsnd: / the sound of a carriage return
73: push ebx
74: mov ebx,sdtm_topcr
75: rs1: call toggle
76: mov edx,ebx
77: push ebx
78: call t1wait
79: pop ebx
80: sub ebx,sdtm_inccr
81: cmp ebx,sdtm_botcr
82: ja rs1
83: jmp sndret
84:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.