I am just following the book from my university to run this simple code I found as an example for my coding practice. I am new to assembly language.
The problem is that I only know how to assemble in TASM with tasm <filename> tlink /t <filename>, then running the .COM file, based on the teachings of my professor. I would just like to know where I can assemble this code and make it work.
When assembling on DOSBox, TASM would generate an error of:
Cannot generate COM file: stack segment present
or what can I change in my code to assemble it with TASM and generate the .COM file?
TITLE MYPROG.ASM
DOSSEG
.MODEL SMALL
.STACK 0100h
.DATA
NEYM DB 08h, ?, 08h DUP ("$")
Q DB "What is your name? $"
A1 DB 0Ah, 0Dh, "What a nice name! $"
A2 DB 0Ah, 0Dh, "I'm glad to meet you! $"
.CODE
start:
MOV AX, @DATA
MOV DS, AX
MOV AH, 09h
MOV DX, OFFSET Q
INT 21H
MOV AH, 0Ah
MOV DX, OFFSET NEYM
INT 21H
MOV AH, 09H
MOV DX, OFFSET A1
INT 21H
MOV DX, OFFSET NEYM+2
INT 21
MOV DX, OFFSET A2
INT 21H
MOV AX, 4C00H
INT 21H
END start
I tried following this:
How to fix "error:cannot generate COM file, stack segment present"?
- removing the stack segment
- writing the
org 100h - replacing SMALL with TINY
and it gave me an error:
Cannot generate COM file: segment-relocatable items present
.com, you also need to removeMOV AX, @DATA/MOV DS, AX. A.comstarts with segments already set up for the "tiny" model, all the same. The source you have is for a.exe.