Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using CosmoX...
#1
...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: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....
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]
Reply
#2
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.
earn.
Reply
#3
I just can't figure out the order of CSMapEMSLayer Handle% and CSClear Layer%.. does anyone have some source I can look at?
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]
Reply
#4
You don't need:

CSClear Layer%

It is simply a CLS for that particular layer.
earn.
Reply
#5
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...
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]
Reply
#6
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.
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.
Reply
#7
Quote: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...
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]
Reply
#8
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..
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.
Reply
#9
by E-mail?
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]
Reply
#10
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!
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)