Login
Back to forumReply to this topicGo to last reply

Posted By

Uto
on 2019-12-22
19:08:28
 Read from RAM and colour area

Hi All,

I'm quite new to Plus/4, but I'm trying to finish porting an modern addon for an ancient text adventure engine to Plus/4 from C64.

Please notice the ancient engine had a feature wich allows adding your own machine code, but I don't have the sources for the engine interpreter, I just can make the engine load my code, and do my stuff there. That means that, for instance, I cannot change the addresses where there the bitmap, luminance and colour areas are. I have bitmap area at $E000 and colour at DC00, and the engine runs in HiResolution mode.

Someone else helped with port before myself, and I got a function to load raster graphics from disk I had created for C64, ported to Plus/4. But now I want to port myself another function able to load text from disk, so the text adventure is not limited to 64K.

I copied the code from the picture loading and it worked, just the picture loading code blanks the screen while loading, by storing $0B at $FF06. That may be OK for loading a picture, cause when you loada picture you are in general changing to a new location in the game, so blanking the screen doesn't look bad.

On the other hand, when loading a text you want to display, blanking the screen looks weird, so I made something so the screen is not blanked, but then when I was about to load the file, something that to be done needs that I page ROM first (Storing at $FF3E), all the screen attributes get messed up, and then once I page RAM back they are Ok again. Please notice it's only color attributes, the pixels in the bitmap remain the same.

I have checked bit 2 at $FF12 and it's 0 all the time, so it's reading from RAM, but apparently that works only for bitmap data, not color data.

I've tried both with VICE/Plus4 and with YAPE, but both of them show the same.

Is there any way to make TED look for the color information in RAM also? I couldn't find anything related to that.

Thanks in advance for your help.

PS: The engine is DAAD (https://github.com/daad-adventure-writer/daad), but that doesn't really matter too much, just think you want to read a file using KERNAL while in HiResolution mode, and you cannot change bitmap from $E000 nor colour from $DC00.

Posted By

SVS
on 2019-12-23
07:36:11
 Re: Read from RAM and colour area

Hi Uto,
some hints you should check:
1) $FF06: if you poke $1B instead of $0B you'll have the same features (maybe with a slower speed), but you can see the screen and what's happening;
2) The poke to $FF3E only enable the reading from RAM. Be informed that the writing is always to RAM even with address' greater than $7FFF;
3) Beware to the bug returning from use of Monitor environment: When you press X (or in case of error) it resets the TED to read from ROM ($FF16 bit 2) but does not modify the address'.

Posted By

Uto
on 2019-12-23
10:50:40
 Re: Read from RAM and colour area

Thank you for your response SVS. In fact I just don't write to $FF06 amymore, that's why I found this issue. What I do is:

1) Page in ROM (write to $FF3E)
2) User KERNAL functions to read file
3) Write text read from file on screen
4) Page in RAM

What happens is just after point #1 all the attributes on screen change to random values, so I get multiple colour 8x8 squares. The bitmap data though remains the same, you can still see the picture pixels and the text letters below those messed colors. Them, when point #4 happens, all attributes come back to previous status.

That's why I think that the bitmap data is being read from RAM, but the luminance and colours data is being read from ROM.

Regarding your point #2 it's a interesting information, but I've checked and I don't see any code writing to RAM that can affect the attributes area randomly, and as the attributes are restored to the proper ones when I page in RAM again, it means RAM has not been modified.

Your third point is very interesting to know, it could led to misunderstandings, but I have checked the game without even opening the monitor and same thing happens.

Thanks again for your response, the more I know, the easier is I found a solution.

PS: These are three pictures that show how the screen is before paging in ROM, while ROM is paged, and how it looks after RAM is paged in again.

Before:
htt://drive.google.com/file/d/1cyo5OVewvv31krn7AYvH6rmmqMOWf4g9/view?usp=sharing

Meanwhile:
htt://drive.google.com/file/d/1NtP_xyjmAe-qEQ9bHyZm_QJnlkq8qvU-/view?usp=sharing

After:
htt://drive.google.com/file/d/1ueaLOtiRvpyW024o0gAeB7GXdYj_xeSk/view?usp=sharing

Please add the missing "p" to the http links above, I had to remove them cause otherwise the forum thinks it's SPAM. Sorry for that.

Posted By

siz
on 2019-12-23
14:49:34
 Re: Read from RAM and colour area

Yes, I've turned of the screen for KERNAL functions (and in DAAD waiting for the not visible screen area to do this) because TED always reads screen attributes from ROM if that's paged in. RAM/ROM selector bit of $ff13 affects bitmap and character set reading only.
(and sorry, Uto but until this moment I was so busy that I couldn't find any time to spend on XMessages - I'll get to my mails now)

Posted By

Uto
on 2019-12-23
15:18:02
 Re: Read from RAM and colour area

Thank you Siz, don't worry, every cloud has a silver lining, so thanks to that I've started to know Plus/4 better happy

At the moment Stefan and I have decided to keep the screen blankening, but it's good to know it's not a bug, it's just like that.



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024