User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 370,613 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,101 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser:
Views: 2186 | Replies: 11
Reply
Join Date: Jan 2007
Posts: 8
Reputation: csckw is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
csckw csckw is offline Offline
Newbie Poster

helllp me plz

  #1  
Jan 13th, 2007
hello every one i had some erros in my code
can you plz fix it to me coz i didnt know how to fix it
this is my code :
======================================

DOSSEG
.model small
.stack 100h
.data

redbox db 10, 30, 13, 40
lbox db 10, 30, 13, 40
db 10, 20, 13, 30
db 10, 10, 13, 20
db 10, 0, 13, 10

rbox db 10, 30, 13, 40
db 10, 40, 13, 50
db 10, 50, 13, 60
db 10, 60, 13, 70

upbox db 10, 30, 13, 40
db 7, 30, 10, 40
db 4, 30, 7, 40
db 1, 30, 4, 40

downbox db 10, 30, 13, 40
db 13, 30, 16, 40
db 16, 30, 19, 40
db 19, 30, 22, 40

msg db' TO EXIT ENTER Q',0dh,0ah,'$'
msg1 db 0dh,0ah, ' HAVE A NICE DAY',0dh,0ah,'$'
SPEAKER EQU 61H ;the address of speaker port { This Is For
The
Sound }
TIMER EQU 42H ;{ This Is For The Sound }
D EQU 0D000H

.code
main proc
mov ax, @data
mov ds, ax

Start:
mov ah, 0
mov al, 3
int 10h
mov ah, 6
mov al, 0
mov ch, 0
mov cl, 0
mov dh, 24
mov dl, 79
mov bh, 7Eh
int 10h
mov si, offset redbox
mov ah, 6
mov al, 0
mov ch, [si]
mov cl, [si + 1]
mov dh, [si + 2]
mov dl, [si + 3]
mov bh, 4Eh
int 10h
mov ah,9
mov dx,offset msg
int 21h
mov ah,0
int 16h

mov al,ah
cmp al,4bh
je left_proc
cmp al,4dh
je right_proc
cmp al,50h
je down
cmp al,48h
je up_pro
cmp al,23h
je Final


Final:
jmp cltb

down:
jmp down_proc

up_pro:
jmp up_proc


left_proc:
mov cx,3
mov si, offset lbox
lopl1:
push cx
mov ah, 6
mov al, 0
mov ch, [si]
mov cl, [si + 1]
mov dh, [si + 2]
mov dl, [si + 3]
mov bh, 4Eh
int 10h
call Delay
call sound1
mov ah, 6
mov al, 0
mov ch, [si]
mov cl, [si + 1]
mov dh, [si + 2]
mov dl, [si + 3]
mov bh, 7Eh
int 10h
add si,4
pop cx
loop lopl1
jmp Start

right_proc:
mov cx,3
mov si, offset rbox

lopl2:
push cx
mov ah, 6
mov al, 0
mov ch, [si]
mov cl, [si + 1]
mov dh, [si + 2]
mov dl, [si + 3]
mov bh, 4Eh
int 10h
call sound1
call Delay

mov ah, 6
mov al, 0
mov ch, [si]
mov cl, [si + 1]
mov dh, [si + 2]
mov dl, [si + 3]
mov bh, 7Eh
int 10h

pop cx
add si,4
loop lopl2
jmp Start

cltb:
jmp clt_break



up_proc:
mov cx,3
mov si, offset upbox
lopl3:
push cx
mov ah, 6
mov al, 0
mov ch, [si]
mov cl, [si + 1]
mov dh, [si + 2]
mov dl, [si + 3]
mov bh, 4Eh
int 10h
call Delay
call sound1

mov ah, 6
mov al, 0
mov ch, [si]
mov cl, [si + 1]
mov dh, [si + 2]
mov dl, [si + 3]
mov bh, 7Eh
int 10h

pop cx
add si,4
loop lopl3
jmp start


down_proc:
mov cx,3
mov si, offset downbox

lopl4:
push cx
mov ah, 6
mov al, 0
mov ch, [si]
mov cl, [si + 1]
mov dh, [si + 2]
mov dl, [si + 3]
mov bh, 4Eh
int 10h
call Delay
call sound1

mov ah, 6
mov al, 0
mov ch, [si]
mov cl, [si + 1]
mov dh, [si + 2]
mov dl, [si + 3]
mov bh, 7Eh
int 10h

pop cx
add si,4
loop lopl4
jmp start

clt_break:
install_handler:

push ds ; save DS
mov ax,@code ; initialize DS
mov ds,ax
mov ah,25h ; set interrupt vector
mov al,23h ; for interrupt 23h
mov dx,offset clock
int 21h
pop ds ; restore DS

L1:
mov ah,1 ; wait for a key, echo it
int 21h
cmp al,51h ; ESC pressed?
jnz L1 ; no: continue
mov ah,9
mov dx,offset msg1 ; display greeting message
int 21h
mov ax,4c00h ; yes: exit program
int 21h



main endp
; The following routine executes when Ctrl-Break
; is pressed.
clock proc
mov ah,2
int 1ah
;ch=hours,cl=minutes,dh=seconds,dl=daylight
saving time flag
mov ax,0
mov al,ch
call write_c
mov dl,':'
call outchar
mov ax,0
mov al,cl
call write_c
mov dl,':'
call outchar
mov ax,0
mov al,dh
call write_c
iret
clock endp
outchar proc
push ax
mov ah,2
int 21h
pop ax
ret
outchar endp
write_c proc
mov bl,10h
div bl
push ax
mov dl,al
add dl,30h
mov ah,2
int 21h
pop ax
mov dl,ah
add dl,30h
mov ah,2
int 21h
ret
write_c endp


Delay proc
push cx
push ax
mov cx, 64000
LL1: push cx
mov cx, 9000
LL2: add ah, 2
sub ah, 2
loop LL2
pop cx
loop LL1
pop ax
pop cx
Ret
Delay endp
sound1 proc
in al,speaker
push cx
push ax
or al,10101011b;turn on the speaker {hint:the first two lowest
bits
is on}
out speaker,al
mov al,20
lop2:
out timer,al
mov cx,d
lop3:
loop lop3
sub al,1
jnz lop2
pop ax
pop cx
and al,01010100b ;turn off the speaker
out speaker,al
ret
sound1 endp
end
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2007
Posts: 8
Reputation: csckw is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
csckw csckw is offline Offline
Newbie Poster

Re: helllp me plz

  #2  
Jan 13th, 2007
by the way the program is a red box in the middle move with the arrows when you press the up arrows its go up and so on for the rest of the arrows some thing else its quit when we press ESC and every time i press this keys it give a sound


thanx
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,104
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 34
Solved Threads: 806
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: helllp me plz

  #3  
Jan 13th, 2007
what are the errors?
'Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.
- Gore Vidal
Being ignorant is not so much a shame as being unwilling to learn. - Benjamin Franklin
Reply With Quote  
Join Date: Jan 2007
Posts: 8
Reputation: csckw is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
csckw csckw is offline Offline
Newbie Poster

Re: helllp me plz

  #4  
Jan 13th, 2007
the errors are:
==========
**Error** hw.asm(39) Illegal instruction
**Error** hw.asm(40) Illegal instruction
**Error** hw.asm(321) Illegal instruction
**Error** hw.asm(385) Illegal instruction
**Error** hw.asm(386) Illegal instruction
Error messages: 5
Warning messages: None
Passes: 1
Remaining memory: 437k
Reply With Quote  
Join Date: Jan 2007
Posts: 8
Reputation: csckw is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
csckw csckw is offline Offline
Newbie Poster

Re: helllp me plz

  #5  
Jan 13th, 2007
hi ....i fix the errors but the run is wrong why?? the ESC cannt work only the arrows
Last edited by csckw : Jan 13th, 2007 at 4:55 pm.
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,104
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 34
Solved Threads: 806
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: helllp me plz

  #6  
Jan 13th, 2007
>>cmp al,51h ; ESC pressed?
ESC is not 51h -- its 1BH (27 decimal) you should be using an ascii chart
'Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.
- Gore Vidal
Being ignorant is not so much a shame as being unwilling to learn. - Benjamin Franklin
Reply With Quote  
Join Date: Jan 2007
Posts: 8
Reputation: csckw is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
csckw csckw is offline Offline
Newbie Poster

Re: helllp me plz

  #7  
Jan 14th, 2007
thanx alot i try it but still not working ,when i press ESC nothing happens after that i try to use the arrows so alphabtic appear in the screen and the box dosnt work??!!!!!!!:eek:
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,104
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 34
Solved Threads: 806
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: helllp me plz

  #8  
Jan 14th, 2007
If you expect anyone to help you:

(1) you need to comment the hell out of your code, put comments on nearly every line and at the beginning of each section telling what it is supposed to do. I'm not going to try to figure it out and just "guess" at it, and I doubt your instructor will either.

(2) post most recent code -- its sort of difficult for me to see it on your computer

Get yourself a debugger so that you can see what the program is doing one line at a time. Every version of MS operating systems is shipped with an assembler debugger called debug.exe located in c:\windows directory. There are better ones on the net, but will do in a pinch.

Read through some of the links in the new Sticky to this board.
Last edited by Ancient Dragon : Jan 14th, 2007 at 7:57 am.
'Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.
- Gore Vidal
Being ignorant is not so much a shame as being unwilling to learn. - Benjamin Franklin
Reply With Quote  
Join Date: Jan 2007
Posts: 8
Reputation: csckw is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
csckw csckw is offline Offline
Newbie Poster

Re: helllp me plz

  #9  
Jan 14th, 2007
thanx i will do this things next time ,about the debuger i found it but i dont know how to use it ,any way thanx again
Last edited by csckw : Jan 14th, 2007 at 12:01 pm.
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,104
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 34
Solved Threads: 806
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: helllp me plz

  #10  
Jan 14th, 2007
Here is a brief tutorial. It takes a bit of practice, but works.
'Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.
- Gore Vidal
Being ignorant is not so much a shame as being unwilling to learn. - Benjamin Franklin
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Assembly Marketplace
Thread Tools Display Modes

Other Threads in the Assembly Forum

All times are GMT -4. The time now is 6:52 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC