Image Map Image Map
View RSS Feed

Recent Blogs Posts

  1. C's itoa() in Assembler with mini-sprintf bonus

    I've been poking around for a quick way to convert 16-bit words into digit characters a la the itoa() function in C. [1] I thought and searched a lot around dividing by constants and clever ways of converting numbers to strings. In the end, I chose the K&R method as the base for my algorithm [2] which goes like this:

    1. Divide number by base (10).
    2. Write remainder as next digit (converting to ASCII by adding 30h).
    3. Use quotient as number and repeat loop if non-zero.
    4. Reverse
  2. CGA Tiny Font (4x4)

    In accordance with yesterday's entry on text rendering, I've now created the routine for a "tiny" font. What this does is take the 8x8 glyphs and compresses them into 4x4 squares by creating a sort of average brightness of each pixel based on the surrounding 4. The four distinct colors of CGA mode 4 (black, magenta, white, cyan) are thus used for brightness and the caller cannot specify the foreground or background colors of the text.

    Click image for larger version. 

Name:	tinyblit.jpg 
Views:	8 
Size:	8.2 KB 
ID:	39906
    Tags: assember, bios, cga, font, x86 Add / Edit Tags
  3. CGA Text Blit

    I went back and forth over whether or not to write my own text rendering routine in assembler. DOS supplies a decent print string function [1] but it turned out to be insufficient to my needs. My requirements include the ability to change color mid-stream as well as repeat lines of pixel data twice to create a "large" font. Here's a screenshot from a test of the C functions I created back in January:

    Click image for larger version. 

Name:	fonts-testcga.jpg 
Views:	9 
Size:	30.4 KB 
ID:	39886

    There were three functions ...
    Tags: bios, cga, x86 Add / Edit Tags
  4. PICKUPS 13: Video Games + Stuff | It's a Pixel THING - Ep. 122

    Let's take a look at 20 video games + related stuff that I managed to grab during the last 2 months! There's stuff for the PlayStation 4, PC, PlayStation 3, Xbox 360, PlayStation 2 and the original Xbox!

    PICKUPS 13: Video Games + Stuff | It's a Pixel THING - Ep. 122
  5. Variable FPS Animation with DDA

    I just finished writing some code to animate movement and turning. When initially planning to tackled this task I was going to make a lot of assumptions and fix the framerate regardless of the computer speed. This would mean that on fast-enough computers the animation would run as expected but on slower computers it would slow down. Of course, once I started down this path I immediately didn't like it and decided to delve into writing something that would adjust the FPS [1] depending on how much ...
    Tags: bresenham, math Add / Edit Tags
Page 1 of 99 123451151 ... LastLast