rusty@sdcc3.UUCP (Rusty Wright) (10/20/84)
i am trying to figure out how to write assembly language programs for
the ibm pc. what i want to do is put each module into a separate file.
for example here are 3 files, the first is the startup that gets called
by dos, the second is the global stack, and the third is the global
data.
what i'm having trouble with is using the ASSUME directive with
segments defined in other files. i either get complaints from the
linker about them being undefined or from the assembler about incorrect
usage. as you can see i've used EXTRN to say that they are elsewhere.
if i try to use PUBLIC on stackseg and dataseg in their respective
files i get complaints from the assembler.
can anybody shed any light on what i'm doing wrong? also any other
helpful comments and suggestions would be appreciated.
please reply directly as i don't read this newsgroup that often.
{ucbvax,ihnp4,hplabs}!sdcarl!rusty
::::::::::::::
start.asm
::::::::::::::
title start - dos runtime startup
extrn stackseg:far
extrn dataseg:far
extrn main:far
startseg segment para public 'code'
assume ss:stackseg ; already set by dos linker
assume cs:startseg
start proc far ; entry point from dos
mov ax, dataseg ; set up addressability to
mov ds, ax ; the data segment
assume ds:dataseg ; tell assembler what i just did
call main ; call user program
mov ax, 0 ; all ok
push ax ; arg for exit
call exit ; return to dos
start endp
startseg ends
end start
::::::::::::::
stack.asm
::::::::::::::
stackseg segment word stack 'stack'
dw 256 dup(0) ; stack area
stackseg ends
end
::::::::::::::
data.asm
::::::::::::::
dataseg segment byte public 'data'
; insert global data here
dataseg ends
end