Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for BANKED on cpc #1010

Open
poppichicken opened this issue Nov 10, 2024 · 5 comments
Open

Add support for BANKED on cpc #1010

poppichicken opened this issue Nov 10, 2024 · 5 comments
Labels
beta Candidate for BETA cpc Amstrad CPC 664 enhancement New feature or request
Milestone

Comments

@poppichicken
Copy link

poppichicken commented Nov 10, 2024

hi Marco.

Has BANKED been implemented on CPC?
This doesn't compile:

 BITMAP ENABLE(320,200,4)
 COLOR BORDER WHITE
 CLS BLACK
 DEFINE KEYBOARD ASYNC

 player:=LOAD IMAGE("image/airplane.png") BANKED

image

This makes sense if you're only targeting the 464 and 664 models, of course.

@spotlessmind1975 spotlessmind1975 added the enhancement New feature or request label Nov 10, 2024
@spotlessmind1975 spotlessmind1975 added the cpc Amstrad CPC 664 label Nov 10, 2024
@spotlessmind1975 spotlessmind1975 added this to the future milestone Nov 10, 2024
@spotlessmind1975
Copy link
Owner

Hi @poppichicken , and thank you for your bug report!

Support for memory expansions is not yet available on cpc, but is being implemented. The real problem, at the moment, would be to introduce data loading at startup. In fact, the current implementation on other targets requires that the memory expansion is loaded with data prepared by the compiler at startup. This step must be implemented to implement commands like LOAD IMAGE.

I convert this ticket.

@poppichicken
Copy link
Author

Ah, I see.
Thanks.

@spotlessmind1975 spotlessmind1975 changed the title BANKED question (CPC) Add support for BANKED on cpc Nov 10, 2024
@spotlessmind1975 spotlessmind1975 added the beta Candidate for BETA label Dec 15, 2024
@spotlessmind1975
Copy link
Owner

I am going to use the explanation here:
https://cpcrulez.fr/applications_util-bankrsx-amstrad_action.htm

@spotlessmind1975
Copy link
Owner

spotlessmind1975 commented Dec 15, 2024

From a first analysis, the main problem lies in the fact that the memory area for banking is located "in the middle" of the executable, in the range 0x4000 - 0x7fff. As of today, the executable can theoretically have 48895 bytes. Limiting the extension to the address 0x3fff, we would have an executable of a maximum of only 16127 bytes (and it would only be a gain for the 6128, because the 464/64 has nothing to bank switch with!). The code generator could be modified to move the data memory from address 0x8000 onwards, and move all the included libraries up.

In summary, it will be necessary to differentiate the generation of executables for 464/664 and 6128, so that the latter has a different generator of executables, capable of dislocating the memory differently, and thus leaving the identified window free.

Once this is done, a special routine at boot will load from disk into the (sequential) memory banks switched from time to time.

Qui di seguito lo pseudocodice individuato per il cambio dei banchi:

 #define crBANKSetC0( ) asm( "ld bc, $7f00 \n out (c), c \n ld a, $C0 \n out (c),a" );
 #define crBANKSetC4( ) asm( "ld bc, $7f00 \n out (c), c \n ld a, $C4 \n out (c),a" );
 #define crBANKSetC5( ) asm( "ld bc, $7f00 \n out (c), c \n ld a, $C5 \n out (c),a" );
 #define crBANKSetC6( ) asm( "ld bc, $7f00 \n out (c), c \n ld a, $C6 \n out (c),a" );
 #define crBANKSetC7( ) asm( "ld bc, $7f00 \n out (c), c \n ld a, $C7 \n out (c),a" );

@poppichicken
Copy link
Author

That all makes sense.
It will be a great feature.
:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta Candidate for BETA cpc Amstrad CPC 664 enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants