Add initial source files for Tic-Tac-Toe game implementation
Signed-off-by: Elmar Kresse <elmar.kresse@stud.htwk-leipzig.de>
This commit is contained in:
45
sound.asm
Normal file
45
sound.asm
Normal file
@ -0,0 +1,45 @@
|
||||
;****************************************
|
||||
; Elmar Kresse 19-INB-1 (2021)
|
||||
; sound.asm
|
||||
; file contains source code for
|
||||
; only playing sounds
|
||||
;
|
||||
; - playbeep PROC
|
||||
;source: http://muruganad.com/8086/8086-assembly-language-program-to-play-sound-using-pc-speaker.html
|
||||
;****************************************
|
||||
|
||||
|
||||
playbeep PROC
|
||||
MOV AL, 182
|
||||
OUT 43h, AL
|
||||
beep:
|
||||
|
||||
;set frequency
|
||||
MOV AX, [BX]
|
||||
OUT 42h, AL
|
||||
MOV AL, AH
|
||||
OUT 42h, AL
|
||||
;sound on
|
||||
IN AL, 61h
|
||||
OR AL, 00000011b
|
||||
OUT 61h, AL
|
||||
|
||||
ADD BX, 4
|
||||
MOV WORD ptr [CS:timer_ticks], 0
|
||||
|
||||
;break
|
||||
timer_loop:
|
||||
CMP WORD ptr [CS:timer_ticks], 3
|
||||
jne timer_loop
|
||||
MOV WORD ptr [CS:timer_ticks], 0
|
||||
|
||||
;sound off
|
||||
IN AL, 61h
|
||||
AND AL, 11111100b
|
||||
OUT 61h, AL
|
||||
|
||||
ADD BX, 4
|
||||
SUB CX, 8
|
||||
JNE beep
|
||||
ret
|
||||
playbeep ENDP
|
Reference in New Issue
Block a user