Dynamic Profile Codes
Would you like to react to this message? Create an account in a few clicks or log in to continue.

ASSMBLY Languages

Go down

ASSMBLY Languages Empty ASSMBLY Languages

Post by vampscalling Thu Nov 19, 2009 9:17 pm

..model small
.stack
.data
str db 'ASCENDING/DESCENDING$'
str2 db 'ENTER 10 NUMBERS: $'
ascd db 'ASCENDING : $'
desd db 'DESCENDING: $'
num db 10 dup(0)
spc db " $ "
x db ?
cont db 'ENTER AGAIN? [y/n]: $'
.code



start:
act6 proc far
mov ax,@data
mov ds,ax
public act6

;clearscreen0
mov ax,0600h
mov bh,8Eh
mov cx,0000h
mov dh,14h
mov dl,50h
int 10h

;clearscreen1
mov ax,0600h
mov bh,1Eh
mov cx,0101h
mov dh,13h
mov dl,4eh
int 10h

;clearscreen2
mov ax,0600h
mov bh,1Eh
mov cx,0401h
mov dh,4h
mov dl,4eh
int 10h




;clearscreenleft
mov ax,0600h
mov bh,17h
mov cx,0119h
mov dh,04h
mov dl,1ah
int 10h

;clearscreenright
mov ax,0600h
mov bh,17h
mov cx,0131h
mov dh,04h
mov dl,32h
int 10h




;setcursor1
mov ah,2
mov bh,0
mov dh,02h
mov dl,1ch
int 10h

;print1
mov ah,9
lea dx,str
int 21h

mov ax,0600h
mov bh,00eh
mov cx,0612h
mov dx,0839h
int 10h

;setcursor
mov ah,02
mov bh,00
mov dh,07h
mov dl,13h
int 10h

;printStr2

mov ah,09
lea dx,str2
int 21h

mov cx,00h
mov bx,00h

input:
mov ah,01
int 21h

mov num[bx],al
inc cx
mov bx,cx

cmp cx,10

;printSpacing

mov ah,09
lea dx,spc
int 21h

je choose
jmp input

choose:

again:
mov ah,7
int 21h
cmp al,13
jne again

mov ax,0600h
mov bh,00eh
mov cx,0a16h
mov dx,1036h
int 10h

je ascending
jmp toend




ascending:
next:
mov cx,00h

outer:
mov bx,cx
mov di,cx
mov al,num[bx]
inc cx
cmp cx,10
je endascend

inner:
inc di
cmp di,10

je outer
cmp al,num[di]

jle inner
xchg al,num[di]
mov num[bx],al
jmp inner

endascend:
;setcursor ascending
mov ah,02
mov bh,00
mov dh,0ch
mov dl,17h
int 10h

;printDisplay
mov ah,09
lea dx,ascd
int 21h

mov cx,00h

output:
mov si,cx

mov ah,02
mov dl,num[si]
int 21h

inc cx
cmp cx,10

;printSpacing
mov ah,09
lea dx,spc
int 21h

je descending
jmp output
jmp exit

descending:
nextd:
mov cx,00h

outerd:
mov bx,cx
mov di,cx
mov al,num[bx]
inc cx
cmp cx,10
je enddescend

innerd:
inc di
cmp di,10

je outerd
cmp al,num[di]

jnle innerd
xchg al,num[di]
mov num[bx],al
jmp innerd

enddescend:

;setcursor desc
mov ah,02
mov bh,00
mov dh,0eh
mov dl,17h
int 10h

;printdisplay
mov ah,09
lea dx,desd
int 21h

mov cx,00h

outputd:
mov si,cx
mov ah,02
mov dl,num[si]
int 21h

inc cx
cmp cx,10

;printspacing
mov ah,09
lea dx,spc
int 21h

je exit
jmp outputd
jmp exit

exit:
;clearscreen;continue
mov ax,0600h
mov bh,00eh
mov cx,1215h
mov dx,1237h
int 10h

;setcursor
mov ah,02
mov bh,00
mov dh,12h
mov dl,1ch
int 10h

mov ah,09
lea dx,cont
int 21h

mov ah,01
int 21h

cmp al,'y'

jne toend
jmp start


toend:

;setcursor2
mov ah,2
mov bh,0
mov dh,17h
mov dl,1h
int 10h

a:
mov ah,07
int 21h
cmp al,13
jne a

ret


act6 endp
end act6
vampscalling
vampscalling
DPC Member

Male
Posts : 31
Age : 32
Joined date : 2009-11-19
Location : Cebu City
Cash : 26264

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum