0% found this document useful (0 votes)
152 views3 pages

1.8086 Assembler Tutorial For Beginners (Part 1)

This document provides an introduction to 8086 assembler for beginners. It discusses what assembly language is and some basic concepts like the CPU, RAM, and system bus. It then describes the different types of registers in the 8086 CPU, including general purpose registers (AX, BX, CX, DX, SI, DI, BP, SP), segment registers (CS, DS, ES, SS), and special purpose registers (IP and flags register). It explains how the registers are used to form effective addresses to access memory locations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
152 views3 pages

1.8086 Assembler Tutorial For Beginners (Part 1)

This document provides an introduction to 8086 assembler for beginners. It discusses what assembly language is and some basic concepts like the CPU, RAM, and system bus. It then describes the different types of registers in the 8086 CPU, including general purpose registers (AX, BX, CX, DX, SI, DI, BP, SP), segment registers (CS, DS, ES, SS), and special purpose registers (IP and flags register). It explains how the registers are used to form effective addresses to access memory locations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

10/2/2016

8086AssemblerTutorialforBeginners(Part1)

8086Assembler
Thistutorialisintendedforthosewhoarenotfamiliarwithassembler
atall,orhaveaverydistantideaaboutit.Ofcourseifyouhave
knowledgeofsomeotherprogramminglanguage(Basic,C/C++,
Pascal...)thatmayhelpyoualot.
Butevenifyouarefamiliarwithassembler,itisstillagoodideato
lookthroughthisdocumentinordertostudyEmu8086syntax.
Itisassumedthatyouhavesomeknowledgeaboutnumber
representation(HEX/BIN),ifnotitishighlyrecommendedtostudy
NumberingSystemsTutorialbeforeyouproceed.

Whatisanassemblylanguage?
Assemblylanguageisalowlevelprogramminglanguage.Youneedto
getsomeknowledgeaboutcomputerstructureinordertounderstand
anything.ThesimplecomputermodelasIseeit:

Thesystembus(showninyellow)connectsthevariouscomponents
ofacomputer.
TheCPUistheheartofthecomputer,mostofcomputationsoccur
insidetheCPU.
RAMisaplacetowheretheprogramsareloadedinordertobe
executed.

InsidetheCPU

http://ce.kashanu.ac.ir/sabaghian/assembly/8086%20tutorial/8086%20Assembler%20Tutorial%20for%20Beginners%20(Part%201).htm

1/3

10/2/2016

8086AssemblerTutorialforBeginners(Part1)

GENERALPURPOSEREGISTERS
8086CPUhas8generalpurposeregisters,eachregisterhasitsown
name:
AXtheaccumulatorregister(dividedintoAH/AL).
BXthebaseaddressregister(dividedintoBH/BL).
CXthecountregister(dividedintoCH/CL).
DXthedataregister(dividedintoDH/DL).
SIsourceindexregister.
DIdestinationindexregister.
BPbasepointer.
SPstackpointer.
Despitethenameofaregister,it'stheprogrammerwhodetermines
theusageforeachgeneralpurposeregister.Themainpurposeofa
registeristokeepanumber(variable).Thesizeoftheaboveregisters
is16bit,it'ssomethinglike:0011000000111001b(inbinaryform),
or12345indecimal(human)form.
4generalpurposeregisters(AX,BX,CX,DX)aremadeoftwo
separate8bitregisters,forexampleifAX=0011000000111001b,
thenAH=00110000bandAL=00111001b.Therefore,whenyou
modifyanyofthe8bitregisters16bitregisterisalsoupdated,and
viceversa.Thesameisforother3registers,"H"isforhighand"L"is
forlowpart.
BecauseregistersarelocatedinsidetheCPU,theyaremuchfaster
thanmemory.Accessingamemorylocationrequirestheuseofa
systembus,soittakesmuchlonger.Accessingdatainaregister
usuallytakesnotime.Therefore,youshouldtrytokeepvariablesin
theregisters.Registersetsareverysmallandmostregistershave
specialpurposeswhichlimittheiruseasvariables,buttheyarestill
anexcellentplacetostoretemporarydataofcalculations.
http://ce.kashanu.ac.ir/sabaghian/assembly/8086%20tutorial/8086%20Assembler%20Tutorial%20for%20Beginners%20(Part%201).htm

2/3

10/2/2016

8086AssemblerTutorialforBeginners(Part1)

SEGMENTREGISTERS
CSpointsatthesegmentcontainingthecurrentprogram.
DSgenerallypointsatsegmentwherevariablesaredefined.
ESextrasegmentregister,it'suptoacodertodefineitsusage.
SSpointsatthesegmentcontainingthestack.
Althoughitispossibletostoreanydatainthesegmentregisters,this
isneveragoodidea.Thesegmentregistershaveaveryspecial
purposepointingataccessibleblocksofmemory.
Segmentregistersworktogetherwithgeneralpurposeregisterto
accessanymemoryvalue.Forexampleifwewouldliketoaccess
memoryatthephysicaladdress12345h(hexadecimal),weshould
settheDS=1230handSI=0045h.Thisisgood,sincethiswaywe
canaccessmuchmorememorythanwithasingleregisterthatis
limitedto16bitvalues.
CPUmakesacalculationofphysicaladdressbymultiplyingthe
segmentregisterby10handaddinggeneralpurposeregistertoit
(1230h*10h+45h=12345h):

Theaddressformedwith2registersiscalledaneffectiveaddress.
BydefaultBX,SIandDIregistersworkwithDSsegmentregister
BPandSPworkwithSSsegmentregister.
Othergeneralpurposeregisterscannotformaneffectiveaddress!
Also,althoughBXcanformaneffectiveaddress,BHandBLcannot!
SPECIALPURPOSEREGISTERS
IPtheinstructionpointer.
FlagsRegisterdeterminesthecurrentstateoftheprocessor.
IPregisteralwaysworkstogetherwithCSsegmentregisterandit
pointstocurrentlyexecutinginstruction.
FlagsRegisterismodifiedautomaticallybyCPUaftermathematical
operations,thisallowstodeterminethetypeoftheresult,andto
determineconditionstotransfercontroltootherpartsoftheprogram.
Generallyyoucannotaccesstheseregistersdirectly.

>>>NextPart>>>

http://ce.kashanu.ac.ir/sabaghian/assembly/8086%20tutorial/8086%20Assembler%20Tutorial%20for%20Beginners%20(Part%201).htm

3/3

You might also like