www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/19/23:36:59

From: peter AT agnes DOT dida DOT physik DOT uni-essen DOT de (Peter Gerwinski)
Newsgroups: comp.os.msdos.djgpp,comp.os.msdos.djgpp
Subject: Re: Graphics in Pascal
Followup-To: comp.os.msdos.djgpp,comp.os.msdos.djgpp
Date: 19 Jan 1997 23:52:08 GMT
Organization: Universitaet Essen, Germany
Lines: 64
Message-ID: <5buc38$44c@sun3.uni-essen.de>
References: <5bp9er$k73 AT acs1 DOT star DOT net>
Reply-To: peter DOT gerwinski AT uni-essen DOT de
NNTP-Posting-Host: agnes.dida.physik.uni-essen.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Brin wrote:
>   I wrote the following small program to try out some graphics
> routines [...]

There is already BGI2GRX, a "Graph" compatible Unit, based on 
GRX20 and BCC2GRX, written by Sven Hilscher.

> [...] Here is the program, any idea to
> what I am doing wrong!

The problem is that you are confusing some sizes of data types:

> {****************************************************************}
> Program Mode13h;
> type
>   {Define some 'terms'}
>   byte  = __byte__ integer;       {8 bit unsigned integer}
                                             signed

>   word  = __unsigned__ integer;   {16 bit unsigned integer}
                                     32

>   Long = __longlong__ integer;    {64 bit signed integer}
                   correct, but used in wrong context (see below)

If you correct them, your program runs fine.

Below are the correct sizes for Intel X86 platforms.  (I am
thinking about implementing the identifiers below into GPC's
standard vocabulary.)

Type
  ByteInt   = __byte__ Integer;       (* 8 bit signed Integer    *)
  Byte      = __unsigned__ ByteInt;   (* 8 bit unsigned Integer  *)
  ShortInt  = __short__ Integer;      (* 16 bit signed Integer   *)
  ShortWord = __unsigned__ ShortInt;  (* 16 bit unsigned Integer *)
  (* Integer = __long__ Integer *)    (* 32 bit signed Integer   *)
  Word      = __unsigned Integer;     (* 32 bit unsigned Integer *)
  LongInt   = __longlong__ Integer;   (* 64 bit signed Integer   *)
  LongWord  = __unsigned__ LongInt;

In addition, "unsigned long" in C has 32 bits, not 64:

> {routines taken from include/sys/farptr.h}
> {Puts a byte}
> procedure _farnspokeb(offset: Long ; value: byte);External;C;    
> {Gets a byte}               
> function _farnspeekb(offset: Long ; value: byte):byte;External;C;

                            (* Here's ^^^^^^^^^^^ another error ;*)

    Procedure FarNoSelectorPokeByte ( Offset: Word; value: Byte );
    AsmName '_farnspokeb';  (* ;-) *)
 
    Function FarNoSelectorPeekByte ( Offset: Word ): Byte;
    AsmName '_farnspeekb';  (* (-; *)

Hope this helps,

    Peter

      e-mail:  peter DOT gerwinski AT uni-essen DOT de
home address:  D\"usseldorfer Str. 35, 45145 Essen, Germany
         WWW:  http://agnes.dida.physik.uni-essen.de/~peter/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019