TASM error when i tried to compile this code

43 views Asked by At

I'm currently trying to convert assembly language to binary in Kali Linux for the first time, but I'm getting weird errors while writing the assembly language code correctly according to the book I have.

According to the book, after I translate the following code by tasm, I should use tlink software, but the tasm assembler gives an error.

STACKSG SEGMENT STACK `STACK`
    DW 32H DUP(0)
STACKSG ENDS

DATASG SEGMENT `DATA`
DATA1 DB 120
DATASG ENDS

CODESG SEGMENT `CODE`
    ASSUME SS:STACKSG, DS:DATASG, CS:CODESG
MAIN    PROC FAR
        MOV AX, DATASG
        MOV DS, AX
        MOV AX, 4C00H
        INT 21H

MAIN    ENDP
CODESG  ENDS
        END MAIN

and assembler error:

*Warning* hello.asm(1) ignoring unrecognized character ``'
**Error** hello.asm(1) junk at end of line, first unrecognized character is `S'
*Warning* hello.asm(1) ignoring unrecognized character ``'
*Warning* hello.asm(5) ignoring unrecognized character ``'
*Warning* hello.asm(5) ignoring unrecognized character ``'
*Warning* hello.asm(9) ignoring unrecognized character ``'
*Warning* hello.asm(9) ignoring unrecognized character ``'
**Error** hello.asm(12) undefined symbol `datasg' (first use)
**Error** hello.asm(12)  (Each undefined symbol is reported only once.)

According to the book that I have, everything should come out right and I should not think that the book is wrong.

The book teaches M-Assembly up to Penium series for personal computers. Is this smell different from x86-64 series? My PC is intel x86-64 Victus HP Laptop.

the full image of my Book's Example code : enter image description here

chatgpt AI corrected it like this, but it was useless and did not work and gave a new error.

STACKSG SEGMENT STACK
    DW 32 DUP(0)
STACKSG ENDS

DATASG SEGMENT
DATA1 DB 120
DATASG ENDS

CODESG SEGMENT
    ASSUME SS:STACKSG, DS:DATASG, CS:CODESG

MAIN PROC FAR
    MOV AX, DATASG
    MOV DS, AX
    MOV AX, 4C00H
    INT 21H
MAIN ENDP

CODESG ENDS
END MAIN

New error :

**Error** hello.asm(13) undefined symbol `datasg' (first use)
**Error** hello.asm(13)  (Each undefined symbol is reported only once.)
0

There are 0 answers