SlideShare a Scribd company logo
1 of 10
the_proj_main.asm
;
; the_proj_main.asm
;
; Created: 23/12/2019 16:27:40
; Author : W7
;
;
.include "8def.inc"
.MACRO INITSTACK
ldi r16,LOW(RAMEND) ; initialize
out SPL,r16 ; stack pointer
ldi r16,HIGH(RAMEND); to RAMEND
out SPH,r16 ; "
.ENDMACRO
.def index_reg = r17
.def readValue_reg = r18
.def zero_reg = r19
.def temp_reg = r21
.def subr_param_1_reg = r24
.def subr_param_2_reg = r25
.equ BLOCK_SIZE =
.equ NUM_OF_BLOCKS = 3
;data
.dseg
.org 0x60
arrout1: .byte BLOCK_SIZE ; destination for data
.org 0x68
arrout2: .byte BLOCK_SIZE ; destination for data
.org 0x70
arrout3: .byte BLOCK_SIZE ; destination for data
.cseg
;code
start:
INITSTACK
ldi zero_reg,
;initialize index reg
ldi index_reg,0
main:
; set subr_param_1_reg to index_reg
mov subr_param_1_reg, index_reg
rcall setUpPointersAndReadBlock
; increment the index
inc index_reg
cpi index_reg, NUM_OF_BLOCKS+1
br end
rjmp main ; do while (index_reg < NUM_OF_BLOCKS) ....
end: rjmp end
;
; SUBROUTINE setUpPointersAndReadBlock
; Inputs: subr_param_1_reg = index to read/write from/to array
;
setUpPointersAndReadBlock:
push xL
; First read the RAM output Address
ldi zH, HIGH( )
ldi zL, LOW(outPtrs)
; subr_param_1_reg already contains the desired index
rcall setInArrayPtrRegs
; set Y to beginning of RAM array
yH,z+
yL,z+
; set Z to the base-address + offset in the FLASH input-array
of pointers
ldi zH, HIGH(inPtrs)
ldi zL, LOW(inPtrs)
rcall setInArrayPtrRegs
;
; save the ptr to the data block in xL & xH
lpm xH,z+
lpm xL,z+
; now move the address of the data block to Z
mov zH,
mov zL,
; set input param to BLOCK_SIZE and call the subroutine
readOneBlock
subr_param_1_reg, BLOCK_SIZE
rcall readOneBlock
pop xL
pop xH
pop yL
pop yH
pop zL
pop zH
ret
;
; SUBROUTINE readOneBlock - from Flash
; Inputs: zH & zL = base address of input array in FLASH
; yH & yL = base address of output array in RAM
;
readOneBlock:
push readValue_reg
push index_reg
mov index_reg,subr_param_1_reg
; copy each byte in the data from the FLASH data block to
the RAM data block
loop3: readValue_reg,Z+
y+,readValue_reg
dec index_reg
brne loop3
ret
;
; SUBROUTINE setInArrayPtrRegs - sets up the input Z pointer
reg to arrin base-address (to read from flash)
;
; inputs: zH & zL = base address of the input array in flash
; subr_param_1_reg = index to read/write from/to array
; output: zH & zL = address of the requested entry in the array
with address adjusted to byte-based (like RAM)
setInArrayPtrRegs:
; use index to access next byte to be copied
add zL,subr_param_1_reg
zH,zero_reg
; fix offset for address in FLASH (words)
zL
rol zH ; *2
ret
; Finds the highest value in all the bytes in the current block
; and saves the value in the array MaxNum located at address 90
in the RAM
; Input: subr_param_1_reg = index to array blocks and to
MaxNum array
findMaxNumAndSaveIt:
ret
.org 0x80
outPtrs: .db 0x0, 0x70, 0x0, 0x68, 0x0, 0x60 ; target in RAM
for each data block
inPtrs: .db 0x1, 0xC, 0x1, 0x14, 0x1, 0x1C ; source in
FLASH for each data block
; Data Blocks with their data
block1: 0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B
block2: 0x6C,0x6D,0x6E,0x6F,0x70,0x71,0 x72,0x73
block3: 0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B
__MACOSX/._the_proj_main.asm

More Related Content

What's hot

Taller practico emu8086_galarraga
Taller practico emu8086_galarragaTaller practico emu8086_galarraga
Taller practico emu8086_galarragaFabricio Galárraga
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about CYi-Hsiu Hsu
 
Code GPU with CUDA - Applying optimization techniques
Code GPU with CUDA - Applying optimization techniquesCode GPU with CUDA - Applying optimization techniques
Code GPU with CUDA - Applying optimization techniquesMarina Kolpakova
 
Distributed Computing Patterns in R
Distributed Computing Patterns in RDistributed Computing Patterns in R
Distributed Computing Patterns in Rarmstrtw
 
Exploring the x64
Exploring the x64Exploring the x64
Exploring the x64FFRI, Inc.
 
Php7 hashtable
Php7 hashtablePhp7 hashtable
Php7 hashtable桐 王
 

What's hot (8)

Taller practico emu8086_galarraga
Taller practico emu8086_galarragaTaller practico emu8086_galarraga
Taller practico emu8086_galarraga
 
Practical notes
Practical notesPractical notes
Practical notes
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about C
 
Assembly language part I
Assembly language part IAssembly language part I
Assembly language part I
 
Code GPU with CUDA - Applying optimization techniques
Code GPU with CUDA - Applying optimization techniquesCode GPU with CUDA - Applying optimization techniques
Code GPU with CUDA - Applying optimization techniques
 
Distributed Computing Patterns in R
Distributed Computing Patterns in RDistributed Computing Patterns in R
Distributed Computing Patterns in R
 
Exploring the x64
Exploring the x64Exploring the x64
Exploring the x64
 
Php7 hashtable
Php7 hashtablePhp7 hashtable
Php7 hashtable
 

Similar to The proj main.asm;; the_proj_main.asm;; created 231

Hooking signals and dumping the callstack
Hooking signals and dumping the callstackHooking signals and dumping the callstack
Hooking signals and dumping the callstackThierry Gayet
 
Stack and subroutine
Stack and subroutineStack and subroutine
Stack and subroutineAshim Saha
 
Unit 4
Unit 4Unit 4
Unit 4siddr
 
code-nodemcu.docx
code-nodemcu.docxcode-nodemcu.docx
code-nodemcu.docxLTinTun
 
This code works only for palindrome If NOT a palindrome the.pdf
This code works only for palindrome If NOT a palindrome the.pdfThis code works only for palindrome If NOT a palindrome the.pdf
This code works only for palindrome If NOT a palindrome the.pdfadislifestyle
 
Microcontroller directives
Microcontroller directivesMicrocontroller directives
Microcontroller directivesManoj Harsule
 
Shellcodes for ARM: Your Pills Don't Work on Me, x86
Shellcodes for ARM: Your Pills Don't Work on Me, x86Shellcodes for ARM: Your Pills Don't Work on Me, x86
Shellcodes for ARM: Your Pills Don't Work on Me, x86Svetlana Gaivoronski
 
Rpg Pointers And User Space
Rpg Pointers And User SpaceRpg Pointers And User Space
Rpg Pointers And User Spaceramanjosan
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction setStefan Oprea
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorialhughpearse
 
Code only works for is NOT a palindrome radar reports NO.pdf
Code only works for is NOT a palindrome radar reports NO.pdfCode only works for is NOT a palindrome radar reports NO.pdf
Code only works for is NOT a palindrome radar reports NO.pdfaggarwalcollection1
 
07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W mattersAlexandre Moneger
 

Similar to The proj main.asm;; the_proj_main.asm;; created 231 (20)

Hd7
Hd7Hd7
Hd7
 
Hooking signals and dumping the callstack
Hooking signals and dumping the callstackHooking signals and dumping the callstack
Hooking signals and dumping the callstack
 
Ragel talk
Ragel talkRagel talk
Ragel talk
 
A Close Look at ARM Code Size
A Close Look at ARM Code SizeA Close Look at ARM Code Size
A Close Look at ARM Code Size
 
Stack and subroutine
Stack and subroutineStack and subroutine
Stack and subroutine
 
X86 assembly nasm syntax
X86 assembly nasm syntaxX86 assembly nasm syntax
X86 assembly nasm syntax
 
Unit 4
Unit 4Unit 4
Unit 4
 
FINISHED_CODE
FINISHED_CODEFINISHED_CODE
FINISHED_CODE
 
code-nodemcu.docx
code-nodemcu.docxcode-nodemcu.docx
code-nodemcu.docx
 
This code works only for palindrome If NOT a palindrome the.pdf
This code works only for palindrome If NOT a palindrome the.pdfThis code works only for palindrome If NOT a palindrome the.pdf
This code works only for palindrome If NOT a palindrome the.pdf
 
Microcontroller directives
Microcontroller directivesMicrocontroller directives
Microcontroller directives
 
Shellcodes for ARM: Your Pills Don't Work on Me, x86
Shellcodes for ARM: Your Pills Don't Work on Me, x86Shellcodes for ARM: Your Pills Don't Work on Me, x86
Shellcodes for ARM: Your Pills Don't Work on Me, x86
 
Rpg Pointers And User Space
Rpg Pointers And User SpaceRpg Pointers And User Space
Rpg Pointers And User Space
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorial
 
Code only works for is NOT a palindrome radar reports NO.pdf
Code only works for is NOT a palindrome radar reports NO.pdfCode only works for is NOT a palindrome radar reports NO.pdf
Code only works for is NOT a palindrome radar reports NO.pdf
 
Embedded C programming session10
Embedded C programming  session10Embedded C programming  session10
Embedded C programming session10
 
07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters
 
C programming session10
C programming  session10C programming  session10
C programming session10
 

More from ojas18

Volume 39 n um ber 2a pril 2017pages i l6 l3 ld o iio .i
Volume 39 n um ber 2a pril 2017pages i l6   l3 ld o iio .iVolume 39 n um ber 2a pril 2017pages i l6   l3 ld o iio .i
Volume 39 n um ber 2a pril 2017pages i l6 l3 ld o iio .iojas18
 
Vol.(0123456789)1 3 journal of business ethics (2019) 160
Vol.(0123456789)1 3 journal of business ethics (2019) 160Vol.(0123456789)1 3 journal of business ethics (2019) 160
Vol.(0123456789)1 3 journal of business ethics (2019) 160ojas18
 
Violence prevention programs an exploratory study of the ch
Violence prevention programs an exploratory study of the chViolence prevention programs an exploratory study of the ch
Violence prevention programs an exploratory study of the chojas18
 
Vii. concession and refutation (you may decide to divide this sect
Vii. concession and refutation (you may decide to divide this sectVii. concession and refutation (you may decide to divide this sect
Vii. concession and refutation (you may decide to divide this sectojas18
 
Using positive and negative numbers in context mathematical goals
Using positive and negative numbers in context mathematical goalsUsing positive and negative numbers in context mathematical goals
Using positive and negative numbers in context mathematical goalsojas18
 
W13 d1 answer the critical thinking question on p. 641. be sp
W13 d1 answer the critical thinking question on p. 641. be spW13 d1 answer the critical thinking question on p. 641. be sp
W13 d1 answer the critical thinking question on p. 641. be spojas18
 
Use a web search engine to search for local, state, and federal gove
Use a web search engine to search for local, state, and federal goveUse a web search engine to search for local, state, and federal gove
Use a web search engine to search for local, state, and federal goveojas18
 
Us history 1 research and writing assignment objectives· th
Us history 1 research and writing assignment objectives· thUs history 1 research and writing assignment objectives· th
Us history 1 research and writing assignment objectives· thojas18
 
Unit i power point presentationcompensation direct and indirect
Unit i power point presentationcompensation direct and indirect Unit i power point presentationcompensation direct and indirect
Unit i power point presentationcompensation direct and indirect ojas18
 
Unit 7 assignment research paper crj101 – introduction to crim
Unit 7 assignment research paper crj101 – introduction to crimUnit 7 assignment research paper crj101 – introduction to crim
Unit 7 assignment research paper crj101 – introduction to crimojas18
 
Unit 6 case discussion 1 requirements· all responses in the
Unit 6 case discussion 1 requirements· all responses in the Unit 6 case discussion 1 requirements· all responses in the
Unit 6 case discussion 1 requirements· all responses in the ojas18
 
Unit 5 assignment contract terms template law204 – business l
Unit 5 assignment contract terms template law204 – business lUnit 5 assignment contract terms template law204 – business l
Unit 5 assignment contract terms template law204 – business lojas18
 
Unit 5 wholefood .docxby blanca luz benavidez submissio
Unit 5   wholefood .docxby blanca luz benavidez submissioUnit 5   wholefood .docxby blanca luz benavidez submissio
Unit 5 wholefood .docxby blanca luz benavidez submissioojas18
 
Unit 2 understanding business ethics business ethics
Unit 2 understanding business ethics business ethicsUnit 2 understanding business ethics business ethics
Unit 2 understanding business ethics business ethicsojas18
 
Unit 1 assignment consists of seven parts. each part will provid
Unit 1 assignment consists of seven parts. each part will providUnit 1 assignment consists of seven parts. each part will provid
Unit 1 assignment consists of seven parts. each part will providojas18
 
Tropic of cancer these novels will give way, by and
Tropic of cancer these novels will give way, by andTropic of cancer these novels will give way, by and
Tropic of cancer these novels will give way, by andojas18
 
Trauma informed organizationswww.scanva.org a program
Trauma informed organizationswww.scanva.org a programTrauma informed organizationswww.scanva.org a program
Trauma informed organizationswww.scanva.org a programojas18
 
Topic effects of parental involvement on student success at the k
Topic effects of parental involvement on student success at the kTopic effects of parental involvement on student success at the k
Topic effects of parental involvement on student success at the kojas18
 
Topic   making head trauma safer the effectiveness of the nf ls i
Topic   making head trauma safer the effectiveness of the nf ls iTopic   making head trauma safer the effectiveness of the nf ls i
Topic   making head trauma safer the effectiveness of the nf ls iojas18
 
Today’s agenda chapter 6 cultureminute polltopic 1 cultur
Today’s agenda chapter 6 cultureminute polltopic 1 culturToday’s agenda chapter 6 cultureminute polltopic 1 cultur
Today’s agenda chapter 6 cultureminute polltopic 1 culturojas18
 

More from ojas18 (20)

Volume 39 n um ber 2a pril 2017pages i l6 l3 ld o iio .i
Volume 39 n um ber 2a pril 2017pages i l6   l3 ld o iio .iVolume 39 n um ber 2a pril 2017pages i l6   l3 ld o iio .i
Volume 39 n um ber 2a pril 2017pages i l6 l3 ld o iio .i
 
Vol.(0123456789)1 3 journal of business ethics (2019) 160
Vol.(0123456789)1 3 journal of business ethics (2019) 160Vol.(0123456789)1 3 journal of business ethics (2019) 160
Vol.(0123456789)1 3 journal of business ethics (2019) 160
 
Violence prevention programs an exploratory study of the ch
Violence prevention programs an exploratory study of the chViolence prevention programs an exploratory study of the ch
Violence prevention programs an exploratory study of the ch
 
Vii. concession and refutation (you may decide to divide this sect
Vii. concession and refutation (you may decide to divide this sectVii. concession and refutation (you may decide to divide this sect
Vii. concession and refutation (you may decide to divide this sect
 
Using positive and negative numbers in context mathematical goals
Using positive and negative numbers in context mathematical goalsUsing positive and negative numbers in context mathematical goals
Using positive and negative numbers in context mathematical goals
 
W13 d1 answer the critical thinking question on p. 641. be sp
W13 d1 answer the critical thinking question on p. 641. be spW13 d1 answer the critical thinking question on p. 641. be sp
W13 d1 answer the critical thinking question on p. 641. be sp
 
Use a web search engine to search for local, state, and federal gove
Use a web search engine to search for local, state, and federal goveUse a web search engine to search for local, state, and federal gove
Use a web search engine to search for local, state, and federal gove
 
Us history 1 research and writing assignment objectives· th
Us history 1 research and writing assignment objectives· thUs history 1 research and writing assignment objectives· th
Us history 1 research and writing assignment objectives· th
 
Unit i power point presentationcompensation direct and indirect
Unit i power point presentationcompensation direct and indirect Unit i power point presentationcompensation direct and indirect
Unit i power point presentationcompensation direct and indirect
 
Unit 7 assignment research paper crj101 – introduction to crim
Unit 7 assignment research paper crj101 – introduction to crimUnit 7 assignment research paper crj101 – introduction to crim
Unit 7 assignment research paper crj101 – introduction to crim
 
Unit 6 case discussion 1 requirements· all responses in the
Unit 6 case discussion 1 requirements· all responses in the Unit 6 case discussion 1 requirements· all responses in the
Unit 6 case discussion 1 requirements· all responses in the
 
Unit 5 assignment contract terms template law204 – business l
Unit 5 assignment contract terms template law204 – business lUnit 5 assignment contract terms template law204 – business l
Unit 5 assignment contract terms template law204 – business l
 
Unit 5 wholefood .docxby blanca luz benavidez submissio
Unit 5   wholefood .docxby blanca luz benavidez submissioUnit 5   wholefood .docxby blanca luz benavidez submissio
Unit 5 wholefood .docxby blanca luz benavidez submissio
 
Unit 2 understanding business ethics business ethics
Unit 2 understanding business ethics business ethicsUnit 2 understanding business ethics business ethics
Unit 2 understanding business ethics business ethics
 
Unit 1 assignment consists of seven parts. each part will provid
Unit 1 assignment consists of seven parts. each part will providUnit 1 assignment consists of seven parts. each part will provid
Unit 1 assignment consists of seven parts. each part will provid
 
Tropic of cancer these novels will give way, by and
Tropic of cancer these novels will give way, by andTropic of cancer these novels will give way, by and
Tropic of cancer these novels will give way, by and
 
Trauma informed organizationswww.scanva.org a program
Trauma informed organizationswww.scanva.org a programTrauma informed organizationswww.scanva.org a program
Trauma informed organizationswww.scanva.org a program
 
Topic effects of parental involvement on student success at the k
Topic effects of parental involvement on student success at the kTopic effects of parental involvement on student success at the k
Topic effects of parental involvement on student success at the k
 
Topic   making head trauma safer the effectiveness of the nf ls i
Topic   making head trauma safer the effectiveness of the nf ls iTopic   making head trauma safer the effectiveness of the nf ls i
Topic   making head trauma safer the effectiveness of the nf ls i
 
Today’s agenda chapter 6 cultureminute polltopic 1 cultur
Today’s agenda chapter 6 cultureminute polltopic 1 culturToday’s agenda chapter 6 cultureminute polltopic 1 cultur
Today’s agenda chapter 6 cultureminute polltopic 1 cultur
 

Recently uploaded

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 

Recently uploaded (20)

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 

The proj main.asm;; the_proj_main.asm;; created 231

  • 1. the_proj_main.asm ; ; the_proj_main.asm ; ; Created: 23/12/2019 16:27:40 ; Author : W7 ; ; .include "8def.inc" .MACRO INITSTACK ldi r16,LOW(RAMEND) ; initialize out SPL,r16 ; stack pointer ldi r16,HIGH(RAMEND); to RAMEND out SPH,r16 ; " .ENDMACRO
  • 2. .def index_reg = r17 .def readValue_reg = r18 .def zero_reg = r19 .def temp_reg = r21 .def subr_param_1_reg = r24 .def subr_param_2_reg = r25 .equ BLOCK_SIZE = .equ NUM_OF_BLOCKS = 3 ;data .dseg .org 0x60 arrout1: .byte BLOCK_SIZE ; destination for data .org 0x68 arrout2: .byte BLOCK_SIZE ; destination for data .org 0x70 arrout3: .byte BLOCK_SIZE ; destination for data
  • 3. .cseg ;code start: INITSTACK ldi zero_reg, ;initialize index reg ldi index_reg,0 main: ; set subr_param_1_reg to index_reg mov subr_param_1_reg, index_reg rcall setUpPointersAndReadBlock ; increment the index inc index_reg
  • 4. cpi index_reg, NUM_OF_BLOCKS+1 br end rjmp main ; do while (index_reg < NUM_OF_BLOCKS) .... end: rjmp end ; ; SUBROUTINE setUpPointersAndReadBlock ; Inputs: subr_param_1_reg = index to read/write from/to array ; setUpPointersAndReadBlock: push xL ; First read the RAM output Address ldi zH, HIGH( )
  • 5. ldi zL, LOW(outPtrs) ; subr_param_1_reg already contains the desired index rcall setInArrayPtrRegs ; set Y to beginning of RAM array yH,z+ yL,z+ ; set Z to the base-address + offset in the FLASH input-array of pointers ldi zH, HIGH(inPtrs) ldi zL, LOW(inPtrs) rcall setInArrayPtrRegs ; ; save the ptr to the data block in xL & xH lpm xH,z+ lpm xL,z+ ; now move the address of the data block to Z
  • 6. mov zH, mov zL, ; set input param to BLOCK_SIZE and call the subroutine readOneBlock subr_param_1_reg, BLOCK_SIZE rcall readOneBlock pop xL pop xH pop yL pop yH pop zL pop zH ret ;
  • 7. ; SUBROUTINE readOneBlock - from Flash ; Inputs: zH & zL = base address of input array in FLASH ; yH & yL = base address of output array in RAM ; readOneBlock: push readValue_reg push index_reg mov index_reg,subr_param_1_reg ; copy each byte in the data from the FLASH data block to the RAM data block loop3: readValue_reg,Z+ y+,readValue_reg dec index_reg brne loop3 ret
  • 8. ; ; SUBROUTINE setInArrayPtrRegs - sets up the input Z pointer reg to arrin base-address (to read from flash) ; ; inputs: zH & zL = base address of the input array in flash ; subr_param_1_reg = index to read/write from/to array ; output: zH & zL = address of the requested entry in the array with address adjusted to byte-based (like RAM) setInArrayPtrRegs: ; use index to access next byte to be copied add zL,subr_param_1_reg zH,zero_reg ; fix offset for address in FLASH (words) zL rol zH ; *2
  • 9. ret ; Finds the highest value in all the bytes in the current block ; and saves the value in the array MaxNum located at address 90 in the RAM ; Input: subr_param_1_reg = index to array blocks and to MaxNum array findMaxNumAndSaveIt: ret .org 0x80 outPtrs: .db 0x0, 0x70, 0x0, 0x68, 0x0, 0x60 ; target in RAM for each data block inPtrs: .db 0x1, 0xC, 0x1, 0x14, 0x1, 0x1C ; source in FLASH for each data block ; Data Blocks with their data block1: 0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B
  • 10. block2: 0x6C,0x6D,0x6E,0x6F,0x70,0x71,0 x72,0x73 block3: 0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B __MACOSX/._the_proj_main.asm