🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.lang.asm
Article #316

Need some help here...

#316
From: M.Thie
Date: Mon, 22 May 2000 00:00
88 lines
3078 bytes
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: <siip08ido1161@corp.supernews.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1125f6,3d80c1f0ef66ac3f,start
X-Google-Attributes: gid1125f6,public
X-Google-Thread: 110df7,3d80c1f0ef66ac3f,start
X-Google-Attributes: gid110df7,public
X-Google-Thread: 1093da,3d80c1f0ef66ac3f,start
X-Google-Attributes: gid1093da,public
X-Google-Thread: feaef,3d80c1f0ef66ac3f,start
X-Google-Attributes: gidfeaef,public
X-Google-Thread: f7d8d,3d80c1f0ef66ac3f,start
X-Google-Attributes: gidf7d8d,public
X-Google-Thread: 114917,3d80c1f0ef66ac3f,start
X-Google-Attributes: gid114917,public
From: "M.Thie" <---.m.thie@hetnet.nl.--->
Subject: Need some help here...
Date: 2000/05/22
Message-ID: <siip08ido1161@corp.supernews.com>
X-Deja-AN: 625913938
Approved: ccrayne@pacific.net (comp.lang.asm.x86)
Organization: @Home Network
X-MSMail-Priority: Normal
X-Priority: 3
X-Track: 1-1: 40
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
Newsgroups: alt.lang.asm,alt.os.assembly,borland.public.tasm,comp.lang.asm,comp.lang.asm.x86,microsoft.public.masm
X-Complaints-To: newsabuse@supernews.com