Created
June 30, 2026 05:56
-
-
Save hed0rah/ab666b7c83bc644810bd9c03864ae2c9 to your computer and use it in GitHub Desktop.
MS-DOS VGA Video Register & Text Mode Corruption
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ============================================================================= | |
| MS-DOS VGA VIDEO HARDWARE & DIRECT MEMORY MANIPULATION | |
| ============================================================================= | |
| [1] BIOS INTERFACE FONT MISMATCHES (INT 10h) | |
| -------------------------------------------------------------------------------- | |
| Forces the VGA BIOS to map non-native physical ROM font heights into the active | |
| 16-pixel high text grid. Forcing mismatched metrics causes row duplication, | |
| truncation, and structural distortions. | |
| ; --- Skinny/Thorned Font (Map 7x14 Font into 16-pixel Grid) --- | |
| mov ax, 1101h ; Subfunction 11h: Load ROM 7x14 Font | |
| mov bx, 0000h ; BH = Font height (0=Default), BL = Font Block (0) | |
| int 10h ; Result: Truncates columns; leaves sharp, jagged serifs | |
| int 20h ; Terminate Program | |
| ; --- Row Doubling Font (Map 8x14 Font into 16-pixel Grid) --- | |
| mov ax, 1102h ; Subfunction 11h: Load ROM 8x14 Font | |
| mov bx, 0000h ; BH = Font height (0=Default), BL = Font Block (0) | |
| int 10h ; Result: Hardware duplicates bottom pixel rows to fill cell | |
| int 20h | |
| ; --- Squashed Faux-Gothic Font (Map 8x8 Font into 16-pixel Grid) --- | |
| mov ax, 1104h ; Subfunction 11h: Load ROM 8x8 Font | |
| mov bx, 0000h ; BH = Font height (0=Default), BL = Font Block (0) | |
| int 10h ; Result: Flattens font to top 8 pixels; lower half blank | |
| int 20h | |
| ; --- Split Block Character Map Selection --- | |
| mov ax, 1103h ; Subfunction 11h: Set Block Specifier | |
| mov bx, 0004h ; BL bitmask: Selects character map source blocks in Plane 2 | |
| int 10h ; Result: Cross-contaminates maps; injects glitch artifacts | |
| int 20h | |
| [2] HARDWARE PORT REGISTER MANIPULATION (CRTC / ATTRIBUTE CONTROLLER) | |
| -------------------------------------------------------------------------------- | |
| Bypasses the BIOS entirely to talk directly to VGA I/O ports. Manipulates | |
| horizontal pixel clocks, raster beam scanline timing, and column cell widths. | |
| ; --- Scanline Compression (CRTC Registers) --- | |
| mov dx, 03d4h ; DX = CRTC Controller Address Port | |
| mov al, 09h ; Index 09h: Maximum Scan Line Register | |
| out dx, al | |
| inc dx ; DX = CRTC Data Port (03d5h) | |
| mov al, 07h ; Force character cell to 7 pixels tall (Default = 15) | |
| out dx, al ; Result: Compresses active text block into sharp, tiny grid | |
| int 20h | |
| ; --- 9-Dot Stripping & Spacing Shift (Attribute Controller) --- | |
| mov dx, 03dah ; Status Register 1 (Reading resets 3C0h Address/Data flip-flop) | |
| in al, dx | |
| mov dx, 03c0h ; DX = Attribute Controller Port | |
| mov al, 10h ; Index 10h: Attribute Mode Control Register | |
| out dx, al | |
| mov al, 00h ; Clear Bit 0 (Graphics Mode) & Bit 2 (Line Graphics Enable) | |
| out dx, al ; Result: Slices 9th column padding; horizontal text squish | |
| int 20h | |
| [3] DIRECT VIDEO MEMORY MANIPULATION (Segment B800h) | |
| -------------------------------------------------------------------------------- | |
| Bypasses both BIOS and video hardware logic by writing directly to screen RAM. | |
| VGA Text Mode maps memory sequentially as alternating pairs: [Character, Attribute]. | |
| ; --- Screen Character/Attribute Flood Loop --- | |
| mov ax, b800h ; Segment B800h = Color Text Video Memory Address | |
| mov es, ax | |
| mov di, 0000h ; DI = Top-left corner offset of screen | |
| mov cx, 07d0h ; CX = 2000 loops (80 columns x 25 rows = 4000 bytes) | |
| mov ax, 8a8ah ; AH = Attribute (8Ah = Blinking Light Green), AL = Char (8Ah) | |
| rep stosw ; Blast AX into ES:DI, incrementing DI automatically | |
| int 20h ; Result: Instant fullscreen matrix-style textured glitch wall | |
| ; --- Flash-Overwriting Character Bytes Only --- | |
| mov ax, b800h ; Point ES to video RAM segment | |
| mov es, ax | |
| mov di, 0000h ; Start at top-left | |
| mov cx, 07d0h ; Target entire screen | |
| mov al, b0h ; AL = Shading character (░ Block) | |
| @loop: | |
| mov es:[di], al ; Overwrite character byte | |
| add di, 2 ; Skip the next byte (preserves existing color attribute) | |
| loop @loop | |
| int 20h | |
| [4] RESTORE / CLEAN RESET OVERRIDE | |
| -------------------------------------------------------------------------------- | |
| Flushes custom register tables, terminates text distortions, reinitializes the | |
| standard 8x16 font array from ROM, and blanks screen back to plain Mode 3. | |
| ; --- Absolute Mode 3 Reinitialization --- | |
| mov ax, 0003h ; AH = 00h (Set Video Mode Subfunction), AL = 03h (80x25 Text) | |
| int 10h ; Triggers clean hardware state restore | |
| int 20h | |
| ================================================================================ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment