Skip to main content

Posts

Showing posts with the label C programming

Making CHIP-8 emulator in C

  Chip8 doc link | Components | Opcode Table GitHub - AdithyakrishnaV/Chip8_Emulator--Interpreter Contribute to AdithyakrishnaV/Chip8_Emulator--Interpreter development by creating an account on GitHub. github.com CHIP-8 programs are binary files, and your emulator must read them and operate on the bytes. You will also need a way to draw graphics to the screen and read keypresses. Many graphical libraries can do this for you or use something like SDL directly. CHIP-8 components Display 64 pixels wide and 32 pixels tall. Each pixel is a boolean value, or a bit; can be on or off (“off” pixel was just black, and “on” was white). We’ll use SDL for rendering: SDL initialization Not initialize:- returns -1  Error message is stored in SDL_GetError Initializing SDL if (SDL_Init(SDL_INIT_VIDEO)!= 0 ){ printf ( "SDL not initialized,%s\n" , SDL_GetError); exit (- 1 ); } Initialize display SDL_Window * window = SDL_CreateWindow ( "chip8" , SDL_WINDOWPOS_CENTERED , SDL_...

ALGORITHMS

  I’m making this for my quick reference for what I learned from the video series below and other sources. My C Playlist (In Malayalam): Time Complexity: Types of Time Functions: Time Complexities Cheat Sheet: Time Complexities of all Sorting Algorithms: Divide and Conquer: Recurrence Relation: Masters Theorem For Decreasing Functions: Masters Theorem For Division Functions: ROOT FUNCTION: Binary search Time Complexity: Iterative  method : Heap: (heap is a complete binary tree) Theoretically, index is taken from 1 to make I easy to explain but in programming the index is taken from 0. The positions are left blank to follow the rules. The 3rd binary tree is not a complete binary tree, because even if there is a single missing element in between when represented as an array it is not a complete binary tree(Note* Elements are filled from left to right in a binary tree). So 2nd one is a complete binary tree. Height of a binary tree: log n Min Heap & Max Heap: Inserting element...