Skip to content

Instantly share code, notes, and snippets.

View neuro-sys's full-sized avatar
💭
💾

Fırat Salgür neuro-sys

💭
💾
View GitHub Profile
@neuro-sys
neuro-sys / sinusoidshit.c
Created May 3, 2011 15:04
sinusoid shit
#include <SDL/SDL.h>
#include <SDL/SDL_draw.h>
#include <stdio.h>
#include <math.h>
SDL_Surface* screen;
Uint8 *keys;
int done;
int main(int argc, char *argv[])
@neuro-sys
neuro-sys / BCD.java
Last active January 13, 2022 03:34
BCD Conversion in java
/*
* Copyright 2010 Firat Salgur
* Improved by Abdallah Abdelazim
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
@neuro-sys
neuro-sys / rayc.c
Created May 3, 2011 15:41
Raycaster: finding distance.
inline void ray(int i, float x, float y, float angle, float fisheye)
{ float fx = x - (int)x, fy = y - (int)y;
float xstep, ystep, xdist, ydist, xx, yy, xdistadd, ydistadd;
int xy, yx;
int xdir = (cos(angle)<0 ? 1 : 0), ydir = (sin(angle)<0 ? 1 : 0);
xstep = 1./tan(angle);
xx = x + (ydir ? fy*-xstep : (1-fy)*xstep);
xy = ydir ? (int)y : (int)y+1;
xdist = sqrt((xx-x)*(xx-x) + (xy-y)*(xy-y));
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <string.h>
#include "SDL.h"
#include "SDL_ttf.h"
#define WIDTH 1024
#define HEIGHT 600
@neuro-sys
neuro-sys / bit.c
Created May 3, 2011 15:50
bitwise unwise
void print_as_binary(unsigned int num)
{
unsigned int mask = (1 << 31);
int i;
for (i = 1; i <= 32; i++) {
printf("%d", (num & mask) ? 1 : 0);
mask >>= 1;
if (i % 4 == 0)
@neuro-sys
neuro-sys / plasmoid.c
Created May 3, 2011 15:53
old school plasma effect f'd
#include <allegro.h>
#include <math.h>
#include <time.h>
#define WIDTH 320
#define HEIGHT 240
int progress = 0;
int plasma1Thickness = 10, plasma2Thickness = 10, plasma3Thickness = 10;
@neuro-sys
neuro-sys / 8bitmul.asm
Created May 3, 2011 23:07
6502 multiplier
processor 6502
prod EQU $0380
multiplier EQU $0381
multiplicand EQU $0382
INCLUDE basic.rom
INCLUDE common.asm
+autoRun
@neuro-sys
neuro-sys / x86stuff.asm
Created May 6, 2011 18:26
x86stuff.asm
section .bss
intvar resw 1
section .text
global _start
_start:
push 2
@neuro-sys
neuro-sys / gol.c
Created June 14, 2011 19:46
game of life
#include <stdio.h>
#include <math.h>
#include <SDL/SDL.h>
#include <SDL/SDL_draw.h>
#define SCREEN_W 320
#define SCREEN_H 320
#define CELL_SIZ 10
@neuro-sys
neuro-sys / game_of_life.c
Created June 16, 2011 15:54
game of life
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <SDL/SDL.h>
#include <SDL/SDL_gfxPrimitives.h>
#include "main.h"
#include "isometric.h"