Image Map Image Map
No More Results
About neilobremski

Basic Information

Age
37
About neilobremski
Biography:
I started programming in GW-BASIC by copying and manipulating example listings given to me by a friend. I didn't have access to any books or other references so my initial education was trial and error alone. It was enough to hook me and now I find myself looking back fondly on those early days of struggle and excitement.
Location:
Seattle, USA
Interests:
Walking, Writing, Reading, Music
Occupation:
Computer Programmer

Signature


Statistics


Total Posts
Total Posts
50
Posts Per Day
0.17
General Information
Last Activity
July 20th, 2017 01:14 PM
Join Date
October 9th, 2016
Referrals
0
Home Page
http://gibdon.com/
View neilobremski's Blog

Recent Entries

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

by neilobremski on July 20th, 2017 at 01:14 PM
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

Read More

Categories
Asm

CGA Tiny Font (4x4)

by neilobremski on July 19th, 2017 at 08:38 AM
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.

Read More

Categories
Asm

CGA Text Blit

by neilobremski on July 18th, 2017 at 03:00 PM
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:


There were three functions

Read More

Categories
Asm

Variable FPS Animation with DDA

by neilobremski on July 13th, 2017 at 09:39 AM
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

Read More

Categories
Asm

IDIV and IMUL do not set Sign Flag

by neilobremski on July 10th, 2017 at 11:04 AM
Or more specifically:

The CF, OF, SF, ZF, AF, and PF flags are undefined.
What it comes down to is that you cannot safely jump (JS / JNS) based on a signed multiply or divide.

Code:
MOV AX, FF00	;
CWD		; DX:AX = -256
MOV BX, 0012	; BX = +18
IDIV	BX	;
JNS	$+4	; WRONG!
NEG	AX	; AX = ABS(DX:AX / BX)
The fix is to re-test the highest byte of the result (DH, AH or AL depending ...):

Code:
MOV AX, FF00	;

Read More

Updated July 11th, 2017 at 07:15 AM by neilobremski (Corrected mistakes identified by Krille)

Categories
Asm