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

General Discussion, STOS.

Moderator: troed

User avatar
thorsten.otto
Posts: 148
Joined: Mon Nov 04, 2019 2:20 am

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

Post by thorsten.otto »

stephen_usher wrote: Sun Jan 24, 2021 4:58 pm 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
User avatar
rubber_jonnie
Site Admin
Site Admin
Posts: 10462
Joined: Thu Aug 17, 2017 7:40 pm
Location: Essex
Contact:

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

Post by rubber_jonnie »

stephen_usher wrote: Sun Jan 24, 2021 6:40 pm 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.
Collector of many retro things!
800XL and 65XE both with Ultimate1MB,VBXL/XE & PokeyMax, SIDE3, SDrive Max, 2x 1010 cassette, 2x 1050 one with Happy mod, 3x 2600 Jr, 7800 and Lynx II
Approx 20 STs, including a 520 STM, 520 STFMs, 3x Mega ST, MSTE & 2x 32 Mhz boosted STEs
Plus the rest, totalling around 50 machines including a QL, 3x BBC Model B, Electron, Spectrums, ZX81 etc...
User avatar
stephen_usher
Posts: 5578
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

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

Post 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++);
....
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
Post Reply

Return to “SOFTWARE”