Re: How does Pi get its t

-=> Dennis Lee Bieber wrote to All <=-

DLB> CP/M: single level; max drive 8M (larger drives are split DLB> into "logical drives")

CP/M must not have suffered from the MS-DOS limitation of 255 files in the root direcory. Or did it? And that's why they had to split larger drives.

DLB> LS-DOS/TRS-DOS6: DLB> single level directory; path names DLB> 8/3<.password>:<drv#>

DLB> would scan multiple drives to find file, and DLB> for DLB> output would skip write-protected drives to DLB> find DLB> first writable media (made it easy to use a DLB> write-protected system drive with writable data DLB> drive)

I noticed that with my TRS-80 Model 4P with FreHD. It didn't take me long to clone some of the hard drive images to make them for specific tasks (i.e. Deskmate, Games, FORTRAN, etc.) just to manage the files.

DLB> How much stuff could you fit on a 5-10 MB hard-drive... DLB> Granted, back then, the entire OS and support would fit on a 360kB (or DLB> less) floppy.

I remember moving from my floppy based PC to one with a 30 MB hard drive! It took me only a couple of hours to fill up the hard drive from floppies. Then I realized that I needed to start managing my data and decide what needed to be on the primary storage (hard drive) and secondary storage (floppies).

... Why get even, when you can get odd? ___ MultiMail/Linux v0.52

Reply to
Ron Lauzon
Loading thread data ...

The CP/M filesystem could only handle eight megabytes per drive. A CP/M directory entry is 32 bytes (files over 16K would use multiple directory entries - proper name extents - which cuts down the count). Most floppy formats used one track for the directory giving 64 entries in a 2K track - which was plenty for an 80K or even 160K floppy. I don't think there was any limit except that imposed by how much of the disc was allocated to directory entries which was an implemntors choice.

Reply to
Ahem A Rivet's Shot

On Tue, 15 Feb 2022 08:49:07 +1200, snipped-for-privacy@f383.n.z1.fidonet.org (Ron Lauzon) declaimed the following:

"A drive may contain up to 64k separate allocation blocks"; and the driver can be defined to use block sizes from 1kB to 16kB.

Even though I/O was based upon 128byte sectors, and file length is only known by the number of blocks allocated in the directory (text files need to be scanned to find the <EOF> marker).

Book doesn't mention any limit on directory entries (large /files/ toggle from the directory entry have block pointers to having "extent" pointers (to additional directory entries), with the extents having the actual block pointers.

No bit-map of block allocations, per se; each drive has to have the directory scanned to build up a table (in RAM) of which blocks are used/available.

Reply to
Dennis Lee Bieber

split DLB>

The CPM 2.2 Alteration Guide has a bit to say about this.

The number of directory entries depended on specific hardcoded values in the BIOS. The BIOS "Disk Parameter Table" described each attached disk drive with various parameters that included a "Disk Parameter Block" for each type of drive. The DPB contained a number of values, including # of sectors per track, and the "total number of directory entries which can be stored on this drive" (the DRM value), with the AL0 and AL1 allocation bitmaps defining where the (maximum 16) directory data blocks resided within the first sectors of the disk.

A typical disk drive (8" floppy disk, in this case) might have 26 sectors per track, with a total of 243 data blocks, and 64 directory entries. This, from the example BIOS code (for the Intellec "MDS-800" microcomputer development system) included in the Alteration Guide.

Reply to
Lew Pitcher

On a sunny day (Tue, 15 Feb 2022 15:58:46 +0000) it happened Ahem A Rivet's Shot snipped-for-privacy@eircom.net wrote in snipped-for-privacy@eircom.net:

Long time ago I only had a Sinclair ZX80 and then a ZX81. So I designed a floppy drive for it, an EPROM programmer, a ramdisk, and wanted to play with some CP/M software. So I wrote a CP/M clone in the holidays in Z80 asm running on the ZX81 system. Then I designed a CPU card with a Z80, serial output more stuff, modem...

formatting link
formatting link
formatting link
Had Software toolworks C80 C compiler running on it, and lots of fun stuff I wrote. Only supported the Kaypro2 disk format. In those days before the internet we had 'Viditel' here in the Netherlands, sort of a file exchange system over the phone, news etc.

In the later days part of my job was designing PCI cards for in the IBM PC (we worked closely with IBM) but I used my home build CP/M system for many years, I added an IBM keyboard and driver too :-)

Its easy!

Reply to
Jan Panteltje

Did you ever attempt to get WordStar running ? It gave us some trouble at Torch because it was using some undocumented bits (literally IIRC) in the directory entry and the reason CPN existed was because I felt quite ill when I saw the extent mechanism and decided it wasn't much harder to re-implement and make a decent filesystem than it was to port to the hybrid 6502/Z80 environment we had - nobody argued!

Reply to
Ahem A Rivet's Shot

On a sunny day (Tue, 15 Feb 2022 20:45:15 +0000) it happened Ahem A Rivet's Shot snipped-for-privacy@eircom.net wrote in snipped-for-privacy@eircom.net:

No, I mainly used it to write C code and some programs from what was it called ? "The CP/M user club' or something. The C compiler was great and I learned programming in C that way. At work I did a lot of asm programming for various micros like 8051 etc and that code was too much for the programming department that did mainly 8086 asm... So one day boss decided we should all learn C and program in C, we actually got a one hour lessen in C .. I was at an advantage :-)

Later I had a go at writing a multitasking OS for the Z80, it worked but memory limitations were too severe for practical use.

Then I finally bought a real IBM PC win 3.1 and trumpet winsock for the internet.

In 1998 I got a Linux CD with some magazine and installed SLS Linux on that PC. Have not been back, free C compiler gcc! What I missed was Free Agent in Linux, so I wrote NewsFleX:

formatting link
1999 or so...

And now all runs on Raspberries here, last time my PC was on was to adjust my satellite dish and do something with QO100 (ham satellite), not a very active ham here, Once something works I move to the next, 'the experience is the reward' as somebody has as sig in sci.electronics.design. So now I am playing with that pimoroni infrared FLIR camera module and some other stuff.

What helped me a lot in the early days was

formatting link
also had all the Z80 secret asm statements, Also had The C Programming Language by Ritchie & Kernighan, is a free download these days (google).

...

Reply to
Jan Panteltje

Yes, that, or (better choice these days) the second edition which covers ANSI C.

Another book which I think is helpful for almost any new programmer is "The Practice of Programming" by Kernighan and Pike. This shows how to write well-structured code with meaningful names that's easy to read, modify and debug. The book is really intended for new C programmers, but what it has to say about choosing function and variable names as well as designing (and commenting) programs so they are easy to maintain and is relevant to almost any programming language except the real oddballs like FORTH and APL.

This book, and the ideas in it, should work for almost any language though its written round C. It deals with topics that, IME, most books and courses that claim to teach a programming language should cover but don't and it shows, especially in some of the COBOL systems I've had to maintain in the past. The worst I think I ever saw was updated by one Ken Eagle, who called any numeric variables he added KENn and any strings EAGLEn and clearly didn't give a shit about anybody else who might have to maintain the code in future, hence you'd see lines in code he'd touched like:

ADD KEN15 TO KEN5 GIVING KEN9. MOVE KEN9 TO EAGLE2.

Reply to
Martin Gregorie

Holy shit. Legend! (And an asshole.)

Reply to
A. Dumas

That was back in the '70s, when there were some real chancers among some of the freelancers.

Another pair who stood out (this was on an (unnamed) large Civil Service project in Bath:

- One of them was well-known among the locally-based freelancers because none of them could remeber this gent actually finishing a project. His speciality was to put in lots of overtime and then quit abruptly just before system testing started. His 'completed' programs usually weren't.

- Another well-known member of that tribe was considered unlikely to know that, in a COBOL program, code in a paragraph defaults to falling through into the following one unless there's a explicit GO TO, STOP RUN or the paragraph is that last one in a PERFORMED SECTION or set of PERFORMED paragraphs.

We knew this because his programs always contained several sequences that looked like this..... i.e. were sprinkled with line pairs like lines 6 to 8 in the following:

LOOP-START. READ IN-FILE AT END GO TO LOOP_EXIT.

NOTE a set of moves, additions, PERFORMs etc GO TO LOOP-END.

LOOP-END. NOTE more code that completes the in-loop processing. GO TO LOOP-START.

LOOP_EXIT. ...

but at least his code usually worked....

Reply to
Martin Gregorie

On a sunny day (Wed, 16 Feb 2022 10:21:34 -0000 (UTC)) it happened Martin Gregorie snipped-for-privacy@mydomain.invalid wrote in <suij7d$raa$ snipped-for-privacy@dont-email.me:

Yes, it is absolutely essential to write clear code. For example now with my xflir code I use pieces of the Melexis library source for their camera in my code. They use printf("whatever")

I make a big distinction between fprintf(stderr and fprintf(stdout. One of the reasons is so that I can pipe the output from stdout of my programs via other cool programs to get much more done, For example this runs now in a test: xflir -f 20.0 -u 34.0 -j 2 -k 10 -l 27 -m 31 -r -p -w 1 -x -c 4 -y | ffmpeg -i - -vcodec libx264 -y test2.avi

I added yuv output, that format can be read by mplayer and ffmpeg, so makes it easy to make a compressed h264 avi uing ffmpeg. The other thing is that every function I write is like this: char *get_time_as_string(int short_format_flag, int ut_flag) { time_t now; char temp[1024]; struct tm *universal_time, *local_time; char *ptr;

if(verbose) { fprintf(stderr,\ "get_time_as_string(): arg short_format_flag=%d ut_flag=%d\n",\ short_format_flag, ut_flag); } ...code...

if there is a problem say a crash I can activate verbose level on the command line and see exactly where and with what parameters things went wrong (as it usually exits there). Or just comment out 'verbose' in the interesting part of code and see what happens. And the third thing is that all my functions return 0 for error, so I can write if(! this_big_function) { fprintf(stderr, "this_big_function failed, aborting.\n"); }

Nice if the function is a char* and returns a 0 pointer and the 'not' statement is logical in the thinking process.

And fourth there is indentation

for(x = 0; x < 10; x++) { do something }

Note where the brackets are

There is more of course, over the years you build up nice C collection of routines that have proven themselves to be reliable. So I usually do not need to link in big libraries. This only uses libc and libmath and the standard Xlibraries LIBRARY = -lXaw -lXext -lX11 -lXt -lm result: small file size, < 41 kB 40820 Feb 16 14:23 xflir

And then there is parameters, That FLIR camera has low resolution 24 x 32. So the Melexis code uses many times 24 and 32 but also 768 (is 24 x 32) and other funny numbers. Replaced all that by defines so I can easily upgrade to a higher resolution camera... This all works through to the size of the buffers, xbuffer etc.

There is more, better stop here.... ;-)

Reply to
Jan Panteltje

He had probably been unfairly castigated for buggering up someone's code in the past, so now simply ensured his changes were identifiable.

I generally find the better the coder the less obfuscated the code.,

REGEXPS are for wannabe geniuses who have learnt regexp but still cant write clean workmanlike code.

Nowadays with optimising compilers there is no excuse for a=(b? c:d);

when if(b) a=c; else a=d;

will probably compile to the same thing.

Reply to
The Natural Philosopher

Then you get onto C...

The trouble with C is that it allows "side-effects" which can cause some very obfuscated code which is perfectly legal - and is a nightmare to understand.

I saw some code of the form

array1[i++] = b; array2[--i] =c; array3[i++] = d;

What's wrong with the much simpler

array1[i] = b; array2[i] = c; array3[i++] = d;

or

array1[i] = b; array2[i] = c; array3[i] = d; i += 1;

What's the point of incrementing i after use for array1 if you are going to decrement it again before use to its original value for array2?

If I have to do anything "clever" to give extra efficiency, I tend to add a comment to say "this is a more efficient equivalent of <less efficient but more understandable code>".

As a matter of interest, are i++, i +=1 and i = i + 1 equally efficient for most compilers?

Reply to
NY

I'd say the opposite. Unless something has to be super-efficient I tend to take small nibbles at a problem because it is easy to understand the code and (more importantly) easier to understand what I was intending to achieve. Clever people try to show how clever they are by writing very obfuscated code which does in one line what takes several lines of more understandable and maintainable code. Having said that, is the cleverer, more efficient coder "better" if his code is harder to maintain?

I worked with one guy who had a quad-core brain at a time when the rest of us had single-core brains. And his C code was exceptionally efficient because he'd studied the source code of the compiler, but no-one else could understand what the F it was supposed to do. It was recommended that you never ask him a question, not because he'd tell you to F-off, but because he would answer your question in far more detail than you wanted, and then he'd go on to answer all the related questions that you might have asked him next.

He was a walking-lookup table of telephone STD codes and dashboard instruments in cars ("ah yes, 01423 is Harrogate, and if the subscriber's number starts with 61 it's in Woodlands whereas if it starts with 62 it's in Oatlands" or "ah yes, that speedometer was used in a Ford Cortina between

1962 and 1963, a Ford Corsair between 1963 and 1965 and a very similar one that was calibrated up to 100 rather than 90 mph was used in the Zephyr GT"). He apparently discovered a very obscure bug in a device driver (*) that was supplied with a third-party network card, fixed it and offered the fix (with his manager's approval) back to the card vendor so everyone else would benefit from it.

(*) Looking only at the EXE file, with no source code.

Reply to
NY

Kernighan and Ritchie have got a *lot* to answer for in promoting the indentation

if (a==b) { do something } else { do something }

or

for(x = 0; x < 10; x++) { do something }

I like my opening and closing braces to line up so I can count if I've got more opening than closing etc:

if (a==b) { do something } else { do something }

I've seen if statements written all on one line

if (a==b) a++; else { b++; c++ }

Which is legal - but tedious to try to read.

Reply to
NY

yes.

Modern compilers are better at writing assembler than I am.

If [i] is a register sized integer they will all result in INC AX or whatever.

It is also a toss up whether an ADD command will be used to add say 2 rather than a pair of INCs.

All the shorthand that C is capable of and was very useful in the days of impossible to use teletypes, and zero disk space is now equivalent to all the long winded but easy to understand analogs.

Reply to
The Natural Philosopher

No. And cleverness is a quality sought by not so clever people, and in the possession of people who don't need to show it off.

That is before the days of optimizing compilers then. I used to sometimes write like that with rubbish compilers

We have all done that. In fact I and a more hardware guy offered a fix to a hardware company who had supplied a peripheral card whose timings were clearly well out of spec. As evinced by the bug that showed up when using DMA to transfer data off a floppy disk.

Their response? 'No one else has reported any issues'

Sigh. Some people like to write good workmanlike code, other people have small penises and yet more just want to make money without doing any hard work.

I remember a woman who had worked on a certain hardware store that could tell you what thread any screw you showed her was instantly. "1/4" Whitworth" "3/16" UNC" and so on.

Reply to
The Natural Philosopher

My code always looks like that.

I cant read the other forms so fast

Reply to
The Natural Philosopher

x=(a==b)? a++: b++ + c++;

:-)

Then throw x away.

Reply to
The Natural Philosopher

Agreed - I hate reading code with opening and closing 'brackets' which are not on the same level, but I put the brackets on the same level as the introductory statement, e.g.

void function(int arg) { if (arg) { do_this(); } else { do_something_else(); } }

Reply to
Martin Gregorie

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.