Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use Assembly Language (ASIDE and CUSP) Create a version of find biggest (see picture below) that supports processing of arrays of any base index (positive
Use Assembly Language (ASIDE and CUSP)
Create a version of "find biggest" (see picture below) that supports processing of arrays of any base index (positive or negative). Assume that the definition of the array is given by three values:
BASE - the base index;
NUM - the number of elements in the array;
ARR - the starting address of the array.
The program should load into memory at address $000.
Pascal Version of Find Biggest { Finds the biggest element of an array A of positive integers. This illustrates the ease of of array operations vith indexed addressing. ] AType ARRAY [O..N-1] OF INTEGER; A : AType; TYPE VAR BIG,I : INTEGER; BIG := -1; WHILE I BIG THEN BEGIN BIG: A[I]; END IF) END[WHILE) END CUSP Version of Find Biggest EQU e, $000 .EQU N,5 ; aize of array LDA STA LDX# 0 NEG 1 BIG ; BIG :=-1 ; 1 := 0 (XR is 1) JGE LDA+ CMA JLE STA ADX# JMP HLT DONE A BIG ENDIF BIG ; go to END WHILE : ACC := A[1] ; A[I]? BIG i go to END(IF BIGALI] ENDIF : LOOP go to WHILE DONE: NEG 1: WORD-1 BIG: STOP ; required to initialize BIG WORD 0 BIG WORD 17 WORD 5 WORD 1465 WORD 689 WORD 7 END ; 5 array elements Figure 5.5 Index Addressing Example: Find Biggest Pascal Version of Find Biggest { Finds the biggest element of an array A of positive integers. This illustrates the ease of of array operations vith indexed addressing. ] AType ARRAY [O..N-1] OF INTEGER; A : AType; TYPE VAR BIG,I : INTEGER; BIG := -1; WHILE I BIG THEN BEGIN BIG: A[I]; END IF) END[WHILE) END CUSP Version of Find Biggest EQU e, $000 .EQU N,5 ; aize of array LDA STA LDX# 0 NEG 1 BIG ; BIG :=-1 ; 1 := 0 (XR is 1) JGE LDA+ CMA JLE STA ADX# JMP HLT DONE A BIG ENDIF BIG ; go to END WHILE : ACC := A[1] ; A[I]? BIG i go to END(IF BIGALI] ENDIF : LOOP go to WHILE DONE: NEG 1: WORD-1 BIG: STOP ; required to initialize BIG WORD 0 BIG WORD 17 WORD 5 WORD 1465 WORD 689 WORD 7 END ; 5 array elements Figure 5.5 Index Addressing Example: Find BiggestStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started