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 397,705 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,361 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:

helllp me plz

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  
All times are GMT -4. The time now is 1:40 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC