Search found 287 matches

by jorgegv
Sat Mar 16, 2024 7:22 pm
Forum: Sinclair ZX
Topic: Bank 7 corruption while loading in Plus2A mode
Replies: 7
Views: 244

Re: Bank 7 corruption while loading in Plus2A mode

Just a little update on this one, for future reference: After I had done the changes indicated above before to my BASIC+ASM loader, I was still having sporadic crashes (but extrenely infrequent), due again to the same issue: corruption at 0xD200 in bank 7. The issue was extrenmely rare, but I manage...
by jorgegv
Thu Mar 14, 2024 9:27 am
Forum: Sinclair ZX
Topic: Compiler auxiliary functions above $C000
Replies: 3
Views: 58

Re: Compiler auxiliary functions above $C000

Thanks for your comments, Dom, your advice is greatly appreciated, as usual. I've got to ask - why newlib? Is there something missing in classic that you need? It's just a matter of opportunity. RAGE1 started some 3 years ago as a SDCC+Newlib project, then I added (handcrafted) banking support to it...
by jorgegv
Thu Mar 14, 2024 8:57 am
Forum: Sinclair ZX
Topic: Compiler auxiliary functions above $C000
Replies: 3
Views: 58

Re: Compiler auxiliary functions above $C000

Sorry, the compress_zx0 section should not probably be in that list
by jorgegv
Wed Mar 13, 2024 9:44 pm
Forum: Sinclair ZX
Topic: Compiler auxiliary functions above $C000
Replies: 3
Views: 58

Compiler auxiliary functions above $C000

G'night, I have stomped on something that took me a good while to debug. Context is a 128K game (banking in use), where the memory map is almost completely full. Compiler is SDCC and libc is Newlib. In that context, I have a function in memory below $C000, and that function calls a bank switching fu...
by jorgegv
Tue Feb 27, 2024 12:14 pm
Forum: Sinclair ZX
Topic: Bank 7 corruption while loading in Plus2A mode
Replies: 7
Views: 244

Re: Bank 7 corruption while loading in Plus2A mode

THat worked indeed! I added the following to my bankswitch routine: res 4,(iy+1) ; reset bit 4 of FLAGS to disable ; floppy motor check while loading ; (avoids data corruption in BANK7) And I also move my DI to be before the RES instruction, and now the corruption is no more! Thanks Dom, this was a ...
by jorgegv
Tue Feb 27, 2024 12:29 am
Forum: Sinclair ZX
Topic: Bank 7 corruption while loading in Plus2A mode
Replies: 7
Views: 244

Bank 7 corruption while loading in Plus2A mode

Hi guys, I have the following problem: A 128K game works fine in 128K/Plus2 mode, but crashes in Plus2A mode. The problem has been traced as a corruption of a single byte at position $D600 in Bank 7 (offset $2600 from $C000). The data in that address is compressed, this change makes it decompress in...
by jorgegv
Sun Feb 25, 2024 5:56 pm
Forum: Misc
Topic: switch jump table?
Replies: 6
Views: 187

Re: switch jump table?

Alternatively create 256 functions, stick their addresses in an array and dispatch on that. I do It this way in the Code that dispatches rule checks and actions in RAGE1. But to be space efficient, it's best that your switch values start at 0 and are contiguous (in RAGE1, they are). Oh, and one adv...
by jorgegv
Tue Feb 20, 2024 9:40 pm
Forum: Misc
Topic: Recommendation for declaring constants
Replies: 6
Views: 158

Re: Recommendation for declaring constants

I mean this:

Code: Select all

public _VAL8
defc _VAL8 = 0x25
And then:

Code: Select all

extern void *VAL8;
#define VAL8 (uint8_t)&VAL8
by jorgegv
Tue Feb 20, 2024 9:38 pm
Forum: Misc
Topic: Recommendation for declaring constants
Replies: 6
Views: 158

Re: Recommendation for declaring constants

It's the same pattern - we use this one in the library to pass link time values from the crt to the library. The generated code is the same as my previous example. ; Assembler file PUBLIC _SCRM_TEXT1 defc _SCRM_TEXT1 = 0x1000 // C file extern void screenmode(int); extern void *SCRM_TEXT1; #define S...
by jorgegv
Fri Feb 02, 2024 4:13 pm
Forum: Sinclair ZX
Topic: Issues when migrating to classic lib
Replies: 15
Views: 581

Re: Issues when migrating to classic lib

What about the stack? When I find unexpected resets, often the stack has some problem...
by jorgegv
Thu Feb 01, 2024 4:16 pm
Forum: Sinclair ZX
Topic: Issues when migrating to classic lib
Replies: 15
Views: 581

Re: Issues when migrating to classic lib

Yes, that the way It is used in the examples
by jorgegv
Thu Feb 01, 2024 3:19 pm
Forum: Sinclair ZX
Topic: Issues when migrating to classic lib
Replies: 15
Views: 581

Re: Issues when migrating to classic lib

What about this? https://github.com/z88dk/z88dk/wiki/Cla ... figuration

It's the way a custom heap is configured in the Classic SP1 examples...
by jorgegv
Thu Feb 01, 2024 3:13 pm
Forum: Sinclair ZX
Topic: Issues when migrating to classic lib
Replies: 15
Views: 581

Re: Issues when migrating to classic lib

Did you try the options in https://github.com/z88dk/z88dk/wiki/Classic--Pragmas? Admittedly, it seems not as versatile as in newlib, but...
by jorgegv
Wed Jan 31, 2024 8:33 pm
Forum: Sinclair ZX
Topic: Issues when migrating to classic lib
Replies: 15
Views: 581

Re: Issues when migrating to classic lib

PR merged and problem fixed, thanks @fraespre for detecting this one :-)
by jorgegv
Wed Jan 31, 2024 2:04 pm
Forum: Sinclair ZX
Topic: Issues when migrating to classic lib
Replies: 15
Views: 581

Re: Issues when migrating to classic lib

I think in newlib, the table is defined in config_private.inc and then exported via the CRT, so we just need a bit of magic to do the same thing for classic - take a look at the handling of CLIB_BANKING_STACK_SIZE in crt_rules.inc for guidance. Finally @fraespre found that there was a missing INCLU...
by jorgegv
Tue Jan 30, 2024 6:32 pm
Forum: Sinclair ZX
Topic: Issues when migrating to classic lib
Replies: 15
Views: 581

Re: Issues when migrating to classic lib

I can take on this one dom, It looks i'm the one to blame for It...
by jorgegv
Tue Jan 30, 2024 5:16 pm
Forum: Sinclair ZX
Topic: Issues when migrating to classic lib
Replies: 15
Views: 581

Re: Issues when migrating to classic lib

I see you are initializing sp1 without parameters but one of those params is used specifically for requestimng the rotation tables, so i guess the error regarding SP1V_ROTTBL is due to that. You should use the init params. I'm investigating the other errors, because the source for those functions wa...
by jorgegv
Mon Jan 29, 2024 6:18 pm
Forum: Sinclair ZX
Topic: Issues when migrating to classic lib
Replies: 15
Views: 581

Re: Issues when migrating to classic lib

Mmm can you try to compile the examples in directory libsrc/sprites/software/sp1/zx/examples with that same compiler line? The first two look like it's not finding them in the linking phase, but they should be there if you built sp1-zx correctly... And also try to compile the examples with the proid...
by jorgegv
Wed Jan 10, 2024 3:19 pm
Forum: Announcements
Topic: z88dk v2.3 released
Replies: 9
Views: 5658

Re: z88dk v2.3 released

My pleasure!
by jorgegv
Wed Jan 10, 2024 11:42 am
Forum: Other targets
Topic: Unexpected wrong overflow warning with SDCC
Replies: 3
Views: 603

Re: Unexpected wrong overflow warning with SDCC

The bug is still active in Z88DK nightly, which uses SDCC r14210, just tested.
by jorgegv
Wed Jan 10, 2024 11:06 am
Forum: Announcements
Topic: z88dk v2.3 released
Replies: 9
Views: 5658

Re: z88dk v2.3 released

In Fedora the needed package is gmp-devel
by jorgegv
Wed Jan 10, 2024 10:55 am
Forum: Other targets
Topic: Unexpected wrong overflow warning with SDCC
Replies: 3
Views: 603

Re: Unexpected wrong overflow warning with SDCC

Exactly this one: https://sourceforge.net/p/sdcc/bugs/2877/

Thanks for the pointer, Dom. Will live with it for the moment.
by jorgegv
Tue Jan 09, 2024 11:04 pm
Forum: Other targets
Topic: Unexpected wrong overflow warning with SDCC
Replies: 3
Views: 603

Unexpected wrong overflow warning with SDCC

With the following code: // zcc +zx -lndos test.c -create-app // zcc +zx -compiler=sdcc -lndos test.c -create-app #include <stdint.h> #include <stdio.h> struct test_s { uint16_t a; }; struct test_s test = { 128 * 256 }; // 32768 void main( void ) { printf( "test.a = %5u\n", test.a ); } Bot...
by jorgegv
Thu Jan 04, 2024 7:53 pm
Forum: Sinclair ZX
Topic: Detecting any key press?
Replies: 3
Views: 691

Re: Detecting any key press?

If you want to just wait until any key is pressed, you can just use in_wait_key() and in_wait_nokey() Since I regularly use these to wait until the user presses (and releases) any key, and sometimes the Code IS reached with a key already pressed, my normal Code sequence is: in_wait_nokey() in_wait_k...