hello everybody...
can you help me make a program in assembly, that compose ring tones......
i'm very confused about this, my lecturer gave me this task at our first class.
FYI, the input of that program is num pad 1 to 7 that represent' C D E F G A B C' in octaf
thanks 4 ur attention......
Quote from: cl4ud10 on March 22, 2006, 10:41:22 AM
hello everybody...
can you help me make a program in assembly, that compose ring tones......
i'm very confused about this, my lecturer gave me this task at our first class.
FYI, the input of that program is num pad 1 to 7 that represent' C D E F G A B C' in octaf
thanks 4 ur attention......
Go on and post what you have so far.
QuoteFYI, the input of that program is num pad 1 to 7 that represent' C D E F G A B C' in octaf
Did he want this done in assembly? I will say yes since we are in assembly forum.
You would need to look up the key codes for num pad "1 to 7" Which correspond to "C D E F G A B C"
num pad key 1 =C
num pad key 2 =D
etc.
These are musical notes. You would compose a song, or tune useing these keys to represent music that can be played back as a song.
I would get a keyboard of some type and label C through C 1 to 7. Then you could practice making a tune. Write down your numbers. Then create a program to duplicate this.
Otherwise we are guessing what your instructor wants? Ask him what he wants?
Quote
Go on and post what you have so far.
this is what i have done :
NoPCsound MACRO
IN AL,61h ; get data from Port 61h
AND AL,0FCh
OUT 61h,AL ; put the value to Port 61h
ENDM
PCsound MACRO Hz
MOV AL,0B6h
OUT 43h,AL
MOV DX,0012h
MOV AX,3540h ; divide 123540H by the frequency
MOV BX,Hz
DIV BX
OUT 42h,AL
MOV AL,AH
OUT 42h,AL
IN AL,61h ; get port 61h data <Speaker>
OR AL,03
OUT 61h,AL ;speaker
ENDM
.MODEL SMALL
.CODE
ORG 100h
Utama :
MOV AH,0 ; Input a character
INT 16h
salam :
CMP AL,'1' // if AL=='1' then C();
JE C
CMP AL,'2' // if AL=='2' then D();
JE D
CMP AL,'3' // if AL=='3' then E();
JE E
CMP AL,'4' // if AL=='4' then F();
JE F
CMP AL,'q' // if AL=='q' then exit();
JMP exit
bagian :
MOV AH,0
INT 16h
JMP salam
C :
PCsound 275 //assume 275 is frequency for C
MOV AH,00
JMP bagian
F :
PCsound 340 //assume 340 is frequency for F
MOV AH,00
JMP bagian
E :
PCsound 220 //assume 220 is frequency for E
MOV AH,00
JMP bagian
D :
PCsound 207 //assume 207 is frequency for D
MOV AH,00
JMP bagian
exit : INT 20h //exit
END Utama
--------
the code works so far.......
but, the problem occured when i put another 'jump' for G, A, B, .....
the error message is : relative jump out of range...
i still dunno why it happened....