I have this assembly files who’s lines have been corrupt somehow,
There are explanations all around in quotes and I need to complete the function called:
findMaxNumAndSaveIt
;
; 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,0x72,0x73
block3: 0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B
Assembly – Course completion project
1 “Completeness” in the existing Assembly program
The program in the project knows how to get a table of pointers for data blocks in Flash, outPtrs, RAM – array of 3), and respectively, a table of pointers for addresses in (inPtrs (array of 3).
The program reads the address of the data from the table, and through it reaches the block of the data. Please note, all pointers are 11 bits.
The data blocks are all 8 bytes long.
It also reads the address in RAM where the final array will start, and from there the data will be copied from the block in the flash.
The existing plan needs to be supplemented / corrected / renovated so that everything goes through assembly, and that the data does move in the correct order to the places defined in RAM.
And through the routine you will encode (part 2) the maximum numbers in each block will be filled.
Pay attention to the comments in the program – there is a full name information that will help you decipher what should be in the code !!
| Page1
2 Routine writing findMaxNumAndSaveIt The input is the INDEX number of the same block of data (0, 1, or 2)
The output is to update the MaxNum array which will be set to 0x90 within the RAM with the highest number in the data block.
You must scan all the numbers in that block of data, and decide which number is the largest.
And keep it in an array at the appropriate entry for the block number.
For example: for block # 2 containing the numbers 2, 4, 1, 9, 9 will be written instead of the 2nd of the MaxNum array.
We provide professional writing services to help you score straight A’s by submitting custom written assignments that mirror your guidelines.
Get result-oriented writing and never worry about grades anymore. We follow the highest quality standards to make sure that you get perfect assignments.
Our writers have experience in dealing with papers of every educational level. You can surely rely on the expertise of our qualified professionals.
Your deadline is our threshold for success and we take it very seriously. We make sure you receive your papers before your predefined time.
Someone from our customer support team is always here to respond to your questions. So, hit us up if you have got any ambiguity or concern.
Sit back and relax while we help you out with writing your papers. We have an ultimate policy for keeping your personal and order-related details a secret.
We assure you that your document will be thoroughly checked for plagiarism and grammatical errors as we use highly authentic and licit sources.
Still reluctant about placing an order? Our 100% Moneyback Guarantee backs you up on rare occasions where you aren’t satisfied with the writing.
You don’t have to wait for an update for hours; you can track the progress of your order any time you want. We share the status after each step.
Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.
Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.
From brainstorming your paper's outline to perfecting its grammar, we perform every step carefully to make your paper worthy of A grade.
Hire your preferred writer anytime. Simply specify if you want your preferred expert to write your paper and we’ll make that happen.
Get an elaborate and authentic grammar check report with your work to have the grammar goodness sealed in your document.
You can purchase this feature if you want our writers to sum up your paper in the form of a concise and well-articulated summary.
You don’t have to worry about plagiarism anymore. Get a plagiarism report to certify the uniqueness of your work.
Join us for the best experience while seeking writing assistance in your college life. A good grade is all you need to boost up your academic excellence and we are all about it.
We create perfect papers according to the guidelines.
We seamlessly edit out errors from your papers.
We thoroughly read your final draft to identify errors.
Work with ultimate peace of mind because we ensure that your academic work is our responsibility and your grades are a top concern for us!
Dedication. Quality. Commitment. Punctuality
Here is what we have achieved so far. These numbers are evidence that we go the extra mile to make your college journey successful.
We have the most intuitive and minimalistic process so that you can easily place an order. Just follow a few steps to unlock success.
We understand your guidelines first before delivering any writing service. You can discuss your writing needs and we will have them evaluated by our dedicated team.
We write your papers in a standardized way. We complete your work in such a way that it turns out to be a perfect description of your guidelines.
We promise you excellent grades and academic excellence that you always longed for. Our writers stay in touch with you via email.