SlideShare a Scribd company logo
C:HomeNIT0_ClassAutumn 2012Microprocessor Labup Programs8086up_8086_Q1.asm     04 August 2012 23:30

; Q 1>
;   a>      Addition of 2 16bit BCD numbers                     with carry
    SW          2000h
                [2000h]     =   0999h                           ; A = 999 in BCD
                [2002h]     =   0001h                           ; B = 1 in BCD
                [2004h]     =   (ans)                           ; C = (A + B) in BCD
                .

      A
      1000h
          mov            ax,    [2000h]
          mov            bx,    [2002h]
          add            bx,    ax
          mov            al,    bl
          daa
          adc            bh, 00h
          mov            bl, al
          mov            al, bh
          daa
          mov            bh, al
          mov            [2004h], bx
          hlt
          .

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

      SW           2004h                                        ; ans = 1000h
      .                                                         ; => 1000 in BCD




;     b>    Addition of 2 32bit numbers
      SW        2000h
                [2000h]     =   4B20h                           ; A = 12340000
                [2002h]     =   00BCh                           ;
                [2004h]     =   162Eh                           ; B = 5678
                [2006h]     =   0000h                           ;
                [2008h]     =   (ans)                           ; C = (A + B)
                [200Ah]     =   (ans)                           ;
                .

      A
      1000h
          mov            ax, [2000h]
          mov            bx, [2002h]
          add            ax, [2004h]
          adc            bx, [2006h]
          mov            [2008h], ax
          mov            [200Ah], bx
          hlt
          .



                                                                             -1-
C:HomeNIT0_ClassAutumn 2012Microprocessor Labup Programs8086up_8086_Q1.asm   04 August 2012 23:30

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

      SW           2008h                                        ; ans = 614Eh
      SW           200Ah                                        ; ans = 00BCh
      .                                                         ; => 12345678




;     c>    Addition of 2 signed 32bit numbers
      SW        2000h
                [2000h]     =   614Eh       ; A = 12345678
                [2002h]     =   00BCh       ;
                [2004h]     =   0E9D2h      ; B = -5678
                [2006h]     =   0FFFFh      ;
                [2008h]     =   (ans)       ; C = (A + B)
                [200Ah]     =   (ans)       ;
                .

      A
      1000h
          mov            ax, [2000h]
          mov            bx, [2002h]
          add            ax, [2004h]
          adc            bx, [2006h]
          mov            [2008h], ax
          mov            [200Ah], bx
          hlt
          .

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

      SW           2008h                                        ; ans = 4B20h
      SW           200Ah                                        ; ans = 00BCh
      .                                                         ; => 12340000




                                                                             -2-

More Related Content

Viewers also liked

86 pr0grams
86 pr0grams86 pr0grams
ISC
ISCISC
microprocessor & programming
 microprocessor & programming microprocessor & programming
microprocessor & programming
Gaurang Thakar
 
Unit 5 assembly language programming
Unit 5   assembly language programmingUnit 5   assembly language programming
Unit 5 assembly language programming
Kartik Sharma
 
Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086
University of Gujrat, Pakistan
 
Amp
AmpAmp
microprocessor 8086 lab manual !!
microprocessor 8086 lab manual !!microprocessor 8086 lab manual !!
microprocessor 8086 lab manual !!Sushil Mishra
 
8086 alp
8086 alp8086 alp
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
Shehrevar Davierwala
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
Gopikrishna Madanan
 

Viewers also liked (14)

Up 8086 q7
Up 8086 q7Up 8086 q7
Up 8086 q7
 
86 pr0grams
86 pr0grams86 pr0grams
86 pr0grams
 
ISC
ISCISC
ISC
 
microprocessor & programming
 microprocessor & programming microprocessor & programming
microprocessor & programming
 
Unit 5 assembly language programming
Unit 5   assembly language programmingUnit 5   assembly language programming
Unit 5 assembly language programming
 
Mpmc lab
Mpmc labMpmc lab
Mpmc lab
 
Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086
 
Intel 8086
Intel 8086Intel 8086
Intel 8086
 
Amp
AmpAmp
Amp
 
microprocessor 8086 lab manual !!
microprocessor 8086 lab manual !!microprocessor 8086 lab manual !!
microprocessor 8086 lab manual !!
 
8086 alp
8086 alp8086 alp
8086 alp
 
8086 Architecture
8086 Architecture8086 Architecture
8086 Architecture
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
 

More from Subhajit Sahu

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

More from Subhajit Sahu (20)

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

Up 8086 q1

  • 1. C:HomeNIT0_ClassAutumn 2012Microprocessor Labup Programs8086up_8086_Q1.asm 04 August 2012 23:30 ; Q 1> ; a> Addition of 2 16bit BCD numbers with carry SW 2000h [2000h] = 0999h ; A = 999 in BCD [2002h] = 0001h ; B = 1 in BCD [2004h] = (ans) ; C = (A + B) in BCD . A 1000h mov ax, [2000h] mov bx, [2002h] add bx, ax mov al, bl daa adc bh, 00h mov bl, al mov al, bh daa mov bh, al mov [2004h], bx hlt . GO 1000h INT ; (try '.' here) SW 2004h ; ans = 1000h . ; => 1000 in BCD ; b> Addition of 2 32bit numbers SW 2000h [2000h] = 4B20h ; A = 12340000 [2002h] = 00BCh ; [2004h] = 162Eh ; B = 5678 [2006h] = 0000h ; [2008h] = (ans) ; C = (A + B) [200Ah] = (ans) ; . A 1000h mov ax, [2000h] mov bx, [2002h] add ax, [2004h] adc bx, [2006h] mov [2008h], ax mov [200Ah], bx hlt . -1-
  • 2. C:HomeNIT0_ClassAutumn 2012Microprocessor Labup Programs8086up_8086_Q1.asm 04 August 2012 23:30 GO 1000h INT ;(try '.' here) SW 2008h ; ans = 614Eh SW 200Ah ; ans = 00BCh . ; => 12345678 ; c> Addition of 2 signed 32bit numbers SW 2000h [2000h] = 614Eh ; A = 12345678 [2002h] = 00BCh ; [2004h] = 0E9D2h ; B = -5678 [2006h] = 0FFFFh ; [2008h] = (ans) ; C = (A + B) [200Ah] = (ans) ; . A 1000h mov ax, [2000h] mov bx, [2002h] add ax, [2004h] adc bx, [2006h] mov [2008h], ax mov [200Ah], bx hlt . GO 1000h INT ;(try '.' here) SW 2008h ; ans = 4B20h SW 200Ah ; ans = 00BCh . ; => 12340000 -2-