Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 2's,1’s complement
- assume cs:code,ds:data
- data segment
- n1 dw 0005h
- data ends
- code segment
- start:mov ax,data
- mov ds,ax
- mov ax,n1
- not ax
- mov bx,ax
- inc ax
- int 03h
- code ends
- end start
- factorial
- assume cs:code,ds:data
- data segment
- num dw 0003h
- data ends
- code segment
- start:mov ax,data
- mov ds,ax
- mov cx,num
- mov ax,cx
- dec cx
- fact:mul cx
- dec cx
- jnz fact
- int 03h
- code ends
- end start
- Multibyte addition
- Assume cs:code,ds:data
- Data segment
- Num1 db 01h,02h,03h,04h
- Num2 db 05h,06h,07h,08h
- Num3 db 04 dup(00)
- Data ends
- Code Segment
- Start:
- Mov ax,data
- Mov ds,ax
- Xor ax,ax
- Mov bx,ax
- Mov cl,al
- Mov dl,00h
- Mov cl,04h
- Lea si,num1
- Lea di,num2
- Lea bx,num3
- L1: mov al,[si]
- Adc al,[di]
- Mov cl,al
- Mov dl,00h
- Mov cl,04h
- Lea si,num1
- Lea di,num2
- L1: mov al,[si]
- Adc al,[di]
- Mov [bx],al
- Inc si
- Inc di
- Inc bx
- Loop l1
- Jnc l2
- Adc dl,00
- L2: mov [bx],dl
- Int 03h
- Code ends
- End start
- Multibyte subtraction
- Assume ds:data,cs:code
- Data segment
- N1 db 55h,66h,77h,88h
- N2 db 11h,22h,33h,44h
- Result db 4h dup(00)
- Data ends
- Code segment
- Start:mov ax,data
- Mov ds,ax
- Mov si,offset N1
- Mov di,offset N2
- Mov bx,offset result
- Clc
- Mov cx,0004h
- Mov ax,0000h
- Back:mov al,[si]
- Mov dl,[di]
- Sbb al,dl
- Mov [bx],al
- Inc si
- Mov di
- Inc bx
- Loop back
- Mov ah,4Ch
- Int 21h
- Int 03h
- Code ends
- End start
- Hardware add
- A1000
- Mov ax,0005h
- Mov bx,0005h
- Add ax,bx
- Int 03h
- G1000
- Hardware sub
- A1000
- Mov ax,0003h
- Mov bx,0003h
- Sub ax,bx
- Int 03h
- G1000
- Hardware mul
- A1000
- Mov ax,0002h
- Mov bx,0002h
- Mul bx
- Int 03h
- G1000
- Hardware div
- A1000
- Mov ax,0002h
- Mov bx,0002h
- Div bx
- Int 03h
- G1000
- Hardware fact
- A1000
- Mov ax,0001
- Mov cx,0003
- 1006:mul cx
- Dec cx
- Jnz 1006
- G1000
- Hardware sum
- M 1200 02
- M 1201 04
- A1000
- Mov ax,0000
- Mov cl,02
- Mov si,1200
- 1008:add al,[si]
- Inc si
- Dec cl
- Jnz 1008
- G1000
- smallest
- assume ds:data,cs:code
- data segment
- arr1 db 05h,04h,01h,02h,03h
- count db 05h
- data ends
- code segment
- start:mov ax,data
- mov ds,ax
- mov dl,count
- L2:mov cx,dx
- mov si,offset arr1
- L1:mov al,[si]
- cmp al,[si+1]
- jc continue
- xchg al,[si+1]
- mov [si],al
- continue:inc si
- loop L1
- dec dx
- jnz L2
- mov bx,offset arr1
- mov al,[bx]
- int 03h
- code ends
- end start
- largest
- assume cs:code,ds:data
- data segment
- arr db 02h,09h,03h,06h,08h,07h
- count db 06h
- data ends
- code segment
- start:mov ax,data
- mov ds,ax
- mov si,offset arr
- mov cl,count
- mov al,[si]
- up:inc si
- cmp al,[si]
- jnb go
- mov al,[si]
- go:loop up
- int 03h
- code ends
- end start
- search
- assume ds:data,cs:code
- data segment
- arr db 11h,21h,32h
- msg db 'FOUND','$'
- msg1 db 'NOT FOUND','$'
- count db 03h
- data ends
- code segment
- start:mov ax,data
- mov ds,ax
- mov es,ax
- mov cl,count
- mov si,offset arr
- cld
- mov al,32h
- repne scasb
- jz a2
- mov ah,09h
- lea dx,msg1
- int 21h
- jmp a3
- a2:mov ah,09h
- lea dx,msg
- int 21h
- a3:int 03h
- code ends
- end start
- reverse
- assume ds:data,cs:code
- data segment
- stg db 'SVCET','$'
- stg1 db 05h dup(?),'$'
- count db 05h
- data ends
- code segment
- start:mov ax,data
- mov ds,ax
- mov es,ax
- mov cl,count
- mov si,offset stg
- mov di,offset stg1
- cld
- add si,04h
- a1:movsb
- dec si
- dec si
- dec cl
- jnz a1
- mov ah,09h
- lea dx,stg1
- int 21h
- int 03h
- code ends
- end start
- ascending order
- assume ds:data,cs:code
- data segment
- arr db 05h,04h,01h,02h,03h
- count db 05h
- data ends
- code segment
- start:mov ax,data
- mov ds,ax
- mov dl,count
- L2:mov cx,dx
- mov si,offset arr
- L1:mov al,[si]
- cmp al,[si+1]
- jc continue
- xchg al,[si+1]
- mov [si],al
- continue:inc si
- loop L1
- dec dx
- jnz L2
- int 03h
- code ends
- end start
- descending order
- assume data:ds,cs:code
- arr1 db 05h,04h,01h,02h,03h
- count db 05h
- data ends
- code segment
- start:mov ax,data
- mov ds,ax
- mov dl,count
- L2:mov cl,dl
- mov si,offset arr1
- L1:mov al,[si]
- cmp al,[si+1]
- jnc continue
- xchg al,[si+1]
- mov [si],al
- continue:inc si
- loop L1
- dec dl
- jnz L2
- int 03h
- code ends
- end start
- search char
- assume cs:code,ds:data
- data segment
- str db 'VASAVI'
- size1 db 06h
- data ends
- code segment
- start:mov ax,data
- mov ds,ax
- mov es,ax
- CLD
- mov di,offset str
- mov cx,size1
- mov al,49
- REPNE SCASB str
- int 03h
- code ends
- end start
- sum of array numbers
- assume ds:data,cs:code
- data segment
- arr db 02h,03h,04h,05h,01h
- count db 05h
- data ends
- code segment
- start:mov ax,data
- mov ds,ax
- mov al,0h
- mov cl,count
- mov si,offset arr
- again:mov bl,[si]
- add ax,bx
- inc si
- dec cl
- jnz again
- int 03h
- code ends
- end start
- signed multiplication
- assume ds:data,cs:code
- data segment
- n1 dw -0002h
- n2 dw 0004h
- data ends
- code segment
- start:mov ax,data
- mov ds,ax
- mov ax,n1
- mov bx,n2
- imul bx
- int 03h
- code ends
- end start
- signed division
- assume ds:data,cs:code
- data segment
- n1 dw -0004h
- n2 dw 0002h
- data ends
- code segment
- start:mov ax,data
- mov ds,ax
- mov ax,n1
- mov bx,n2
- idiv bx
- int 03h
- code ends
- end start
- multibyte addition
- assume cs:code,ds:data
- data segment
- arr1 dw 0005h,0001h,0004h,0001h
- arr2 dw 0004h,0002h,0003h,0002h
- arr3 dw 4 dup(0)
- data ends
- start:mov ax,data
- mov ds,ax
- lea si,arr1
- lea di,arr2
- lea bx,arr3
- mov cx,04h
- sum:mov ax,[si]
- adc ax,[di]
- mov [bx],ax
- inc si
- inc di
- inc dx
- jnz sum
- int 03h
- code ends
- end start
- lcd
- A1000
- mov AL,90
- mov DX,FF36
- OUT DX,AL
- mov DX,FF30
- IN AL,DX
- MOV DX,FF32
- OUT DX,AL
- JMP 1106
- seven segment
- A1110
- mov al,80h
- mov dx,ff36
- out dx,al
- mov al,01h
- mov dx,ff30
- out dx,al
- mov al,f8h
- mov dx,ff32
- out dx,al
- int 03h
- Hello
- M1200 press enter
- 86
- 89
- C7
- C7
- C0
- Start:mov al,80h
- Mov dx,ff36h
- Out dx,al
- Lea si,1200
- Loop:mov cx,0005h
- Mov al,7F
- Mov dx,ff30
- Out dx,al
- Mov al,[si]
- Mov dx,ff32
- Out dx,al
- Inc si
- Call delay
- Dec cx
- Jnz loop
- Jmp start
- Delay:mov bx,ffff
- Loop1:dec bx
- Jnz loop1
- Ret
- Factorial Procedure
- Data segment
- Num2 dw 0003h
- Data ends
- Code segment
- Start: mov ax,data
- Mov ds,ax
- Mov ax,0000h
- Call myproc
- Int 03h
- Myproc proc near
- Mov ax,00001h
- Mov cx,num2
- Fact: mul cx
- Loop fact
- Ret
- Myroc endp
- Code ends
- End start
- Macro factorial
- Data segment
- Num1 dw 0004h
- Data ends
- Code Segment
- Start: mov ax,data
- Mov ds,ax
- Mov ax,0000h
- factMacro macro p1
- mov cx,p1
- mov ax,0001h
- fact: mul cx
- loop fact
- endm
- factMacro num1
- int 03h
- code ends
- End Start
- 8051 addressing mode
- Register: mov a,b
- Direct: mov 30h,a
- Indirect: mov a,@r0
- Indexed: MOVC a,@a+pc
- 8086 addressing modes
- Assume cs:code
- Code segment
- Start:
- Mov ax,0005h ; immediate
- Mov bx,[2000] ; direct
- Mov dx,[bx] ; indirect
- Mov bx,ax ; register
- Code Ends
- End Start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement