Answered step by step
Verified Expert Solution
Question
1 Approved Answer
TITLE A 1 4 SPRED ( EXE ) Spreadsheet arithmetic . MODEL SMALL . STACK 6 4 ; - - - - - - -
TITLE ASPRED EXE Spreadsheet arithmetic
MODEL SMALL
STACK
;
DATA
SPRDTBL DW ;Data rows
DW
DW
DW
DW ;Total row
COUNT DB
COLS EQU ; cols X bytes
ROWS EQU ; rows X bytes
NOCOLS EQU ;No of columns
NOROWS EQU ;No of rows
COLTOT EQU NOCOLSNOROWS ; cols X rows X
;
CODE
AMAIN PROC FAR
MOV AX @data ;Initialize
MOV DSAX ; segment
MOV ESAX ; registers
CALL BHORZL ;Call horizontal addition
CALL CVERTL ;Call vertical addition
MOV AXCH ;End processing
INT H
AMAIN ENDP
; Add horizontal totals rows:
BHORZL PROC NEAR
PUSHA ;Preserve registers
MOV COUNT,NOROWS ;Count to add row cells
LEA DISPRDTBL ;Initialize table
LEA SISPRDTBL ; addresses
ADD SIROWS
B: MOV CXNOCOLS ;Count for columns
B: MOV AXDI ;Get amount from cell
ADD SIAX ;Add it to row total
ADD DI ;Next cell in row
LOOP B ;Repeat thru all cells in row ADD DI ;First cell in next row
ADD SICOLS ;Next row total
DEC COUNT ;Repeat thru all rows
JNZ B
POPA ;Restore registers
RET
BHORZL ENDP
; Add vertical totals columns:
CVERTL PROC NEAR
PUSHA ;Preserve registers
MOV COUNT,NOCOLS ;Count to add column cells
MOV BX
LEA SISPRDTBLCOLTOT ;Initialize column total
C: LEA DISPRDTBL ;Initialize top cell
ADD DIBX
MOV CXNOROWS ;Count for rows
C: MOV AXDI ;Get amount from cell
ADD SIAX ;Add it to column total
ADD DICOLS ;Next cell in column
LOOP C ;Repeat thru all cells in column
ADD BX ;Next cell in row
ADD SI ;Next column total
DEC COUNT ;Repeat thru all cols
JNZ C
POPA ;Restore registers
RET
CVERTL ENDP
END AMAIN
Revise the program: ASPRED EXE Spreadsheet arithmetic so that it adds the totals of
a at the right of each row vertically
b at the bottom of each column horizontally
c Display the spreadsheet on the screen.
Step 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