Image Map Image Map
View RSS Feed

All Blog Entries

  1. Seeding Randomness with a String

    Random numbers are great but sometimes you want them to be consistently random (an oxymoron!) so that you can rely on their pattern being the same. For example, in Magenta's Maze everything is generated from random numbers that are seeded by the spell name. This is a string which is boiled down to an integer that is used to reset the pseudo-random number generator. Thus, the level generated for a certain string is always the same even across computers and time.

    In the first version, ...
  2. RAND() in Assembler

    The puzzles of Magenta's Maze are generated using the barely sufficient rand() function supplied by MSC 5.1. There are some issues with this, most notably that the highest bit of the 16-bit word output is always zero. The way we C programmers were taught to use this function was to modulus the result by the maximum amount desired thus providing 0 to N - 1 (where N is the maximum). This is unfortunately how Magenta's Maze uses it to place objects within the map and rotate the magic circles.
    Tags: assembler, debug, math, x86 Add / Edit Tags
  3. VINTAGE FLYERS from COMMODORE [1990] | It's a Pixel THING - Ep. 123

    This week I'll be showcasing some vintage flyers from the Amiga and Personal Computer families from Commodore that were being commercialized around 1990.

    VINTAGE FLYERS from COMMODORE [1990] | It's a Pixel THING - Ep. 123
  4. 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
  5. 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.

    Tags: assember, bios, cga, font, x86 Add / Edit Tags
Page 7 of 105 FirstFirst ... 345678910111757 ... LastLast