SlideShare a Scribd company logo
C:HomeNIT0_ClassAutumn 2012Microprocessor Labup Programs8086up_8086_Q6.asm                        05 August 2012 16:14

; Q 6>      Given a 16bit number determine all its factors from
;           0 to 9
    SW          2000h
                [2000h]     =   00D2h       ; A = 210
                [2002h]     =   2004h       ; Address to Factors Array F[]
                .

      A
      1000h
          mov     cx, 0000h
          mov     bx, 0001h
          mov     di, [2002h]
          add     di, 0002h
          loop_label:
          mov     dx, 0000h
          mov     ax, [2000h]
          div     bx
          or      dx, dx
          jnz     not_factor
          inc     cx
          mov     [di], bx
          add     di, 0002h
          not_factor:
          inc     bx
          cmp     bx, 0009h
          jbe     loop_label
          mov     di, [2002h]
          mov     [di], cx
          hlt
          .

      GO           1000h
      INT                                    ;(try '.' here)

      SW           2004h                                        ;   ans   =   0006h   =>   F.length = 6
      SW           2006h                                        ;   ans   =   0001h   =>   1
      SW           2008h                                        ;   ans   =   0002h   =>   2
      SW           200Ah                                        ;   ans   =   0003h   =>   3
      SW           200Ch                                        ;   ans   =   0005h   =>   5
      SW           200Eh                                        ;   ans   =   0006h   =>   6
      SW           2010h                                        ;   ans   =   0007h   =>   7
      .




                                                                              -1-

More Related Content

PDF
Up 8086 q3
PDF
Up 8086 q4
PDF
Up 8086 q7
PDF
Log log b
PDF
Ch12 19
PDF
Up 8086 q9
PPTX
Operator overloadng
Up 8086 q3
Up 8086 q4
Up 8086 q7
Log log b
Ch12 19
Up 8086 q9
Operator overloadng

Similar to Up 8086 q6 (11)

PDF
Up 8086 q2
PDF
Up 8086 q1
PDF
Lp fp us with multispeculative techniques_19_12_12
PDF
8086 labmanual
PDF
8086 labmanual
DOCX
Introduction to instruction set. new course
PPTX
Module 2 (1).pptx
PPTX
Wire - A Formal Intermediate Language for Binary Analysis
PPTX
Mod-2.pptx
PPT
Microcontrollers
PPT
Chapter1
Up 8086 q2
Up 8086 q1
Lp fp us with multispeculative techniques_19_12_12
8086 labmanual
8086 labmanual
Introduction to instruction set. new course
Module 2 (1).pptx
Wire - A Formal Intermediate Language for Binary Analysis
Mod-2.pptx
Microcontrollers
Chapter1
Ad

More from Subhajit Sahu (20)

PDF
About TrueTime, Spanner, Clock synchronization, CAP theorem, Two-phase lockin...
PDF
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
PDF
Adjusting Bitset for graph : SHORT REPORT / NOTES
PDF
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
PDF
Adjusting primitives for graph : SHORT REPORT / NOTES
PDF
Experiments with Primitive operations : SHORT REPORT / NOTES
PDF
PageRank Experiments : SHORT REPORT / NOTES
PDF
Algorithmic optimizations for Dynamic Monolithic PageRank (from STICD) : SHOR...
PDF
Adjusting OpenMP PageRank : SHORT REPORT / NOTES
PDF
word2vec, node2vec, graph2vec, X2vec: Towards a Theory of Vector Embeddings o...
PDF
DyGraph: A Dynamic Graph Generator and Benchmark Suite : NOTES
PDF
Shared memory Parallelism (NOTES)
PDF
A Dynamic Algorithm for Local Community Detection in Graphs : NOTES
PDF
Scalable Static and Dynamic Community Detection Using Grappolo : NOTES
PDF
Application Areas of Community Detection: A Review : NOTES
PDF
Community Detection on the GPU : NOTES
PDF
Survey for extra-child-process package : NOTES
PDF
Dynamic Batch Parallel Algorithms for Updating PageRank : POSTER
PDF
Abstract for IPDPS 2022 PhD Forum on Dynamic Batch Parallel Algorithms for Up...
PDF
Fast Incremental Community Detection on Dynamic Graphs : NOTES
About TrueTime, Spanner, Clock synchronization, CAP theorem, Two-phase lockin...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Adjusting Bitset for graph : SHORT REPORT / NOTES
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Adjusting primitives for graph : SHORT REPORT / NOTES
Experiments with Primitive operations : SHORT REPORT / NOTES
PageRank Experiments : SHORT REPORT / NOTES
Algorithmic optimizations for Dynamic Monolithic PageRank (from STICD) : SHOR...
Adjusting OpenMP PageRank : SHORT REPORT / NOTES
word2vec, node2vec, graph2vec, X2vec: Towards a Theory of Vector Embeddings o...
DyGraph: A Dynamic Graph Generator and Benchmark Suite : NOTES
Shared memory Parallelism (NOTES)
A Dynamic Algorithm for Local Community Detection in Graphs : NOTES
Scalable Static and Dynamic Community Detection Using Grappolo : NOTES
Application Areas of Community Detection: A Review : NOTES
Community Detection on the GPU : NOTES
Survey for extra-child-process package : NOTES
Dynamic Batch Parallel Algorithms for Updating PageRank : POSTER
Abstract for IPDPS 2022 PhD Forum on Dynamic Batch Parallel Algorithms for Up...
Fast Incremental Community Detection on Dynamic Graphs : NOTES
Ad

Up 8086 q6

  • 1. C:HomeNIT0_ClassAutumn 2012Microprocessor Labup Programs8086up_8086_Q6.asm 05 August 2012 16:14 ; Q 6> Given a 16bit number determine all its factors from ; 0 to 9 SW 2000h [2000h] = 00D2h ; A = 210 [2002h] = 2004h ; Address to Factors Array F[] . A 1000h mov cx, 0000h mov bx, 0001h mov di, [2002h] add di, 0002h loop_label: mov dx, 0000h mov ax, [2000h] div bx or dx, dx jnz not_factor inc cx mov [di], bx add di, 0002h not_factor: inc bx cmp bx, 0009h jbe loop_label mov di, [2002h] mov [di], cx hlt . GO 1000h INT ;(try '.' here) SW 2004h ; ans = 0006h => F.length = 6 SW 2006h ; ans = 0001h => 1 SW 2008h ; ans = 0002h => 2 SW 200Ah ; ans = 0003h => 3 SW 200Ch ; ans = 0005h => 5 SW 200Eh ; ans = 0006h => 6 SW 2010h ; ans = 0007h => 7 . -1-