Author Topic: 3d Construction Kit bug  (Read 1704 times)

0 Members and 1 Guest are viewing this topic.

Offline MiguelSky

  • 464 Plus
  • *****
  • Posts: 375
  • Country: es
    • CPCGamesCD
  • Liked: 210
  • Likes Given: 392
3d Construction Kit bug
« on: 21:52, 01 October 14 »
While working on 3DCK I noticed a bug: if a text is being wrote, when a fixed screen coordinate is reached cursor jumps several lines above and several chacters bakwards and continues the writing there. I looked for into the program some firmware character writing routine but I didn't find any. Any ideas?

I join a WinAPE .sna with an autowriting text programmed where you can see when third line is reached, text jumps to an above line and write there " KIT". You can move to refresh screen and see the effect.

http://www.amstrad.es/forum/download/file.php?id=2904


Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.335
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2264
  • Likes Given: 3478
Re: 3d Construction Kit bug
« Reply #1 on: 15:01, 03 October 14 »
Sorry I missed your post.

This seems weird, it looks like the screen has been scrolled, and the character drawing code doesn't work correctly.

You can reset the scroll with "mode 1" before.

Does this fix the problem?

EDIT: Looking at the snapshot. No that will not fix it.
« Last Edit: 15:19, 03 October 14 by arnoldemu »
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline MiguelSky

  • 464 Plus
  • *****
  • Posts: 375
  • Country: es
    • CPCGamesCD
  • Liked: 210
  • Likes Given: 392
Re: 3d Construction Kit bug
« Reply #2 on: 09:23, 04 October 14 »
Thanks for the reply, Kev :)

I tried to write in another screen coordinates and similar problem occurs in some points.



Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.335
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2264
  • Likes Given: 3478
Re: 3d Construction Kit bug
« Reply #3 on: 15:30, 04 October 14 »
I think I can see the bug now.

In the text writing code it does this:

Code: [Select]
ld a,(hl)
inc hl
ld h,(hl)
add a,e
add a,e
ld l,a
ld a,h
adc a,0
ld h,a

The first add a,e is ok, but if it overflows (goes greater than 255) the second add a,e will update the low byte only of the address. The effect is that the text moves to a different position. The result is as you see.

Code needs to be changed so that full 16-bits are updated. Address will be calculated correct now.:

Code: [Select]
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
ld d,0
add hl,de
add hl,de
nop
nop

this will work I think.

Your snapshot is in the middle of drawing I think so already some text is displayed wrong, but if you have an earlier snapshot from when text begins to write then I think we will see correct result.

Try these pokes:

These bytes:

6F,16,00,19,19,00,00

put these bytes at these addresses: 4111, 41b2 and 4233.
I see three places where similar code is being used, so I guessed that all of these need to be changed.

I hope this should work.

These addresses are based on your snapshot. I don't know what the address will be for 3dck when loaded from start.


« Last Edit: 15:32, 04 October 14 by arnoldemu »
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline MiguelSky

  • 464 Plus
  • *****
  • Posts: 375
  • Country: es
    • CPCGamesCD
  • Liked: 210
  • Likes Given: 392
Re: 3d Construction Kit bug
« Reply #4 on: 20:57, 04 October 14 »
Great work, Kev !! I tried and by editing in the first address fix my problem in all the screen positions :). The two other address seem not affect my problem but sure does to others. I looked for these data in the original program and they are the same. I'm going to try the three edited positions in my program and I will tell you if I find another effects.

Thanks a lot !! :)

Offline MiguelSky

  • 464 Plus
  • *****
  • Posts: 375
  • Country: es
    • CPCGamesCD
  • Liked: 210
  • Likes Given: 392
Re: 3d Construction Kit bug
« Reply #5 on: 10:49, 02 November 14 »
And finally, game working :)

http://www.amstrad.es/forum/viewtopic.php?f=19&t=3632

The compiler needed the same patch. I'll take a look of the 64k editors and I'll send the fixed program to CPC-Power.
« Last Edit: 10:51, 02 November 14 by MiguelSky »