News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_MiguelSky

3d Construction Kit bug

Started by MiguelSky, 19:52, 01 October 14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MiguelSky

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


arnoldemu

#1
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.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

MiguelSky

Thanks for the reply, Kev :)

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



arnoldemu

#3
I think I can see the bug now.

In the text writing code it does this:


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.:


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.


My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

MiguelSky

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 !! :)

MiguelSky

#5
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.

Powered by SMFPacks Menu Editor Mod