Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*DARSHIL KE NOTES*/
- add
- sub
- adc
- div
- mul-only one arg with multiplication
- imul-signed multiplication()
- idiv-signed division(2's complement)
- inc
- stc-set carry flag explicitly
- clc-clear carry flag explicitly
- rcr-rotates specified bits right side with carry.(ex: RCR AL,1;RCR AL,4(i.e.4times);RCR AL,CL(CL has some value))
- rcl-rotates left with carry.
- ROR-rotate right without carry.
- ROL-rotate left without carry.
- INC-increment by 1.
- DEC-decrement by 1.
- CMP- cmp ax,bx (eventually does ax-bx)
- JZ-
- JA-jump above-if in cmp ax,bx ax is greater then true.
- JB-jump below.if in cmp ax,bx ax is smaller then true.
- QUE:-Find whether no is odd or eve. (dont use div)
- note:uppar na ma remainder jaay.(ex:dx...ah)
- bx -can be used as pointer,not dx
- pointers-SI,DI,BX
- offset array1
- byte ptr [SI]
- length of array:b db ($-array)
- */END OF DARSHIL KE NOTES*/
- aim: odd even
- data segment
- d1 db 31
- msg1 db "even$"
- msg2 db "odd number$"
- data ends
- code segment
- assume cs:code, ds:data
- MOV AX,data
- MOV DS,AX
- XOR AX,AX
- MOV AL,d1
- RCR AL,1
- JC odd
- MOV DX,offset msg1
- mov ah,09
- int 21h
- jmp exit
- odd:mov ah,09
- mov dx,offset msg2
- int 21h
- exit:int 3
- code ends
- end
- aim:prime
- data segment
- d1 db 9
- msg1 db "prime$"
- msg2 db "not prime$"
- data ends
- code segment
- assume cs:code, ds:data
- MOV AX,data
- MOV DS,AX
- XOR AX,AX
- MOV AL,d1
- MOV BL,AL
- MOV CL,1
- AGAIN:
- MOV AH,00
- DIV CL
- CMP AH,00
- JZ NOT_PRIME
- INC CL
- CMP CL,BL
- JZ PRIME
- JMP AGAIN
- NOT_PRIME:
- MOV AH,09
- MOV DX,OFFSET MSG2
- INT 21H
- JMP EXIT
- PRIME:
- MOV AH,09
- MOV DX,OFFSET MSG1
- INT 21H
- EXIT:
- INT 3
- code ends
- end
- aim: find an even number from array
- data segment
- array1 db 1,3,5,7,8,9,11
- b db ($-array1)
- data ends
- code segment
- assume cs:code, ds:data
- MOV AX,data
- MOV DS,AX
- XOR AX,AX
- MOV BL,b
- MOV SI,offset array1
- again:
- mov al,byte ptr[SI]
- rcr al,1
- jnc print
- inc SI
- jz exit
- jmp again
- print:
- mov dx,SI
- add dl,30h
- mov ah,02
- int 21h
- exit:int 3
- code ends
- end
- aim: find minimum and maximum from the given array
- aim: find out GCD of 2 numbers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement