Re: Borland Turbo C 2.0 for Atari 68000 machines: ODD behavior

ckp@grebyn.com (Checkpoint Technologies)
Mon, 8 Apr 1991 13:33:07 GMT

          From comp.compilers

Related articles
Borland Turbo C 2.0 for Atari 68000 machines: ODD behavior carter@cs.wisc.edu (1991-04-06)
Re: Borland Turbo C 2.0 for Atari 68000 machines: ODD behavior ckp@grebyn.com (1991-04-08)
Re: Borland Turbo C 2.0 for Atari 68000 machines: ODD behavior albaugh@dms.UUCP (1991-04-09)
Re: Borland Turbo C 2.0 for Atari 68000 machines: ODD behavior pardo@june.cs.washington.edu (1991-04-12)
| List of all articles for this month |
Newsgroups: comp.compilers,comp.lang.c
From: ckp@grebyn.com (Checkpoint Technologies)
Summary: Skip this if you're not into 68Ks
Keywords: C, code,
Organization: Grebyn Timesharing
References: <1991Apr6.091013.26131@daffy.cs.wisc.edu>
Date: Mon, 8 Apr 1991 13:33:07 GMT

In article <1991Apr6.091013.26131@daffy.cs.wisc.edu> carter@cs.wisc.edu (Gregory Carter) writes:
> (unsigned int)(*((unsigned int *)0x00ff8e20L)) = 0x03;
> MOVE.W #$0003, $00ff8e20
>...
> (unsigned int)(*((unsigned int *)0xffff8e20L)) = 0x03;
> MOVE.W #$0003, $8e20
>
>This is obviously not correct.


This may not be obvious, but it *is* correct. The compiler is doing you a
favor.


The 68K has "absolute short" and "absolute long" addressing. Absolute
long means that a whole 32 bit absoluet address follows.


Absolute short means that only a 16 bit word follows, and it should be
*sign extended* to 32 bits before being used.


The value $8E20, when sign extended into a full 32 bit address becomes
$FFFF8E20. This is just what you asked for, and the compiler found a
briefer way to code it.
--
ckp@grebyn.com
[brychcy@informatik.tu-muenchen.dbp.de (Till Brychcy) also pointed this out.
-John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.