ASSMBLY Languages

View previous topic View next topic Go down

ASSMBLY Languages

Post by vampscalling on Thu Nov 19, 2009 9:23 pm

CREDITS: VampscallinG






include macro.txt
.model small
.stack
.data

head db "FIBONACCI SERIES$"
head1 db "Enter the number of integers in the series: $"
head2 db "Fibonacci series is: $"
backmenu db "Back to main menu [y/n]: $"
outs db ?
hi db ?
cat db 0
p1 db 10
p2 db ?
fibo dw ?
bx_num dw ?
ten dw 0ah
input db 5 dup(" ")
ctr db 0

.code
start:
act4 proc far
file

public act4

clrscr 79, 1, 17, 3, 50
clear 46, 2, 29, 4, 49
clear 24, 3, 3, 3, 28
clear 24, 3, 50, 3, 74
clear 24, 3, 3, 11, 3
clear 24, 3, 74, 11, 74
;clear 24, 22, 3, 22, 74
clear 24, 8, 53, 8, 56
clear 43, 12, 1, 21, 78

gotoxy 3, 31
printf head
gotoxy 8, 10
printf head1
lea di, head1
xor cx, cx
mov bh, 30h
mov bl, 0dh

one:
inp
cmp al,0
mov [di], al
sub [di], bh
inc cx
inc di
cmp bl, al
jne one

lea di, head1
cmp cl, 02h
jne two
mov cl, [di]
jmp three

two:
xor cx, cx
mov al, [di]
mul p1
add cl, al
inc di
add cl, [di]

three:
mov ctr, cl
xor ax, ax
mov bx, 0001h
mov fibo, bx
gotoxy 11, 10
printf head2
mov p1, 10
gotoxy 17, 4
and ctr, 00h
mov bx_num, bx

four:
push bx_num
mov bx, bx_num
add bx, fibo
xchg fibo, bx
mov bx_num, bx
pop ax
xor dx, dx

some:
div ten
push dx
xor dx, dx
inc ctr
cmp ax, 000h
jnz some

dips:
pop dx
add dl, 30h
disp dl
dec ctr
jnz dips
mov p2, ' '
mov dl, p2

disp dl
disp dl

inc cat
cmp cat, 9
jnz kataposan
and cat, 00h
add hi, 2
xor dx, dx
mov dh, hi
mov dl, 5

kataposan:
loop four
gotoxy 25,25

inputed:
mov ah,02h
mov bh,00
mov dh,15h
mov dl,30
int 10h

mov ah,9
lea dx,backmenu
int 21h

mov ah,01
int 21h


cmp al,'n'
jne cond
jmp start

cond:
cmp al,'y'
jne notequal
jmp bak1

notequal:
mov ah,02
mov dl,08h
int 21h
mov dl,20h
int 21h
mov dl,08h
int 21h
jmp inputed


bak1:
call main

ret

gotoxy 22,23

gawas

act4:
call main
ret
act4 endp
end
extrn main:far


;include macro.txt
.model small
.stack
.data
input1 db "Input single digit number$"
resulto db "There are odd number(s):$"
resulte db "There are even number(s):$"
con db "Would you like to try again?[Y/N]$"
ctr db 0
odd db 0
ven db 0
zero db ?
sor db ?
axis db 18h

.code
act5 proc far
mov ax,@data
mov ds,ax
public act5

start:
;clrscr
mov ax,0600h
mov bh,80h
mov cx,0
mov dh,24h
mov dl,79h
int 10h

mov ctr,0
mov odd,0
mov ven,0
mov axis,18h

;box
mov ax,0600h
mov bh,72h
mov ch,2
mov cl,22
mov dh,5
mov dl,66
int 10h


;box1
mov ax,0600h
mov bh,9Eh
mov ch,5
mov cl,22
mov dh,7
mov dl,66
int 10h

;box2
mov ax,0600h
mov bh,24h
mov ch,8
mov cl,22
mov dh,10
mov dl,66
int 10h

;box3
mov ax,0600h
mov bh,60h
mov ch,11
mov cl,22
mov dh,13
mov dl,66
int 10h

;boxt4
mov ax,0600h
mov bh,85h
mov ch,14
mov cl,22
mov dh,16
mov dl,66
int 10h


;setcursor
mov ah,2
mov bh,0
mov dh,3
mov dl,24
int 10h

;display
mov ah,09
lea dx,input1
int 21h

;input
mov ah,2
mov bh,0
mov dh,3
mov dl,30
int 10h

mov ah,01
int 21h

mov ctr,al

cmp ctr,'0'
jbe toU
cmp ctr,0ah
je toU

inpt:
cmp ctr,'0'
jbe disp

mov ah,02
mov bh,0
mov dh,6
mov dl,axis
int 10h

add axis,2

mov ah,01
int 21h

dec ctr
sub al,30h

test al,1
jnp codd
jp ceven
jmp nxt

toU:
exit

nxt:
ceven:
inc ven
jmp inpt

codd:
inc odd
jmp inpt

czero:
inc zero
jmp inpt

jmp wui

back:
jmp start

wui:
disp:
add ven,30h
add odd,30h

;disp odd

;setcursor
mov ah,2
mov bh,0
mov dh,9
mov dl,24
int 10h

mov ah,09
lea dx,resulto
int 21h

mov ah,02
mov dl,odd
int 21h

;disp even

;setcursor
mov ah,2
mov bh,0
mov dh,12
mov dl,24
int 10h

mov ah,09
lea dx,resulte
int 21h

mov ah,02
mov dl,ven
int 21h

;Continue
mov ah,2
mov bh,0
mov dh,15
mov dl,24
int 10h

mov ah,09
lea dx,con
int 21h

mov ah,01
int 21h

cmp al,'y'
je back
jmp he

he:
call act5

ret

act5 endp
end
extrn main:far
include macro.txt
.model small
.stack
.data
input1 db "Input single digit number$"
resulto db "There are odd number(s):$"
resulte db "There are even number(s):$"
con db "Would you like to try again?[Y/N]$"
ctr db 0
odd db 0
ven db 0
zero db ?
sor db ?
axis db 18h

.code
act5 proc far
mov ax,@data
mov ds,ax
public act5

start:
;clrscr
mov ax,0600h
mov bh,83h
mov cx,0
mov dh,24h
mov dl,79h
int 10h

mov ctr,0
mov odd,0
mov ven,0
mov axis,18h

;box
mov ax,0600h
mov bh,72h
mov ch,2
mov cl,22
mov dh,5
mov dl,66
int 10h


;box1
mov ax,0600h
mov bh,9Eh
mov ch,5
mov cl,22
mov dh,7
mov dl,66
int 10h

;box2
mov ax,0600h
mov bh,24h
mov ch,8
mov cl,22
mov dh,10
mov dl,66
int 10h

;box3
mov ax,0600h
mov bh,60h
mov ch,11
mov cl,22
mov dh,13
mov dl,66
int 10h

;boxt4
mov ax,0600h
mov bh,85h
mov ch,14
mov cl,22
mov dh,16
mov dl,66
int 10h


;setcursor
mov ah,2
mov bh,0
mov dh,3
mov dl,24
int 10h

;display
mov ah,09
lea dx,input1
int 21h

;input
mov ah,2
mov bh,0
mov dh,3
mov dl,30
int 10h

mov ah,01
int 21h

mov ctr,al

cmp ctr,'0'
jbe toU
cmp ctr,0ah
je toU

inpt:
cmp ctr,'0'
jbe disp

mov ah,02
mov bh,0
mov dh,6
mov dl,axis
int 10h

add axis,2

mov ah,01
int 21h

dec ctr
sub al,30h

test al,1
jnp codd
jp ceven
jmp nxt

toU:
exit

nxt:
ceven:
inc ven
jmp inpt

codd:
inc odd
jmp inpt

czero:
inc zero
jmp inpt

jmp wui

back:
jmp start

wui:
disp:
add ven,30h
add odd,30h

;disp odd

;setcursor
mov ah,2
mov bh,0
mov dh,9
mov dl,24
int 10h

mov ah,09
lea dx,resulto
int 21h

mov ah,02
mov dl,odd
int 21h

;disp even

;setcursor
mov ah,2
mov bh,0
mov dh,12
mov dl,24
int 10h

mov ah,09
lea dx,resulte
int 21h

mov ah,02
mov dl,ven
int 21h

;Continue
mov ah,2
mov bh,0
mov dh,15
mov dl,24
int 10h

mov ah,09
lea dx,con
int 21h

mov ah,01
int 21h

cmp al,'y'
je back
jmp he

he:
call act5

ret

act5 endp
end
extrn main:far
..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
extrn main:far
include macro.txt

.model small
.stack
.data
byteVAL dw 0
temp dw 0

num1 dw ?
num2 dw ?

str1 db 'Enter 1st number: $'
str2 db 'Enter 2nd number: $'
str3 db 'Sum: $'
str4 db 'Difference: -$'
cont db "Try Again? [y/n] : $"


.code


start7:
act7 proc far
initz
public act7
clrscr
clear 4eh,4,12,15,45;bh,ch,cl,dh,dl
gotoxy 5,15

printf str1
call readInt
mov ax,byteVAL
mov num1,ax


gotoxy 7,15
printf str2

call readInt
mov ax,byteVAL
mov num2,ax


mov ax,num1
mov bx,num2

cmp ax,bx
jae greater
jmp notgreater

sugod7:
jmp start7


greater:

add ax,bx
mov byteVAL,ax
jmp printsum



notgreater:

sub bx,ax
mov byteVAL,bx
jmp printdif



printsum:

gotoxy 9,15
printf str3
mov ax,byteVAL
call writeInt
exit

printdif:

gotoxy 9,15
printf str4
mov ax,byteVAL
call writeInt





mov ah,01
int 21h

ret

;start endp

;Procedure that reads 3-digit number and converts its ASCII code to decimal.

readInt proc near
push ax
push bx
push cx
push dx

mov bx,10
mov temp,0
mov byteVal,0

mov cx,3

input:
mov ah,1
int 21h

cmp al,30h
jb invalid
cmp al,39h
ja invalid
jmp convert



invalid:
mov ah,2
mov dl,8
int 21h
mov dl,20h
int 21h
mov dl,8
int 21h
jmp input


start7a:
jmp sugod7

convert:
and ax,0fh
mov temp,ax
mov ax,byteVal
mul bx
add ax,temp
mov byteVal,ax
xor ax,ax
loop input

askagain:

mov ah,7
int 21h

cmp al,13
jne askagain

pop dx
pop cx
pop bx
pop ax

ret
readInt endp


;Procedure that displays n-digit integer in DX:AX

writeInt proc near
push bx
push cx
push dx

mov bx,10
mov cx,0

; integer broken down to digits
again:

xor dx,dx
div bx
push dx
inc cx
or ax,ax
jnz again

display:

pop dx
mov ah,2
add dl,30h
int 21h
loop display

pop dx
pop cx
pop bx

gotoxy 13,15
printf cont
mov ah,01
int 21h

cmp al,'y'
jne bm7
jmp start7a

bm7:
call main

mov ah,01
int 21h

mov ah,01
int 21h


ret

writeInt endp
act7 endp
end


extrn main:far
include macro.txt
.model small
.stack
.386
.data
para_list label byte
max_len db 30
act_len db ?
kb_data db 30 dup (' ')
ctr db ?
converted db 30 dup (' ')
bali db 30 dup(' ')
capi db ?
smalll db ?
answer db ?
eql db 'Palindrome!$'
noteql db 'Not Palindrome!$'
reverse db 30 dup (' ')
str1 db 'Input a String: $'
cont db "Want to try Again?[y/n]: $"
.code
act8 proc far
start9a:
initz
public act8

clrscr 0e0h

gotoxy 2,7
mov ah,09
lea dx,str1
int 21h


mov ah,0ah
lea dx,para_list
int 21h

mov al,'$'
movzx si,act_len
lea bx,kb_data
mov [bx+si],al

printf kb_data

lea si,kb_data
lea di,converted
mov bl,act_len
inc bl

movzx cx,bl
mov capi,65
mov smalll,97


character:
lodsb
call convert9
stosb

loop character

call balhin
call compare

ret


convert9 proc near
push cx
mov cx,26
mov capi,65

capital:
cmp cx,0
je small2
cmp al,capi
je outna

back:
inc capi
dec cx
jmp capital

small2:
mov cx,26
mov smalll,97

small:
cmp cx,0
je outna
cmp al,smalll
je convertcapi
inc smalll
dec cx
jmp small
jmp outna

convertcapi:
sub al,20h

outna:
pop cx
ret
convert9 endp

balhin proc near
lea si,converted
movzx bx,act_len
dec bx
add si,bx
lea di,reverse
movzx cx,act_len

toink:
mov bl,[si]
mov [di],bl
dec si
inc di
loop toink


ret
balhin endp

compare proc near
lea si,converted
lea di,reverse

movzx cx,act_len
repe cmpsb
jne notpali

gotoxy 4,7
printf eql
jmp gawas

notpali:
gotoxy 4,7
printf noteql

gawas:
clear 80h,16,20,18,50
gotoxy 10,7
printf cont
mov ah,01
int 21h


cmp al,'y'
jne bm9
jmp start9a

bm9:
call main




compare endp
act8 endp
end

;-----------------
;extrn main:far
;----------------
.model SMALL
.stack
.data
PROMPT DB "PASSWORD :$"
PASSWORD DB "PASSWORD"
access db"ACCESS GRANTED$"
denied db"ACCESS DENIED$"
RETRY db"[ ] RETRY$"
EXIT2 db"[ ] EXIT$"
TAKECARE DB "LUV YAH$"
ENTER DB 25 dup(?)
box db 0dah,27 dup(0c4h),0bfh,24h
box2 db 0b3h,27 dup(20h),0b3h,24h
box3 db 0c0h,27 dup(0c4h),0d9h,24h
ROW db ?
col db ?
blank db " $"

.code
main Proc Far
;password proc far
mov ax,@data
mov ds,ax
mov es,ax


;clear screen
mov ax,0600h
mov bh,27
mov ch,02
mov cl,00
mov dh,22
mov dl,79
int 10h
;box1
mov ax,0600h
mov bh,-72h
mov ch,05
mov cl,15
mov dh,20
mov dl,65
int 10h
;box2
mov ax,0600h
mov bh,-51h
mov ch,11
mov cl,15
mov dh,11
mov dl,65
int 10h
;box3
mov ax,0600h
mov bh,-61h
mov ch,05
mov cl,15
mov dh,05
mov dl,65
int 10h
;box4
mov ax,0600h
mov bh,-41h
mov ch,04
mov cl,15
mov dh,04
mov dl,65
int 10h

mov ah,2
mov dh,8
mov dl,17
mov bh,0
int 10h

mov ah,09
mov al,20h
mov bh,0
mov bl,-76h
mov cx,10
int 10h

mov ah,09
lea dx,PROMPT
int 21h

mov ah,2
mov dh,7
mov dl,30
mov bh,0
int 10h
mov ah,09
lea dx,box
int 21h
mov ah,2
mov dh,8
mov dl,30
mov bh,0
int 10h
mov ah,09
lea dx,box2
int 21h
mov ah,2
mov dh,9
mov dl,30
mov bh,0
int 10h
mov ah,09
lea dx,box3
int 21h
mov ah,2
mov dh,15
mov dl,17
mov bh,0
int 10h
mov ah,09
mov al,20h
mov bh,0
mov bl,-76h
mov cx,10
int 10h
mov ah,09
lea dx,RETRY
int 21h
mov ah,2
mov dh,17
mov dl,17
mov bh,0
int 10h
mov ah,09
mov al,20h
mov bh,0
mov bl,-76h
mov cx,10
int 10h

mov ah,09
lea dx,EXIT2
int 21h


;setcursor for PASSWORD

mov ah,2
mov dh,08
mov dl,31
mov bh,0
int 10h



mov cx,00h
mov bx,00h
INPUT:

mov ah,07
int 21h
cmp al,0DH
je NEXT
cmp al,08H
je STOP
mov ENTER[bx],al
push ax
cmp cx,27
je STOP2
inc cx
mov bx,cx
mov ah,02
mov dl,03h
int 21h
jmp INPUT
look:
mov ah,3
mov bh,0
int 10h
sub dl,1h
mov col,dl

mov ah,2
mov dh,08
mov dl,col
mov bh,0
int 10h

mov ah,09
lea dx,blank
int 21h

mov ah,2
mov dh,08
mov dl,col
mov bh,0
int 10h
jmp Input
STOP:
mov ah,3
mov bh,0
int 10h
mov col,dl

cmp col,31
mov ah,2
mov dh,08
mov dl,31
mov bh,0
int 10h
je Input
jmp look
STOP2:
mov ah,07
int 21h
cmp al,0DH
je NEXT
jmp STOP2
NEXT:
mov si,offset PASSWORD
add si,7
mov cx,08
lop:
pop ax
cmp al,[si]
jne print2
dec si
loop lop


COMMENT $********************************************************************** CLD
mov cx,7
lea di,ENTER
lea si,PASSWORD
REP CMPSB
JE print1
JNE print2
***********************************************************************************$

print1: mov ah,2H
mov dh,11
mov dl,35
mov bh,0
int 10h
mov ah,09
lea dx,access
int 21h
jmp bleh
print2:
mov ah,2H
mov dh,11
mov dl,35
mov bh,0
int 10h
mov ah,09
lea dx,denied
int 21h
;jmp bleh
bleh:


mov ah,2
mov dh,15
mov dl,18
mov bh,0
int 10h
mov ah,02
mov dl,06h
int 21h
mov ah,2
mov dh,15
mov dl,18
mov bh,0
int 10h

process:
mov ah,07h
int 21h
cmp al,50H
je DOWN
cmp al,48h
je UP
cmp al,0dh
je suerte
DOWN:
mov ah,2
mov dh,17
mov dl,18
mov bh,0
int 10h

mov ah,02
mov dl,06h
int 21h

mov ah,2
mov dh,15
mov dl,18
mov bh,0
int 10h
mov ah,02
mov dl,20h
int 21h

mov ah,2
mov dh,17
mov dl,18
mov bh,0
int 10h
jmp process

UP:
mov ah,2
mov dh,15
mov dl,18
mov bh,0
int 10h

mov ah,02
mov dl,06h
int 21h

mov ah,2
mov dh,17
mov dl,18
mov bh,0
int 10h
mov ah,02
mov dl,20h
int 21h

mov ah,2
mov dh,15
mov dl,18
mov bh,0
int 10h
jmp process

suerte:
mov ah,3
mov bh,0
int 10h
mov ROW,dh
cmp ROW,17
je exit
call main
exit:

mov ah,2
mov dh,24
mov dl,00
mov bh,0
int 10h
mov ah,4ch
int 21h

main Endp
End main
extrn act2:far,act3:far,act4:far,act5_s:far,act6:far,act7:far,act8:far,act9:far
include macro.txt
.model small
.stack
.data
str1 db '**MY ACTIVITIES**$'
str2 db '[2]Subject Matter$'
str3 db '[3]Reverse String$'
str4 db '[4]Fibonacci$'
str5 db '[5]Odd/Even$'
str6 db '[6]Sorting Integers$'
str7 db '[7]3-Digit Arithmetic$'
str8 db '[8]Palindrome$'
str9 db '[9]Log in$'
str10 db' [0]to Exit$'
pili db 'Enter Choice[2-9]: $'
agn db 'continue? $'
.code
main proc far
initz
public main
clrscr

clear 12,2,4,20,60
gotoxy 3,10
printf str1

gotoxy 4,10
printf str2

gotoxy 5,10
printf str3

gotoxy 6,10
printf str4

gotoxy 7,10
printf str5

gotoxy 8,10
printf str6

gotoxy 9,10
printf str7

gotoxy 10,10
printf str8

gotoxy 11,10
printf str9

gotoxy 12,7
printf str10


startm:
gotoxy 15,7
printf pili


mov ah,01
int 21h

cmp al,'2'
je acti2


cmp al,'3'
je acti3


cmp al,'4'
je acti4

cmp al,'5'
je acti5

cmp al,'6'
je acti6

cmp al,'7'
je acti7

cmp al,'8'
je acti8

cmp al,'9'
je acti9

cmp al,'0'
je gawasko




acti2:
call act2
exit

acti3:
call act3
exit

acti4:
call act4
exit

acti5:
call act5_s
exit

acti6:
call act6
exit

acti7:
call act7
exit

acti8:
call act8
exit
acti9:
call act9
exit

gawasko:
exit

gotoxy 18h,4h
exit

main endp
end main
initz macro
mov ax, @data
mov ds, ax
mov es, ax
endm

exit macro
mov ah, 4ch
int 21h
endm

printf macro msg
mov ah, 9
lea dx, msg
int 21h
endm

gotoxy macro row, col
mov ah,2
mov bh,0
mov dh, row
mov dl, col
int 10h
endm

clrscr macro
mov ax,0600h
mov bh,80h
mov cx,0
mov dh, 24
mov dl, 79
int 10h
endm

clear macro atth, ulr, ulc, lrr, lrc
mov ax,0600h
mov bh, atth
mov ch, ulr
mov cl, ulc
mov dh, lrr
mov dl, lrc
int 10h
endm

;Procedure that reads 3-digit number and converts its ASCII code to decimal.

readInt proc near
push ax
push bx
push cx
push dx

mov bx,10
mov temp,0
mov byteVal,0

mov cx,3

input:
mov ah,1
int 21h

cmp al,30h
jb invalid
cmp al,39h
ja invalid
jmp convert

invalid:
mov ah,2
mov dl,8
int 21h
mov dl,20h
int 21h
mov dl,8
int 21h
jmp input




convert:
and ax,0fh
mov temp,ax
mov ax,byteVal
mul bx
add ax,temp
mov byteVal,ax
xor ax,ax
loop input

pop dx
pop cx
pop bx
pop ax

ret
readInt endp


;Procedure that displays n-digit integer in DX:AX

writeInt proc near
push bx
push cx
push dx

mov bx,10
mov cx,0

; integer broken down to digits
again:
xor dx,dx
div bx
push dx
inc cx
or ax,ax
jnz again

display:

pop dx
mov ah,2
add dl,30h
int 21h
loop display

pop dx
pop cx
pop bx


ret
writeInt endp
avatar
vampscalling
DPC Member

Male
Posts : 31
Age : 26
Joined date : 2009-11-19
Location : Cebu City
Cash : 14504

Back to top Go down

Re: ASSMBLY Languages

Post by danielvicedo on Tue Dec 08, 2009 12:43 am

OMg . it's a long code .

Thanks for sharing.
avatar
danielvicedo
DPC Freak

Male
Posts : 1078
Age : 22
Joined date : 2009-10-16
Location : under my bebe's bed. :)
Cash : 15363

http://danielvicedo.tk

Back to top Go down

Re: ASSMBLY Languages

Post by Null on Tue Jan 12, 2010 8:52 am

if you want to learn about assembly then you can check it here
good for reverse engineers .
avatar
Null
DPC Guest
DPC Guest

Male
Posts : 625
Age : 27
Joined date : 2009-10-29
Location : Regina Parquez's Heart
Cash : 14779

Back to top Go down

Re: ASSMBLY Languages

Post by kLiing2x™ on Tue Mar 02, 2010 10:25 am

u may use spoiler sir
ndi po bawal gamitin.

nice ang haba . tinamad akong tingnan x|
para san nalang in short ?
avatar
kLiing2x™
DPC Geek

Female
Posts : 515
Age : 106
Joined date : 2009-10-23
Location : qc
Cash : 15136

http://www.plurk.com/awanun02

Back to top Go down

Re: ASSMBLY Languages

Post by jhennyz on Thu Mar 04, 2010 11:17 pm

oh..

a very long code..

i really do prefer to use the JAVA PL.. hehehe

newiex.. i think itx much better if you can have

a picturesque output..^^
avatar
jhennyz
DPC Addict

Female
Posts : 148
Age : 25
Joined date : 2010-03-04
Location : ~NOWHERETOFiND~
Cash : 14591

Back to top Go down

Re: ASSMBLY Languages

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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