Binary and hex input/output (in 8086 assembuly langyage)

B
Bilal AmjadResearch Student em University of Huddersfield
Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)
Microprocessor
Instructor Mam Yumna Bilal
Group Members
 Abdul Qayum
 Imran Khan
 Adnan Murtaza
 Usman Mahmood
 Ahmad Ali
 M.Shebaz Shreef
Binary input:
For binary Input, we assume a program reads In a binary number
from the keyboard, followed by a carriage return.
The number actually Is a character string of O's and l's.
As each character Is entered, we need to convert it to a bit value,
and collect the bits in a register.
Clear BX /* BX will hold binary value */
Input a character /* '0' or '1' */
WHILE character <> CR DO
Convert character to binary value
Left shift BX
Insert value into 1sb of BX
Input a character
END_WHILE
Clear BX
BX
Input character '1', convert to 1
AND AL,OFH
Left Shift BX
CF BX
Insert value into lsb
BX
Input character ‘1' , convert to 1 AND AL,OFH
Left shift BX
CF BX
Insert value into lsb
BX
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 00
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
Input character '0' convert to o AND AL,OFH
Left shift BX
CF BX
Insert value into lsb
BX = 0000 0000 0000 0110
BX contains 110b
The algorithm assumes (1) input characters are either "O", “1", or
CR, and (2) at most 16 binary digits are input.AS a new digit Is
Input, the previous bits in BX must be shifted to the left to make
room; then an OR operation can be used to insert the new bit
into BX.
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 00
XOR BX, BX ; clear BX
MOV AH, 1 ;input char function
INT 21H ;read a character
WHILE_:
CMP AL, ODH ;CR?
JE END_WHILE ;yes, done
AND AL, OFH ;no convert to binary Value
SHL BX, 1 ;make room for new value
OR BL,AL ;put value into BX
INT 21H ;read a character
JMP WHILE_ ;loop back
END_WHILE:
Algorithm for Binary Output:
FOR 16 times DO
Rotate left BX /* BX holds output value,
put msb into CF */
IF CF = 1
THEN
output ‘1’
ELSE
output ‘0’
END_IF,
END_FOR
Mov CX,16
Top:
ROL BX,1
JNC Next
Mov AH,2
Mov DL,1
JMP Ali
Next:
Mov DL,2
Mov DL,0
Ali:
Int 21H
Int Top
loop Top
Hex input consists of digits ("0" to "9") and letters ("A" to "F”)
followed by a carriage return.
For simplicity, we assume that (1) only uppercase letters are
used, and (2) the user inputs no more than four hex characters.
The process of converting characters to binary values Is more
Involved than it was for binary input.
BX must be shifted four times to make room for a hex value.
Clear BX /* BX will hold input value */
input hex character
WHILE character <> CR DO
convert character to binary value
left shift BX 4 times
insert value into lower 4 bits of BX
input a character
END_WHlLE
Clear BX
BX
Input '6', convert to 0110
Left, shift BX 4 times
CF BX
Insert value into lower 4 bits of BX
BX
Input 'A', convert to Ah = 1010
Left shift BX 4 times
CF BX
Insert value into lower 4 bits of BX
BX
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0
0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 00
0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0
Input 'B', convert to 1011
Left shift BX 4 times
CF BX
Insert value into lower 4 bits of BX
BX
BX contains 06ABh.
Here is the code:
XOR BX,BX ;clear BX
MOV CL,4 ;counter for 4 shifts
MOV AH,1 ; input character function
INT 21H ; input a character
WHILE_:
0 0 0 0 0 1 1 0 1 0 1 0 0 0 0 00
0 0 0 0 0 1 1 0 1 0 1 0 1 0 1 1
CMP AL,ODH ;CR?
JE END WHILE ;yes, exit
;convert character to binary value
AL, 39H ;a digit?
CMP AL, 39H ;a digit?
JG LETTER. ; no, a letter
; input is a digit
AND AL,OFH ;convert digit to binary value
JMP SHIFT ;go to insert in BX
LETTER:
SUB AL, 37H ;convert letter to binary value
SHIFT:
SHL BX, CL ;make room for new value
;insert value into BX
CR BL, AL ;put vi!lue into low 4 bits
;of BX
INT 21H ; input a character
JMP WHILE_ ; loop until CR
END_WHILE:
BX contains 16 bits, which equal four hex digit values.
To output the contents of BX, we start from the left and get hold of
each digit, convert it to a hex character, and output it.
Algorithm for Hex Output:
FOR 4 times DO
Move BH to DL /* BX holds output value *I
Shift DL 4 times to the right
IF DL < 10
THEN
convert to character in '0' .. '9.
ELSE
convert to character in 'A' .. 'F‘
END_IF
output character
Rotate BX left 4 times
END FOR
BX = 4CA9h = 0100 1100 1010 1001
Move BH to DL
DL = 0100 1100
Shift DL 4 times to the right
DL = 0000 0100
convert to character and output
DL = 0011 0100 = 34h = '4'
Rotate BX left. 4 times
BX = 1100 1010 1001 0100
Move BH to DL
DL = 1100 1010
Shift DL 4 times t0 the right
DL = 0000 1100
Convert to character and output
DL = 0100 0011 = 43h =‘C’
Rotate BX left 4 times
BX = 1010 1001 0100 1100
Move BH to DL
DL = 1010 1001
Shift DL 4 times to the right
DL = 0000 1010
Convert, to character and output
DL = 0100 0010 = 42h ='B'
Rotate BX left"4 times
BX = 1001 0100 1100 1010
Move BH to DL
DL = 1001 0100
Shift DL 4 times to the right
DL = 0000 1001
Convert to character and output
DL = 0011 1001 =39h = '9'
Rotate BX 4 times to the left
BX = 0100 1100 1010 1001 = original contents
1 de 20

Recomendados

Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an... por
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...warda aziz
7.7K visualizações13 slides
chapter 7 Logic, shift and rotate instructions por
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionswarda aziz
19.3K visualizações13 slides
Introduction to ibm pc assembly language por
Introduction to ibm pc assembly languageIntroduction to ibm pc assembly language
Introduction to ibm pc assembly languagewarda aziz
8.8K visualizações10 slides
Chapter 6 Flow control Instructions por
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructionswarda aziz
15.1K visualizações17 slides
Chapter 5The proessor status and the FLAGS registers por
Chapter 5The proessor status and the FLAGS registersChapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registerswarda aziz
15.5K visualizações7 slides
Assembly Langauge Chap 1 por
Assembly Langauge Chap 1Assembly Langauge Chap 1
Assembly Langauge Chap 1warda aziz
6.3K visualizações4 slides

Mais conteúdo relacionado

Mais procurados

Assembly language (coal) por
Assembly language (coal)Assembly language (coal)
Assembly language (coal)Hareem Aslam
4.2K visualizações129 slides
assembly language programming and organization of IBM PC" by YTHA YU por
assembly language programming and organization of IBM PC" by YTHA YUassembly language programming and organization of IBM PC" by YTHA YU
assembly language programming and organization of IBM PC" by YTHA YUEducation
56.4K visualizações131 slides
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ... por
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Bilal Amjad
2K visualizações70 slides
Assignment on alp por
Assignment on alpAssignment on alp
Assignment on alpJahurul Islam
2.8K visualizações31 slides
Solution manual of assembly language programming and organization of the ibm ... por
Solution manual of assembly language programming and organization of the ibm ...Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...Tayeen Ahmed
25.4K visualizações131 slides
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and... por
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...Bilal Amjad
1.7K visualizações49 slides

Mais procurados(20)

Assembly language (coal) por Hareem Aslam
Assembly language (coal)Assembly language (coal)
Assembly language (coal)
Hareem Aslam4.2K visualizações
assembly language programming and organization of IBM PC" by YTHA YU por Education
assembly language programming and organization of IBM PC" by YTHA YUassembly language programming and organization of IBM PC" by YTHA YU
assembly language programming and organization of IBM PC" by YTHA YU
Education56.4K visualizações
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ... por Bilal Amjad
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Bilal Amjad2K visualizações
Assignment on alp por Jahurul Islam
Assignment on alpAssignment on alp
Assignment on alp
Jahurul Islam2.8K visualizações
Solution manual of assembly language programming and organization of the ibm ... por Tayeen Ahmed
Solution manual of assembly language programming and organization of the ibm ...Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...
Tayeen Ahmed25.4K visualizações
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and... por Bilal Amjad
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Bilal Amjad1.7K visualizações
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor... por Bilal Amjad
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
Bilal Amjad1.1K visualizações
Multiplication & division instructions microprocessor 8086 por University of Gujrat, Pakistan
Multiplication & division instructions microprocessor 8086Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086
University of Gujrat, Pakistan23.4K visualizações
Assembly 8086 por Mustafa Salah
Assembly 8086Assembly 8086
Assembly 8086
Mustafa Salah21.7K visualizações
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ... por Bilal Amjad
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Bilal Amjad4.2K visualizações
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ... por Bilal Amjad
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
Bilal Amjad2.7K visualizações
Assembly Language Lecture 4 por Motaz Saad
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
Motaz Saad11.7K visualizações
8086 assembly language por Mir Majid
8086 assembly language8086 assembly language
8086 assembly language
Mir Majid 12.5K visualizações
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,... por Bilal Amjad
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Bilal Amjad3K visualizações
Assembly Language Lecture 3 por Motaz Saad
Assembly Language Lecture 3Assembly Language Lecture 3
Assembly Language Lecture 3
Motaz Saad14.7K visualizações
Jumps in Assembly Language. por NA000000
Jumps in Assembly Language.Jumps in Assembly Language.
Jumps in Assembly Language.
NA0000007.5K visualizações
Types of instructions por ihsanjamil
Types of instructionsTypes of instructions
Types of instructions
ihsanjamil103.6K visualizações
Address translation-mechanism-of-80386 by aniket bhute por Aniket Bhute
Address translation-mechanism-of-80386 by aniket bhuteAddress translation-mechanism-of-80386 by aniket bhute
Address translation-mechanism-of-80386 by aniket bhute
Aniket Bhute6.8K visualizações

Similar a Binary and hex input/output (in 8086 assembuly langyage)

[ASM]Lab7 por
[ASM]Lab7[ASM]Lab7
[ASM]Lab7Nora Youssef
638 visualizações56 slides
8086 instruction set por
8086 instruction set8086 instruction set
8086 instruction setmeenakshi_l
42 visualizações30 slides
8086 instruction set por
8086 instruction set8086 instruction set
8086 instruction setAlamin Hossain Miraje
663 visualizações30 slides
8086 instruction set por
8086 instruction set8086 instruction set
8086 instruction setjemimajerome
11K visualizações30 slides
assembly language programming organization of IBM PC chapter 9 part-2(decimal... por
assembly language programming organization of IBM PC chapter 9 part-2(decimal...assembly language programming organization of IBM PC chapter 9 part-2(decimal...
assembly language programming organization of IBM PC chapter 9 part-2(decimal...Bilal Amjad
856 visualizações34 slides
int 21 h for screen display por
int 21 h for screen displayint 21 h for screen display
int 21 h for screen displayAnju Kanjirathingal
1K visualizações25 slides

Similar a Binary and hex input/output (in 8086 assembuly langyage)(7)

[ASM]Lab7 por Nora Youssef
[ASM]Lab7[ASM]Lab7
[ASM]Lab7
Nora Youssef638 visualizações
8086 instruction set por meenakshi_l
8086 instruction set8086 instruction set
8086 instruction set
meenakshi_l42 visualizações
8086 instruction set por jemimajerome
8086 instruction set8086 instruction set
8086 instruction set
jemimajerome11K visualizações
assembly language programming organization of IBM PC chapter 9 part-2(decimal... por Bilal Amjad
assembly language programming organization of IBM PC chapter 9 part-2(decimal...assembly language programming organization of IBM PC chapter 9 part-2(decimal...
assembly language programming organization of IBM PC chapter 9 part-2(decimal...
Bilal Amjad856 visualizações
int 21 h for screen display por Anju Kanjirathingal
int 21 h for screen displayint 21 h for screen display
int 21 h for screen display
Anju Kanjirathingal1K visualizações
8086 instructions por Ravi Anand
8086 instructions8086 instructions
8086 instructions
Ravi Anand63.3K visualizações

Mais de Bilal Amjad

IoT Based Smart Energy Meter using Raspberry Pi and Arduino por
IoT Based Smart Energy Meter using Raspberry Pi and Arduino IoT Based Smart Energy Meter using Raspberry Pi and Arduino
IoT Based Smart Energy Meter using Raspberry Pi and Arduino Bilal Amjad
1.8K visualizações20 slides
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink) por
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink) Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink)
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink) Bilal Amjad
836 visualizações34 slides
Solar Radiation monthly prediction and forecasting using Machine Learning tec... por
Solar Radiation monthly prediction and forecasting using Machine Learning tec...Solar Radiation monthly prediction and forecasting using Machine Learning tec...
Solar Radiation monthly prediction and forecasting using Machine Learning tec...Bilal Amjad
147 visualizações33 slides
Big Data in Smart Grid por
Big Data in Smart GridBig Data in Smart Grid
Big Data in Smart GridBilal Amjad
149 visualizações9 slides
Flexibility of Power System (Sources of flexibility & flexibility markets) por
Flexibility of Power System (Sources of flexibility & flexibility markets)Flexibility of Power System (Sources of flexibility & flexibility markets)
Flexibility of Power System (Sources of flexibility & flexibility markets)Bilal Amjad
341 visualizações33 slides
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ... por
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Bilal Amjad
745 visualizações31 slides

Mais de Bilal Amjad(13)

IoT Based Smart Energy Meter using Raspberry Pi and Arduino por Bilal Amjad
IoT Based Smart Energy Meter using Raspberry Pi and Arduino IoT Based Smart Energy Meter using Raspberry Pi and Arduino
IoT Based Smart Energy Meter using Raspberry Pi and Arduino
Bilal Amjad1.8K visualizações
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink) por Bilal Amjad
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink) Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink)
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink)
Bilal Amjad836 visualizações
Solar Radiation monthly prediction and forecasting using Machine Learning tec... por Bilal Amjad
Solar Radiation monthly prediction and forecasting using Machine Learning tec...Solar Radiation monthly prediction and forecasting using Machine Learning tec...
Solar Radiation monthly prediction and forecasting using Machine Learning tec...
Bilal Amjad147 visualizações
Big Data in Smart Grid por Bilal Amjad
Big Data in Smart GridBig Data in Smart Grid
Big Data in Smart Grid
Bilal Amjad149 visualizações
Flexibility of Power System (Sources of flexibility & flexibility markets) por Bilal Amjad
Flexibility of Power System (Sources of flexibility & flexibility markets)Flexibility of Power System (Sources of flexibility & flexibility markets)
Flexibility of Power System (Sources of flexibility & flexibility markets)
Bilal Amjad341 visualizações
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ... por Bilal Amjad
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Bilal Amjad745 visualizações
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ... por Bilal Amjad
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
Bilal Amjad2.7K visualizações
bubble sorting of an array in 8086 assembly language por Bilal Amjad
bubble sorting of an array in 8086 assembly languagebubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly language
Bilal Amjad21.6K visualizações
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL... por Bilal Amjad
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
Bilal Amjad1K visualizações
Limit of complex number por Bilal Amjad
Limit of complex numberLimit of complex number
Limit of complex number
Bilal Amjad4.3K visualizações
simple combinational lock por Bilal Amjad
simple combinational locksimple combinational lock
simple combinational lock
Bilal Amjad3.1K visualizações
4-bit camparator por Bilal Amjad
4-bit camparator4-bit camparator
4-bit camparator
Bilal Amjad1.2K visualizações
Orthogonal trajectories por Bilal Amjad
Orthogonal trajectoriesOrthogonal trajectories
Orthogonal trajectories
Bilal Amjad5K visualizações

Último

9_DVD_Dynamic_logic_circuits.pdf por
9_DVD_Dynamic_logic_circuits.pdf9_DVD_Dynamic_logic_circuits.pdf
9_DVD_Dynamic_logic_circuits.pdfUsha Mehta
21 visualizações32 slides
What is Whirling Hygrometer.pdf por
What is Whirling Hygrometer.pdfWhat is Whirling Hygrometer.pdf
What is Whirling Hygrometer.pdfIIT KHARAGPUR
11 visualizações3 slides
Thermal aware task assignment for multicore processors using genetic algorithm por
Thermal aware task assignment for multicore processors using genetic algorithm Thermal aware task assignment for multicore processors using genetic algorithm
Thermal aware task assignment for multicore processors using genetic algorithm IJECEIAES
29 visualizações12 slides
How I learned to stop worrying and love the dark silicon apocalypse.pdf por
How I learned to stop worrying and love the dark silicon apocalypse.pdfHow I learned to stop worrying and love the dark silicon apocalypse.pdf
How I learned to stop worrying and love the dark silicon apocalypse.pdfTomasz Kowalczewski
23 visualizações66 slides
NEW SUPPLIERS SUPPLIES (copie).pdf por
NEW SUPPLIERS SUPPLIES (copie).pdfNEW SUPPLIERS SUPPLIES (copie).pdf
NEW SUPPLIERS SUPPLIES (copie).pdfgeorgesradjou
7 visualizações30 slides
Extensions of Time - Contract Management por
Extensions of Time - Contract ManagementExtensions of Time - Contract Management
Extensions of Time - Contract Managementbrainquisitive
15 visualizações18 slides

Último(20)

9_DVD_Dynamic_logic_circuits.pdf por Usha Mehta
9_DVD_Dynamic_logic_circuits.pdf9_DVD_Dynamic_logic_circuits.pdf
9_DVD_Dynamic_logic_circuits.pdf
Usha Mehta21 visualizações
What is Whirling Hygrometer.pdf por IIT KHARAGPUR
What is Whirling Hygrometer.pdfWhat is Whirling Hygrometer.pdf
What is Whirling Hygrometer.pdf
IIT KHARAGPUR 11 visualizações
Thermal aware task assignment for multicore processors using genetic algorithm por IJECEIAES
Thermal aware task assignment for multicore processors using genetic algorithm Thermal aware task assignment for multicore processors using genetic algorithm
Thermal aware task assignment for multicore processors using genetic algorithm
IJECEIAES29 visualizações
How I learned to stop worrying and love the dark silicon apocalypse.pdf por Tomasz Kowalczewski
How I learned to stop worrying and love the dark silicon apocalypse.pdfHow I learned to stop worrying and love the dark silicon apocalypse.pdf
How I learned to stop worrying and love the dark silicon apocalypse.pdf
Tomasz Kowalczewski23 visualizações
NEW SUPPLIERS SUPPLIES (copie).pdf por georgesradjou
NEW SUPPLIERS SUPPLIES (copie).pdfNEW SUPPLIERS SUPPLIES (copie).pdf
NEW SUPPLIERS SUPPLIES (copie).pdf
georgesradjou7 visualizações
Extensions of Time - Contract Management por brainquisitive
Extensions of Time - Contract ManagementExtensions of Time - Contract Management
Extensions of Time - Contract Management
brainquisitive15 visualizações
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,... por AakashShakya12
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...
AakashShakya1245 visualizações
Design and analysis of a new undergraduate Computer Engineering degree – a me... por WaelBadawy6
Design and analysis of a new undergraduate Computer Engineering degree – a me...Design and analysis of a new undergraduate Computer Engineering degree – a me...
Design and analysis of a new undergraduate Computer Engineering degree – a me...
WaelBadawy652 visualizações
Art of Writing Research article slide share.pptx por sureshc91
Art of Writing Research article slide share.pptxArt of Writing Research article slide share.pptx
Art of Writing Research article slide share.pptx
sureshc9114 visualizações
SWM L1-L14_drhasan (Part 1).pdf por MahmudHasan747870
SWM L1-L14_drhasan (Part 1).pdfSWM L1-L14_drhasan (Part 1).pdf
SWM L1-L14_drhasan (Part 1).pdf
MahmudHasan74787048 visualizações
SPICE PARK DEC2023 (6,625 SPICE Models) por Tsuyoshi Horigome
SPICE PARK DEC2023 (6,625 SPICE Models) SPICE PARK DEC2023 (6,625 SPICE Models)
SPICE PARK DEC2023 (6,625 SPICE Models)
Tsuyoshi Horigome14 visualizações
Machine Element II Course outline.pdf por odatadese1
Machine Element II Course outline.pdfMachine Element II Course outline.pdf
Machine Element II Course outline.pdf
odatadese16 visualizações
Object Oriented Programming with JAVA por Demian Antony D'Mello
Object Oriented Programming with JAVAObject Oriented Programming with JAVA
Object Oriented Programming with JAVA
Demian Antony D'Mello64 visualizações
SNMPx por Amatullahbutt
SNMPxSNMPx
SNMPx
Amatullahbutt12 visualizações
FLOW IN PIPES NOTES.pdf por Dearest Arhelo
FLOW IN PIPES NOTES.pdfFLOW IN PIPES NOTES.pdf
FLOW IN PIPES NOTES.pdf
Dearest Arhelo90 visualizações
13_DVD_Latch-up_prevention.pdf por Usha Mehta
13_DVD_Latch-up_prevention.pdf13_DVD_Latch-up_prevention.pdf
13_DVD_Latch-up_prevention.pdf
Usha Mehta9 visualizações

Binary and hex input/output (in 8086 assembuly langyage)

  • 4. Group Members  Abdul Qayum  Imran Khan  Adnan Murtaza  Usman Mahmood  Ahmad Ali  M.Shebaz Shreef
  • 5. Binary input: For binary Input, we assume a program reads In a binary number from the keyboard, followed by a carriage return. The number actually Is a character string of O's and l's. As each character Is entered, we need to convert it to a bit value, and collect the bits in a register.
  • 6. Clear BX /* BX will hold binary value */ Input a character /* '0' or '1' */ WHILE character <> CR DO Convert character to binary value Left shift BX Insert value into 1sb of BX Input a character END_WHILE
  • 7. Clear BX BX Input character '1', convert to 1 AND AL,OFH Left Shift BX CF BX Insert value into lsb BX Input character ‘1' , convert to 1 AND AL,OFH Left shift BX CF BX Insert value into lsb BX 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
  • 8. Input character '0' convert to o AND AL,OFH Left shift BX CF BX Insert value into lsb BX = 0000 0000 0000 0110 BX contains 110b The algorithm assumes (1) input characters are either "O", “1", or CR, and (2) at most 16 binary digits are input.AS a new digit Is Input, the previous bits in BX must be shifted to the left to make room; then an OR operation can be used to insert the new bit into BX. 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 00
  • 9. XOR BX, BX ; clear BX MOV AH, 1 ;input char function INT 21H ;read a character WHILE_: CMP AL, ODH ;CR? JE END_WHILE ;yes, done AND AL, OFH ;no convert to binary Value SHL BX, 1 ;make room for new value OR BL,AL ;put value into BX INT 21H ;read a character JMP WHILE_ ;loop back END_WHILE:
  • 10. Algorithm for Binary Output: FOR 16 times DO Rotate left BX /* BX holds output value, put msb into CF */ IF CF = 1 THEN output ‘1’ ELSE output ‘0’ END_IF, END_FOR
  • 11. Mov CX,16 Top: ROL BX,1 JNC Next Mov AH,2 Mov DL,1 JMP Ali Next: Mov DL,2 Mov DL,0 Ali: Int 21H Int Top loop Top
  • 12. Hex input consists of digits ("0" to "9") and letters ("A" to "F”) followed by a carriage return. For simplicity, we assume that (1) only uppercase letters are used, and (2) the user inputs no more than four hex characters. The process of converting characters to binary values Is more Involved than it was for binary input. BX must be shifted four times to make room for a hex value.
  • 13. Clear BX /* BX will hold input value */ input hex character WHILE character <> CR DO convert character to binary value left shift BX 4 times insert value into lower 4 bits of BX input a character END_WHlLE
  • 14. Clear BX BX Input '6', convert to 0110 Left, shift BX 4 times CF BX Insert value into lower 4 bits of BX BX Input 'A', convert to Ah = 1010 Left shift BX 4 times CF BX Insert value into lower 4 bits of BX BX 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 00 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0
  • 15. Input 'B', convert to 1011 Left shift BX 4 times CF BX Insert value into lower 4 bits of BX BX BX contains 06ABh. Here is the code: XOR BX,BX ;clear BX MOV CL,4 ;counter for 4 shifts MOV AH,1 ; input character function INT 21H ; input a character WHILE_: 0 0 0 0 0 1 1 0 1 0 1 0 0 0 0 00 0 0 0 0 0 1 1 0 1 0 1 0 1 0 1 1
  • 16. CMP AL,ODH ;CR? JE END WHILE ;yes, exit ;convert character to binary value AL, 39H ;a digit? CMP AL, 39H ;a digit? JG LETTER. ; no, a letter ; input is a digit AND AL,OFH ;convert digit to binary value JMP SHIFT ;go to insert in BX LETTER: SUB AL, 37H ;convert letter to binary value SHIFT: SHL BX, CL ;make room for new value
  • 17. ;insert value into BX CR BL, AL ;put vi!lue into low 4 bits ;of BX INT 21H ; input a character JMP WHILE_ ; loop until CR END_WHILE:
  • 18. BX contains 16 bits, which equal four hex digit values. To output the contents of BX, we start from the left and get hold of each digit, convert it to a hex character, and output it. Algorithm for Hex Output: FOR 4 times DO Move BH to DL /* BX holds output value *I Shift DL 4 times to the right IF DL < 10 THEN convert to character in '0' .. '9. ELSE convert to character in 'A' .. 'F‘ END_IF output character Rotate BX left 4 times END FOR
  • 19. BX = 4CA9h = 0100 1100 1010 1001 Move BH to DL DL = 0100 1100 Shift DL 4 times to the right DL = 0000 0100 convert to character and output DL = 0011 0100 = 34h = '4' Rotate BX left. 4 times BX = 1100 1010 1001 0100 Move BH to DL DL = 1100 1010 Shift DL 4 times t0 the right DL = 0000 1100
  • 20. Convert to character and output DL = 0100 0011 = 43h =‘C’ Rotate BX left 4 times BX = 1010 1001 0100 1100 Move BH to DL DL = 1010 1001 Shift DL 4 times to the right DL = 0000 1010 Convert, to character and output DL = 0100 0010 = 42h ='B' Rotate BX left"4 times BX = 1001 0100 1100 1010 Move BH to DL DL = 1001 0100 Shift DL 4 times to the right DL = 0000 1001 Convert to character and output DL = 0011 1001 =39h = '9' Rotate BX 4 times to the left BX = 0100 1100 1010 1001 = original contents