At school they gave me an exercise that goes like this: Write a program in assembly language to define three standard arrays Block 1 Block 2 Block 3 and where each array has 8 bytes of size data when block 3 will end with the results. The first digit must be taken from block 1 and decomposed into hundreds, tens and unit, part must also be taken from block 2 and decomposed into one hundred, ten and one unit of the sum whose digits are the largest will be placed in block 3 I wrote a code that does not work for me and I can not find a solution to the program:
GODEL EQU 8
DSEG SEGMENT
BLOCK1 DB 10H,20H,30H,40H,50H,60H,70H,80H
BLOCK2 DB 20H,30H,40H,50H,60H,70H,80H,90H
BLOCK3 DB GODEL DUP(?)
TOTAL1 DB ?
TOTAL2 DB ?
DSEG ENDS
SSEG SEGMENT STACK
DB 100H DUP(?)
SSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG,SS:SSEG
BEGIN: MOV AX,DSEG
MOV DS,AX
MOV CX,GODEL
MOV BL,10
MOV SI,0H
MOV TOTAL1,0H
MOV TOTAL2,0H
INCBLOCK1: MOV AL,BLOCK1[SI]
MOV TOTAL1,0H
MOV TOTAL2,0H
SUMBLOCK1BLOCK1:
MOV AH,0H
DIV BL
ADD TOTAL1,AH
SUB AL,0H
JNZ SUMBLOCK1
MOV AL,BLOCK2[SI]
SUMBLOCK2:
MOV AH,0H
DIV BL
ADD TOTAL2,AH
SUB AL,0H
JNZ SUMBLOCK2
JB TOTAL1,TOTAL2
JMP TOTBLOCK3
MOV BLOCK3[SI],TOTAL2
JMP SOF
TOTBLOCK3: MOV BLOCK3[SI],TOTAL1
SOF: INC SI
LOOP INCBLOCK1
CSEG ENDS
END BEGIN