🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.lang.asm
Article #319

Re: Need some help here...

#319
From: Jussi Marttila
Date: Tue, 23 May 2000 00:00
101 lines
3878 bytes
That's easy, you have the ASSUME DS:Data, but that only tells the assembler
that you consider that as your data segment. In order to USE your data segment,
you have to put it's address to ds. Put this as the first code:

mov ax, DATA            ; Or the name of your data segment whatever it is.
mov ds, ax                   ; there.

It should, no it WILL work after this. (Of course you could use tiny model and
use only CS)

Jussi

"M.Thie" wrote:

> Hello....
>
> Sorry for multiposting this message, but I realy need some help...
>
> I'm a newbee to assembly, as you can see later on at the source. In that
> source I just try to write a textbuffer to screen without any DOS
> interrupts. Well, one char is not a problem, but a NULL terminated string
> is.
> I think the problem has something to do with the segments. I did create a
> data-segment and a code-segment, but strangely enough...  the code-segment
> isn't familiar with the data-segment.
> I tried putting the data within the data-segment into the code-segment and
> then it works. But I'd realy like to produce propper code.
> I'm using the A86 assembler and it compiles just fine, but...   Why doesn't
> it work???
>
> If anyone could help me...
> Thanks in advance.
>
> Martijn Thie
>
> ----- CODE BELOW -----
>
> DATA SEGMENT
>
>   text DB "This is a test!",00h
>
> DATA ENDS
>
> CODE SEGMENT
>
>   assume CS:CODE,DS:DATA
>
>   ;Set cursor pos.
>   mov  DH,00h  ;Row
>   mov  DL,00h  ;Column
>   mov  AH,02h   ;SetCur command
>   int  10h  ;Initiate
>
>   ;Write the text
>   lea  BX,text  ;Set the pointer to the text
>   call Write            ;Write the damn thing
>
>   ;Wait for keystroke
>   mov  AH,00h  ;Wait for keystroke command
>   int  16h  ;Initiate
>
>   ;End program
>   ret
>
> ;*******************************
> ;* Write command
> ;*******************************
> ;
> ;input:
> ;  BX = pointer to NULL terminated string
> ;
> ;output:
> ;
> ;uses:
> ;  AX, BX, CX, DX
>
> Write:
>   mov  AL,BYTE[BX]  ;Get char to print
>   push BX   ;Push pointer to stack
>   xor  BX,BX   ;Clear register
>   mov  CX,01h   ;Print char 1 time
>   mov  AH,0Ah   ;Write command
>   int  10h   ;Initiate
>
>   mov  AH,03h   ;Get cursor pos command
>   int  10h   ;Initiate
>   inc  DL   ;Next column
>   mov  AH,02h   ;Set cursor pos command
>   int  10h   ;Initiate
>
>   pop  BX   ;Get pointer from stack
>   inc  BX   ;Next char
>   cmp  BYTE[BX],00h  ;Check for end
>   jne  Write   ;Not the end, next char
>   ret
>
> CODE ENDS
>
>
 
Technical Details
Message-ID: <sijit441o113@corp.supernews.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <siip08ido1161@corp.supernews.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 110df7,3d80c1f0ef66ac3f
X-Google-Attributes: gid110df7,public
X-Google-Thread: 1125f6,3d80c1f0ef66ac3f
X-Google-Attributes: gid1125f6,public
X-Google-Thread: 114917,3d80c1f0ef66ac3f
X-Google-Attributes: gid114917,public
X-Google-Thread: 1093da,3d80c1f0ef66ac3f
X-Google-Attributes: gid1093da,public
X-Google-Thread: f7d8d,3d80c1f0ef66ac3f
X-Google-Attributes: gidf7d8d,public
X-Google-Thread: feaef,3d80c1f0ef66ac3f
X-Google-Attributes: gidfeaef,public
From: Jussi Marttila <Jussi.Marttila@iobox.com>
Subject: Re: Need some help here...
Date: 2000/05/23
Message-ID: <sijit441o113@corp.supernews.com>
X-Deja-AN: 626073847
Content-Transfer-Encoding: 7bit
Approved: ccrayne@pacific.net (comp.lang.asm.x86)
References: <siip08ido1161@corp.supernews.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: newsabuse@supernews.com
Organization: Sonera corp
X-Track: 1-1: 40   (peer crosschecked as: smtp.inet.fi [192.89.123.192])   id QQiqhu21928   for <comp-lang-asm-x86@moderators.isc.org>; Mon, 22 May 2000 18:31:49 GMT
MIME-Version: 1.0
Newsgroups: alt.lang.asm,alt.os.assembly,borland.public.tasm,comp.lang.asm,comp.lang.asm.x86,microsoft.public.masm