How to use external data segment ? [MASM/TASM]

Hello everybody. I'm a ASM-noob and testing the EXTRN-directive and custom segments. My goal is to write a hello-world program - using int 21h,AH 09 - that stores the HelloWorld variable (and text) in an external segment.

Here's what I've come up with so far, but it doesn't work smoothly.
Main.asm
[code]Extrn SomeText:far

.MODEL SMALL
myStack Segment stack 'stack'
DB 100h DUP(?)
myStack EndS

myCode Segment public 'code'
Assume CS:myCode, SS:myStack,; DS:myData
Start:
Mov AX,myStack
Mov SS,AX

;Mov AX,myData
;Mov DS,AX

Mov DX, Offset SomeText
Mov AH,09h
Int 21h

Mov AX, 4C00h
Int 21h
myCode EndS
End Start[/code]
Sub.asm
[code]Public SomeText

.MODEL SMALL

myData Segment public 'data'
SomeText DB "I have added some text right here !$"
myData EndS

End[/code]
Here's the output:
[code]-

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories