Skip to content

Instantly share code, notes, and snippets.

View lardratboy's full-sized avatar

Brad P. Taylor lardratboy

View GitHub Profile
@juj
juj / 60hz.cpp
Created January 11, 2023 20:54
How to reprogram VGA registers to a 320x200@60hz mode with either square pixels or 5:6 pixels.
// License: public domain.
#include <dos.h>
#include <conio.h>
void set_video_mode(int mode)
{
union REGS regs;
regs.x.ax = mode;
int86(0x10, &regs, &regs);
@paniq
paniq / minmaxabssign.txt
Last active November 8, 2024 13:39
useful min/max/abs/sign identities
max(-x,-y) = -min(x,y)
min(-x,-y) = -max(x,y)
abs(x) = abs(-x)
abs(x) = max(x,-x) = -min(x,-x)
abs(x*a) = if (a >= 0) abs(x)*a
(a < 0) -abs(x)*a
// basically any commutative operation
min(x,y) + max(x,y) = x + y