Programers can - with or without gotos (they have the knack); others can’t (they don’t). Then there are those who earn a living by programming, even if they can’t. The evidence suggests that there are millions of them. On balance, providing ways to program with less gotos probably makes the world a safer place. I did find thought provoking Dijkstra’s distinction between linear text and linear time.
But, I would note that c just hides the goto bit. Eg, a switch statement contains a series of label statement prefixed by 'case' ... not too different from if (XXX) goto YYY;
Louis;
Thanks for the -i suggestion. I think I cracked this last night simply by adding this to the cc ... line. I suspect I have not got the ld line quite right and hence some bus errors etc. But, -i is passed to the loader as below.
This allows for 20k of core such that I can run my toytown pdp8 c compiler ... works as well!
I have attached a zip with the simulator and 2 disk images ... OS/8 and 4K DMS.
under BSD build with:
cc pdp8.c -lcurses -ltermcap -i -o pdp8
NB This app assumes 16bit int. If you wish to try on 32/64 bit linux distro, the typeof(mem) should be unsigned short or uint16 or whatever and the pointer p in iot(...) should be short as well. Also, it is very old and very bad c .. don't use -Wall as it will burnout your terminal.
At the simulator '>' command prompt:
type b for boot
then r 30 for OS/8 or r 200 for 4K DMS.
type ^a to interrupt the simulation and x to exit.
Sorry for the lack of documentation as in 'good programmers don't do documentation or use goto's'
HP-calc is on the OS/8 disk as
HPC.BN. Don't bother trying to assemble
HPC.PA ... it works but takes forever.
Have fun, regards, Ian.