1. FAQ & Sequences & Text Mode & Far Pointers

Thanks Irv and Jiri.
Honestly I don't have time to go through the archives.
Oh I suppose I do, but that Intel file was 566 pages,
not 299 pages, and I have code to write and exams to
do etc. So...I'll try. I got the list.

A few days ago Doug Edmunds asked:
> Is there any difference (size, performance, etc.)
> between declaring a variable as an object and
> declaring it as a sequence, other than type checking?

Remember Euphoria stores the length of every sequence
seperately so the more sequences more memory used.
I created a compression algoritm and tried it on a
640 x 480  picture which created a sequence of 307200
two integer sequences + the original read_bitmap()
sequence + my drivers and euphoria returned:
Out of memory! Yet when I changed the algorithm to
a 614400 integer sequence it worked.
So be careful.

TEXT MODE GRAPHICS
Colour Text Memory starts at B8000 + the content
of 44E. Monochrome Memory starts at B0000.
It is made up by
CHARBYTE, COLORBYTE, CHARBYTE, COLORBYTE etc.
And COLORBYTE = FOREGROUND + BACKGROUND * 16.
Remember 44E is a far pointer.

So to change a characters colour to black
try something like this...

sequence val
atom at, row, col, color
atom offset

row = 2
col = 2
color = 7 + 0 * 16 -- WHITE + BLACK * 16
val = peek({44E,2})
offset = val[1] * #10 + val[2]
at = #B8000 + offset
at = at + (80 * (row -1) + col - 1) * 2
poke(at+1, color)

And to get a character and it's color...

sequence val
atom at, row, col
atom offset

row = 2
col = 2
val = peek({44E,2})
offset = val[1] * #10 + val[2]
at = #B8000 + offset
at = at + (80 * (row -1) + col - 1) * 2
val = peek({at+1,2})

A far pointer is 2 bytes, SEGMENT:OFFSET
so the actual address is
SEGMENT * #10 + OFFSET
or in euphoria

actual = floor(f_point/256) * #10 +
         remainder(f_point,256)

Have a nice day.

Sincerely,
Mathew Hounsell
Mat.Hounsell at mailexcite.com




Free web-based e-mail, Forever, From anywhere!
http://www.mailexcite.com

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu