REMINDER - Stay logged in for at least 2 hours a week to get whitelisted.
Also it helps build a picture where our "good traffic" is coming from for detection scripts.
:o)

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

General Discussion, STOS.
User avatar
thorsten.otto
Posts: 148
Joined: 04 Nov 2019 02:20

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

Post 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
User avatar
rubber_jonnie
Site Admin
Site Admin
Posts: 15027
Joined: 17 Aug 2017 19:40
Location: Essex

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

Post 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.
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
Site sponsor
Site sponsor
Posts: 7454
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

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.

Return to “SOFTWARE”

Who is online

Users browsing this forum: ClaudeBot and 8 guests