Search found 2360 matches

by dom
Fri Feb 09, 2024 7:18 pm
Forum: Sinclair ZX
Topic: How to allocate a variable in a specific memory location
Replies: 12
Views: 287

Re: How to allocate a variable in a specific memory location

This is the first I've heard of someone wanting to place data at a particular address, the original intention behind the __at() syntax was I believe for access to system variables or data already existing in memory. However, it does look like data can be initialised and this should answer the questi...
by dom
Wed Feb 07, 2024 10:09 pm
Forum: Sinclair ZX
Topic: ZX81 Static Variables
Replies: 7
Views: 464

Re: ZX81 Static Variables

Can I ask then, is static void *sp[MAXSTACK] = {0}; a valid way to declare an ARRAY OF VOID POINTERS? If not, then how? That's a valid way to declare an array of void pointers and initialise them to NULL. For static variables, the {0} isn't that important (since without {0} the variable will end up...
by dom
Wed Feb 07, 2024 8:54 pm
Forum: Announcements
Topic: Forum registration
Replies: 0
Views: 224

Forum registration

It must be a year of elections... Unfortunately, one of the numerous Russian bot networks seems to have found us. I somehow don't expect them to be sharing interesting details about the design of the KR580VM80A As a result, forum registration might be disabled from time to time whilst I clean up the...
by dom
Thu Feb 01, 2024 5:04 pm
Forum: MSX, SVI, TMS99x8 and Sega Master System
Topic: How to display sprites on colecovision?
Replies: 2
Views: 303

Re: How to display sprites on colecovision?

There's examples in examples/msx/. ex4, ex6, ex7, ex8, ex9 all use sprites.
by dom
Thu Feb 01, 2024 4:57 pm
Forum: Sinclair ZX
Topic: Issues when migrating to classic lib
Replies: 15
Views: 581

Re: Issues when migrating to classic lib

So the code for classic should be (removing the noise):

Code: Select all

ld hl,__malloc_heap
ld bc,__heap_size
call asm_HeapAlloc
vs the following for newlib:

Code: Select all

ld hl,__malloc_block
ld bc,__heap_size
call asm_heap_init

by dom
Thu Feb 01, 2024 3:55 pm
Forum: Sinclair ZX
Topic: Issues when migrating to classic lib
Replies: 15
Views: 581

Re: Issues when migrating to classic lib

I think classic takes the address of a pointer to the heap start.
by dom
Tue Jan 30, 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

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 think in newlib, the table is defined in config_private.inc and then expor...
by dom
Fri Jan 26, 2024 9:58 pm
Forum: MSX, SVI, TMS99x8 and Sega Master System
Topic: Complete noob in need of help! (Colecovision programming)
Replies: 6
Views: 391

Re: Complete noob in need of help! (Colecovision programming)

I don’t want to completely discourage you but I think it’s probably best if you do one of the free online C courses before you start developing for the coleco. If you’re on windows download visual studio to do the courses - it’s a fantastic environment for developing and debugging. If you’re on Linu...
by dom
Thu Jan 25, 2024 4:30 pm
Forum: MSX, SVI, TMS99x8 and Sega Master System
Topic: Complete noob in need of help! (Colecovision programming)
Replies: 6
Views: 391

Re: Complete noob in need of help! (Colecovision programming)

The Coleco joypad is handled by the int joystick(int stick_nr) function in <games.h>. The lower 8 bits return the directions (bit set for each direction that's pressed): #define MOVE_RIGHT 1 #define MOVE_LEFT 2 #define MOVE_DOWN 4 #define MOVE_UP 8 #define MOVE_FIRE 16 #define MOVE_FIRE1 MOVE_FIRE #...
by dom
Thu Jan 25, 2024 8:37 am
Forum: Sinclair ZX
Topic: ZX81 Static Variables
Replies: 7
Views: 464

Re: ZX81 Static Variables

It looks like it's a bit of funky initialisation behaviour - you're initialising an array incorrectly and it's being turned into a pointer. You need the curly braces, however uninitialised global variables end up in bss anyway, so you don't need to initialise them unless you really want the arrays t...
by dom
Thu Jan 25, 2024 8:34 am
Forum: Bug reports
Topic: switch within switch
Replies: 6
Views: 510

Re: switch within switch

The nightly from today has a limit of 512 - hopefully that'll be enough!
by dom
Thu Jan 25, 2024 8:33 am
Forum: MSX, SVI, TMS99x8 and Sega Master System
Topic: How to play psg music on the colecovision/adam?
Replies: 12
Views: 651

Re: How to play psg music on the colecovision/adam?

If it's playing the example song then a step has been missed. So let's debug this - here's a walkthrough to solving the two most likely problems: First of all, remove any rom or .bin files from the directory. Recompile, is there a rom file there? If not, check that you're using the -create-app optio...
by dom
Wed Jan 24, 2024 8:39 pm
Forum: MSX, SVI, TMS99x8 and Sega Master System
Topic: How to play psg music on the colecovision/adam?
Replies: 12
Views: 651

Re: How to play psg music on the colecovision/adam?

Okay, if we've got the PSG file life is very easy. Using examples/sound/psglib for simplicity, copy the psg file into that directory. We now need to wrap the PSG file so that we can assemble it, so create the following file - let's call it mymusic.asm: SECTION rodata_user PUBLIC _mymusic _mymusic: B...
by dom
Wed Jan 24, 2024 4:53 pm
Forum: MSX, SVI, TMS99x8 and Sega Master System
Topic: How to play psg music on the colecovision/adam?
Replies: 12
Views: 651

Re: How to play psg music on the colecovision/adam?

The wiki page for audio is here: https://github.com/z88dk/z88dk/wiki/Classic-Audio The coleco has an SN PSG so only psglib is available. Thankfully that’s widely used by SMS devs so there’s a lot of resources available. As long as whatever tracker you use supports exporting to VGM format you can use...
by dom
Wed Jan 24, 2024 10:45 am
Forum: MSX, SVI, TMS99x8 and Sega Master System
Topic: How to play psg music on the colecovision/adam?
Replies: 12
Views: 651

Re: How to play psg music on the colecovision/adam?

As plug and play as you can get: https://github.com/z88dk/z88dk/blob/mas ... /main.c#L8

That will generate a ROM which you can then load.
by dom
Wed Jan 24, 2024 10:25 am
Forum: MSX, SVI, TMS99x8 and Sega Master System
Topic: How to play psg music on the colecovision/adam?
Replies: 12
Views: 651

Re: How to play psg music on the colecovision/adam?

There's an example using PSGlib here: https://github.com/z88dk/z88dk/tree/mas ... und/psglib which seems to be the usual player for the SN chips.

I'm not sure how to get furnace to export in an appropriate format, but there's tools like mod2psg which could be used.
by dom
Wed Jan 24, 2024 9:22 am
Forum: Bug reports
Topic: switch within switch
Replies: 6
Views: 510

Re: switch within switch

Sorry, I was far too tired last night so I didn't reply. There's a limit of 256 case statements that can be pending - I'm not sure how you did it with an i4004 instruction set, but that's likely the problem. I can raise the limit, but in the mean time you can work around it by putting the second lev...
by dom
Tue Jan 23, 2024 10:12 am
Forum: Sinclair ZX
Topic: ZX81 Line Editing with getchar
Replies: 2
Views: 388

Re: ZX81 Line Editing with getchar

fgets_cons(char *buf, size_t len) provides the ability to enter a line and erase characters.
by dom
Sat Jan 20, 2024 10:45 pm
Forum: Sinclair ZX
Topic: sp1 in contended memory
Replies: 2
Views: 496

Re: sp1 in contended memory

From that code_threads_mutex at the bottom I think you're using newlib? The section order is defined by target/crt_memory_model_z80.inc, there's this bit in there: section code_driver section code_font section code_clib include "../../clib_code.inc" section code_lib section code_compiler T...
by dom
Sat Jan 20, 2024 10:37 pm
Forum: Misc
Topic: Multi-Dimensional array declaration not compiling anymore
Replies: 2
Views: 497

Re: Multi-Dimensional array declaration not compiling anymore

I can't pinpoint when the change happened, but it's actually consistent with other compilers: dom@ermintrude z88dk % zcc +test arr.c -compiler=sccz80 arr.c:1:40: fatal error: Must specify array dimension of type: const unsigned char [] Compilation aborted dom@ermintrude z88dk % zcc +test arr.c -comp...
by dom
Thu Jan 18, 2024 9:50 pm
Forum: Announcements
Topic: z88dk v2.3 released
Replies: 9
Views: 5659

Re: z88dk v2.3 released

The compilers and libraries only support z80 mode, however access to more than 64k of data is available using either named address spaces or __far pointers. As a result +agon binaries are, as indicated on the wiki, ADL=0 compilations. Both the assembler (z88dk-z80asm) and disassembler (z88dk-dis) su...
by dom
Tue Jan 16, 2024 11:18 pm
Forum: Sinclair ZX
Topic: +zx screen printing
Replies: 1
Views: 475

Re: +zx screen printing

[I've split this off since this from the previous topic since this about +zx rather than +zx81] It looks like you're using VT52 escape sequences but compiling using the VT100 driver. If you compile with: zcc +zx [file.c] -lndos and make one small change indicated below (removing the commas) it will ...
by dom
Tue Jan 16, 2024 11:05 am
Forum: Sinclair ZX
Topic: +zx81 Noob Question About Libraries
Replies: 16
Views: 2201

Re: Noob Question About Libraries

You'll have to join all the pieces together yourself, but some pointers: z88dk/classic has an sdcard library originally used for +osca: https://github.com/z88dk/z88dk/tree/master/libsrc/sdcard @feilipu has a bunch of libraries which are worth looking at: https://github.com/feilipu/z88dk-libraries/tr...
by dom
Sun Jan 14, 2024 9:16 pm
Forum: Sinclair ZX
Topic: Help with variadic function / va_list
Replies: 2
Views: 512

Re: Help with variadic function / va_list

sdcc is sane in va-args handling so you don't need to worry about too much. However, try this:

Code: Select all

            text_token_print( (uint8_t) va_arg(ptr, uint16_t) );
It looks like variadic arguments aren't packed onto the stack