Dead Hackers Society
Other BBSes »
 
 

68k Inside

Sommarhack 2024

Silly Venture 2024 SE
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Texture U/V misunderstanding
Posted by: Orion_ Jan,24.2015-17:41 

I saw this page about texture mapping and I'm trying to implement the last routine in my 3D Engine:
http://s390174849.online.de/ray.tscc.de/fatmap.htm

In theory I understand it, but I can't make it work for a simple reason
If we have "UUuuVVvv" in a register (8.8 fixed point)
we do this tiny loop:
.loop:
move.l d3,d0 ; UUuuVVvv
lsr.w #8,d0 ; UUuu--VV
rol.l #8,d0 ; uu--VVUU
move.b (a1,d0.w),(a0)+ ; *screen++ = tex[U/V];
add.l d4,d3 ; tx += mtx; ty += mty;
dbra d1,.loop

The problem is that the add.l isn't working, here is what I get in steam debugger:
move.l #$00010001,d0 ; U = 1 V = 1
moveq #0,d1

add.l d0,d1 ; $00010001 ok
add.l d0,d1 ; $00020002 ok
add.l d0,d1 ; $00030003 ok

move.l #$0001FFFF,d0 ; U = 1 V = -1
moveq #0,d1

add.l d0,d1 ; $0001FFFF ok
add.l d0,d1 ; $0003FFFE wrong, should be $0002FFFE
add.l d0,d1 ; $0005FFFD wrong, should be $0003FFFD

so, what did I misunderstand ?








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

Topic Posted by  Date 
Texture U/V misunderstanding Orion_ Jan,24.2015-17:41
  Re: Texture U/V misunderstanding ggn Jan,24.2015-21:43
    Re: Texture U/V misunderstanding Orion_ Jan,25.2015-18:07
      Re: Texture U/V misunderstanding ggn Jan,25.2015-20:51
  Re: Texture U/V misunderstanding mikro Jan,26.2015-10:05
    Re: Texture U/V misunderstanding Orion_ Jan,26.2015-15:47
      Re: Texture U/V misunderstanding Orion_ Jan,26.2015-17:54
      Re: Texture U/V misunderstanding mikro Jan,27.2015-11:26


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