1. Virtual Graphics Library (in the works)

I am creating a graphics library that uses virtual pages in memory.  I
am making this because I don't like the ones I've seen (no offense or
anything...).  But i have just this one problem...the routine i use to
put the virtual info onto the screen causes the program to lock up or
give a message telling you to 'quit all programs and reboot your
computer' (I'm testing on Win95).  Here's a demo program that shows the
style I'm using...please either point me in the right direction or
email me a copy that is correct.

I APOLOGIZE BEFORHAND FOR MY SLOPPY PROGRAMMING, THIS IS HOW THINGS
LOOK BEFORE I NEATEN THEM UP.

TEST.EX:

include machine.e
constant img=repeat(repeat(15,640),480)
--the above line makes a 640x480 BRIGHT_WHITE rectangle
atom mem,mem2
mem=allocate(480*640) --make buffer in memory
mem2=mem --this will be used later...
include graphics.e
if graphics_mode(18) then end if --put to 640x480x16
for y=1 to 480 do
     for x=1 to 640 do
          poke(mem2,img[y][x]) --poke pixels in one at
          mem2=mem2+1          --a time
          --move further into memory
     end for
end for
mem_copy(#A0000,mem,640*480)--put stuff from memory to
                            --screen. (visible)
include get.e
if wait_key() then end if --wait for keypress
free(mem) --free allocated memory
if graphics_mode(-1) then end if --restore graphics

----END----
YOU MAY WANT TO COPY AND PASTE THIS INFO ONTO AN EDITOR
USING A MONOSPACED FONT...DOING SO WOULD MAKE THIS
EASIER TO READ.

Thank you ahead of time, and please respond,
Mike Hurley
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

new topic     » topic index » view message » categorize

2. Re: Virtual Graphics Library (in the works)

You can't poke into mem2 because you havent allocated it

Your poke into some place in windows system memory.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Virtual Graphics Library (in the works)

>
> TEST.EX:
>
> include machine.e
> constant img=repeat(repeat(15,640),480)
> --the above line makes a 640x480 BRIGHT_WHITE rectangle
> atom mem,mem2
> mem=allocate(480*640) --make buffer in memory
> mem2=mem --this will be used later...
> include graphics.e
> if graphics_mode(18) then end if --put to 640x480x16
> for y=1 to 480 do
>      for x=1 to 640 do
>           poke(mem2,img[y][x]) --poke pixels in one at
>           mem2=mem2+1          --a time
>           --move further into memory
>      end for
> end for
> mem_copy(#A0000,mem,640*480)--put stuff from memory to
>                             --screen. (visible)
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is what is causing the problem.  The video memory window at #A0000
only allows 64k of memory or 65536 bytes.  640*480 is 307200 so you are
trying to write to memory from #A0000 to #E6000, most of which is not
video memory at all and probably code, so your computer crashes.  The
solution to this is to use the video interrupt to select different banks
of video memory to map to the #A0000 location.  Other libraries have
already been written to do this.

> include get.e
> if wait_key() then end if --wait for keypress
> free(mem) --free allocated memory
> if graphics_mode(-1) then end if --restore graphics



 _______  ______  _______  ______
[    _  \[    _ ][ _   _ ][    _ ]
[/| [_] |[/| [_\][/ | | \][/| [_\]
  |  ___/  |  _]    | |     |  _]
[\| [/]  [\| [_/] [\| |/] [\| [_/]
[_____]  [______] [_____] [______]
xseal at harborside.com  ICQ:13466657
http://www.harborside.com/home/x/xseal/euphoria/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu