COMMODORE PLUS/4 WORLD
  Home  Search  Games  Tapes  Covers  Cheats  Maps  Software  New Stuff 
 Hall Of Fame  HVTC  Game Endings  Features  Solutions  Remakes  Publications  Magazines  Effects  Top List 
 Members  Groups  Plus/4 Encyclopedia  Hardware  Tools  Options  Forum 
Login
Back to forumReply To This TopicGo to last reply

Posted By

Twinspirit32
on 2016-12-26
05:41:48
 Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Hi everybody, Merry Christimas!
I'm about to port a game that I originally wrote for Apple II and then ported to C64 to Commodore Plus 4.
I've been reading about the memory map and structure of Plus 4 and I'm wondering what would be
the best choices in terms of code organizzation of the game.
I understand that Plus 4 has ROM/RAM switchable at $8000-$FFFF, RAM always available for writing and available for reading when switched in by a trigger.
I'm looking into how to map the hires pages I need for the game, Pg1/Pg2 for page flipping, and Pg3 for background backup/restore.
The TED chip can address the bitmap area of $2000 bytes and the color/luminance area of $800 pretty much in multiple of $2000 and $800 in all 64k, but my question is if I map bitmaps pg1 at $8000, pg2 at $A000, pg3 at $C000 and the 3 pages color luminance at $D800, $E800 and $F800 is TED able to display correctly the graphics? TED does need to switch in ram in some ways for reading areas in $8000-$FFFF? Or is he capable to handle the RAM reading also over $8000 without special bank switching?
Another question, I assume that, give the architecture of $8000-$FFFF ROM area, If I want to place running code in the area of $8000-$FFFF I'm forced to keep always RAM reading switched in, loosing the possibility of using IRW ($FFFE-$FFFF vectors and KERNAL interrupt routine)?

Thanks in advance for your help and info!
Daniele

Posted By

gerliczer
on 2016-12-26
05:57:46
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Ultimate Map by SVS.

TED can read from the $8000-$FFFF RAM area even if the ROM is paged in. You have to set it in register $FF12 bit 2. What it is that you absolutely need from the KERNAL interrupt handler and can't realise yourself in a more efficient manner? Not that it couldn't be solved, but you will have to pay attention to what you are doing a bit more than usual.

Posted By

JamesC
on 2016-12-26
06:13:43
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Plus/4 has various I/O at $FD00 and above. It's a LOT easier to stay below this address, than to see the RAM underneath.

Posted By

Twinspirit32
on 2016-12-26
06:19:31
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Thanks for your quick answer!
I actually need to load data from disk from time to time, and I use some KERNAL procedures for Random numbers generation. I've already most of my code that is structured to enable RAM when needed, so I was thinking to reuse that concept also in plus 4 to change less code as possible.
If I can place page 1-3 graphic data over $8000 and TED is ok with that I've pretty much a very easy way to
port the code without not many changes...
The color/luminance $800 data placement is totally free? Or is it realated in some way to the Active Bmp area address setted?
In other words can I activate for TED a BMP area to $8000 and activate a Color/luminance area where ever I want? Or should it be contiguos with BMP address? like $7800 color and $8000 bmp?
is it possible to set for example $8000 bmp ad $E800 color/luminance ?

Posted By

JamesC
on 2016-12-26
07:02:54
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

According to the Ultimate Map (as linked by gerliczer, above) -> TED tab -> lines 22 and 24: Bitmap and Color/Luminance can be positioned independently of each other.

Whether this is a benefit is debatable. IMO it's easier to manage as one 10K block, than to have 8K in one place and 2K elsewhere.

The TED tab of the Ultimate Map also shows comparable VIC registers, which may help you port your graphics to the Plus/4.

Posted By

gerliczer
on 2016-12-26
07:17:06
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Luca and SVS,

Greet your fellow countryman Daniele Liverani, and help him in his endeavour, please. Head over to the place linked as follows to see what he is up to. https://www.facebook.com/groups/96483730310/permalink/10157961183100311/

Posted By

JamesC
on 2016-12-26
07:33:15
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Also preview the C64 version. [ADULT GRAPHIC WARNING.] http://csdb.dk/release/?id=152089

Posted By

Litwr
on 2016-12-26
09:31:27
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

IMHO it is easy to use 64 KB RAM permanently. Just make IRQ and KERNAL calls wrappers. For example, IRQ wrapper maybe something like the next code

bintr
STA $FF3E ;enables ROM
STA *+11 ;saves AC
LDA #>rintr
PHA
LDA #<rintr
PHA
PHP
LDA #0
PHA
TXA
PHA
TYA
PHA
JMP ($314) ;ROM IRQ handler
rintr
STA $FF3F ;turn RAM on
RTI

You should place bintr address to $fffe.

Posted By

Twinspirit32
on 2016-12-26
12:05:44
 Autostart / Boot from disk

Thanks everybody for the tips and info! Very usefull!

Anyone has some suggestion for an autostart of the game for the Plus 4?

In C64 i've been connecting the lading of the first object to the vectors 032C 032D (CLALL system call)
It there a similar vector that can bee hooked at the boot of the disk on the autostart?

Posted By

gerliczer
on 2016-12-26
14:06:51
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Autostarters exploiting only the KERNAL, and not the C64 specific hardware features, work the same on TED machines.

Posted By

Csabo
on 2016-12-26
14:09:00
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Hi Twinspirit32,

A few posts earlier gerliczer recommended the Ultimate Map by SVS, I'd like to echo this. The answer to your question can be found there very quickly.

To be specific, The CLALL system call is on $032A/$032B, so the same technique should work. Another way to do it is hook $0302/$0303 (I think this is the most common way to do it).

In addition, I'd suggest that if a disk image only starts with LOAD"*",8,1 - that is a bug, or at least a major inconvenience for the user. DLOAD should work, and in fact, with minimal amount of work it's possible to make a small loader file which works both ways (DLOAD+RUN or LOAD"*",8,1 autostart).

One more note (my biggest pet peeve): don't make it PAL only

Good luck with your port!

Posted By

JamesC
on 2016-12-26
15:26:05
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

I would suggest that the program not use an autoloader at all.

A boot program, sure. If you can reuse your data files between the 64 and Plus/4 versions, you might use a BASIC boot program to detect which machine it's running on, and the booter can set up whatever is needed to load the appropriate version. Some of Commodore's own titles do this (Micro Illustrator), as well as many of the Commodore-issued Infocom games (grey boxes with Commodore labels).

If your autoloader is strictly to protect your code from prying eyes, the Plus/4 has a Reset button that lets us straight into the machine language monitor.

Posted By

Csabo
on 2016-12-26
22:22:51
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

That's a reasonable suggestion, JamesC.

So what I was referring to was putting the BASIC header in front of the vectors, and making the code memory location independent - neither of those are hard to do, and you have the "holy grail" of start programs. (BTW, do any programs actually do this?) But you raised a good suggestion: all of this PLUS the ability to detect the machine! That's the true holy grail

Posted By

Twinspirit32
on 2016-12-27
03:59:39
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Thanks a lot! Definitely precious info! $0302/$0303 did the work perfectly, but will look into all other advices!

Another thing I'm looking into is the raster $D012 location I've used to sync my page flipping routine.
Is there a similar need in Plus 4 to sync the page flipping to the raster? I see there's $ff0b as raster input
that it's stated similar to what $D012 does in C64, but it seems that looking for $FF value of that location
doesn't do the sync, that value doesn't change apparently.
Tried also to rise bit 1 of $FF0A to enable interrupt but nothing happens.
Anyone had to do sync to raster to switch/flip hi res pages?

Posted By

Twinspirit32
on 2016-12-27
05:39:32
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Couple of more questiions:
Can I use RAM memory from $800 to $1000 if I don't use text mode?
In C64 I stored $0 to $9D pg zero location to disable output to video (Searching for etc) and after that I never wrote to text page and I could use those location.
Using Bitmap hires mode I don't need to write to TEXT memory area.
I've not found a similar feature to $9D "message display control" in plus 4 pg zero, and when I load my object files (the game is splitted in many objs) Video out currpts my obj starting at $800.

Posted By

gerliczer
on 2016-12-27
05:58:01
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

You should really read all the TED registers' descriptions.

$FF0B/$FF0A is the raster interrupt input register. To read the actual raster line value, you should access $FF1D/$FF1C. If you keep the KERNAL interrupt handler running than probably you shouldn't be surprised that you raster interrupt is "denied". The TED machines have graphic screen modes accessible in BASIC with dedicated commands. And there are graphic modes that create split screen where there are graphics in the upper part (~20 rows) and text in the bottom (~5 rows). That requires support in the KERNAL interrupt handler which is what, I guess, interferes with your actions. No, you don't have to sync to the raster for flipping pages, but it could result in ugly tearing.

You are free to use any available memory. System area is below $0800, so it is advised to keep it intact if you want stay compatible with the KERNAL, all others can be used as it fits your needs. Although I'll say just in case caveat emptor.

Posted By

Twinspirit32
on 2016-12-28
05:11:32
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

As JamesC stated:
"Plus/4 has various I/O at $FD00 and above. It's a LOT easier to stay below this address, than to see the RAM underneath."

I've mapped my game code and for addressing reasongs I would like to use $E000-$FFFF for hires page 3 used as background copy for restoring pixels during the animation.
I'm having trouble writing/reading from the area $FD00-$FFFF, when I write there the systems crashes due to I/O registers changing etc..
I'm using the $FF3F and $FF3E to enable and disable RAM bank $8000-FFFF, but apparently writing to $FD00-$FFFF ram causes crashes.
Is there a way to read/write correctly RAM in that particular range of address without messing with I/O, and being the RAM/ROM switch in that area too, when I write to $FF3F first time I activate the RAM, when I write for the second time I store the byte in that location?
Before making changes to the addressing mode look up table to foward that $FD00-$FFFF area to another specific RAM space I would like to check it there's a way to use that memory...
Thanks for any tip in advance!

Posted By

gerliczer
on 2016-12-28
06:30:27
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

There's no way to page away I/O area. The range between $FD00 and $FF3F is always I/O. Just as $00/$01 is always CPU I/O port.

On a rather off topic note, I don't know how to ask this politely without hurting your feelings, or making me look like an impatient bastard a*hole, so I'll do it straightforwardly. Pardon my French, but would it really kill you if you read these things in the recommended collection of knowledge instead of always asking them one by one? My deepest apologies for lacking patience and understanding.

Posted By

Twinspirit32
on 2016-12-28
06:43:31
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

You're definitely right, I'll take some time to read the whole documentation. sorry!

Posted By

Csabo
on 2016-12-28
08:56:51
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Let me chime in from the other end: the docs is one thing, but they don't answer everything, and they are not always 100% clear. Sometimes one just wants to ask things for confirmation. There's a lot of us here who don't mind answering questions, even if they've been asked to death; after all, this is about the thing we love

Posted By

gerliczer
on 2016-12-28
09:59:47
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

/OFF

I love answering questions about our machines, too. But repeatedly answering the most basic questions rapidly evaporates my enthusiasm. Especially, when they came from someone who could be considered a seasoned veteran. And before anybody misunderstands it, this latter is not directed to Twinspirit32 or any other specific person.

/ON

Posted By

Twinspirit32
on 2016-12-28
17:30:47
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

http://www.danieleliverani.com/Genius-Plus4.jpg
Plus4 version is coming alive, thanks everybody for the tips!

Posted By

Luca
on 2016-12-28
17:43:52
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Fantastic news Daniele! Anyway your work would worth a good Plus/4 emulator, whereas VICE still shows several flaws regarding the xplus4.exe unfortunately...

Posted By

Twinspirit32
on 2016-12-28
18:26:58
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Thanks Luca!
I have also this:
plus4emu-1.2.10_beta-x64.exe

Any other good emulators out there for Max/Pc?

Posted By

Luca
on 2016-12-28
19:03:17
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

You've just got the most near-to-real one, you can also use the YAPE, very friendly and reliable enough, the common choice.

Posted By

Gaia
on 2016-12-29
17:12:41
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

My emulator (YAPE) has an open source spinoff called yapeSDL which has recently been ported to the Mac (iOS). Check it out here:

https://yapesdl.codeplex.com/releases/view/621382

Posted By

Mad
on 2016-12-29
20:45:45
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

I do use yape, too. It's the easiest usable one when developing. For me the best since years.. :) however using win most of the time.

Posted By

carrion
on 2016-12-30
04:10:43
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

@Gaia
WOW YAPE on mac OS.
Thanks. Now we are talking...

question though:
Are you aware it is up to date with latest fixes of main Yape code?

Posted By

gerliczer
on 2016-12-30
07:16:43
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Who could be more aware of how up-to-date an emulator is than the author himself? Anyway, I seem to remember Gaia saying once that the version number of YapeSDL shows what version of YAPE the given release roughly corresponds to.

Posted By

Gaia
on 2016-12-30
13:26:08
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

@carrion:Alas, no some of the trickier stuff is still missing. I'm working on it (kind of). Once... The current compatibility level is a sort of a hybrid of the mainstream YAPE's high and medium level accuracy modes.

Posted By

carrion
on 2016-12-31
05:56:50
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

@Gaia
well I had the time to check it myself. the SDL mac port can't show mFLI pics correctly so I guess it is far from current version of YAPE. pitty

Posted By

Twinspirit32
on 2016-12-31
10:01:32
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

I use merlin 128 on vice 128 emulator as main assembler for my game for Commodore 64 ver, Plus 4 vers, and even Apple II version and BBC Micro version. I extract the binaries and create the Apple II dsk and BBC Micro ssd diskrs with a batch invoking with conversion tools I found on the interent.
So it's a sort of "retro" cross compiling, I love to work with old fashion assemblers and Merlin 128 of Glen Brendon is very brilliant and powerfull in my opinion.
So it's great to have YAPE for Mac Osx so I can test the Apple II version directly working on MAC with Virtual II emulator which I prefer to AppleWin

I'm almost done with the port to Plus 4, still have to dig into Zero Page variables that I'm using. I have strange behavious from routines that are relying on fast zero pages vars.
Would be usefull to know what vars in Page zero can by safey used, are there any specific infos ragarding this topic out there maybe?
Would love to have some help in beta testing the plus 4 version when ready if anyone is interested!

btw. Happy new year to everybody!!



Posted By

Twinspirit32
on 2016-12-31
11:43:22
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Apparently I found the vars that were giving me problems! The RND routine $A707 uses some locations at $22 $2A for its computations. Everything works fine so far now!

Posted By

Csabo
on 2016-12-31
12:21:58
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Sign me up as a beta tester, I'd be happy to give your game a try and provide feedback.

Posted By

Twinspirit32
on 2016-12-31
19:25:36
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Thant's great!
Anyone who might be interested please join my GENIUS 8 bit game group:
https://www.facebook.com/groups/193784371026617/
Version for download will be available there!
Happy new year to all retro friends!!

Posted By

MMS
on 2017-01-01
03:11:22
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Let's see that new gem

Posted By

Twinspirit32
on 2017-01-04
14:56:48
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Just a quick question: how do you embed pictures and links in this forum? What's the sysntax you use?
Thanks!

Posted By

Csabo
on 2017-01-04
15:04:28
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

When you post, there's a little "Forum Help" link at the top that explains all this. Specifically for links, just wrap them in [url]...[/url]. You can't embed images unless you're a member (and even then it's complicated ), so probably just include links to a free image host like imgur.

Posted By

Twinspirit32
on 2017-01-04
17:07:04
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Thanks a lot!

I'm having difficulties in finding the Plus 4 equivalent of $9D in C64.
Storing 0 into that location caused the messages output to window to be hidden when loading
binary files (SEARCHING FOR etc.etc).
Is there any equivalent for PLus 4 to hide output to video of the LOAD/SAVE commands?
Tnx for any hint.

Posted By

gerliczer
on 2017-01-05
13:41:47
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

$9A? I'm not sure, but checking the C64 memory map and looking for something similar in SVS's Ultimate Map gave this idea.

Posted By

JamesC
on 2017-01-05
16:59:30
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

If you're loading from within a program, neither the C64 or the Plus/4 will display a LOADING message on-screen. So I suspect you're using a dynamic keyboard technique (printing the commands to the screen, then POKEing some CHR$(13)s into the keyboard buffer).

Simply set your text color to your background color before you PRINT everything to the screen.

Posted By

gerliczer
on 2017-01-06
00:45:43
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

@JamesC: That's not the problem. He used the default screen memory too, so it can't be allowed to be overwritten. See his post on 2016-12-27 05:39:32.

Posted By

Csabo
on 2017-01-06
10:28:18
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

So does $9A work? I remember an old POKE that we used in BASIC, that made the ? at the beginning of INPUT statements disappear, maybe the same one can be used?

Otherwise I was going to suggest what JamesC said too, but it seemed too obvious. Another similar trick that can work nicely is to create a window which is only 1 character in size (ESC+T/ESC+B). As long as there's one "free" character on screen (e.g. top/right corner), this would also effectively "hide" all messages coming from disk/tape operations.

Posted By

SVS
on 2017-01-07
09:32:46
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

@gerliczer: it seems that it is this in our machines:

$9A bit 6 = enable/disable Control messages (Load/save/etc.)
$9A bit 7 = enable/disable I/o Error messages (File not found/etc.)

From my tests the Basic commands, like DLOAD, in direct mode do force both the bits to 1 (enable)

*EDIT*
the info is for @Twinspirit32

Posted By

Twinspirit32
on 2017-01-06
16:39:27
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

$9A works great! Thanks a lot!
I'm almost done with porting, made also a custom color setting for Plus 4 using luminosity
I can't wait to share with you all the game!

Posted By

Luca
on 2017-01-06
16:42:32
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Bravissimo Daniele!

Posted By

Twinspirit32
on 2017-01-06
19:03:18
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

For some reason I've been told that most of the single players games for C64 have as default joystick selected/read on port 2.
Is it the same for plus 4? I was thinking of placing joystick default on port 1 for Plus 4

Posted By

Csabo
on 2017-01-06
20:53:16
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

I don't really know which port would be considered default, but I always thought old games over-complicated this issue. For single player games, why not support both ports? It's about the same effort. When I wrote 1010!, I allowed both ports and keyboard (two different configs). Simple, no trouble for the user.

Posted By

gerliczer
on 2017-01-07
03:28:04
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

@Twinspirit32: Grats, carry on with the nice work.

@SVS: OK, but why are you telling this to me? I wasn't really interested in it. I just tried to give a hint to Twinspirit32.

Posted By

Twinspirit32
on 2017-01-07
07:03:01
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Thanks for the precious help everybody!!
Here's first beta version 01!!

http://www.danieleliverani.com/GENIUS1_CPLUS4_Rel01.zip

Will dig into the double joystick handling and keyborads types to...

If anyone wants to transfer to real hardwere and give i a try it would be great! I will buy a Plus 4 in the near future, but now I don't have one

Posted By

Luca
on 2017-01-07
09:17:29
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Daniele, still there's no need to test it on the real hardware, 'coz it seems the game needs to be fixed, as you can see running it on the main Plus/4 emulators, plus4emu and YAPE.
I tried to take you away from VICE warning you here...

Posted By

Twinspirit32
on 2017-01-07
09:20:08
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Oh ok! Will test on those right away!

Posted By

Twinspirit32
on 2017-01-07
10:04:27
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

I've mapped hires page1 to $8000 and page 2 to $C000, apparenlty VICE works fine with this mapping
and shows correctly the hires bitmaps even without the RAM activated with $FF3F.
VICE anyway is not allowing to map the $800 luminance+Color bytes in RAM area without activating it,
infact i had to place these lum color memory below $8000 to see the right colors/luminance on Hires.

Plus4emu is showing content of ROM instead both bitmap pixels areas and color/lum area, so apparently
I have to change the situation in terms of IRQ handling and keep always RAM active I suppose.
I filled with code the area $1000-$8000 so I thought I could have used the shadow RAM $8000-$FFFF for hires area and I thougt that TED could address and read those areas even without atctivating RAM with $FF3F.
So I assume that the real machine behaviour is that TED needs RAM activated with $FF3F to show bitmaps located over $8000 at this point right?
If this is true VICE is really not that true emulation

Posted By

Twinspirit32
on 2017-01-07
10:38:30
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

About mapping hires bitmap area to Pg1 $8000-$9FFF and Pg2 $C000-$DFFF:

3 emulators, 3 different behavours:

Testing on VICE :
Both areas /pages works fine without enabling RAM with $FF3F, it shows graphics RAM data correctly and game works fine. No need to enable RAM.

Testing on YAPE:
Hires Page1 mapped at $8000-$9FFF works fine without enabling RAM with $FF3F, shows RAM data
Hires Page2 mapped at $C000-$DFFF needs enabling RAM with $FF3F, shows ROM data

Testing on PLUS4EMU:
Hires Page1 mapped at $8000-$9FFF needs enabling RAM with $FF3F, shows ROM data
Hires Page2 mapped at $C000-$DFFFneeds enabling RAM with $FF3F, shows ROM data

Anyone have experience on real hardwere and knows what's the real behaviour of this Bitmap/TED addressing accessing?



Posted By

Twinspirit32
on 2017-01-07
11:11:22
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

I noticed also that timer1 FF00 FF01 That I use for IRQ music playing works ok in VICE and PLUS4EMU, in YAPE the speed of the timer is slower, similar to the default value that I had at startup in other 2 emulators without setting the new value (14734) in FF00 FF01.
Many differencies in these emulators

Posted By

Luca
on 2017-01-07
11:12:00
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Ok, I'm going to check the real behaviour on real hardware, then I'll write the result editing this post (and I suggest to you about doing the same: instead of entering multiple posts, prefer to edit your last one ).

Meanwhile, I alerted Gaia, author of YAPE about those discrepancies, so stay tuned for further news to come

Posted By

Gaia
on 2017-01-07
11:26:22
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Thanks. Will have a look as I do not have an answer off the top of my head. I don't think the timer is slow in YAPE though. One proof is that there are many timer based protectors and they all work fine in YAPE and also plus4emu but not so much in VICE. BTW, you should control whether the TED reads bitmap data from ROM or RAM above $8000 not via $FF3E/F but via $FF12.

Posted By

Luca
on 2017-01-07
11:41:00
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Ok, new post then
Tested on real hardware: plus4emu is right again.

Posted By

Gaia
on 2017-01-07
11:59:06
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Note that setting video address above $8000 without clearing the ROM bit will show you the garbage on the data bus, not ROM or RAM data. Bitmap address ROM/RAM location is controlled via bit#2 in $FF12. I am now a bit confused what you have actually done here since I quickly checked and both YAPE and plus4emu behaved like the real machine (although when the bitmap data is set to start from $E000 YAPE is not showing the TED and I/O area via the bitmap because of performance reasons but since this mode should not be used anyway, this known limitation is of little practical relevance). I need to have a more detailed look later.

EDIT: I confirm this is a bug in YAPE. Wow. Such a simple glitch and took so many years to be revealed... it occurs in case registers are written in a given order.

Posted By

Twinspirit32
on 2017-01-07
18:44:40
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

I checked my code and debugged, I clear to 0 correctly the bit 2 of $FF12 to select RAM.
As a quick cross test I tried to set to 1 the bit 2 of $FF12 and in this case also VICE shows garbage on both Page1 $8000 and page2 $C000. VICE works fine with bit 2 of $FF12 clear.

Debugging with PLUS4EMU, the bitmap of page1 $8000 shows up correctly at the beginning and the register $FF12 is set at $E0 correctly at startup, but at some points, when music starts it should become $E3 or $E2 (the lower bits are used for freq settings) but I find that the register $FF12 goes to FF and this I guess causes the setting of bit 2 that causes the garbage graphics.
The registers remanis to $FF even if I start the GAME which runs even showing garbage graphics.
I've also noticed that after some resets, I've seen PLUS4EMU working correctly and not writing $FF to $FF12 registers, but the correct $E0 $E1 $E2 $E3 values, and the game was running correctly.
So the behaviour is not repetitive I guess.

Debugging with YAPE I see the same behaviour basically, $FF12 turns into $FF at some point and
graphics shows garbage.
Also in YAPE I have the music playing a bit slower than in VICE and PLUS4EMU.
I set timer 1 at 14734/$398E which is F000:8E F001:39, in VICE and PLUS4EMU I've seen values of 38/39 at times breaking into debugger, on YAPE I never saw values bigger that 33, in any case music IRQ is
a little slower that VICE and PLUS4EMU, so I assume that the IRQ in YAPE are occurring at a lower rate.

That's my cross checking about the 3 emulators!

Also:
On VICE dragging the d64 image file causes the autostart/autoloading of the first PRG file of the diskette which is A.O that is the autostart that hooks to the $0332 boot system call at startup. The code then launch the game which load all other object parts.

If I drag the d64 on YAPE it crashes at $5F44, which is the location of the jump to the game start (actually it's $5F42), it looks like the A.O code is correctly loaded and launched but it doesn't load the prg file G.O which is the main loader of the game where the A.O jump to as its final step.
If I type manualy LOAD "A.O",8,1 then the game starts correctly.

In PLUS4EMU I actually haven't found an autostart procedure, if I drag the d64 file on its window nothing, and also nothing if I attache the d64 image to
the drive 8 and reset, is there a way to have autostart on PLUS4EMU

Thanks everybody for the great help and collaboration!

Posted By

Gaia
on 2017-01-07
17:02:31
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Running the program did some random lockups at times. I have also seen some ORA $AF00,Y -like assembly code starting from $A696 that is ultimately responsible for overwriting the correct $FF12 value with $FF (or actually: whatever startup or leftover pattern is there in the memory). This commands the TED to read bitmap data from ROM (not that it makes much sense for bitmap graphics - the character set is also using this bit). I suggest you fill this memory with zeroes and ones only or change the code.

Trust me, the timer1 runs and generates IRQ at the same pace in the emulators so in case you see some different values that could rather be a debugger/monitor issue.

EDIT: Drag'n'drop crash: in YAPE, "blitz" loading of PRG files directly from the D64 image is enabled by default. Make sure to turn it off in the Advanced settings. Then it loads fine.

Posted By

Twinspirit32
on 2017-01-08
10:31:36
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Oh my GOD! Yeah I probably forgot to zero the memory RAM from AF00 to AFFF which is used as
memory for the player.
I make some ORA $AF00,X of FF12 and probably on VICE and at times the memory is filled with ZERO and
some times not, I assume in real hardwere there might be random values at startup and this surely
would have ruined bit 2 of $FF12.
Correcting and testing now! Thanks GAIA a lot for the help!

EDIT:
http://www.danieleliverani.com/GENIUS1_CPLUS4_Rel02.zip

Here's version 02, works in YAPE and PLUS4EMU correctly so far...still testing. There were a couple of memory areas that needed to be cleared at startup and some premature routine calls that were causing damages that were not visibile in VICE.

Still music is playing a bit slower in YAPE, really don't know why :)

Thanks for any real hardwere test feedback! :)



Posted By

Gaia
on 2017-01-08
13:33:39
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Wow. Love those old-school and fat TED square waves! Way to go.

Posted By

Twinspirit32
on 2017-01-08
14:58:13
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

I'm definitely into old school Arcade games style both graphics and sound, 78-82 era

Posted By

Luca
on 2017-01-08
17:38:11
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Tested on real hardware, working flawlessly as expected It was late night and I could only play the first 7 levels, just for a quick ride, joystick in port 2 (I guess) or keyboard.



Posted By

Mad
on 2017-01-08
19:36:30
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Nice! And respect for doing this in bitmap mode. The double buffer takes some serious amount of mem I suppose.. Cool, that you getting it to this level, already! And it's fun to play!

Posted By

Gaia
on 2017-01-09
01:51:01
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Bitmap mode games are totally a thing and I have been wondering whether the title screen could be made (partly) multicolour? (using raster IRQ) I guess the bitmap pattern is coming from Apple where due to its video implementation this kind of rasterization creates an illusion of colours (if I'm right).

Posted By

carrion
on 2017-01-09
03:39:35
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

how to run this game from d64?
which file starts the game?

Posted By

Luca
on 2017-01-09
04:10:01
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

carrion: it uses autorun, so you need to LOAD"*",8,1

Posted By

Twinspirit32
on 2017-01-09
04:34:12
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Thanks everybody! it would be great to see some vids of the game running on your systems! I'm planning to buy a real one soon btw.

for GAIA: I've been testing the game on my main faster pc and speed of music is perfect! I work on a laptop usually which is an entry level and very slow machine, so probably my low cost slower pc was the problem!
As for the colors, the main game banner comes from Apple II, I just made a screen shot from the emulator and
stated from there to adapt sizes, positions and then I coloured the bitmap using color characters screen memory. Some of the patterns are pixeled from original Apple II rendering, and so the white gray is obtained with that pixeling effect, anyway no raster use here. I'm trying to keep everything generic, I've rewritten also font output with proprietary routines, I'm pretty much using only IRQ, TED registers and couple of KERNAL routines for random numbers and LOAD/SAVE operations, other than that everything is rewritten, to mininize difficulties of porting in various platforms with 6502

for LUCA: Thanks for the screen shot and for playing the game! Joystick should be in port 1, I've tested it
with a USB joystick so far.

for CARRION: Yes it uses autorun as LUCA answered, but anyway the obj file that runs the game is A.O so also LOAD "A.O",8,1 will run the game

For MAD: Thanks a lot, yeah for doing animation without sprites, with only straight coding, I needed 3 pages of 8K+800bytes of col/lum. So 26,4 Kb is dedicated to bitmap areas. Pag1/2 for double buffering and Pag3 for background restoring backup area during the characters animation process.

Posted By

Csabo
on 2017-01-09
10:41:29
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Hi,

The current version is PAL only, so on NTSC machines it won't run correctly, and it comes down to (unnecessarily) overwriting a single bit. Instead of LDA #$xx / STA $FF07, you should do LDA $FF07 / AND #$40 / ORA #$xx / STA $FF07. In other words, leave the $40 bit of $FF07 alone. When I do this manually, the game seems to run fine on NTSC too, so hopefully it's a quick fix.

Other suggestions: I've already said this above, but the auto-start is more of a problem than a helper, and seeing the above comments it seems I was right You could easily make it work both ways, that would be the best solution to the end user. Otherwise this is a minor issue, no big deal.

The other thing is the title screen, it just looks odd - like it should be multi-color graphics mistakenly displayed as hires. It's not really a bug or anything, and certainly could be chalked up to artistic choices, I'm just thinking it doesn't do justice to the capabilities of the machine.

Otherwise congrats on making the conversion happen!

Posted By

Twinspirit32
on 2017-01-10
12:27:07
 o!Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Hi Csabo!
Thanks a lot for your considerations! :)
Here's a link to version 03 with the $FF07 register setting fixed for the NTSC models, please let me know if it works now!
http://www.danieleliverani.com/GENIUS1_CPLUS4_Rel03.zip

and btw about game start:

If I type
LOAD "G.O",8,1
SYS24386
the game runs correctly.

if I insert a BASIC program titled GENIUS like this

10 LOAD "G.O",8,1
20 SYS24386
and then
DSAVE "GENIUS"
it saves the program to the diskette

I restart the system and I type
DLOAD "GENIUS"
I get
LOADING
READY.

but if I type
RUN
The systems freezes and it doesn't launch the game.

Is there something I'm doing wrong?


Posted By

JamesC
on 2017-01-10
12:46:25
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

I can report that the game now works in NTSC mode. And the music sounds ... well, better.

On the BASIC boot file: if there's no room for a C64 version on the disk too, then a boot isn't necessary. Just edit A.O's entry on the disk to add ,8,1 after. This tells any Commodore user that the file -requires- a non-relocated load.

The problem with your boot, is that it goes into an endless loop when it loads G.O. Try:
10 IF A=0 THEN A=1: LOAD"G.O",8,1
20 SYSxxxxx




Posted By

Twinspirit32
on 2017-01-10
13:07:02
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Thanks a lot! Yea, there's no room for the C64 version as well in only one diskette.

Well a GENIUS named basic program as a loader usable with DLOAD / RUN wouldn't be usefull as well? :D

Posted By

JamesC
on 2017-01-10
13:51:37
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

When software came on physical diskettes, one could note the proper boot sequence on the disk label. But for .d64 images, there is no label for me to write DLOAD or LOAD"*",8,1.

If you include a BASIC loader, you might also display some hints to the user: which joystick port they should plug their joystick into, which button turns the music off, etc.

Posted By

SVS
on 2017-01-11
05:52:35
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

@twinspirit32: I can add some info to the LOAD problem:

>>10 LOAD "G.O",8,1
>>20 SYS24386

This program will not work since, as JamesC correctly says, the running goes into an infinite loop. This is because after a LOAD, the Basic interpreter resets the running to the first statement (like a GOTO 0). The variables still remain set, then this allows a control in order to exit the loop.

>>DSAVE "GENIUS"
>>it saves the program to the diskette

DSAVE does not save the loading address like SAVE zzz,8,1 does.

>>I restart the system and I type
>>DLOAD "GENIUS"
>>I get
>>LOADING
>>READY.

DLOAD always loads to the standard Basic area (even if the file was saved by SAVE zzz,8,1)

Hoping to have helped.
Ciao

Posted By

Twinspirit32
on 2017-01-11
15:12:44
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Thanks a lot everybody!
for JamesC: how do you rename A.O in the d64 image to get "A.O",8,1 in the file listing? I only goto to rename it to "A.O,8,1" . How can you get ,8,1 outside the "" of the filename?

I succeded in creating a BASIC loader btw! I will add some info in a text file about instructions btw

Posted By

JamesC
on 2017-01-11
16:12:27
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

You'll need a disk editor to put ,8,1 outside the filename. My preference is Disk Doctor, but anything that allows you to directly edit a sector on a disk will do the job.

A.O resides in the first directory slot of the disk, Track 18 Sector 1. To force an ending quote mark, leave a shifted space (the disk editor will show it as CHR$(160)) after A.O. After the shifted space, in the area of other shifted spaces, type ,8,1: and then save this sector back to the disk.

If you're not comfortable editing the disk directly, email me the "official" distribution disk image (if it differs from yesterday's preview) and I'll do it for you. Click my name at the left side of this post to get my email address.

*Subtle correction to SVS's comment about DLOAD/DSAVE -- DLOAD will load to wherever BASIC happens to reside. In text mode (or on a C16 or 116) this is 4097 ($1001), but if a GRAPHIC mode is active on the Plus4 then DLOAD will load to 16385 ($4001).

DSAVE will save from BASIC space, and will include the load address at the time of the save -- a major inconvenience if you save from GRAPHIC mode but later LOAD"*",8,1 from text mode! One solution is to GRAPHIC CLR (deallocate graphic memory) before DSAVEing your program.

Posted By

Twinspirit32
on 2017-01-24
12:22:32
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Ok thanks for the explanation, I will wait a bit for possible test feedback and will try to do that on my own. Will ask further help just in case! Thanks a lot

UPDATE: I've noticed that some news web sites have been downloading PLUS4 ver 03 from my FB official GENIUS group and wrote about a "release of the game" for Plus/4 in these last 2 days. I'm actually playing/testing the game at the moment, and those web sites just did news/annoucements on their own :) , but it's ok, it's very likely that ver3 will be the definitive one, I've had no issue so far with that release.
I will post some news when the test is done, ad again, it's free, it's an hobby fun for me, it's great to see good interest and I'm not that worried about what web sites write :), if there will be some bugs I will happy to make version 4 and keep you updated! :)
Thanks for the precious support everybody! It was fun!

UPDATE 2 : I confirm that the test of GENIUS game for Plus4 is completed and Vers. 03 is the official release version! Further bug reports will be followed by the way as for all other platforms version!

Posted By

Mad
on 2017-01-24
12:42:31
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Great!

Posted By

Csabo
on 2017-01-24
13:33:49
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

Yay, official release!

Posted By

Litwr
on 2017-01-26
01:57:00
 Re: Porting to Commodore Plus 4 of my game Genius, memory/bitmap mode questions..

I've just finished the level 5. The shark and gameplay are good for me.



Back to topReply To This Topic


Copyright © Plus/4 World Team, 2001-2017