Skip to content

Instantly share code, notes, and snippets.

@tuttlem
tuttlem / gist:4168963
Created November 29, 2012 13:14
modex - 400x300
tweak_400x300:
; --------------------------
; 400x300
;
; pages = 2
; line size = 100
; page size = 120000
; --------------------------
outp 03d4h, 011h
@tuttlem
tuttlem / gist:4168969
Created November 29, 2012 13:15
modex - setmcga
set_mcga:
mov ax, 0013h
int 10h
ret
@tuttlem
tuttlem / gist:4172261
Created November 29, 2012 22:14
plasmas - generate costab
#include <stdio.h>
#include <math.h>
#define PI_BY_2 (3.14159f * 2)
int main(int argc, char *argv[]) {
int theta = 0, count = 0, count2 = 0;
unsigned char values[256];
@tuttlem
tuttlem / gist:4175519
Created November 30, 2012 12:36
plasma - frame
plasma_frame:
; jump over the local variables
jmp plasma_frame_code
temp_phase_1 DB 0
temp_phase_2 DB 0
temp_phase_3 DB 0
temp_phase_4 DB 0
@tuttlem
tuttlem / gist:4175531
Created November 30, 2012 12:41
plasma - move
move_plasma:
mov al, phase_1
add al, 2
mov phase_1, al
mov al, phase_2
add al, 1
mov phase_2, al
@tuttlem
tuttlem / gist:4180890
Created December 1, 2012 06:56
OpenGL2D - setup
/* first of all, we need to read the dimensions of the
display viewport. */
int viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
/* setup an orthographic matrix using the viewport
dimensions on the projection matrix */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, viewport[2], viewport[3], 0, -1, 1);
@tuttlem
tuttlem / gist:4180941
Created December 1, 2012 07:14
OpenGL2D - drawing
/* note that we're not clearing the depth buffer */
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
/* draw a triangle */
glBegin(GL_TRIANGLES);
glColor3ub(255, 0, 0);
@tuttlem
tuttlem / gist:4181270
Created December 1, 2012 09:25
Mandelbrot - frame
void mandelbrot_frame(double zoom, int max_iter, int xofs, int yofs) {
double zx = 0, zy = 0, cx = 0, cy = 0;
/* enumerate all of the rows */
for (int y = 0; y < 200; y ++) {
/* enumerate all of the columns */
for (int x = 0; x < 320; x ++) {
/* initialize step variables */
@tuttlem
tuttlem / gist:4182207
Created December 1, 2012 13:14
snow - random
get_random:
; start out with ax and bx = 0
xor ax, ax
xor bx, bx
; get the first random number and
; store it off in bl
mov dx, 40h
in al, dx
mov bl, al
@tuttlem
tuttlem / gist:4182214
Created December 1, 2012 13:18
snow - generate
no_kbhit:
; put a new snowflake at the top
; of the screen
call get_random
mov di, ax
mov byte ptr es:[di], 15
decend: