Qbasicnews.com
February 28, 2020, 02:25:44 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: Using CosmoX...  (Read 3683 times)
pr0gger
I hold this place together
*****
Posts: 775


« on: June 01, 2003, 08:02:03 PM »

...is confusing me.  I've removed all the DQB and replaced it with CosmoX, but it's not working...  I've narrowed down the problem down to start of the program.

Quote from: "CosmoX Manual"
EMS Layers

  If you don't know why the heck would you like a layer think on this, you
  draw something in the screen, then you clear it to draw your next thing, and
  you do it again, what you see ??, FLICKER!!!. The screen is flickering
  constantly because you have the time to see the screen clearing. This looks
  ugly. With EMS you just set up a layer (or as many as you want) and get the
  page frame address. Now instead of passing the video memory address to
  the library functions, pass the page frame address, obviously you don't see
  anything because you are drawing in a offscreen layer, but now you copy
  your layer all at a time to the video memory, clear the layer, start drawing
  on it, copy it again to video memory and so on, and what you get ??...
  flickerless animation!!!!.

  The page frame is 64K size so you can only have a layer at a time. So to
  have more than one layer, you have to be constantly remapping them.
  The page frame is divided in 4 pages of 16K of memory just like the size of
  the logical pages of EMS. To setup a layer just do this :


  We make sure there is a Expanded Memory manager so our program won't crash.

  IF CSDetectEMS = 0 THEN
    PRINT "You need an EMS Manager to run this program!!"
    END
  END IF

  We allocate 4 logical pages ( 4 * 16K = 64K = 1 layer).

  Handle% = CSAllocateEMS(4)

  We make sure there is a free EMS so our program won't crash.

  IF Handle% = 0 THEN
    PRINT "You need 64K of free EMS to run this program!!"
    END
  END IF

  Then we get the page frame address and store it in the Layer% variable.

  Layer% = CSGetEMSFrame

  We map the EMS memory, we have pass the Handle we get from CSAllocateEMS
  so the function can know which memory to map.

  CSMapEMSLayer Handle%, 0

  Note: CSMapEMSLayer maps 4 logical pages to the 4 pages in the page frame
  so if the Handle passed doesn't have at least 4 logical pages, your program
  may crash.

  Now that our layer is mapped and is accessible we clear our layer so it
  doesn't have any garbage.

  CSClear Layer%, 0

  And we draw something to it.

  CSPrint Layer%, 5, 100, "Expanded memory is useful!!", 15

  Now we pass it to the screen

  CSPcopy Layer%, VIDEO


  But what happens if I want more than one layer ??.
  You allocate more memory for them and map them one at a time.

  1 layers = 4 logical pages
  2 layers = 8 logical pages
  3 layers = 12 logical pages
  and so on.

  Get the address and allocate mmmm... 3 layers.

  Layer% = CSGetEMSFrame
  Handle% = CSAllocateEMS(12)

  We map the first layer and draw to it.

  CSMapEMSLayer Handle%, 0
  CSClear Layer%, 0
  CSPrint Layer%, 5, 100, "Layer 1", 15

  We map the second layer and draw to it.

  CSMapEMSLayer Handle%, 4
  CSClear Layer%, 0
  CSPrint Layer%, 5, 100, "Layer 2", 15

  We map the third layer and draw to it.

  CSMapEMSLayer Handle%, 8
  CSClear Layer%, 0
  CSPrint Layer%, 5, 100, "Layer 3", 15

  Did you see how I mapped them?
  I allocated 12 pages ok?, then I map the first, so I give CSMapEMSLayer
  my EMS handle and the logical page where to start mapping. I give 0 the
  first time because it is zero relative, so it maps the first four pages
  that make my first layer, I clear it and print a message on it.
  Then I map the second layer, this time I pass 4 as the logical page where
  to start mapping this is because the 0, 1, 2, and 3 are the first layer,
  so 4, 5, 6, and 7 are the second, so when I map the third layer I give
  8 as the page where to start so 8, 9, 10, and 11 are my third layer.
  Very easy, isn't it?

  Just don't forget to free the memory you allocate so other programs can
  use it. If you take memory and you don't return it your program will look
  very unprofessional.

  You free it like this :

  CSDeallocateEMS Handle%

  You have to do this with any handle you may have allocated. I suggest you
  to use only 1 handle and allocate all your memory on it so you don't have
  trouble.


So that's what the maunal says, but I can't make use of it....
Logged

size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
seph
Na_th_an
*****
Posts: 1915



« Reply #1 on: June 01, 2003, 08:09:35 PM »

The problem I encountered with layers in CSX is that I can only use one, since any layer I map and retrieve gives me the same exact memory location. Meh, DQB works fine for me.
Logged

earn.
pr0gger
I hold this place together
*****
Posts: 775


« Reply #2 on: June 01, 2003, 09:05:36 PM »

I just can't figure out the order of CSMapEMSLayer Handle% and CSClear Layer%.. does anyone have some source I can look at?
Logged

size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
seph
Na_th_an
*****
Posts: 1915



« Reply #3 on: June 01, 2003, 09:06:20 PM »

You don't need:

CSClear Layer%

It is simply a CLS for that particular layer.
Logged

earn.
pr0gger
I hold this place together
*****
Posts: 775


« Reply #4 on: June 01, 2003, 09:08:15 PM »

but if I want... say, the video layers and 3 back layers, what do I put? And whats all this CSGetEMSFrame stuff?

In DQB, it was simple.

Code:
IF DQBInit (3, 0) THEN
 PRINT DQBError$
 DQBClose
 END
END IF


And go along my merry way...
Logged

size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #5 on: June 01, 2003, 09:15:53 PM »

Would you like me to send you a UGL template?

You can vertical/horizontal flip the pictures, and rotate them, too. (but not sure how to get rotation working right)

UGL is so fast that you can even have a neutral color to fill in with the point and pset functions, instead of making two color copies.

And, it's all done in EMS, so you don't need to worry about graphics memory, at all.

UGL is so fast that it will be faster doing 16 bit, 800x640 graphics in UGL than 320x200, 8-bit Cosmox or DQB. It's so fast that you need a .1s timer to stop it from putting the graphics too fast.
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
pr0gger
I hold this place together
*****
Posts: 775


« Reply #6 on: June 01, 2003, 09:16:47 PM »

Quote from: "Agamemnus"
Would you like me to send you a UGL template?

You can vertical/horizontal flip the pictures, and rotate them, too. (but not sure how to get rotation working right)

UGL is so fast that you can even have a neutral color to fill in with the point and pset functions, instead of making two color copies.

And, it's all done in EMS, so you don't need to worry about graphics memory, at all.

UGL scares me... I can't figure it out...
Logged

size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #7 on: June 01, 2003, 09:19:19 PM »

Don't worry, buddy. It scared me, too. I'll send you the template in 5 min.... brb.

EDIT: And if someone told me how to compile UGL, and how to use the rotate function, I'd be *that* much happier..
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
pr0gger
I hold this place together
*****
Posts: 775


« Reply #8 on: June 01, 2003, 09:31:25 PM »

by E-mail?
Logged

size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #9 on: June 01, 2003, 09:38:19 PM »

Yeah. I sent it. Download UGL first.
There's a link on qb45.net.....

EDIT: I am resending it-- I forgot the 10 in your email address!
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
pr0gger
I hold this place together
*****
Posts: 775


« Reply #10 on: June 01, 2003, 09:41:17 PM »

Who'd you send it to?  Shocked

Erm.  Still not here :? This could be bad. ...lol
Logged

size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #11 on: June 01, 2003, 09:48:13 PM »

did you get it?
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
pr0gger
I hold this place together
*****
Posts: 775


« Reply #12 on: June 01, 2003, 09:48:34 PM »

No...  Shocked

EDIT: Got it Cheesy
Logged

size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
pr0gger
I hold this place together
*****
Posts: 775


« Reply #13 on: June 01, 2003, 09:55:34 PM »

There should be a UGL.QLB around here somewhere, right?

btw, this may be your compiling problem

Quote
   The linker tool that comes with QB4.5 (LINK.EXE) does not support
    a command-line option (/seg) needed to link any project with ugl's
    library files, so, it can't be used when creating an executable.
Logged

size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #14 on: June 01, 2003, 09:58:06 PM »

yeah

/lib/release/qb and /inc

EDIT: I know, Blitz says to use the bat file (somehow) and he told me what to put for seg/xxxx, but I don't know where to put that command or how to modify the bat file.
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!