Re: Virtual Graphics Library (in the works)

new topic     » goto parent     » topic index » view thread      » older message » newer message

>
> 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 thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu