Is there (was there ever?) serious programming being done in machine code?

Oh yes, the systems were supported by assemblers at IBM, but they were not commonly used by the customers where i was resident.

By far the best (and only decent) discussion I have ever seen of C declarations, I found in the VAX C programming manual. It gave a full step-by-step procedure for building any arbitrarily complex declaration you want, and a separate procedure for comprehending any existing declaration written by someone else. If you wanted to declare a pointer to an array of pointers to functions returning float, you could. Or an array of pointers to arrays of functions returning pointers to a struct. Or whatever.

I made a copy, which I still have around somewhere. I’ll post some examples if I find it.

See, everywhere students learned Pascal as a “teaching language”, they came out as fully-indoctrinated Pascal fanatics who thought Pascal was God’s gift to the world and any other language was just the shitz. So instead of graduating from Pascal to a Real Programming Language, they insisted on bringing Pascal with them wherever they went. Then you got different implementations of Pascal everywhere, all of them with system-specific extensions, often including their ways of doing input/output, and none of them are portable any more. Same thing that happened with Algol.

This must have been a standard joke Wirth always told everywhere he went. Ed Post (author of Real Programmers Don’t Use Pascal, cited several posts above) quoted it also.

Gosh, yes. I had a copy of that too. It really was a godsend. DEC had some fabulously well written documentation. Especially compared to the dearth of anything useful from modern zillion dollar companies.

cdecl was pretty useful to check with, but didn’t give any clues about how to actually craft the declaration.

Yup. I have heard him make the same joke.

Three backticks ``` allows formatting of multiline blocks of code, e.g.,

function AuxInChar(Port: word): char;
    inline (
            $5A/
            $B4/$02/
            $CD/$14);

Not including the disassembled x86 instructions as comments seems like bad programming practice.

And the forum software is Discourse. Discord is for group chat.

Well, I can tell you that $5A is a POP (to get Port off the stack), and $CD $14 is (interrupt 14). Dunno what $B4 $02 is, but given the context (just before $CD $14), it’s MOV immediate: MOV AX 2 or MOV AH 2. My DOS book isn’t on the shelf here anymore.

TP3 and DOS says 1980’s, but that snip is actually from a TP7 program: somewhere along the line it was updated without re-writing. If it was native TP7 it wouldn’t even be ASM, it would be an INTR declaration.

I got bothered enough to disassemble the machine code myself.

0:  5a                      pop    edx
1:  b4 02                   mov    ah,0x2
3:  cd 14                   int    0x14

int 14 with AH=2 is a DOS call to read from AUX (i.e., COM1), so at least the function name reflects what’s going on in the code.

Turbo Pascal could already Read() and Write() from/to AUX so I’m not sure what was to be gained by writing inline code to do the same thing.

Oh! DX lets you set the port number so this allows you to read from other than COM1. I’m fairly sure there’s also a way to do that, but I’ve wasted enough time on this already.

With DOS you could access the parallel port directly with the port addresses 03BC, 0378 and 0278.

This was the normal way to do it. What TP did was provide the hooks so that Read and Write could be hooked into things that aren’t DOS text files or DOS random access files or DOS logical devices (AUX). The code that uses this ‘file driver’ just uses PASCAL ‘read’ and ‘write’.

What’s notable is that the other part of the code for this test machine doesn’t use ‘read’ and ‘write’ at all – it uses direct hardware access. Including serial I/O (using a different protocol) through a digital I/O card.

The chipset for PC serial I/O was well known and no more complex than the digital I/O card: this serial I/O part could have been written the same way as the other (using port addresses), avoiding ‘read’ and ‘write’ and the DOS serial I/O API. Or the other serial I/O could have been written this way: as a ‘file driver’ hiding the digital I/O card behind ‘read’ and ‘write’. The two sections were written by different people…

Yeah, I got the impression it was standard (and he used his last name only) but I heard it with my own ears, so my post is my cite. :stuck_out_tongue:

An example of the assembly language:
1969 Apollo 11 used these 30 lines of assembly language code to calculate transcendental functions for navigation | Tech News | Startups News (techstartups.com)

The navigation was handled in an interpreted language, with the interpreter running as a native program, so the code example may be from the interpreter.

This was Apollo 11 (first moon landing). I haven’t seen information about earlier iterations.

Not ‘serious’ programming, but Linus Torvalds talking about his Sinclair QL and writing his assembler in machine code, so that he could place it in ROM:
Linus Torvalds interviewed by Jeremy Allison - YouTube

As I probably said upthread (I’m not about to check) I wrote my first assembler in machine code since I had nothing else to write it in. It’s not all that hard if you grok the instruction set.