Permalink
Browse files

Assembly Courses code during my graduation

Assembly Courses code during my graduation
  • Loading branch information...
zakilive committed Feb 12, 2015
1 parent 93fb344 commit ccaaa75f11c00541cb0956eb4ac40ce670940df7
View
@@ -0,0 +1,26 @@
.model small
.stack 100h
.data
m1 db "The sum of 5 and 4 is:$"
.code
main proc
mov ax,@data
mov ds,ax
mov ah,9
lea dx,m1
int 21h
mov ah,5
add ah,4
int 21h
mov ah,4ch
int 21h
main endp
end main
View
@@ -0,0 +1,18 @@
.model small
.stack 100h
.data
.code
main proc
mov ax,5
add ax,4
mov b,ax
mov dl,b
int 21h
main endp
end main
View
@@ -0,0 +1,70 @@
.model small
.stack 100h
.data
m1 db "Enter two number: $"
m2 db "The sum of $"
m3 db " and $"
m4 db " = $"
.code
main proc
mov ax,@data
mov ds,ax
lea dx,m1
mov ah,9
int 21h
mov ah,1
int 21h
mov bl,al
mov ah,1
int 21h
mov bh,al
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
lea dx,m2
mov ah,9
int 21h
mov ah,2
mov dl,bl
int 21h
mov ah,9
lea dx,m3
int 21h
mov ah,2
mov dl,bh
int 21h
lea dx,m4
mov ah,9
int 21h
sub bl,30h
sub bh,30h
add bl,bh
add bl,30h
mov ah,2
mov dl,bl
int 21h
mov ah,4ch
int 21h
main endp
end main
View
@@ -0,0 +1,94 @@
.model small
.stack 100h
.data
m1 db "Enter five initial:$"
.code
main proc
mov ax,@data
mov ds,ax
lea dx,m1
mov ah,9
int 21h
mov ah,1
int 21h
mov bl,al
mov ah,1
int 21h
mov bh,al
mov ah,1
int 21h
mov cl,al
mov ah,1
int 21h
mov ch,al
mov ah,1
int 21h
mov dh,al
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
mov ah,2
mov dl,bl
int 21h
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
mov ah,2
mov dl,bh
int 21h
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
mov ah,2
mov dl,cl
int 21h
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
mov ah,2
mov dl,ch
int 21h
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
mov ah,2
mov dl,dh
int 21h
mov ah,4ch
int 21h
main endp
end main
View
@@ -0,0 +1,28 @@
.model small
.stack 100h
.data
.code
main proc
mov cx,5
mov ah,2
mov dl,'*'
mov ah,2
count:
int 21h
int 21h
int 21h
loop count
main endp
end main
View
@@ -0,0 +1,81 @@
.model small
.stack 100h
.data
prompt db 'Type a line of text',0dh,0ah,'$'
nocap_msg db 0dh,0ah,'No capitals $'
cap_msg db 0dh,0ah,'First Capital = '
first db '|'
db ' Last Capital = '
last db '@ $'
.code
main proc
;initialize ds
mov ax,@data
mov ds,ax
;display opening message
mov ah,9 ;display string function
lea dx,prompt ;get opening message
int 21h ;display it
;read and process a line of text
mov ah,1 ;read a character function
int 21h ;char in dl
while_:
;while a character is not a carriage return do
cmp al,0dh ;CR?
je end_while ;yes,exit
;if character is a capital letter
cmp al,'A' ;char >='A'?
jnge end_if ;not a capital letter
cmp al,'Z' ;char <= 'Z'?
jnle end_if ;not a capital letter
;then
;if character precedes first capital
cmp al,first ;char < first capital ?
jnl check_last ;no, >=
;then first capital = character
mov first,al ;FIRST=char
;end_if
check_last: ;char >last capital?
;if character follows last capital
cmp al,last ;char > last capital?
jng end_if ;no,<=
;then last capital=character
mov last,al ;last = char
;end_if
end_if:
;read a character
int 21h ;char in AL
jmp while_ ;repeat loop
end_while:
;display results
mov ah,9 ;display string function
;if no capitals were typed
cmp first,'|' ;first '|'
jne caps ;no display results
;then
lea dx,nocap_msg ;no capitals
jmp display
caps:
lea dx,cap_msg ;capitals
display:
int 21h ;display message
;end_if
;dos exit
mov ah,4ch
int 21h
main endp
end main
View
@@ -0,0 +1,45 @@
; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt
org 100h
.model small
.stack 100h
.data
msg1 db "Enter the number from 0 to 9: $"
msg2 db 0dh,0ah,"The number is:$"
.code
main proc
mov ax,@data
mov ds,ax
lea dx, msg1
mov ah,9
int 21h
mov ah,1
int 21h
mov bl,al
lea dx,msg2
mov ah,9
int 21h
main endp
end main
ret
Oops, something went wrong.

0 comments on commit ccaaa75

Please sign in to comment.