Anyone Knowledgeable in Assembly Language? My Ass is Thoroughly Kicked.
0 replies, posted
I was tasked with making a program wherein you input 4 digits and it'd add them up. Then he wanted us to use a shift command to calculate the average... In class the command worked, at home? Not so much.
I'm using MASM as a compiler, When I start the MASM command I get to issues by the time it's done
[code]takehome.as(65): warning 14031: Operand types must match
takehome.as(73): warning 14031: Operand types must match
[/code]
I assumed this meant that the commands on lines 65 + 73 had to be equal, so I did just that to no avail.
When I go to do the link .obj command It goes
[code]Run File [~~~.exe] :
List File [NULL.MAP]:
Libraries [.LIB]: [/code]
I input Util.lib because that's what he told us to do. but it comes up as
[code]LINK : warning L4051: UTIL.LIB : cannot find library
Enter new file spec: [/code]
This I haven't gotten any clue as to what's the issue at hand. Upon hitting enter it pops up as
[code]PUTDEC in file(s):
TAKEHOME.OBJ(takehome.asm)
GETDEC in file(s):
These were 2 errors detected
[/code]
When I the program, it sort of just shits the bed. At any rate, if anyone here is a cryptologist and can help me the full code is
[code]
.MODEL SMALL
;.586
EXTRN GetDec:NEAR
EXTRN PutDec:NEAR
.STACK 100h
.DATA
P DW ?
Q DW ?
R DW ?
S DW ?
RESULT DW ?
Prompt1 DB 'Number one is? ','$'
Prompt2 DB 'Number two is? ','$'
Prompt3 DB 'Number three is? ','$'
Prompt4 DB 'Number four is? ','$'
Answer1 DB 'The total is: ','$'
Answer2 DB 'The average is: ','$'
Newline DB 10,13,'$'
.CODE
CALC PROC
mov ax, @DATA
mov ds, ax ; "Standard Boilerplate"
;Input Segment
mov dx, OFFSET Prompt1
mov ah, 9h
int 21h ; DOS Display Prompt1
call GetDec
mov P,AX; Moves AX into P
mov dx, OFFSET Prompt2
mov ah, 9h
int 21h ; DOS Display Prompt2
call GetDec
mov Q,AX; Moves AX into Q
mov dx, OFFSET Prompt3
mov ah, 9h
int 21h ; DOS Display Prompt3
call GetDec
mov R,AX; Moves AX into R
mov dx, OFFSET Prompt4
mov ah, 9h
int 21h ; DOS Display Prompt4
call GetDec
mov S,AX; Moves AX into S
;Process: computing the sum
mov AX, P
add AX, Q
mov DX, AX
add DX, R
mov AX, DX
add AX, S ;
mov Answer1, AX ; Adds it all up
;Output
mov dx, OFFSET Answer1
mov ah, 9h
int 21h
mov Ax, Answer1
call PutDec
mov dx, OFFSET Newline
mov ah, 9h
int 21h
mov al, 0
mov ah, 4ch
int 21h
CALC ENDP
END
[/code]
Sorry, you need to Log In to post a reply to this thread.