Page 2 of 2

Re: Sozobon C's a bit broken isn't it?

Posted: 24 Jan 2021 18:44
by thorsten.otto
stephen_usher wrote: 24 Jan 2021 16:58 It looks like all tests and arithmetic, even on pointers, is 16 bit only, and unsigned arithmetic seems to be sort of signed. That's rather broken.
Its not really broken. Its just that typeof(size_t) in this compiler is unsigned int (16bit). You have the same problem when using ancient DOS-compilers, when the pointers are also 16bit only. There you would not even be able to use far pointers for that, only Borland-C with _huge pointers will work.
Pure C is far too GUI for me
As already mentioned, there are also command line versions of the compiler, assembler and linker. There is even a commandline-tool that i wrote some time ago that can process a project-file, if you don't like make. https://github.com/th-otto/pcmake

Re: Sozobon C's a bit broken isn't it?

Posted: 24 Jan 2021 19:32
by rubber_jonnie
stephen_usher wrote: 24 Jan 2021 18:40 Yes, lines 8 & 9 should be:

Code: Select all

	unsigned char *addr = (unsigned char *) CARTSTART;
	unsigned char *endaddr = (unsigned char *) CARTEND;
Yep, no errors now, and it runs, but I don't get any output, which I did originally.

Re: Sozobon C's a bit broken isn't it?

Posted: 24 Jan 2021 20:49
by stephen_usher
The alternative to testing the whether the address is below the end of the cartridge port address range is to use a counter and test if that's less than the total, e.g.

Code: Select all

....
	unsigned long i;
....	
	for (i = 0; i < 0x20000L ; i++)
		printf("0x%02x\t", addr++);
....