Difference between revisions of "Z80 Routines:Sound:Beep"
From WikiTI
(capitals in category sorts) |
m |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Z80 Routines:Sound|Beep]] | [[Category:Z80 Routines:Sound|Beep]] | ||
[[Category:Z80 Routines|Beep]] | [[Category:Z80 Routines|Beep]] | ||
| − | + | By Joe Wingbermuehle (joewing@calc.org). This routine was written for the ZLib library for the SOS shell. | |
| − | By Joe Wingbermuehle (joewing@calc.org). This routine was written for the ZLib library for the SOS | + | |
| − | shell. | + | |
<nowiki> | <nowiki> | ||
Latest revision as of 14:12, 26 October 2009
By Joe Wingbermuehle (joewing@calc.org). This routine was written for the ZLib library for the SOS shell.
;---------= Make a sound =---------
; c=frequency, b=duration
beep: di
ld e,INIT
beepl1: ld a,c
beepl2: dec a
jr nz,beepl2
ld a,e
xor %00000011
ld e,a
out (0),a
djnz beepl1
ld a,INIT ; you may be able to omit
out (0),a ; these two lines
ei
ret
Notes
- On the TI-83, INIT = 0D0h. On the TI-83 Plus, INIT = 0.
- You may omit the final output if you make sure to always pass an even value for B. Otherwise you risk leaving the link port active.
- Remember that using port 0 also affects the memory mapping on the TI-83.
- On the TI-83 Plus SE and TI-84 Plus, you may need to disable the hardware assist and slow the CPU clock as well.