Hello,
ive to write an assembly language program for college that will play musical notes when the user strikes the keys (1-8). Heres my code:
.model large
.stack 100h
.data
prompt DB 'Press 1-8 to play notes!',13,10,'$'
.code
mov ax,@data
mov ds,ax
mov dx, OFFSET prompt
mov ah,9
int 21h
start:
mov ah,1
int 21h
cmp al,'1'
jz is1
cmp al,'2'
jz is2
cmp al,'3'
jz is3
cmp al,'4'
jz is4
cmp al,'5'
jz is5
cmp al,'6'
jz is6
cmp al,'7'
jz is7
cmp al,'8'
jz is8 ;*ERROR* relative jump out of
cmp al,'x' ;range by 0002h bytes
jz isx ;*ERROR* relative jump out of
jmp start ;range by 000fh bytes
is1:
mov al,10110110b
out 43h,al
mov al,7dh
out 42h,al
mov al,0a9h
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is2:
mov al,0beh
out 42h,al
mov al,54h
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is3:
mov al,5fh
out 42h,al
mov al,2ah
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is4:
mov al,2fh
out 42h,al
mov al,15h
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is5:
mov al,97h
out 42h,al
mov al,0ah
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is6:
mov al,4bh
out 42h,al
mov al,5h
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is7:
mov al,77h
out 42h,al
mov al,6h
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is8:
mov al,52h
out 42h,al
mov al,1h
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
isx:
in al,61h
and al,11111100b
out 61h,al
jmp done
delay:
mov ah,86h
mov cx,02h
mov dx,0d090h
int 15h
in al,61h
and al,11111100b
out 61h,al
jmp start
done:
mov ah,4ch
int 21h
END
the code is designed to play all 8 octaves of A (Well, as well as it can as it is hardly a hi-fi) which seems to work ok when i have entered code for the keys 1-6, but when i put the code in for keys 7 and 8 i get the errors shown on lines 29 and 31.
Can anyone please help me by giving me some advice on why im getting these errors when i am assembling the code.
Thank you
ive to write an assembly language program for college that will play musical notes when the user strikes the keys (1-8). Heres my code:
.model large
.stack 100h
.data
prompt DB 'Press 1-8 to play notes!',13,10,'$'
.code
mov ax,@data
mov ds,ax
mov dx, OFFSET prompt
mov ah,9
int 21h
start:
mov ah,1
int 21h
cmp al,'1'
jz is1
cmp al,'2'
jz is2
cmp al,'3'
jz is3
cmp al,'4'
jz is4
cmp al,'5'
jz is5
cmp al,'6'
jz is6
cmp al,'7'
jz is7
cmp al,'8'
jz is8 ;*ERROR* relative jump out of
cmp al,'x' ;range by 0002h bytes
jz isx ;*ERROR* relative jump out of
jmp start ;range by 000fh bytes
is1:
mov al,10110110b
out 43h,al
mov al,7dh
out 42h,al
mov al,0a9h
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is2:
mov al,0beh
out 42h,al
mov al,54h
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is3:
mov al,5fh
out 42h,al
mov al,2ah
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is4:
mov al,2fh
out 42h,al
mov al,15h
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is5:
mov al,97h
out 42h,al
mov al,0ah
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is6:
mov al,4bh
out 42h,al
mov al,5h
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is7:
mov al,77h
out 42h,al
mov al,6h
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
is8:
mov al,52h
out 42h,al
mov al,1h
out 42h,al
in al,61h
or al,00000011b
out 61h,al
jmp delay
isx:
in al,61h
and al,11111100b
out 61h,al
jmp done
delay:
mov ah,86h
mov cx,02h
mov dx,0d090h
int 15h
in al,61h
and al,11111100b
out 61h,al
jmp start
done:
mov ah,4ch
int 21h
END
the code is designed to play all 8 octaves of A (Well, as well as it can as it is hardly a hi-fi) which seems to work ok when i have entered code for the keys 1-6, but when i put the code in for keys 7 and 8 i get the errors shown on lines 29 and 31.
Can anyone please help me by giving me some advice on why im getting these errors when i am assembling the code.
Thank you