<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hacker News: rep_lodsb</title><link>https://news.ycombinator.com/user?id=rep_lodsb</link><description>Hacker News RSS</description><docs>https://hnrss.org/</docs><generator>hnrss v2.1.1</generator><lastBuildDate>Sat, 04 Jul 2026 14:29:54 +0000</lastBuildDate><atom:link href="https://hnrss.org/user?id=rep_lodsb" rel="self" type="application/rss+xml"></atom:link><item><title><![CDATA[New comment by rep_lodsb in "Five monitors on a Commodore 128 [video]"]]></title><description><![CDATA[
<p>And for you that's reason enough not to watch his videos?<p>Fine, but I get the distinct impression you (and other people in your "camp") don't want anyone else to watch his content either, and that's why you're posting about it. You probably wouldn't do it if he was publicly supporting the legality of weed or gay marriage in his country?</p>
]]></description><pubDate>Wed, 24 Jun 2026 12:56:29 +0000</pubDate><link>https://news.ycombinator.com/item?id=48659028</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=48659028</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48659028</guid></item><item><title><![CDATA[New comment by rep_lodsb in "Five monitors on a Commodore 128 [video]"]]></title><description><![CDATA[
<p>16-color EGA and VGA had separate bitplanes, so writing 4 monochrome images would take the same time as a single one in color.</p>
]]></description><pubDate>Wed, 24 Jun 2026 12:39:11 +0000</pubDate><link>https://news.ycombinator.com/item?id=48658794</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=48658794</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48658794</guid></item><item><title><![CDATA[New comment by rep_lodsb in "8086 Segmented Memory was a good idea"]]></title><description><![CDATA[
<p>That's a limitation of the Turbo C library, as the comment says. DOS memory allocation functions take the size in 16-byte "paragraphs", and return a segment, with the allocated memory starting at offset zero in that segment.</p>
]]></description><pubDate>Tue, 23 Jun 2026 10:57:39 +0000</pubDate><link>https://news.ycombinator.com/item?id=48643109</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=48643109</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48643109</guid></item><item><title><![CDATA[New comment by rep_lodsb in "8086 Segmented Memory was a good idea"]]></title><description><![CDATA[
<p>A lot of that is just bloat that you wouldn't have had back then. But it could still be handled by an 8086, not by storing the raw HTML in memory at all, but parsing it as it loads. Each DOM node would be its own object with child pointers, with attributes and names all converted into binary numbers of (at most) 32 bits each.<p>64K of actual text content in a single node could be reached in some documents, but it's not <i>that</i> small, more than a chapter of a typical book.<p>What was always a problem for segmented memory was graphics, at least if you wanted higher resolution than 320x200 at 256 colors. But you could have a segment pointer to each row of pixels instead of an entire image, as long as it would still fit within 1 MB (16 MB in the 286 protected mode).</p>
]]></description><pubDate>Tue, 23 Jun 2026 10:44:11 +0000</pubDate><link>https://news.ycombinator.com/item?id=48642961</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=48642961</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48642961</guid></item><item><title><![CDATA[New comment by rep_lodsb in "80386 microcode disassembled"]]></title><description><![CDATA[
<p>Well, one indication is the value loaded into EDX on reset:<p><pre><code>    9B5 BIST1  -> TMPD    0x0303         PASS2
    9B6 SIGMA  -> EDX
    9B7 BIST2  -> TMPE    TMPD           XOR
    9B8 SIGMA             0x3ddc0c2c     XOR
    9B9 SIGMA  -> EAX     BOOTUP_JUMP    JFPUOK
</code></pre>
0x303 = family 3, model 0, stepping id 3.</p>
]]></description><pubDate>Sun, 24 May 2026 08:43:34 +0000</pubDate><link>https://news.ycombinator.com/item?id=48255651</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=48255651</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48255651</guid></item><item><title><![CDATA[New comment by rep_lodsb in "Building a UMatrix Replacement"]]></title><description><![CDATA[
<p>Maybe websites should work without loading megabytes of scripts from third-party servers? I think <i>that</i> should be disabled unless you opt-in.<p>Also browsers by default using a blocklist from some company, and showing a giant scary warning and contacting their server when the user <i>deliberately navigates to an URL</i> that is on that list. That should be opt-in as well, rather than something that just happens and is considered acceptable.</p>
]]></description><pubDate>Sat, 16 May 2026 20:59:56 +0000</pubDate><link>https://news.ycombinator.com/item?id=48163761</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=48163761</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48163761</guid></item><item><title><![CDATA[New comment by rep_lodsb in "Building a UMatrix Replacement"]]></title><description><![CDATA[
<p>Something like uMatrix should be built right into the browser, and the fact that this isn't the case really says it all about how it's not the "user agent" anymore. It's the one extension that's absolutely essential IMO -- no third-party connections at all by default, yes it breaks a lot of sites, but then you should ask yourself if the content was really worth reading in the first place!<p>Besides the blocking, being able to see at the click of a button what kind of crap most sites want to load is really eye opening. And they <i>would</i> do so completely silently if you're using a "normie" browser created or financially supported by the largest advertising company in the world.<p>Instead the mainstream gets "security features" like Safe Browsing, where it connects to a Google server every day without most people's consent or even knowledge, downloading a list of hashes of "bad stuff" to block. Like open source software to download videos from YouTube (yt-dlp), which it flags as malware. Of course the tinfoil hat conspiracy theory that it's also sending every URL you visit to their server isn't true -- only the ones that match a hash, "to check for false positives". It's easy to see how this mechanism <i>could</i> be abused to log who is visiting particular URLs of interest, without alerting the user to it happening. As far as I see it, you would just have to trust them when they super-double-pinky-swear they would never do this. And of course the TLAs wouldn't allow them to disclose it if something like this happened on their orders.</p>
]]></description><pubDate>Sat, 16 May 2026 17:55:44 +0000</pubDate><link>https://news.ycombinator.com/item?id=48162324</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=48162324</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48162324</guid></item><item><title><![CDATA[New comment by rep_lodsb in "I designed a nibble-oriented CPU in Verilog to build a scientific calculator"]]></title><description><![CDATA[
<p>Slight correction, the correct offset is 7, and DAA only adds 6. But the trick is also adding the carry bit. This works on the 6502 in decimal mode too, e.g. <a href="https://news.ycombinator.com/item?id=6342286">https://news.ycombinator.com/item?id=6342286</a><p>On the Z80 and 8086, the code can be made one byte shorter by taking advantage of adjust-after-subtraction, which the 8080 didn't have (and on 6502 worked differently):<p><pre><code>    CP   10      / CMP  AL,10      ;set carry if valid decimal digit
    SBC  A,69H   / SBB  AL,69H     ;0..9 => 96h..9Fh (auxC=1), 10..15 => A1h..A6h (auxC=0)
    DAA          / DAS             ;subtract 66h if auxC set, 60h if clear</code></pre></p>
]]></description><pubDate>Sat, 16 May 2026 11:33:57 +0000</pubDate><link>https://news.ycombinator.com/item?id=48159225</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=48159225</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48159225</guid></item><item><title><![CDATA[New comment by rep_lodsb in "A desktop made for one"]]></title><description><![CDATA[
<p>I know this comment will get ignored by the true believers, and likely pasted directly into Claude by the author in order to "further improve" the code, but here's some small excerpts from the terminal emulator (glass.asm, 19360 lines, 555 KiB):<p><pre><code>    cmp dword [rax], 'XAUT'
    jne .rxa_next
    cmp dword [rax+4], 'HORI'
    jne .rxa_next
    cmp word [rax+8], 'TY'
    jne .rxa_next
    cmp byte [rax+10], '='
    jne .rxa_next
    ; Found XAUTHORITY=path
</code></pre>
Okay, this is setup code that only runs once at startup - but that would be a reason to optimize it for size and/or readability! REPE CMPSB exists, and may not be the fastest, but certainly the most compact and idiomatic way to compare strings. Or write a subroutine to do it!<p>This pattern is used <i>everywhere</i> for copying or comparing strings, this was just one example of it.<p>There's a state variable that's used to keep track of whether the input is text to be displayed or part of a control sequence. It's a full 64 bits, probably not because we need 18 quintillion states? Here's how it is evaluated:<p><pre><code>    ; Dispatch based on state
    mov rcx, [vt_state]
    cmp rcx, VT_ESC
    je .vtp_esc
    cmp rcx, VT_CSI
    je .vtp_csi
    cmp rcx, VT_CSI_PARAM
    ...
</code></pre>
In total, there are 7 compares + conditional jumps, one after another. Compilers would generate a jump table for this, and a better option in assembly might be to make vt_state a pointer to the label we want to go to. Branch predictors nowadays can handle indirect jumps, and may actually have more trouble with such tightly clustered conditionals as seen in this code.<p>This code is on the "slow" path, there's a faster one for 7-bit ASCII outside of control sequences, with a lengthy comment by Claude at the top on how it optimized this. Even this one starts with a bunch of conditionals though:<p><pre><code>    cmp qword [vt_state], 0            ; VT_NORMAL == 0
    jne .vtp_loop_slow
    cmp dword [utf8_remaining], 0
    jne .vtp_loop_slow
    cmp byte [pending_wrap], 0
    jne .vtp_loop_slow
</code></pre>
These could likely all be condensed into a single test or indirect jump via the state variable, by introducing just a few more states for UTF-8 decoding and wrap. Following this, here's a "useless use of TEST" (the subtraction already set the flags):<p><pre><code>    mov rbx, [grid_cols]
    sub rbx, [cursor_col]              ; rbx = cells left on this row
    test rbx, rbx
    jle .vtp_loop_slow                 ; no room (or already past)
</code></pre>
This also again shows the compulsive use of 64-bit registers and variables for values that should never be this big. It's not the "natural" data size on x86-64 at all, every such instruction requires an extra prefix byte.<p>I freely confess that I'm a "Luddite", and was explicitly looking for bad (and obviously so) code, but this took me just a few minutes of scrolling through the nearly 20K lines in this file, so it should be somewhat representative of the whole.</p>
]]></description><pubDate>Mon, 04 May 2026 13:12:05 +0000</pubDate><link>https://news.ycombinator.com/item?id=48008299</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=48008299</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48008299</guid></item><item><title><![CDATA[New comment by rep_lodsb in "Why are there both TMP and TEMP environment variables? (2015)"]]></title><description><![CDATA[
<p>Fun fact: "/dev/nul" (with only one L) would have worked, even if there is no directory with that name.<p>That's been a feature since DOS 2.0, there was even an undocumented option AVAILDEV to make the prefix mandatory, instead of having device names present everywhere. But it broke the common trick used to detect if a directory exists ("if exist c:\some\path\nul").</p>
]]></description><pubDate>Sat, 02 May 2026 11:35:49 +0000</pubDate><link>https://news.ycombinator.com/item?id=47985485</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=47985485</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47985485</guid></item><item><title><![CDATA[New comment by rep_lodsb in "Microsoft open sources DOS 1.00 on 45th anniversary"]]></title><description><![CDATA[
<p>Last I checked, it's still mostly unusable, especially on real hardware (both modern and Win2k-era). Not saying this because I have anything against it, that's just a fact.<p>Of course one could say that Windows 11 provides negative value, in which case running DOS 1.00 would also be better ;)</p>
]]></description><pubDate>Thu, 30 Apr 2026 15:01:44 +0000</pubDate><link>https://news.ycombinator.com/item?id=47963579</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=47963579</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47963579</guid></item><item><title><![CDATA[New comment by rep_lodsb in "GitHub – DOS 1.0: Transcription of Tim Paterson's DOS Printouts"]]></title><description><![CDATA[
<p>The original code using ROL <i>should</i> have been correct? As I see it, what is needed is a rotation <i>without</i> involving the carry flag, and the fix emulates that by RCL'ing the two bits separately, giving the same effect on the RELOC variable.<p>This may actually have been a bug not in the code, but in the assembler used to build it. The 8080 had mnemonics ROL and ROR that rotated through carry, and RLC/RRC (standing for "rotate <i>circular</i>", not "through carry"). Opposite meaning of the 8086 mnemonics! So I suspect this may have been switched up in the assembler, especially if it was running on an 8080 machine and developed by someone more familiar with its instruction set.<p>The STORE bug would have prevented using files over the size of <i>512 bytes</i>, not just 64K. It's dividing by the sector size, and if DX was greater than that, it would have caused a "divide overflow" exception, since the result wouldn't fit in 16 bits.<p>(Also, by the Laws of Robotics you have to tell me if you're an LLM, or used one to generate this comment.)<p><i>EDIT:</i> not an assembler bug, it seems. The printed listing shows that it produced the correct opcode for ROL (RCL would be D1 D1):<p><pre><code>    0A28 8A 0E D4 1B           1353  MOV CL,[RELOC]
    0A2C D1 C1                 1354  ROL CX
    0A2E D1 C1                 1355  ROL CX
    0A30 88 0E D4 1B           1356  MOV [RELOC],CL
</code></pre>
So I don't know why this version of the code wouldn't have worked. Maybe the penciled-in "fix" was to free up CL for some other purpose?</p>
]]></description><pubDate>Thu, 30 Apr 2026 09:56:55 +0000</pubDate><link>https://news.ycombinator.com/item?id=47960268</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=47960268</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47960268</guid></item><item><title><![CDATA[New comment by rep_lodsb in "Math Is Hard – OpenBSD Stories"]]></title><description><![CDATA[
<p>Division by zero is handled the same on x86, and also changed from "trap" to "fault" after the original 8086/8088. And despite what is often said about its variable-length instruction format, skipping over opcodes is pretty much trivial compared to VAX.<p>Early versions of Microsoft Flight Simulator included a handler for the divide exception, which adjusted the result to +/- "infinity" (for a 16-bit signed integer, 32767 or -32768). The rest of the code relied on this in order to work correctly, and it was more efficient to take advantage of the processor's microcode doing this check rather than coding it explicitly before every division.<p>So even if it doesn't make mathematical sense, being able to continue after this type of exception is a useful feature to have.<p>>(and if you ignore SIGSEGV, it is considered perfectly acceptable that your program spins in a SIGSEGV loop until you kill it.)<p>This, on the other hand, shouldn't ever be acceptable. If a fatal-by-default signal is just ignored, it should always terminate the process.</p>
]]></description><pubDate>Sun, 26 Apr 2026 17:49:36 +0000</pubDate><link>https://news.ycombinator.com/item?id=47912257</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=47912257</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47912257</guid></item><item><title><![CDATA[New comment by rep_lodsb in "XOR'ing a register with itself is the idiom for zeroing it out. Why not sub?"]]></title><description><![CDATA[
<p>Most of mul/div was implemented in hardware since the 80186 (and the more or less compatible NEC V30 too). The microcode only loaded the operands into internal ALU registers, and did some final adjustment at the end. But it was still done as a sequence of single bit shifts with add/sub, taking one clock cycle per bit.</p>
]]></description><pubDate>Wed, 22 Apr 2026 20:58:04 +0000</pubDate><link>https://news.ycombinator.com/item?id=47869195</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=47869195</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47869195</guid></item><item><title><![CDATA[New comment by rep_lodsb in "Windows 9x Subsystem for Linux"]]></title><description><![CDATA[
<p>That's greatly oversimplified, or less generously, just flat out wrong. Win32 programs have always had their own isolated address space. That infamous BSOD is the result of <i>memory protection hardware</i> catching an access to something outside of that address space. When you open a DOS box, it uses the paging and V86 hardware mechanisms to <i>create a new virtual machine</i>, even though it shares some memory with the instance of DOS from which Windows was booted.<p>What Windows 9x didn't have was <i>security</i>. A program could interfere with these mechanisms, but usually only if it was designed to do that, not as a result of a random bug (if the entire machine crashed, it was usually because of a buggy driver).</p>
]]></description><pubDate>Wed, 22 Apr 2026 18:55:04 +0000</pubDate><link>https://news.ycombinator.com/item?id=47867727</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=47867727</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47867727</guid></item><item><title><![CDATA[New comment by rep_lodsb in "XOR'ing a register with itself is the idiom for zeroing it out. Why not sub?"]]></title><description><![CDATA[
<p>I don't doubt that this specific processor special-cased XOR (regardless of how it was called in the assembly language)!<p>Merely pointing out that where both operations were available, there seems to have been a preference to use SUB instead, with some continuity from early business-oriented mainframes, to the 360, to the PC.</p>
]]></description><pubDate>Wed, 22 Apr 2026 16:10:07 +0000</pubDate><link>https://news.ycombinator.com/item?id=47865646</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=47865646</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47865646</guid></item><item><title><![CDATA[New comment by rep_lodsb in "XOR'ing a register with itself is the idiom for zeroing it out. Why not sub?"]]></title><description><![CDATA[
<p>These two steps usually run in parallel though, with transistors to enable them depending on what operation should be performed.</p>
]]></description><pubDate>Wed, 22 Apr 2026 16:02:39 +0000</pubDate><link>https://news.ycombinator.com/item?id=47865555</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=47865555</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47865555</guid></item><item><title><![CDATA[New comment by rep_lodsb in "XOR'ing a register with itself is the idiom for zeroing it out. Why not sub?"]]></title><description><![CDATA[
<p>Some other architectures like PDP-11 and 680x0 had a dedicated "clear register" instruction.<p>It could have been added to x86, even as a group of single-byte opcodes with the register encoded in three bits (as with PUSH, POP, and INC/DEC outside of long mode). But the XOR idiom was already established on the 8080 by that point.</p>
]]></description><pubDate>Wed, 22 Apr 2026 15:31:51 +0000</pubDate><link>https://news.ycombinator.com/item?id=47865062</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=47865062</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47865062</guid></item><item><title><![CDATA[New comment by rep_lodsb in "XOR'ing a register with itself is the idiom for zeroing it out. Why not sub?"]]></title><description><![CDATA[
<p>Interesting, since the general culture at IBM seems to have preferred SUB over XOR -- their earlier business-oriented machines didn't even have a XOR instruction, and even on later ones the use of SUB has persisted, including in the IBM PC and AT BIOS.<p>(There was another, now deleted, comment somewhere in this thread that mentioned IBM's preference for SUB. Source of that statement was Claude, but it seems very likely to be correct. The BIOS code I've checked myself, lots of 'SUB AX,AX', no XOR)</p>
]]></description><pubDate>Wed, 22 Apr 2026 15:20:35 +0000</pubDate><link>https://news.ycombinator.com/item?id=47864902</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=47864902</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47864902</guid></item><item><title><![CDATA[New comment by rep_lodsb in "XOR'ing a register with itself is the idiom for zeroing it out. Why not sub?"]]></title><description><![CDATA[
<p>Comparing for equality can use either SUB or XOR: it sets the zero flag if (and only if) the two values are equal. That's why JE/JNE (jump if equal/not equal) is an alias for JZ/JNZ (jump if zero/not zero).<p>There's also the TEST instruction, which does a logical AND but without storing the result (like CMP does for SUB). This can be used to test specific bits.<p>Testing a single register for zero can be done in several ways, in addition to CMP with 0:<p><pre><code>    TEST AX,AX
    AND  AX,AX
    OR   AX,AX
    INC  AX    followed by DEC AX (or the other way around)
</code></pre>
The 8080/Z80 didn't have TEST, but the other three were all in common use. Particularly INC/DEC, since it worked with all registers instead of just the accumulator.<p>Also any arithmetic operation sets those flags, so you may not even need an explicit test. MOV doesn't set flags however, at least on x86 -- it does on some other architectures.</p>
]]></description><pubDate>Wed, 22 Apr 2026 15:02:04 +0000</pubDate><link>https://news.ycombinator.com/item?id=47864637</link><dc:creator>rep_lodsb</dc:creator><comments>https://news.ycombinator.com/item?id=47864637</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47864637</guid></item></channel></rss>