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

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

what are the errors?

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

hi ....i fix the errors but the run is wrong why?? the ESC cannt work only the arrows

>>cmp al,51h ; ESC pressed?
ESC is not 51h -- its 1BH (27 decimal) you should be using an ascii chart

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:

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.

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:)

Here is a brief tutorial. It takes a bit of practice, but works.

thanx its help :)

I would suggest IFDEF'ing out most of that crap and make one small piece work at a time.

The "big bang" theory of development and debugging is a very frustrating path to take.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.