Direct Video Memory Access (text) Question
All right, I'm writing a few functions for fast text output in DOS. I'm using the pokeb function in order to write to memory B800:offset, so my line basically looks like this:
pokeb(B800,(y*screen_width)+(x*2),character);
pokeb(B800,(y*screen_width)+(x*2)+1,color);
(Actually I use shifting instead of multiplication but this is easier to understand)
Since the memory is linear the lines are automatically wrapped and the format of the memory is 0:[character], 1:[color], 2:[character], 3:[color],…
That's pretty simple and works fine. My question is as follows, while those two lines seem to be working fine for most computers, on others (my own for example) the start of the video memory is not B800:0 but B800:32. So with that I need to add 32 to the offset in order for the text to appear in the right place, otherwise if x is less then 32 and y is 0 the letters just don't appear. This seems to be machine specific because all of the computers at my school work fine with B800:0 and so do a number of other computers that I've tested this with, but as I've said before, my own computer needs for me to add 32 to the offset. Does anyone know why this is, and if there is a way to detect which setting is needed automatically without me having to create 2 versions of my program that uses this.