Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
TRS80Model1
22
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 11th Feb 2003 23:32
Ok since Music playing() does not funtion right now I want to be able to get a memory pointer:
load music "song.midi",1

K, I would like to get pointers to my loaded midi's to read the headers to find out how long they are so I can stop them when they are done and load up my next song.

Any thinkers out there?
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 11th Feb 2003 23:37
Nope, not unless they tell us where to go...
...to get the headers.

I would also like to get hold of the sprite handles too (for interrupt-driven movement).

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 14th Feb 2003 01:39
Wots Its Format?
there is a good midi description on there the rest is upto you.

however i'd like to know something before i try it


i'm unsure howto check memory areas which are being used - so really i'm just gonna have to hope that one isn't
well anyways ... i'm pretty sure this isn't going to work but what i need to do is create a table which can be edited but i need the memory position also editable so that i compress directly in the memory

firstly, if i additional the hex like that will it actually go up as hex or change to an interger?
secondly, can i attach pointers to arrays?
thirdly, would someone who understands this a bit better than me (cause there is little to no help on this right now) could post an working example which i could learn from

i've got my binary routine compressing data within pro and decompressing it quite well, but i'd rather not have to create a manual table for this so i can create more than one at a time and do syncronious data editing
i mean as it stands i can compress an 512x512 w/alpha image within 30-40 seconds with this, and with additional data table arrays i can almost cut the time in half
just be good to know howto do this, and possibly have the make memory explained as well - perhaps in conjunction with pointers

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 14th Feb 2003 11:01
Firstly, it will revert back to binary actually. Depending on how you read the value, it could be decimal, hexidecimal or Mayan.
Secondly, I'm pretty sure you can't..
Thirdly, I dont have any ZIP code unfortunately. The last time I wrote a ZIP compression routine I couldn't UNZIP the thing back again...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 14th Feb 2003 15:20
well its not the zip routines i need demonstrating ... its an effective use of the memory pointers/memory creation

my routines work fine but the way i'm doing it just seems very weird, i mean would like rather than work on the first Quadratic then move onto the next to be able to do 2 or 3 at a time using the same table but different memory positions.
kinda wish i had a fully copy of pro right now to test the pointers - cause somehow i think the demo isn't gonna do them right. but i can try

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 14th Feb 2003 15:55
Forunately the demo can use plug-ins.

As for effective use of memory pointers/creation, you need to do something like :

ptr=make memory(1024)
tempPtr=ptr
print chr$(*tempPtr)
inc tempPtr
..

Or if you want to use plug-ins, you've got calloc to allocate memory (and zero it first which make memory doesn't do), plus all the peek/poke commands. My ones use base address, offset, value parameters whilst IanM's just uses base address + offset, value.

Effective use is rather a personal choice, and none of the abour will really help to do 3/4 memory accesses any easier.

I think putting them in an array as in the example will be the way to go...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 14th Feb 2003 17:33
no offense but i don't want to use plugins for this, i mean i'm developing this for something that could use them as plugins but i have a feeling somewhere down the line it'll be far better to understand this all better.

i'm still trying to figure out a use for pointers
to be quite honest i'm a little unsure to thier uses, i mean the memory is being edited directly - which given the position can allow me to edit on the binary/hex/oct levels easier right?

so when you access the memory do you access the pointer with the command or with the memory position + offset to data set ... is a little confusing
still using an array for now, but i think i'll test these a little more on a system with little installed - because i know what happens if i set them up wrong

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 14th Feb 2003 17:40
You have to access it at the current position, unforunately you can't do *(addr+5)

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 14th Feb 2003 17:42
well thats what the HEX$(), STR$() & VAL() commands are for no

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 14th Feb 2003 18:02
Once your at the start of a given position, then yes...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 14th Feb 2003 19:24
i wonder if they're gonna add a memory range check, because as you can potentically add upon where something else is already - then it would be useful if you can check a specific range of data within the memory if its use or reserved.

i mean the last thing you want to do i overwrite the graphics memory space of something

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 14th Feb 2003 19:31
thats so true!

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 14th Feb 2003 19:37
With greater power comes greater responsibility.

Your code should perform all the checking required. If it overwrites essential memory that's your fault I'm afraid I'd rather have the ability and crash my PC a few times than not have the ability.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 14th Feb 2003 19:49
i'm not saying not to have it... its just we can't check what is essential memory space, i mean in C++ there are ways to check what memory ranges are resevered by Windows

would be good if we can just check to see if they're in use or not really ... that way we can range at the end of them

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 14th Feb 2003 20:02
What fun would that be?! If it's in memory you can play with it. Think about the hacking ability that gives you for a moment

Also I think you are living a little in the old days Raven! Memory is totally dynamic now and moves around all the time! Windows will keep allocating and deallocating literally thousands of chunks of dynamic memory ALL the time. There are no C++ "commands" to retrieve the range of data reserved by Windows - there are only ways to get handles to all sorts of resources and even then all they will do is tell you where in memory they are at that point in time. On the whole they are useless to a DBPro coder.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Feb 2003 20:05
If you can do this in C++, then you should be able to do this in DBPro with appropriate DLL calls.

But why would you want to know? You can't use this information in any meaningful way anyway.

With windows you must always ask for memory, not just take it. If you are trying to hit memory mapped devices, then for any of the NT platforms (NT,Win2K,XP) they will stop you anyway.
Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 14th Feb 2003 20:18
IanM - thank you, exactly what I was trying to say! (and no, you can't do it in C++, not natively anyway).

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 14th Feb 2003 20:22
generally i'd agree knowing where things are are useless to the adverage coder - but when you start poking about in ranges of memory, then really you should know if someone is already using it else you get what puffy seem'd to do alot recently and hit something you shouldn't and boom! you crash everything - or worst case scenario need to reinstall windows.

i did use the graphics as an example for a good reason, although the actual allocation is dynamic, the ranges for the allocation arn't ... atleast not for the native resources.

for example my graphics card uses the memory ranges
DC000000 - DCFFFFFF
D0000000 - D7FFFFFF
for the standard system overflow as well as
000A0000 - 000BFFFF
which is for the driver sets

the memory within there is oftenly jiggled about - but the actual ranges must be kept free at all times from misc data else you will crash you graphcs card
i mean this is all i'm suggesting with something like this you get given a function to allow you to place it initilially - because you think about it, its like giving a blind man TnT and asking him to safely put it in the blast holes before you blow the mountain.

i know the point is that we really should fashion our own glasses here to see whats infront of us, but if you give us something of this nature surely we should atleast have a cane just to poke to see whats there?

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 14th Feb 2003 20:23
and remember that the NT Platforms will stop you, but not everyone is on NT based OS's - Pro will run on 9x/Me as well, so something that doesn't affect you could kill an endusers system.

the point isn't to use the information but to prevent from doing something stupid

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 14th Feb 2003 20:34
"i mean this is all i'm suggesting with something like this you get given a function to allow you to place it initilially"

Yes - that would be the "make memory" command!! It already exists, it will assign memory in the correct location and of the correct size and it's dynamic so you can increase/decrease as required.

All we're sayins is that it is impossible to stop people writing into areas of memory they shouldn't be playing with unless you take away power and commands from them.

If they think "wow, that could be dangerous - how can I make sure I do this carefully and never run over into system memory?" - then I've got one word for you "memblocks"! Defined, safe, versatile chunks of memory.

If on the other hand they ignore memblocks and create a block of memory say 100,000 bytes in size and write to byte 100,001 of it because their code didn't check correctly then whatever happens is their problem.

If you can't stand the heat, don't code in the kitchen

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 14th Feb 2003 20:48
hehee... yeah i guess, thing is the pointers ask for the return of a Hex value for placement in the memory don't they - but the Make Memory command doesn't give you that, this is probably something which is driving me insane.

you'd think the make memory and (*) pointer would be able to be setup to be accessed the same fashion, allowing you to edit the blocks in Nth size.
That way you make the memory range then you edit it using the pointer to gather each information type

i dunno maybe it because there is literally a single paragraph on them in the manual and half of that is to warn you they're dangerous to use
the uses and combination uses are confusing when its not fully explains what they are or howto use them i think.

i mean its like, i do have a machine to test things on and they might work - but if they don't then i've lost my only machine to compile DBpro code on for a few hours whilst i try to undo what has happened + the wasted time that i'm not getting on with any work for.

however if i don't use them then this means that the data editing has to be done in a more slower fashion and with alot more unnessary code
ack, its a gambling inccident which i'd rather not take right now - but if push came to shove i'd have to.
if i wasn't so pushed for time then i'd just do it and not care, but as i am even a few hours is something you have to really wonder about.

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Feb 2003 20:57
Huh?

` Allocate 1024 bytes of memory
addr=MAKE MEMORY(1024)
` Set the first four bytes (dword)
*addr=0xffffffff
` Illegal access
addr=addr+1024
*addr=0xffffffff
` Release the memory
DELETE MEMORY addr

Of course if you access past the 1024 bytes allocated, you deserve a crash, but you *might* get away with it - exactly the same as in C++.
Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 14th Feb 2003 21:00
Pointers require a hex value to set-up, yes. But that's exactly what "make memory" returns when you call it. Feed one into the other.

You could write a program that did nothing but stuck the word "Raven" throughout your ENTIRE memory range and the chances of it requiring nothing more than a reboot to fix are exceedingly slim. Windows core system is in protected memory anyway (regardless of version) and even if you did get in there what's it going to do? Think "oh hey look at this! totally unexpected data, I'd better over-write some system files with it on the hard drive".

I don't think so

The permanent damage you can do by messing with pure memory isn't quite as extensive as you'd think.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 14th Feb 2003 22:19
maybe not rich... but windows (especially older version like the 9x series) have a tendancy to access memory area's and take a course of action without the full information - so if you overwrite some memory accidentally then its not going to even go "hey look at this" until its run whatever its going to run, and then it suddenly figures out the data which was there was wrong.

boom you get an internal memory crash (this happens an amazing ammount with Delphi based programs) ... and if you happen to hit the wrong area of the memory, it'll run a function with the possiblity of destroy part of itself because it just doesn't run checks for unexpected data

the readme for the make memory says about the (*) pointers, however says returns a dword
that kinda makes no sense ... i know a hex value is like a dword value, but does that mean its returning a dword hex value which you have to traslate or a hex value direct?

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Feb 2003 22:26
It's just a number in the range 0 to 4+billion. A standard unsigned 4 byte value. No translation is required for either reading or writing it.

The bottom line on memory access is if you use the memblock stuff, DB/DBPro will protect you. If you decide to do it yourself, you have to make sure that you get things right.

Oh, and upgrade to an OS that at least tries to protect itself
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 15th Feb 2003 00:13
hmm i'll have to try it later, as for an OS - there is alot that XP will save me from, cept the same can't be said about 98 or ME ... so something that might work in XP especially because of the automatic allocation, might destroy a 98 system - and sometimes it protection methods are worse than just an invalid command and reboot

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Feb 2003 00:24
Nah, it won't work in XP. XP will detect it and terminate your app!

Of course you could use a couple of routines within kernel32.dll to check out your pointer before you use it.
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 15th Feb 2003 00:28
i suppose ... lol ... you know i'm wondering how much of the code i've done over the past day is going to work off the bat now. probably shouldn't be worrying as much about pointers right now

but they are too dang interesting

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?

Login to post a reply

Server time is: 2025-05-18 05:33:06
Your offset time is: 2025-05-18 05:33:06