🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #3398

fardata segs in TASM/TC small model

#3398
From: egg
Date: Mon, 28 Sep 1992 15:42
72 lines
1740 bytes
Hi,

  I was wondering if someone could shed some light on a TASM/TC
  problem I am having. I am trying to set aside an initialized
  far data segment (to eventually contain a 64K data table) but I cannot
  get the variables in the fardata segment to initialize ie.
  the following asm and C source should print consecutively increasing
  integers starting from 0, but no matter what value I initialize "farvar"
  to, it always starts at the same nonsensical (and non zero) value.
  I'm currently using TC 2.0 and TASM 3.0.

  Anyone, please help!!!

  Themie Gouthas
  egg@dstos3.dsto.gov.au


-------------------------------------------------------------
.model small

   global _testseg  :proc
   global _test     :word

.data

   _test   dw  0


.fardata

   farvar  dw 0

.code

_testseg proc
        push  bp
        mov   bp,sp
        mov   ax,@fardata
        mov   es,ax


        inc   es:[farvar]
        mov   ax,es:[farvar]
        mov   [_test],ax


        pop   bp
        ret
_testgameseg  endp


        end

-------------------------------------------------------------

#include <stdio.h>
#include <conio.h>

extern unsigned int test;
extern void testseg();

void main(){
  int i,d;
  clrscr();
  do{
    testseg();
    gotoxy(10,10);
    printf("farvar = %u ",test);
  } while(getch()!='q');

}
Technical Details
Message-ID: <1992Sep28.094236.164654@dstos3.dsto.gov.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!yoyo.aarnet.edu.au!dstos3.dsto.gov.au!egg

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!yoyo.aarnet.edu.au!dstos3.dsto.gov.au!egg
From: egg@dstos3.dsto.gov.au
Newsgroups: comp.os.msdos.programmer
Subject: fardata segs in TASM/TC small model
Message-ID: <1992Sep28.094236.164654@dstos3.dsto.gov.au>
Date: 28 Sep 92 15:42:35 GMT
Organization: Defence Science and Technology Organisation
Lines: 72