Quantcast
Channel: x86 Assembly - Programmers Heaven
Viewing all articles
Browse latest Browse all 152

need help assembling a program

$
0
0
I am learning assembly language from a book published in 1990 and I am having trouble getting the program to compile or create the appropriate executable. Below is a copy of the code exactly as it is written in the book. I am using MASM32 (Im not sure what version).

The book says I should type:
MASM MYPROG,,,,
In MSDOS. This doesnt work. But, I tried to compile it using the compile command from the MASM editor. I keep getting error messages. Does anyone have suggestions? I would like to write the programs in a low level languageI am interested in learning the fundamentals of the computer.

The program is as follows:

DATA SEGMENT
GOODBYE_MESSAGE DB 'CALCULATION COMPLETE',ODH,OAH,'$'
DATA ENDS

WORKING_STORAGE SEGMENT STACK
DW 100H DUP(?)
WORKING_STORAGE ENDS

CODE SEGMENT
ASSUME DS:DATA, SS:WORKING_STORAGE, CS:CODE
;ESTABLISHES DATA SEGMENT ADDRESSABILITY
PROG_START; MOV AX,DATA
MOV DS,AX
;READ A DIGIT
MOV AH,1
INT 21H
;CONVERT TO A NUMBER
SUB AL,30H
;SAVE IT IN DL
MOV DL,AL
;READ SECOND DIGIT
INT 21H
;CONVERT IT TO A NUMBER
SUB AL,30H
;ADD THE TWO
ADD DL,AL
;CONVERT TO A DIGIT
ADD DL,30H
;DISPLAY THE ANSWER
MOV AH,2
INT 21H
;AND A MESSAGE
MOV DX, OFFSET GOODBYE_MESSAGE
MOV AH,9
INT 21H
;RETURN TO DOS
MOV AX, 4C00H
INT 21H
CODE ENDS
END PROG_START



Viewing all articles
Browse latest Browse all 152

Trending Articles