Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

CT60 and related things BBS
 
Re: quake4falcon060
Posted by: Kalms Sep,08.2006-11:20 

Mikro,

nice work (though I have not seen it running live myself -- no Falcon here)!

I should point out a few things with regards to FPU operations and immediate operands though:


1)

[I don't have any 68k GCC toolchain installed, so I'm guessing a bit in my statements below;
the guesses are based on experiences with various other assemblers.]

GAS probably doesn't look at the operand type of the FPU instruction to determine
what type of immediate operand you have.

I.e, the two instructions below will generate the following opcodes:

FMOVE.S #1234,FP0 F23C 4400 0000 04D2
FMOVE.L #1234,FP0 F23C 4000 0000 04D2
^^^^^^^^^-- immediate value operand

... But $4d2 when interpreted as a floating-point value is a really, really small value
(a denormal, very close to 0.0). What happens here is that the immediate operand to FMOVE.S
is handled as if it is the *raw binary representation* of the floating-point value.
I.e. if you would have specified $3f800000, then the FMOVE.S would load the value 1.0 into FP0.

To get around that, you write the operand as a decimal value:

FMOVE.S #1234.0,FP0 F23C 4400 449A 4000

You can consider this a bug or a feature. Devpac gives the following results:

FMOVE.S #1234.0,FP0 F23C 4400 449A 4000 <- value is interpreted as decimal
FMOVE.S #1234,FP0 F23C 4400 449A 4000 <- value is interpreted as decimal
FMOVE.S #$1234,FP0 F23C 4400 0000 1234 <- value is interpreted as integer

So Devpac is not very consistent either.

You may consider it a bug, but the people designing GAS would probably consider it a "feature".


2)

The immediate operand for F<op>.L #imm,FPn is a signed 32-bit value, and 65536*32768 is not
possible to represent in that format. (It is one higher than $7fffffff) To have that value
as an immediate operand, you need to encode it as an .S operand.
You can accomplish that by giving the exact raw binary representation of the value you're after:

65536*32768 = 2^31
1.0 = $3f800000
1.0 * 2^31 = $3f8
00000 + (31 << 23) = $4f000000

... so the instruction you want to encode is:

FMOVE.S #$4f000000,FPn


(It can actually be handy to be able to specify floating-point values in raw binary form, as
it always allows you to specify the precise value you're after.)


3)

F<op>.L will take a few cycles more than F<op>.S due to the FPU having to do integer<->float
format conversion at runtime.









[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
quake4falcon060 mikro Sep,07.2006-11:20
  Re: quake4falcon060 Peter Sep,07.2006-16:52
    Re: quake4falcon060 Coda Sep,07.2006-17:59
    Re: quake4falcon060 mikro Sep,07.2006-20:03
      Re: quake4falcon060 calimero Sep,08.2006-11:15
        Re: quake4falcon060 mikro Sep,08.2006-12:00
          Re: quake4falcon060 calimero Sep,08.2006-12:25
            Re: quake4falcon060 mikro Sep,08.2006-12:38
  Re: quake4falcon060 ggn Sep,07.2006-19:02
    Re: quake4falcon060 neo_rg Sep,07.2006-19:46
  Re: quake4falcon060 evil Sep,07.2006-20:35
    Re: quake4falcon060 CiH Sep,07.2006-21:28
    Re: quake4falcon060 mikro Sep,08.2006-09:44
      Re: quake4falcon060 mikro Sep,08.2006-09:50
  Re: quake4falcon060 GokMasE Sep,07.2006-23:56
  Re: quake4falcon060 Kalms Sep,08.2006-11:20
    Re: quake4falcon060 mikro Sep,08.2006-12:08
  Re: quake4falcon060 samf Sep,08.2006-17:41
    Re: quake4falcon060 mikro Sep,09.2006-00:01
      Re: quake4falcon060 samf Sep,09.2006-00:30
        Re: quake4falcon060 mikro Sep,09.2006-13:51
          Re: quake4falcon060 samf Sep,09.2006-16:09
      Re: quake4falcon060 Peter Sep,09.2006-09:18
        Old pak file support Patrice Mandin Sep,09.2006-09:53
          Re: Old pak file support mikro Sep,09.2006-13:50
          Re: Old pak file support vlg Sep,13.2006-17:03
            Re: Old pak file support mikro Sep,14.2006-12:37
              Re: Old pak file support vlg Sep,14.2006-14:18
                Re: Old pak file support Peter Sep,15.2006-07:21
                  Re: Old pak file support Creature XL Sep,15.2006-19:32
                    Re: Old pak file support Creature XL Sep,15.2006-19:34
                      Re: Old pak file support Patrice Mandin Sep,15.2006-23:12
                      ST RAM size Creature XL Sep,16.2006-11:16
                    Re: Old pak file support Peter Sep,16.2006-15:59
                      Let's play QUAKE :) Creature XL Sep,20.2006-00:40
      Re: quake4falcon060 Creature XL Sep,11.2006-20:50
      Re: quake4falcon060 Creature XL Sep,12.2006-01:23
        Re: quake4falcon060 Patrice Mandin Sep,12.2006-23:06
          Re: quake4falcon060 Creature XL Sep,13.2006-09:57
  Re: quake4falcon060 Xerus Sep,09.2006-04:39
    Re: quake4falcon060 Peter Sep,09.2006-09:19
      Re: quake4falcon060 mikro Sep,09.2006-13:48
        Re: quake4falcon060 Peter Sep,09.2006-16:10
    Re: quake4falcon060 Crature XL Sep,11.2006-23:53
    Re: quake4falcon060 Crature XL Sep,12.2006-00:46
  Re: quake4falcon060 ray Sep,09.2006-10:48
    Re: quake4falcon060 MacFalcon Sep,10.2006-15:57
      Re: quake4falcon060 Peter Sep,11.2006-07:39
  WORKING DATAFILES evil Sep,14.2006-18:00
    Re: WORKING DATAFILES mikro Sep,14.2006-21:57
      Re: WORKING DATAFILES vulgar Sep,17.2006-20:46
        Re: WORKING DATAFILES Saulot Sep,18.2006-09:20
        Re: WORKING DATAFILES Creature XL Sep,18.2006-16:46
          Re: WORKING DATAFILES mikro Sep,18.2006-17:31
            Re: WORKING DATAFILES Creature XL Sep,18.2006-18:05
              Re: WORKING DATAFILES vulgar Sep,19.2006-10:58
                Re: WORKING DATAFILES evil Sep,21.2006-09:08
                  Re: WORKING DATAFILES Creature XL Sep,21.2006-15:27
                    Re: WORKING DATAFILES evil Sep,21.2006-19:54


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson