-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTSOUND.ASM
More file actions
68 lines (61 loc) · 1.35 KB
/
TSOUND.ASM
File metadata and controls
68 lines (61 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
;;Chris Busch
;;ti85 tone generator
;;You may use this code for whatever purpose, its public domain.
;;WARNING! Not responsible for any damage this may cause!!!!!!!
;;How to run:
;;Press custom, ZShell, then sound.
;;Plug in small walkman headphones and you should hear a tone. Press
;;keys on the ti85 calc keypad to generate different tones.
;;Press EXIT when done. Promptly remove headphones.
;;Now you may exit ZShell.
;;I have tested it by plugging it into my stereo and that works too.
#include "ti-85.h"
.org 0
.db "sound",0
premain:
ld d,10
main:
ld b,$FC ;0 0
ld a,r
and 1
cp 1
jr z,nkeepr
ld b,$EB
nkeepr:
ld c,7
out (c),b ;output 0 0
ld b,d ;loop d times
loop0:
push bc
ld b,25 ; inner delay loop of 50 nop's
inner0:
nop
djnz inner0
pop bc
djnz loop0
call GET_KEY
ld b,$C0
ld c,7
out (c),b ;output 1 1 ;;make sure this is the last to be outputted!
cp K_EXIT
jr z,quit ;quit sound generator
cp 0
jr z,skipd
sla a ;let d be the new "tone"
sla a
ld d,a
skipd:
ld b,d ;loop d times
loop:
push bc
ld b,25 ; inner delay loop of 50 nop's
inner:
nop
djnz inner
pop bc
djnz loop
jr main
quit:
ret
.END
;;;;