Advertisement
varun1729

Untitled

Jan 22nd, 2023
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REVERSE STRING
  2. DATA SEGMENT
  3. STRING DB 'IVASAV'
  4. DATA ENDS
  5. CODE SEGMENT
  6. ASSUME CS: CODE, DS: DATA, ES: DATA_SEG
  7. START: MOV AX, DATA
  8. MOV DS, AX
  9. MOV ES, AX
  10. MOV BP, 02
  11. MOV CX, 0006H
  12. MOV SI, CX
  13. MOV AX, CX
  14. DIV BP
  15. MOV CX, AX
  16. XOR DI, DI
  17. MOV BX, OFFSET STRING
  18. MOV AL, [BX+SI]
  19. XCHG [BX+DI], AL
  20. MOV [BX+SI], AL
  21. DEC SI
  22. INC DI
  23. LOOP 11
  24. INT 03H
  25.  
  26. SUM OF ARRAY
  27. DATA SEGMENT
  28. ARR DB 01H,02H,03H,04H,05H
  29. CNT DB 05H
  30. DATA ENDS
  31. CODE SEGMENT
  32. START:MOV AX,DATA
  33. MOV DS,AX
  34. MOV AH,0H
  35. MOV CL,CNT
  36. LEA BX,ARR
  37. MOV AL,0H
  38. AGAIN:ADD AL,[BX]
  39. INC BX
  40. DEC CL
  41. JNZ AGAIN
  42. INT 03H
  43. FACTORIAL
  44. DATA SEGMENT
  45. NUM DW 0004H
  46. DATA ENDS
  47. CODE SEGMENT
  48. START:MOV AX,DATA
  49. MOV DS,AX
  50. MOV AX,NUM
  51. MOV CX,NUM
  52. DEC CX
  53. AGAIN:MUL CX
  54. DEC CX
  55. JNZ AGAIN
  56. MOV AH,4CH
  57. INT 03H
  58.  
  59. FIBOACCI
  60. DATA SEGMENT
  61. ARR DB 01,02,03,04,05,06,07,08,09,10
  62. DATA ENDS
  63. CODE SEGMENT
  64. START:MOV AX,DATA
  65. MOV DS,AX
  66. MOV CL,05
  67. MOV AL,00
  68. MOV BL,01
  69. FIB: MOV DL,00
  70. ADD DL,BL
  71. ADD DL,AL
  72. MOV AL,BL
  73. MOV BL,DL
  74. LOOP FIB   
  75. INT 03H
  76.  
  77.  
  78. ASCENDING DESENDING
  79. DATA SEGMENT
  80. ARR DB 05,04,02,01,03
  81. DATA ENDS
  82. CODE SEGMENT
  83. START:MOV AX,DATA
  84. MOV DS,AX
  85. MOV CL,05
  86. XOR AX,AX
  87. MOV DL,CL
  88. DEC CL
  89. L2 : LEA BX,ARR
  90. L1 :MOV AL,[BX]
  91. CMP AL,[BX+1]
  92. JC CONT
  93. XCHG AL,[BX+1]
  94. MOV [BX],AL
  95. CONT : INC BX
  96. LOOP L1
  97. DEC DL
  98. MOV CL,DL
  99. LOOP L2
  100. INT 03H
  101. #############
  102. DESCENDING JC --- JNC
  103.  
  104. SEARCH
  105. DATA SEGMENT
  106. COUNT EQU 06H
  107. STR DB 'VASAVI'
  108. DATA ENDS
  109. CODE SEGMENT
  110. START: MOV AX,DATA
  111. MOV DS,AX
  112. MOV ES,AX
  113. MOV DI,OFFSET STR
  114. MOV CX,COUNT
  115. MOV AL,'I'
  116. REPNZ SCASB
  117. JNE NOTFIND
  118. MOV BX,0055H
  119. JMP EXIT
  120. NOTFIND: MOV BX,00FFH
  121. EXIT: INT 03H
  122. LAREST & SMALEST
  123. DATA SEGMENT
  124. ARR DB 02H,03H,01H,05H,07H
  125. DATA ENDS
  126. CODE SEGMENT
  127. START:MOV AX,DATA
  128. MOV DS,AX
  129. XOR AX,AX
  130. MOV CL,05H
  131. MOV DL,CL
  132. DEC CL
  133. L2: MOV BX,OFFSET ARR
  134. L1: MOV AL, [BX]
  135. CMP AL, [BX+1]
  136. JNC CONT
  137. XCHG AL,[BX+1]
  138. MOV [BX],AL
  139. CONT: INC BX
  140. LOOP L1
  141. DEC DL
  142. MOV CL,DL
  143. LOOP L2
  144. INT 03H
  145. #LARGE-JNC
  146. #SMALL-JC
  147.  
  148. LED-SWITCH INTERFACE
  149. 1100 MOV AL,90
  150. MOV DX,AL
  151. OUT DX,AL
  152. LOOP:MOV DX,AL
  153. INC AL,DX
  154. MOV DX,FF32
  155. OUT DX,AL
  156. JMP LOOP
  157.  
  158.  
  159. MULTIBYTE ADDITION
  160. DATA SEGMENT
  161. NUM1 DB 15H,25H,35H
  162. NUM2 DB 20H,34H,20H
  163. NUM3 DB ?
  164. DATA ENDS
  165. CODE SEGMENT
  166. START:MOV AX,DATA
  167. MOV DS,AX
  168. MOV CX,03H
  169. CLC
  170. LEA SI,NUM2
  171. LEA BX,NUM2
  172. LEA DI,NUM3
  173. NEXT:MOV AL,[SI]
  174. ADC AL,[BX]
  175. INC SI
  176. INC BX
  177. INC DI
  178. LOOP NEXT
  179. INT 03H
  180.  
  181. SIGNED MUL-DIV
  182. DATA SEGMENT
  183. NUM1 DB 0F2H
  184. NUM2 DB 02H
  185. PRODUCT DB?
  186. DATA ENDS
  187. CODE SEGMENT
  188. START:MOV AX,DATA
  189. MOV DS,AX
  190. MOV AL,NUM1
  191. MOV BL,NUM2
  192. IMUL BX
  193. IDIV BX
  194. MOV PRODUCT,AX
  195. MOV DIVISION,CX
  196. INT 03H
  197.  
  198.  
  199.  
  200.  
  201. BCD ADD
  202. DATA SEGMENT
  203. NUM1 DW 0005H
  204. NUM2 DW 0008H
  205. DATA ENDS
  206. CODE SEGMENT
  207. START:MOV AX,DATA
  208. MOV DS,AX
  209. MOV AX,NUM1
  210. MOV BX,NUM2
  211. ADC AX,BX
  212. DAA
  213. INT 03H
  214.  
  215. PACK-UNPACK BCD
  216. DATA SEGMENT
  217. DATA ENDS
  218. CODE SEGMENT
  219. START:MOV AX ,DATA
  220. MOV DS ,AX
  221. MOV AL, 07H
  222. MOV AH, 03H
  223. MOV BL, 01H
  224. MOV BH, 02H
  225. ADD AX, BX
  226. AAA
  227. INT 03H
  228.  
  229. TRAFFIC LIGHTS
  230. A1100
  231. MOV DS,FF36
  232. MOV AX,80
  233. OUT DS,AX
  234. MOV DS,FF30
  235. MOV AX,01
  236. OUT DS,AX
  237. MOV DS,FF32
  238. MOV AX,02
  239. OUT DS,AX
  240.  
  241.  
  242.  
  243. BCD-BINARY
  244. DATA SEGMENT
  245. BCDIN DB 17H
  246. BINOUT DB ?
  247. DATA ENDS
  248. STACK SEGMENT
  249. STKWRD DW 50 DUP(0)
  250. TOS LABEL WORD
  251. STACK ENDS
  252. CODE SEGMENT
  253. START:MOV AX ,DATA
  254. MOV DS ,AX
  255. MOV AX ,STACK
  256. MOV SS ,AX
  257. MOV SP ,OFFSET TOS
  258. LEA SI, BCDIN
  259. LEA DI, BINOUT
  260. CALL BCDTOBIN
  261. INT 03H
  262. BCDTOBIN PROC NEAR
  263. MOV AL, [SI]
  264. MOV BL, AL
  265. AND BL, 0FH
  266. AND AL, 0F0H
  267. MOV CL, 04H
  268. ROR AL, CL
  269. MOV BH, 0AH
  270. MUL BH
  271. ADD AL, BL
  272. MOV [DI], AL
  273. RET
  274. BCDTOBIN ENDP
  275.  
  276.  
  277. STEPPER
  278. A1100
  279. MOV AL,80
  280. MOV DX,FF36
  281. OUT DX,AL
  282. START:MOV SI,1200
  283. MOV BL,04
  284. REPEAT:MOV AL,[SI]
  285. MOV DX,FF30
  286. OUT DX,AL
  287. CALL DELAY(111B)
  288. INC SI
  289. DEC BL
  290. JNZ REPEAT(110B)
  291. JMP START(1106)
  292. DELAY
  293. A111B
  294. MOV CX,0903
  295. LOOP:DEC CX
  296. JNZ LOOP(111E)
  297. RET
  298.  
  299. DC MOTOR
  300. A1100
  301. MOV AL,80
  302. MOV DX,FF36
  303. OUT DX,AL
  304. MOV AL,05
  305. MOV DX,FF32
  306. OUT DX,AL
  307. CALL 1111
  308. JMP 1106
  309. MOV CX,FFFF
  310. DEC CX
  311. JNZ 1114
  312. RET
  313.  
  314.  
  315. 0 TO 9 DISPLAY
  316. 1100 MOV AL,80
  317. MOV DX,FF36
  318. OUT DX,AL
  319. MOV AL,7F
  320. MOV DDX,FF30
  321. OUT DX,AL
  322. AGN: CALL 1124
  323. START: MOV CL,0A
  324. MOV SI,1200
  325. REP:MOV AL,[SI]
  326. MOV DX,FF32
  327. OUT DX,AL
  328. CALL 1124
  329. INC SI
  330. DEC CL
  331. JNZ REP
  332. JMP START
  333. DLY: MOV DX,FFFF
  334. M:DEC DX
  335. JNZ M
  336. RET
  337. ORG 1300H
  338.  
  339. 7SEGMENT
  340. MOV AL,80H
  341. MOV DX,FF36H
  342. OUT DX,AL
  343. MOV AL,01H
  344. MOV DX,FF30H
  345. OUT DX,AL
  346. MOV AL,F8H
  347. MOV DX,FF32H
  348. OUT DX,AL
  349. INT 03H
  350.  
  351. ROLLING 7
  352. A6000
  353. MOV AL,80H
  354. MOV DX,FF36H
  355. OUT DX,AL
  356. START:MOV BH,06
  357. MOV BL,01
  358. BACK:MOV AL,BL
  359. MOV DX,FF30H
  360. OUT DX,AL
  361. MOV AL,F8H
  362. MOV DX,FF32H
  363. OUT DX,AL
  364. CALL DELAY(6050)
  365. MOV CL,01
  366. SHL BL,CL
  367. DEC BH
  368. JNZ BACK(600A)
  369. JMP START:(6006)
  370. INT 03H
  371. 7-DELAY
  372. A6050
  373. MOV CX,FFFF
  374. LOOP 6053
  375. RET
  376.  
  377.  
  378.  
  379. DISPLAY HELLO
  380. M1200 PRESS ENTER
  381. 86
  382. 89
  383. C7
  384. C7
  385. C0
  386. START:MOV AL,80H
  387. MOV DX,FF36H
  388. OUT DX,AL
  389. LEA SI,1200
  390. LOOP:MOV CX,0005H
  391. MOV AL,7F
  392. MOV DX,FF30
  393. OUT DX,AL
  394. MOV AL,[SI]
  395. MOV DX,FF32
  396. OUT DX,AL
  397. INC SI
  398. CALL DELAY
  399. DEC CX
  400. JNZ LOOP
  401. JMP START
  402. DELAY:MOV BX,FFFF
  403. LOOP1:DEC BX
  404. JNZ LOOP1
  405. RET
  406.  
  407.  
  408.  
  409. ADDRESSING
  410. IMMEDIATE:
  411. START: MOV AX,0010H
  412. INT 03H
  413. DIRECT:
  414. START:MOV AX,[0050]
  415. INT 03H
  416. BASE-INDEX:
  417. START: MOV AL,[BP+SI]
  418. MOV AX,[BX,DI]
  419. INDIRECT:
  420. START:MOV AX,[BX]
  421. ADD AX,0003H
  422. INDEXED:
  423. START:MOV AX,[SI,2000]
  424. REGISTER:
  425. START:MOV BX,0005H
  426. MOV AX,BX
  427.  
  428.  
  429. TRAFFIC LIGHT PROGRAM FOR CONTINUOUS ROTATION
  430. MOV AL,80
  431. MOV DX,FF36
  432. OUT DX,AL
  433. 1106:
  434. MOV AH,04
  435. MOV BX,2000
  436. 110B:
  437. MOV AL,[BX]
  438. MOV DX,FF30
  439. OUT DX,AL
  440. INC BX
  441. MOV AL,[BX]
  442. MOV DX,FF32
  443. OUT DX,AL
  444. CALL 1140
  445. INC BX
  446. DEC AH
  447. JNZ 110B
  448. JMP 1106
  449. 1140:
  450. MOV DX,000F
  451. MOV CX,FFFF
  452. LOOP 1146
  453. DEC DX
  454. JNZ 1143
  455. RET
  456.  
  457. M2000
  458. 21 09 0C 09 64 08 24 03
  459.  
  460.  
  461.  
  462.  
  463. 2's,1’s complement
  464. assume cs:code,ds:data
  465. data segment
  466. n1 dw 0005h
  467. data ends
  468. code segment
  469. start:mov ax,data
  470. mov ds,ax
  471. mov ax,n1
  472. not ax
  473. mov bx,ax
  474. inc ax
  475. int 03h
  476. code ends
  477. end start
  478.  
  479. factorial
  480. assume cs:code,ds:data
  481. data segment
  482. num dw 0003h
  483. data ends
  484. code segment
  485. start:mov ax,data
  486. mov ds,ax
  487. mov cx,num
  488. mov ax,cx
  489. dec cx
  490. fact:mul cx
  491. dec cx
  492. jnz fact
  493. int 03h
  494. code ends
  495. end start
  496. Multibyte addition
  497. Assume cs:code,ds:data
  498. Data segment
  499. Num1 db 01h,02h,03h,04h
  500. Num2 db 05h,06h,07h,08h
  501. Num3 db 04 dup(00)
  502. Data ends
  503. Code Segment
  504. Start:
  505. Mov ax,data
  506. Mov ds,ax
  507. Xor ax,ax
  508. Mov bx,ax
  509. Mov cl,al
  510. Mov dl,00h
  511. Mov cl,04h
  512. Lea si,num1
  513. Lea di,num2
  514. Lea bx,num3
  515. L1: mov al,[si]
  516. Adc al,[di]
  517. Mov cl,al
  518. Mov dl,00h
  519. Mov cl,04h
  520. Lea si,num1
  521. Lea di,num2
  522. L1: mov al,[si]
  523. Adc al,[di]
  524. Mov [bx],al
  525. Inc si
  526. Inc di
  527. Inc bx
  528. Loop l1
  529. Jnc l2
  530. Adc dl,00
  531. L2: mov [bx],dl
  532. Int 03h
  533. Code ends
  534. End start
  535.  
  536. Multibyte subtraction
  537. Assume ds:data,cs:code
  538. Data segment
  539. N1 db 55h,66h,77h,88h
  540. N2 db 11h,22h,33h,44h
  541. Result db 4h dup(00)
  542. Data ends
  543. Code segment
  544. Start:mov ax,data
  545. Mov ds,ax
  546. Mov si,offset N1
  547. Mov di,offset N2
  548. Mov bx,offset result
  549. Clc
  550. Mov cx,0004h
  551. Mov ax,0000h
  552. Back:mov al,[si]
  553. Mov dl,[di]
  554. Sbb al,dl
  555. Mov [bx],al
  556. Inc si
  557. Mov di
  558. Inc bx
  559. Loop back
  560. Mov ah,4Ch
  561. Int 21h
  562. Int 03h
  563. Code ends
  564. End start
  565.  
  566. Hardware add
  567. A1000
  568. Mov ax,0005h
  569. Mov bx,0005h
  570. Add ax,bx
  571. Int 03h
  572. G1000
  573. Hardware sub
  574. A1000
  575. Mov ax,0003h
  576. Mov bx,0003h
  577. Sub ax,bx
  578. Int 03h
  579. G1000
  580. Hardware mul
  581. A1000
  582. Mov ax,0002h
  583. Mov bx,0002h
  584. Mul bx
  585. Int 03h
  586. G1000
  587. Hardware div
  588. A1000
  589. Mov ax,0002h
  590. Mov bx,0002h
  591. Div bx
  592. Int 03h
  593. G1000
  594. Hardware fact
  595. A1000
  596. Mov ax,0001
  597. Mov cx,0003
  598. 1006:mul cx
  599. Dec cx
  600. Jnz 1006
  601. G1000
  602. Hardware sum
  603. M 1200 02
  604. M 1201 04
  605. A1000
  606. Mov ax,0000
  607. Mov cl,02
  608. Mov si,1200
  609. 1008:add al,[si]
  610. Inc si
  611. Dec cl
  612. Jnz 1008
  613. G1000
  614.  
  615.  
  616. smallest
  617. assume ds:data,cs:code
  618. data segment
  619. arr1 db 05h,04h,01h,02h,03h
  620. count db 05h
  621. data ends
  622. code segment
  623. start:mov ax,data
  624. mov ds,ax
  625. mov dl,count
  626. L2:mov cx,dx
  627. mov si,offset arr1
  628. L1:mov al,[si]
  629. cmp al,[si+1]
  630. jc continue
  631. xchg al,[si+1]
  632. mov [si],al
  633. continue:inc si
  634. loop L1
  635. dec dx
  636. jnz L2
  637. mov bx,offset arr1
  638. mov al,[bx]
  639. int 03h
  640. code ends
  641. end start
  642.  
  643. largest
  644. assume cs:code,ds:data
  645. data segment
  646. arr db 02h,09h,03h,06h,08h,07h
  647. count db 06h
  648. data ends
  649. code segment
  650. start:mov ax,data
  651. mov ds,ax
  652. mov si,offset arr
  653. mov cl,count
  654. mov al,[si]
  655. up:inc si
  656. cmp al,[si]
  657. jnb go
  658. mov al,[si]
  659. go:loop up
  660. int 03h
  661. code ends
  662. end start
  663.  
  664. search
  665. assume ds:data,cs:code
  666. data segment
  667. arr db 11h,21h,32h
  668. msg db 'FOUND','$'
  669. msg1 db 'NOT FOUND','$'
  670. count db 03h
  671. data ends
  672. code segment
  673. start:mov ax,data
  674. mov ds,ax
  675. mov es,ax
  676. mov cl,count
  677. mov si,offset arr
  678. cld
  679. mov al,32h
  680. repne scasb
  681. jz a2
  682. mov ah,09h
  683. lea dx,msg1
  684. int 21h
  685. jmp a3
  686. a2:mov ah,09h
  687. lea dx,msg
  688. int 21h
  689. a3:int 03h
  690. code ends
  691. end start
  692.  
  693. reverse
  694. assume ds:data,cs:code
  695. data segment
  696. stg db 'SVCET','$'
  697. stg1 db 05h dup(?),'$'
  698. count db 05h
  699. data ends
  700. code segment
  701. start:mov ax,data
  702. mov ds,ax
  703. mov es,ax
  704. mov cl,count
  705. mov si,offset stg
  706. mov di,offset stg1
  707. cld
  708. add si,04h
  709. a1:movsb
  710. dec si
  711. dec si
  712. dec cl
  713. jnz a1
  714. mov ah,09h
  715. lea dx,stg1
  716. int 21h
  717. int 03h
  718. code ends
  719. end start
  720.  
  721. ascending order
  722. assume ds:data,cs:code
  723. data segment
  724. arr db 05h,04h,01h,02h,03h
  725. count db 05h
  726. data ends
  727. code segment
  728. start:mov ax,data
  729. mov ds,ax
  730. mov dl,count
  731. L2:mov cx,dx
  732. mov si,offset arr
  733. L1:mov al,[si]
  734. cmp al,[si+1]
  735. jc continue
  736. xchg al,[si+1]
  737. mov [si],al
  738. continue:inc si
  739. loop L1
  740. dec dx
  741. jnz L2
  742. int 03h
  743. code ends
  744. end start
  745.  
  746. descending order
  747. assume data:ds,cs:code
  748. arr1 db 05h,04h,01h,02h,03h
  749. count db 05h
  750. data ends
  751. code segment
  752. start:mov ax,data
  753. mov ds,ax
  754. mov dl,count
  755. L2:mov cl,dl
  756. mov si,offset arr1
  757. L1:mov al,[si]
  758. cmp al,[si+1]
  759. jnc continue
  760. xchg al,[si+1]
  761. mov [si],al
  762. continue:inc si
  763. loop L1
  764. dec dl
  765. jnz L2
  766. int 03h
  767. code ends
  768. end start
  769.  
  770. search char
  771. assume cs:code,ds:data
  772. data segment
  773. str db 'VASAVI'
  774. size1 db 06h
  775. data ends
  776. code segment
  777. start:mov ax,data
  778. mov ds,ax
  779. mov es,ax
  780. CLD
  781. mov di,offset str
  782. mov cx,size1
  783. mov al,49
  784. REPNE SCASB str
  785. int 03h
  786. code ends
  787. end start
  788.  
  789. sum of array numbers
  790. assume ds:data,cs:code
  791. data segment
  792. arr db 02h,03h,04h,05h,01h
  793. count db 05h
  794. data ends
  795. code segment
  796. start:mov ax,data
  797. mov ds,ax
  798. mov al,0h
  799. mov cl,count
  800. mov si,offset arr
  801. again:mov bl,[si]
  802. add ax,bx
  803. inc si
  804. dec cl
  805. jnz again
  806. int 03h
  807. code ends
  808. end start
  809.  
  810.  
  811. signed multiplication
  812. assume ds:data,cs:code
  813. data segment
  814. n1 dw -0002h
  815. n2 dw 0004h
  816. data ends
  817. code segment
  818. start:mov ax,data
  819. mov ds,ax
  820. mov ax,n1
  821. mov bx,n2
  822. imul bx
  823. int 03h
  824. code ends
  825. end start
  826.  
  827. signed division
  828. assume ds:data,cs:code
  829. data segment
  830. n1 dw -0004h
  831. n2 dw 0002h
  832. data ends
  833. code segment
  834. start:mov ax,data
  835. mov ds,ax
  836. mov ax,n1
  837. mov bx,n2
  838. idiv bx
  839. int 03h
  840. code ends
  841. end start
  842.  
  843. multibyte addition
  844. assume cs:code,ds:data
  845. data segment
  846. arr1 dw 0005h,0001h,0004h,0001h
  847. arr2 dw 0004h,0002h,0003h,0002h
  848. arr3 dw 4 dup(0)
  849. data ends
  850. start:mov ax,data
  851. mov ds,ax
  852. lea si,arr1
  853. lea di,arr2
  854. lea bx,arr3
  855. mov cx,04h
  856. sum:mov ax,[si]
  857. adc ax,[di]
  858. mov [bx],ax
  859. inc si
  860. inc di
  861. inc dx
  862. jnz sum
  863. int 03h
  864. code ends
  865. end start
  866.  
  867. lcd
  868. A1000
  869. mov AL,90
  870. mov DX,FF36
  871. OUT DX,AL
  872. mov DX,FF30
  873. IN AL,DX
  874. MOV DX,FF32
  875. OUT DX,AL
  876. JMP 1106
  877.  
  878. seven segment
  879. A1110
  880. mov al,80h
  881. mov dx,ff36
  882. out dx,al
  883. mov al,01h
  884. mov dx,ff30
  885. out dx,al
  886. mov al,f8h
  887. mov dx,ff32
  888. out dx,al
  889. int 03h
  890.  
  891. Hello
  892. M1200 press enter
  893. 86
  894. 89
  895. C7
  896. C7
  897. C0
  898. Start:mov al,80h
  899. Mov dx,ff36h
  900. Out dx,al
  901. Lea si,1200
  902. Loop:mov cx,0005h
  903. Mov al,7F
  904. Mov dx,ff30
  905. Out dx,al
  906. Mov al,[si]
  907. Mov dx,ff32
  908. Out dx,al
  909. Inc si
  910. Call delay
  911. Dec cx
  912. Jnz loop
  913. Jmp start
  914. Delay:mov bx,ffff
  915. Loop1:dec bx
  916. Jnz loop1
  917. Ret
  918.  
  919. Factorial Procedure
  920. Data segment
  921. Num2 dw 0003h
  922. Data ends
  923. Code segment
  924. Start: mov ax,data
  925. Mov ds,ax
  926. Mov ax,0000h
  927. Call myproc
  928. Int 03h
  929. Myproc proc near
  930. Mov ax,00001h
  931. Mov cx,num2
  932. Fact: mul cx
  933. Loop fact
  934. Ret
  935. Myroc endp
  936. Code ends
  937. End start
  938.  
  939. Macro factorial
  940. Data segment
  941. Num1 dw 0004h
  942. Data ends
  943. Code Segment
  944. Start: mov ax,data
  945. Mov ds,ax
  946. Mov ax,0000h
  947. factMacro macro p1
  948. mov cx,p1
  949. mov ax,0001h
  950. fact: mul cx
  951. loop fact
  952. endm
  953. factMacro num1
  954. int 03h
  955. code ends
  956. End Start
  957.  
  958. 8051 addressing mode
  959. Register: mov a,b
  960. Direct: mov 30h,a
  961. Indirect: mov a,@r0
  962. Indexed: MOVC a,@a+pc
  963. 8086 addressing modes
  964. Assume cs:code
  965. Code segment
  966. Start:
  967. Mov ax,0005h ; immediate
  968. Mov bx,[2000] ; direct
  969. Mov dx,[bx] ; indirect
  970. Mov bx,ax ; register
  971. Code Ends
  972. End Start
  973.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement