Enterprise Forever

:UK => Programming => Topic started by: Under4Mhz on 2023.August.27. 02:42:46

Title: COM file size
Post by: Under4Mhz on 2023.August.27. 02:42:46
I'm porting a game to the Elan Enterprise.

That game is around 24K and I'm finding that IS-Basic is only loading in the first 16K, no matter what I set in the header.

What's the maximum size of a COM file? Is it 16K?

My guess is this is why most games I've seen have a ~2K COM loader with a 32K sidecar file that it presumably loads.

I wanted to check this is correct before I tried to get around the limitation.
Title: Re: COM file size
Post by: geco on 2023.August.27. 07:14:23
Great :-)
No the limit of file size of COM file is around 42kb, and if you have a loader the next file to be loaded can be much bigger.
Title: Re: COM file size
Post by: Zozosoft on 2023.August.27. 16:27:02
If you use more code than the 0100h-3FFFh, then need to page in the additional segments from EXOS USR_P1 and USR_P2 variables.
Code: [Select]
LD A,(0BFFDh) ;USR_P1
OUT (0B1h),A
LD A,(0BFFEh) ;USR_P2
OUT (0B2h),A
Title: Re: COM file size
Post by: Under4Mhz on 2023.September.02. 03:31:04
Thanks, that was it.

https://under4mhz.itch.io/vexed
Title: Re: COM file size
Post by: SlashNet on 2023.September.02. 09:03:11
Cool!

But something going vrong. :(

[attach=1]
Title: Re: COM file size
Post by: geco on 2023.September.02. 09:27:40
Thanks, that was it.

https://under4mhz.itch.io/vexed
Cool game :) I played a bit :)
Title: Re: COM file size
Post by: geco on 2023.September.02. 09:29:02
Cool!

But something going vrong. :(

The problem is incorrect file size entered into EXOS header 5, it contains the corrected file size.
Title: Re: COM file size
Post by: SlashNet on 2023.September.02. 10:14:00
The problem is incorrect file size entered into EXOS header 5, it contains the corrected file size.

This file produces only black screen :(
Title: Re: COM file size
Post by: geco on 2023.September.02. 10:55:31
This file produces only black screen :(
Please wait.
Title: Re: COM file size
Post by: SlashNet on 2023.September.02. 23:48:30
Please wait.

Oh. 52 seconds from the end of the download to the start screen. :smt107
Title: Re: COM file size
Post by: geco on 2023.September.03. 14:51:27
The problem was that FF segment was used for Graphics page, EXOS LPT is located on FF segment, and the program deleted Graphich page 1st and then changed the LPT from EXOS LPT to Game LPT, so LPT pointer remained on empty segment, and took 52 seconds until it reached a "reload" bit somewhere in the memory.
I changed Graphics segment from FF to FD, 2 byte should be patched 1 where FF segment was paged in, and other at Graphics address in LPT.
Now the game starts immediately.
Title: Re: COM file size
Post by: Under4Mhz on 2023.September.05. 03:50:00
Woah, that was some serious rom hacking.

Thanks, that made it simple to fix, I would have spent days trying to figure out the LPT page issue.

I've fixed that problem as well the header size byte. I've added some sound effects and updated the colours (I had the rgb colour bits around the wrong way).
Title: Re: COM file size
Post by: SlashNet on 2023.September.05. 09:21:05
Cool! :)
That's much better.

I found 2 not critical bugs:

The first one came from the CPC version.
When the level is restarted, the cursor outside the redrawable area does not disappear.
[attachimg=1](https://s1.hostingkartinok.com/uploads/images/2023/09/7ac7d1c7198d67bb4ae134a83dba2e5c.gif)

Second - keyboard has some strange keys definition
IJKL keys - OK
Classic QAOP keys (P doesn't work - ` instead)

External Joy 1 has wrong definitions
ExtJoy1Up - not used
ExtJoy1Down - Left
ExtJoy1Left - not used
ExtJoy1Right - Right (OK)
ExtJoy1Fire - not used
ExtJoy1Fire2 - Restart level (OK)
Title: Re: COM file size
Post by: szipucsu on 2023.September.05. 15:21:06
It is a cool game. I played until level 10 and it was too hard for me.
I miss the sound effects.
Title: Re: COM file size
Post by: geco on 2023.September.05. 18:17:48
I gave up at level 10 also after some attempts :-D , then i turned into fixing the 52 seconds issue :-)
Other small thing could be added, using FF segment if it is an ep64 machine, in this case the game could run on ep64, and a soft reset routine could be added also :-)
Title: Re: COM file size
Post by: geco on 2023.September.05. 18:24:37
if you upload the source, i can add the mentioned modifications
Title: Re: COM file size
Post by: Under4Mhz on 2023.September.06. 04:44:39
Other small thing could be added, using FF segment if it is an ep64 machine, in this case the game could run on ep64
Just a few questions on that. Won't that cause the 52 second problem? What's the default EXOS segment for the EP64? How do I detect a EP64? Won't it run on a EP64 as it is now? I'm not using the extended 128K.
Title: Re: COM file size
Post by: geco on 2023.September.06. 07:57:01
I would change the sequence of LPT setting and video memory deletion, LPT would contain 3F left margin, after deleting video memory left margin would set to 0B, by this 52 sec problem, and dirt on the screen can be avoided if default EXOS system segment is used as video memory. The easiest way (and not 100% sure) if you check if page0 contains FC, if it is, then the machine is EP64. You do not use the extra memory, and after 52 seconds the original version would run on EP64, but after my patch it does not, it even does not use extra memory, but by changing video memory from FF to FD the game will overwrite 2nd game page by video memory, because it is loaded to FC and FD.
Title: Re: COM file size
Post by: Zozosoft on 2023.September.06. 08:59:03
What do you think about the "force an immediate re­load of the line parameter base pointer" (reset b7 of 83h)? Then probably will work the original memory layout? (anyway more EXOS compatible don't ruin the FFh segment :oops: )
Title: Re: COM file size
Post by: geco on 2023.September.06. 18:18:08
What do you think about the "force an immediate re­load of the line parameter base pointer" (reset b7 of 83h)? Then probably will work the original memory layout? (anyway more EXOS compatible don't ruin the FFh segment :oops: )
Good idea, i forgot about this possibility :-) , but yes i would like toadd more exos compatibility to avoid destroying system segment(s) if possible.
Title: Re: COM file size
Post by: geco on 2023.September.08. 12:10:05
I performed some patches:
key @ was changed to P
EXT joy1 fixed
and now the program should run on EP64 also
Soft reset routine added

The zip contains the original version, the patched version, and the source, and binary used for patch.