5 ms·
Crazy that once upon a time just sequences of machine code were written to files, without any headers, or checksums, or basically any modern metadata. Just plai
by ivoras 4y ago
Crazy that once upon a time just sequences of machine code were written to files, without any headers, or checksums, or basically any modern metadata. Just plain machine code, to be directly fed into the CPU.
Cue lamentations of today's complexity mixed with feelings of life being great because of it.
- pizza234 4y agoYes, although this was for COM files only, which were limited to (64k - 0x100) bytes. EXEs didn't have this limitation, but they indeed had a header.
- WalterBright 4y agoFun fact. The COM file size was limited to 64K. The program size was not. Most COM memory models set CS=DS=SS=ES. However, the Zortech C compiler, would have CS set differently. CS pointed to the start of the code segment, DS to the start of the data segment. As long as the code segment plus the initialized data of the data segment was less than 64K, you could have a considerably larger runtime footprint (up to 128K) and still be a COM file with all near pointers.
- stkdump 4y agoActually, .com files can be larger. I don't know how exactly it was handled, but I distincly remember seeing versions of edit.com >64k
- andrewshadura 4y agoThey were .exe internally.
- WalterBright 4y agoI'm not sure when it started, but the .com and .exe extensions were ignored, and the loader looked at the first two bytes to see if it was "MZ" and was an exe file.
- sumtechguy 4y agoI like that every windows exe/dll still have the MZ on the front. Also a working DOS program there in the first hundred bytes which is pretty much a program to say 'hey run this in windows'. As the real windows header is 100 bytes in.
- teh_klev 4y agoThere was a technique that used a thing called overlays[0]. You could write a program that is much larger than the available address space (64k on MS/PCDOS) but you split it up into functional areas or modules that are loaded on demand into a reserved area of your 64k address space. [0]: https://en.wikipedia.org/wiki/Overlay_(programming) https://en.wikipedia.org/wiki/Overlay_(programming)
- Lt_Riza_Hawkeye 4y agoAnd before that, they were toggled directly into the machine using physical switches!
- deleted 4y ago[deleted]
- mikewarot 4y agoI first used toggle switches to input things into a PDP-11/?? I was trying to debug back in 1982 at Rose-Hulman. I next used them to toggle things into an IMSAI earlier this year... the PDP-11 had a better feel, but in both cases it really sucks.
- pjc50 4y agoIf you're programming a microcontroller, that time is now. (OK, so it'll often be the output of a C compiler, but there's usually some work to be done in asm to get the system in a state with a stack, clocks, RAM etc to run a C program!)
- 13of40 4y agoMS-DOS v1 didn't have an assembler in debug.exe (or was it .com?) so the only way to author machine code on a 5150 with no extra dev tools was to code it on paper, translate it by hand, and enter it in hex.
- susam 4y agoYou are right. It was DEBUG.COM. Indeed it did not have an assembler. It had a disassembler though. An archived copy from MS-DOS v1.25 can be found here: https://github.com/microsoft/MS-DOS/blob/master/v1.25/bin/DEBUG.COM https://github.com/microsoft/MS-DOS/blob/master/v1.25/bin/DE... C:\>DEBUG.COM -A ^ Error -N HELLO.COM -L -U 100 107 0340:0100 B409 MOV AH,09 0340:0102 BA0801 MOV DX,0108 0340:0105 CD21 INT 21 0340:0107 C3 RET - There is another copy of the debugger for MS-DOS v2.0 here: https://github.com/microsoft/MS-DOS/blob/master/v2.0/bin/DEBUG.COM https://github.com/microsoft/MS-DOS/blob/master/v2.0/bin/DEB... This one does does have an assembler. C:\>DEBUG.COM -A 0482:0100 MOV AH, 2 0482:0102 MOV DL, 41 0482:0104 INT 21 0482:0106 RET 0482:0107 -N A.COM -R CX CX 0000 :7 -W Writing 0007 bytes -Q C:\>A A C:\>
- WalterBright 4y agoHere's a one file disassembler for x86 and its successors: https://github.com/dlang/dmd/blob/master/compiler/src/dmd/backend/disasm86.d https://github.com/dlang/dmd/blob/master/compiler/src/dmd/ba... The fun thing to do with it is send it your name and have it disassemble it. (I use it to check the object code generated by the compiler. Instead of pretty-printing the instruction stream, it disassembles the binary object code. This helps to find mistakes in either the code generation or the disassembler, as they must match.) Anyhow, feel free to incorporate it into your obj file dumper, exe file dumper, debugger, or any tool that can benefit by examining code.
- deleted 4y ago[deleted]
- 6510 4y agoYou could load the 12 characters directly into the screen memory and make useful use of the meta data.
- yieldcrv 4y agoProgramming smart contracts is like writing to a bunch of distributed microcontrollers The limitations are similar and you can do assembly level coding
- londons_explore 4y agoAnd you frequently do do assembly level coding, either because you're cheap and need to eliminate every byte, or because you're trying to slap an 'accidental backdoor' on there to steal all your users coins...
- dist1ll 4y agoWell, DLTs are supposed to abstract away the distributed-ness. The execution layer usually provides computational primitives, basic memory and cryptographic functions. Not much distributed computing there.
- yieldcrv 4y agoits more similar to distributed microcontrollers by a matter of fact that the nodes don't allow much processing and there are many nodes that replicate the function. it is less similar to simply microcontrollers or simply distributed computing.
- Brian_K_White 4y agoOne of my favorite old bbs taglines was "Real programmers use copy con file.exe" Mighta been file.com. Mighta been real men.
- anjanb 4y agoI still create one liner batch files using copy con <batchfilename.bat>
- rep_lodsb 4y agoOn the PC you can enter pretty much any byte by holding Alt and typing the (decimal) value on the number pad. But here's a "Hello world" in plain ASCII, that works on two different CPU architectures (x86 and 8080): x)y'!B:)),DM!G@))p,T]l%)),@@@Hello, world!$XP5]A%=!P[PZ^V!wV!wX5.<(GV(gX534,!(GWr! My first version was shorter than 80 characters and "symmetrical" (same number of bytes before and after the string), but it didn't work on the 80486 and under DOSBox. The '486 needed an extra jump to clear the pipeline, and DOSBox didn't support the CP/M "CALL 5" interface.
- cestith 4y agoI don't have the code handy, but I once was hanging out with a buddy in an OS/2 lab at uni and used copy con to write a reboot COM program. I meant it to be a soft reboot, but it ended up being a simulated hard boot.
- grishka 4y agoYes but also multitasking is a very notable UX improvement, and virtual memory, its part that gives processes separate address spaces, makes sure that one buggy program won't bring the entire OS down with it. With OSes providing applications with more services (stuff DOS didn't have like a network stack, GUI, abstracted access to all kinds of complex hardware) you start wanting dynamic libraries, which are impossible to implement sanely without some kind of metadata in the executable.
- rrwo 4y agoIf I recall correctly, the COM (stands for something like "COre Memory image") file format is limited to 64k, and was intended to be loaded into the same memory location. It dates back to CP/M days.
- IncRnd 4y agoBefore that, on vax, COM files were text files that contained commands to execute.