Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
63 views
19 pages
Assembly 3
assembly
Uploaded by
rish menush
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Assembly 3 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
63 views
19 pages
Assembly 3
assembly
Uploaded by
rish menush
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Assembly 3 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 19
Search
Fullscreen
MIPS Memery - — Data Segment There ave three main types of memory 1s static 2. stack Dynamic 3, Heap Dynamic Stoic memory isthe simplest. aciit is defined when the program is assemble and allocated when the Program. begins execution. Dynamic memory is allcctted while the program is running and accessed by addvess offsets, This makes dynamic memory more difficule to access programe’ but much more useful. inva Flat memory model “amoFlat memory medel — ie ex He EE MIMO ——_— - ——0« 4404 000C [Keema dota- sacle ~ Pynomic alloc hen vsee Ake | OM Growp own A Growr ay i : duyromic allocstien __. Ox 1904 9000 - r ded.a. . a pn oo Psat. - Paco’ text raed cre) De OX BOHO 0000 —- | oases D¥ 0060 0000Flat memory model ° ox rete fftt allocation ' uses lhe N Grove oo ea tho gles oid ico nowi¢ allocation Ox 1904 nao E stotic dele ir C fined — ize) OX VOOT doo: be © Prtbegeom: dex i 5 Ctived ~ size) _ Peerued [T 9% 0000 O000 OX BOO . o000+ Memory consists of one byte ctored after another and, all bytes are equal + The MEPS programmer ceec a memery where the bytes are Stored as one bid array and the infex te the orray) being dhe byle addrecs. + The memory it addraccible to each by and,dees called byte addveas. soThe bite in MPa are organized 195 > argroup af single byte. > a group of tue bytes ¢ half word , > a group of fow bytes ft word a group of eight bytes + deubles word These groupe are not random in memory + Al) groups starts at 0¥0000; COO0’ and. then occur at regular intervals Single byte hal? word (0x 0000 0000 11 Ox C000 ecco 1 Ox 0000 o001 210% o0ce ce02 21 0x 0000 coo a Oxccce coo4 word double word 11 Ox 0000 coco \ Ox 0000 coe 0x 0000 0004 24 Ox 0000 coos 31 Ox0000 coos 3.Ox 0000 0016 Where the memory group storts is called a boundary + You cannot addrese a group of data exact ot the boundary for ‘that ime, J 0% 0000 C00C Ks mA a bomdary im double werd: ( STF fe I sage, adeblennd © 2) testatic data + gkatic data ia the data that t¢ defined when Ake program is assembled and allocated when the program atords te run. + Due to the fact thet it ie allocated once, the size and the locaton af the static data is Pixed end cannot be changed. static data is defined ucing the «data assembler directory. + A\\ memory allocated in the program a -data aegment ic static data + Stotic data segment of memory starting at address Ox 1000 C000 and continuing untill address 0x 1004 G000. Ox 10000000 - Ox 10040000 + When the assembler starts te execute it keeps track of the next address available in the data segment. + Tritally he value of the next available data im the data segment is set to 0x1000 acce. + As space is allocated in the data aesment the next available slot ia increased by the amount of space repuested + + Thic allows the assembler to keep track of where to store the next data item.eo Hehehe 0x 1001 C00 > -dote a: sword 0% 1234567 0% tot coor space 14 bt word On reDeaAye | \ ' © 14 the assembler found ‘data directory the address 40 Start placing data ig Ox 1601 COO + A word eH bytes of memory. So tre label @ prints ko a byle allocation af memory at address and extending Fo Ox 1001 coos The .epace directory sete a cide 14 tutes aavling at Ox 1001 200 and: ending at Ox 1001 O11 + There ie ne label on this part of date segment ubich wens the programmer must access it) directly through an address. + The next at label b onothes The’ memory could have been in the ner available byte werd of memery alle Hon placed at Ox 1001 col 0% 1001 C000 0 X1001 c002 2x 1001 0090 + © x 1001 cons oy 1001 a0r8 © x for otsee = Aeessing memory im MIPS —— FAL memery acess in MIPS ic done through same form ef a load or store data, Operetory t@baden erd9 Tt has tuo Pormets. Areal feamat + im this format an address is stored in Pe and an offset trem hat addyess stored jm the immediote vive, The value at Re t immedicte is stared inte Re, Format : dw Ry sTambdiate (Re) Meaning 2 Ry < memory [ Ry + Immediate ] B_Pseude operator Format ; tw Ras Label Meaning t Ry Memory C Label 3 Tronslation : tw Re + Ox 1001 e000 tw Py, offeet C Re) This allows dhe addrese of “the lahel to be stored ie Re and then Ahe Real \ood operator is called 40 the lesd value,[Be] operator (store word.) seal format Ain ahis format an eddress ia stored in Re and offset From thet addiess is stored in the immediote value. “he value of Ry is stored in memory ot Ret immediate Formal 1 80 Rye immediate heaning ¢ memory [Re + Immediate J <— Ry B_Pseuds operator Format $ Sw Res Label meaning 1 memory ( Rs t+Immediate | < Label Frenslatin : lw Ra - Ox 1001 oc00 sw Ras offset CRe) — Method and accessing memory There ove 4 method of addressing dala in MEPS. 1. addreasing by label a direct access 3, Register indirect acres be Register offset acces 1 Addressing by tabel Sometimes Ane oldress of 2 Nebel can be debine or @ voriable ia ike addess. Frown ond When a variable is stored Im dhe data seqment id can generally be address divectly using a labelsdext + global main sain t da 4205 prompt Jal prompting move $40 + 4ve #4 load constants arbre into register | Iw $45.0 lw tte ob lw base 4 coleulote y mult $to. $0. $80 mult to. sto, dte mult ty» #20, ¢te add 445, for ats addi 464. S40, 449 FF ctore the result from fea th y ow RSA ey A pied the eulpet ols memery dw fale y Jal print and Jal pind Value tb Exit program Jal exit, + dada at seed s bs sword 2 et sword 2 Yt sword o mpl: wascliz ‘Enter your Bateser” Prompd y + asciiz “* Enter asRegister diveet access Jy register direct access the vabes ore atored directly In Abe registers and 0 memory is not access at all + tent ta 4a. prompt Jal prompt tot more $20. ¢V0 load a@nstants asbsc into reyicter Lio bee i dee Li $tase H caleulate y veut dhe. Fee. tse al Pato, 4to + dee mult 4414 £505 $46 e add tte, tte, bey oda t 44s thos bea H print dhe outout for y la 4004 recut : move $21. $y + data prompt: +asciie “Enter your integer yesult 2 sasciiz Your vecula ja.”a Register indirect access The register mdéreci accese doce nod contains register that te bat contains The “address ww be used, tthe use im the coleulation fn memory of the value values “in the TH Ake -dato segment hes the numbering of shard at Ox100\0000 and variable ‘a address variables will be ot that stent input an integer WF lead @nstants lui Bte . oxtoo1 lui $45. 0 Chto) oddi deo. ate Ie Fae. octesd addi b4o, Ste. § Ww 44. 0 C tte) A caleulade result # Print vesute + data Ox 1001 000 Ox 1001 ccog a b © ex 1001 ooog a © * leet coety Register offees only change 7 load constants lu fhe , OC44) Ie dus, & C440) Ie gts, & Chto) ethers are came Addres: sane 0x 1001 oot Ox 1008 o100 0% 1905 o108 Ox 1008 0100 oy os o10d © x 100% o10e Ox tooe lof Ox 100% o1o4 access wate word werd double twerdFr. conto) strectue in Assembly Language Tee stuclures = sequences, branches ond loops. Bequences 3 that allow programs to execute chlements iw order ane after another. Branches 1 thar allow programs to jump other points in the program Loops : that allow programs to execute a fragment Cblock) af cede multiple times, = Simple if — + tf (num sod F Print CNumber ia positive") stent et greater tena + global main yt ans e : mai 522 iste iF Gum 20) * c wee Wwe tes num 9 8 « mum F245 beclean gewer 894 FEL y Fto. zero 10 ther die, then te se a then tars’ eke tino ihe cda beqe tts endif “fren la a0. gositiveNumber Wi tves + syscall 7 end if t Wo svete syacald Toque Ewch geil tosere santa umf stiordero EEE me . 22+ 0) a ee ¥ (Ger0d ER (xv, ° + lead Ae value 2 Ww tox agt $11, 440, #2400 sls bia, bto sa rem thous vhemer S42 eae a oe sa Ma Pas dee and 441, ber, 442 2? “ vege 441, endoit (Sw ee wth a << fea. dio.e = di athio mmove oe c mohi —~ziht ee) cee $to. 2 if (Ged BR (ane ©) A&Cxer) ) te tho. a fe ror ee vem 442, gto sn pete tee teat ye sii bts) he, ve od Hl. tis bes and $480. tty dag beg? so. Cane ‘lao canbe women mitten as \ popes — siti 43.10 ae rey)igmple iF... else — Pimoedt prind Co“ petitive number” due? print CF fegative number (+3 wert fw Btor% gt Btls fhe» zero bear. #4), else di yo. da $0, positive Mure ayscally bet tke Benet on, > b exit level Uke part of ween the whole code or branch breaks Vi #¥oe & _ “ 4 ait) anip some lines La $40. Negative bum iG SP ; and continue with eyacall - specified location exit t ike ele. exit Ui aves to syscall date Positive Num: sasciiz “Positive Number Negative bum ¢ saacl2 “7 wegative Rumber ™ seq Rye Rew he DP RAT REP Pdol elie Ayre ogt Ry, Rae Ra > ROrRE Prt clte Ayse sl pasts Pe > Rec Re Ral ele RareFox ha wrod? Prina © even”) ele 7 print Codd?) r a text bettors ee ate 441, #80 tcor div tose ae on Phi P40 or Br ee) te ie an beq2 btl. else la gac. msg! Vi geo. syscallaC Cx <0) Ml Gro) F print (“Marks should ties beteen @ and too") 7 dise i? Cxs=a0)F print Corde avd F else iP C >= 80) Z print C~Grode BVIT else C4 Cm 70) ¢ eke 4 Cx>260) print CO armde o7) F print CGrde DDE else Z print C “Grade sf "JF + ege > set grater thon equals age Rd Rs Ry dy fos sh $41, pte. dzero sti $42 5 b4e 5 100 or #4, bar, ate beqz FI, gradeA la 400, meg! Baye 4 syscall b exit graded: syei al, 440, 10 beqa $1, grade la hao may 2 i avo, Syscall b eid SrodeBes : Stade B : Sgei ar, ato, SO beqz fEI. gradee Ya a0, msg 2 Pode Ry then Ret else Ryso Weave s agen b ewe grade c+ ager $ti. Sto. 30 bee 441, graded lo fae, mag Kayes 4 ysel beni grote agei i tie, 60 beqe Ll, else la dao . man 6 Wty so syeent) be omit else + 1a 4a0+ vag 5 Wo fye st agacallWi bye, 10 5 syecal) weg! ¢ “fark Wee between O and ag at ** awade A” ~ @rade 8” * owede c” “ grode 2” “ a@mde ©” eter int Ls prompt C't endeger an integer while CT rea dz rina C% you entered = prompt Center an integer ta $20. prompt 5 prompt Trt 490, 4¥0 loop — login : sne 4ti- beqz la move 440. -1 BEL end_toop, $005 result fal, bso 3 printant la fa0., prompt J promps Sed reve b $805 bve loop = tegin 100" er 7) feel! er 71 to entre end—loep = li tye ste syscall pret Tot ¢ Woevestt ayscal
You might also like
Microprocessor and Microcontroller Notes
PDF
100% (1)
Microprocessor and Microcontroller Notes
52 pages
Computer Organization Practicals
PDF
33% (3)
Computer Organization Practicals
45 pages
25-ARM 7 Assembly Programming-22-03-2024
PDF
No ratings yet
25-ARM 7 Assembly Programming-22-03-2024
24 pages
Lecture 5
PDF
No ratings yet
Lecture 5
31 pages
Assembly #1
PDF
No ratings yet
Assembly #1
8 pages
MIPS Reference Data Card
PDF
No ratings yet
MIPS Reference Data Card
2 pages
7. COMS1015 Low Level Programming
PDF
No ratings yet
7. COMS1015 Low Level Programming
45 pages
MP ORAL
PDF
No ratings yet
MP ORAL
11 pages
lecture01-intro
PDF
No ratings yet
lecture01-intro
67 pages
Assembly
PDF
No ratings yet
Assembly
27 pages
Mips Data Notes
PDF
No ratings yet
Mips Data Notes
9 pages
chapter2_2
PDF
No ratings yet
chapter2_2
25 pages
Mips
PDF
No ratings yet
Mips
16 pages
Programming 8085 Up
PDF
No ratings yet
Programming 8085 Up
19 pages
Assembly: Arithmetic and Logic: Machine Programming
PDF
No ratings yet
Assembly: Arithmetic and Logic: Machine Programming
43 pages
Mipsref
PDF
No ratings yet
Mipsref
1 page
Instruction Format
PDF
No ratings yet
Instruction Format
29 pages
Lec378au05 05
PDF
No ratings yet
Lec378au05 05
13 pages
02 Machine+Organization+and+Assembly+Language
PDF
No ratings yet
02 Machine+Organization+and+Assembly+Language
20 pages
Ics312 - Nasm - Data - BSSPPT BUENOS
PDF
No ratings yet
Ics312 - Nasm - Data - BSSPPT BUENOS
43 pages
AL Basics
PDF
No ratings yet
AL Basics
27 pages
Simplified Instructional Computer
PDF
No ratings yet
Simplified Instructional Computer
27 pages
Microprocessor Lab One
PDF
No ratings yet
Microprocessor Lab One
11 pages
DCP Unit-2
PDF
No ratings yet
DCP Unit-2
22 pages
MIC Manual
PDF
No ratings yet
MIC Manual
47 pages
Integers Floating Point: N N S E
PDF
No ratings yet
Integers Floating Point: N N S E
4 pages
01 Lecture02
PDF
No ratings yet
01 Lecture02
78 pages
Common MIPS Instructions.: Op Funct RD Rs RT Imm Address Shamt
PDF
No ratings yet
Common MIPS Instructions.: Op Funct RD Rs RT Imm Address Shamt
2 pages
College of Computer Science: Chapter 2: Instruction Set Architecture (ISA) : Instruction Formats & MIPS Instructions
PDF
No ratings yet
College of Computer Science: Chapter 2: Instruction Set Architecture (ISA) : Instruction Formats & MIPS Instructions
25 pages
Lec18 Arch
PDF
No ratings yet
Lec18 Arch
55 pages
S4 EC Microprocessor Lab Manual
PDF
No ratings yet
S4 EC Microprocessor Lab Manual
30 pages
Lecture 4: MIPS Instruction Set: Today's Topics: MIPS Instructions Code Examples
PDF
No ratings yet
Lecture 4: MIPS Instruction Set: Today's Topics: MIPS Instructions Code Examples
21 pages
8051 Instruction Set: Facebooktwitterlinkedinredditpinterestshare
PDF
No ratings yet
8051 Instruction Set: Facebooktwitterlinkedinredditpinterestshare
13 pages
LAB4
PDF
No ratings yet
LAB4
3 pages
Session Plan: Assignment No.1
PDF
No ratings yet
Session Plan: Assignment No.1
11 pages
Some Samples of MIPS Assembly Language
PDF
No ratings yet
Some Samples of MIPS Assembly Language
39 pages
03 Mips
PDF
No ratings yet
03 Mips
27 pages
Assembly Notes
PDF
No ratings yet
Assembly Notes
18 pages
Addressing Mode General Meaning: Register
PDF
No ratings yet
Addressing Mode General Meaning: Register
27 pages
CS301 2.1 Lecture 4 CPU Operation
PDF
No ratings yet
CS301 2.1 Lecture 4 CPU Operation
6 pages
Intel Cheat Sheet
PDF
No ratings yet
Intel Cheat Sheet
8 pages
Computer Architecture Lab
PDF
No ratings yet
Computer Architecture Lab
23 pages
14 Linkers W
PDF
No ratings yet
14 Linkers W
38 pages
Micro 7
PDF
No ratings yet
Micro 7
79 pages
Chapter 3 - V2.0
PDF
No ratings yet
Chapter 3 - V2.0
7 pages
Table 1a: The Complete MSP430 Instruction Set of 27 Core Instructions
PDF
No ratings yet
Table 1a: The Complete MSP430 Instruction Set of 27 Core Instructions
9 pages
Instruction Encoding: - The ISA Defines
PDF
No ratings yet
Instruction Encoding: - The ISA Defines
25 pages
Chapter 2: 8051 Assembly Language Programming: - Microcontroller's
PDF
No ratings yet
Chapter 2: 8051 Assembly Language Programming: - Microcontroller's
19 pages
CMP 18
PDF
No ratings yet
CMP 18
46 pages
Assembly Language Programming: CPSC 252 Computer Organization Ellen Walker, Hiram College
PDF
No ratings yet
Assembly Language Programming: CPSC 252 Computer Organization Ellen Walker, Hiram College
64 pages
MIPS Assembly Tutorial
PDF
No ratings yet
MIPS Assembly Tutorial
31 pages
MIPS Assembly Tutorial
PDF
No ratings yet
MIPS Assembly Tutorial
31 pages
The MIPS Instruction-Set Architecture: © 2002 Edward F. Gehringer ECE 463/521 Lecture Notes, Fall 2002 1
PDF
No ratings yet
The MIPS Instruction-Set Architecture: © 2002 Edward F. Gehringer ECE 463/521 Lecture Notes, Fall 2002 1
8 pages
PS1
PDF
No ratings yet
PS1
20 pages
Coduri Mips PDF
PDF
No ratings yet
Coduri Mips PDF
2 pages
What S Inside An 8086
PDF
No ratings yet
What S Inside An 8086
29 pages