• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
devdber

dos memory allocation (ASM)

10 posts in this topic

Hi, im new to asm. I decided to improve my skills by programming for dos. So,now im stuck with 48h function(int 21h) - memory allocation. What is its internal implementation like? I mean, how does dos choose segment address for memory block having been allocated? How can it get to know if any block isn't free?
The only thing i know about memory allocation is 'new' from cpp which returns pointer to object located in memory  sad.png

 

[spoiler]sorry for my English[/spoiler]

0

Share this post


Link to post
Share on other sites
Programming against 16-bit segmented memory models may be educational and fun, and perhaps even slightly useful if you want to do retro-computing work, but for the most part if you want to learn modern assembly language it's a total waste of time.

What's your end goal with learning ASM?
2

Share this post


Link to post
Share on other sites

Hi, im new to asm. I decided to improve my skills by programming for dos. So,now im stuck with 48h function(int 21h) - memory allocation. What is its internal implementation like? I mean, how does dos choose segment address for memory block having been allocated? How can it get to know if any block isn't free?
The only thing i know about memory allocation is 'new' from cpp which returns pointer to object located in memory  sad.png

 

[spoiler]sorry for my English[/spoiler]

So, there are a few things here:

 

1. For learning modern assembly, or even embedded assembly, 16 bit DOS is not the way to go. If you really want to learn some embedded assembly, pickup an arduino/propeller/arm educational board and get started there. If your goal is to learn modern assembly, then you're in for a rocky road, but you should get started on the x64 end of things, as it gives you significantly more registers to play with.

2. Regarding int21h/48h: Depending on how the exe/com file is built, you may need to first free all the memory your application is not using (depending on header flags, etc. DOS can allocate the entire remaining free chunk to you already). As for how DOS does its allocations, it has a lot of tools available to it, one simple way would be a linked list or similar behavior as your typical heap allocator. Another would be to use a bitmask, etc. Microsoft doesn't specify, mainly because it is not an important implementation detail to know about.

0

Share this post


Link to post
Share on other sites

Programming against 16-bit segmented memory models may be educational and fun, and perhaps even slightly useful if you want to do retro-computing work, but for the most part if you want to learn modern assembly language it's a total waste of time.

i think it can be useful even so. Since i don't know asm well yet, it would be nice to start with something not so complicated. Other reason is that i'll have to use api calls for some of my demands, since windows runs in protected mode. Can i be wrong?
 

What's your end goal with learning ASM?

hmm, actually i haven't ever thought about it. Maybe it's just my interest?
 

So, there are a few things here:
 
1. For learning modern assembly, or even embedded assembly, 16 bit DOS is not the way to go. If you really want to learn some embedded assembly, pickup an arduino/propeller/arm educational board and get started there. If your goal is to learn modern assembly, then you're in for a rocky road, but you should get started on the x64 end of things, as it gives you significantly more registers to play with.

thanks for your answer, i hope i'll made it to x64 mode eventually, but i want to know any basics of asm.
 

2. Regarding int21h/48h: Depending on how the exe/com file is built, you may need to first free all the memory your application is not using (depending on header flags, etc. DOS can allocate the entire remaining free chunk to you already). As for how DOS does its allocations, it has a lot of tools available to it, one simple way would be a linked list or similar behavior as your typical heap allocator. Another would be to use a bitmask, etc. Microsoft doesn't specify, mainly because it is not an important implementation detail to know about.

well, but how does dos search free mem block? Does it allocate whole segment to mem block? I mean, why is mem block located at AX:0000? Edited by devdber
0

Share this post


Link to post
Share on other sites
could you give some links with dos custom memory allocation samples? That few ones i found is full with linux/windows/dos internal api calls... Edited by devdber
0

Share this post


Link to post
Share on other sites

1. For learning modern assembly, or even embedded assembly, 16 bit DOS is not the way to go. If you really want to learn some embedded assembly, pickup an arduino/propeller/arm educational board and get started there. If your goal is to learn modern assembly, then you're in for a rocky road, but you should get started on the x64 end of things, as it gives you significantly more registers to play with.

 

Nintendo GBA is another excellent ARM based platform, and of course better optimized for games than the more generic arduino and such. Not much activity on the old forum.gbadev.org these days, but a few of us still check in regularly, and I'm currently working on a NES/SNES style RPG for it smile.png

 

ARM assembly is much more fun to write than x86, plus you can do accurate cycle counting and run on real "period" hardware... if you can still find flash carts these days.

Edited by DekuTree64
0

Share this post


Link to post
Share on other sites


well, but how does dos search free mem block? Does it allocate whole segment to mem block? I mean, why is mem block located at AX:0000?

As I mentioned, DOS maintains a table of information, be it a bit set, or linked list,etc. Of blocks of memory that it has not allocated. In real mode there is NO SUCH THING as free memory. There is memory you have used, and memory you have not used. The DOS memory allocation functions are simply there to TRY and keep your applications from trampling all over DOS.

 

DOS is NOT the platform you should be learning. DOS does not reflect ANY modern machines, embedded or other. If your goal is to LEARN x86 ASSEMBLY, then its time to whip out either the 32 bit or 64 bit assembler and get going. Modern operating systems don't even have to ENTER real mode anymore to boot. So its not even useful there. (If you end up writing your own operating system, then you probably will have to touch realmode for all of 2 seconds, if you don't use grub or another bootloader. But by then you will know enough about assembly to be able to understand what is going on).

 


Nintendo GBA is another excellent ARM based platform, and of course better optimized for games than the more generic arduino and such. Not much activity on the old forum.gbadev.org these days, but a few of us still check in regularly, and I'm currently working on a NES/SNES style RPG for it
 
ARM assembly is much more fun to write than x86, plus you can do accurate cycle counting and run on real "period" hardware... if you can still find flash carts these days.

Yes, although you can also get one of the propeller kits and do some low level development on a multicore board. Pretty fun shit.

1

Share this post


Link to post
Share on other sites

Yes, although you can also get one of the propeller kits and do some low level development on a multicore board. Pretty fun shit.

I don't doubt it :) I've dabbled in robotics, although using the AVR microcontrollers rather than ARM because they're cheap and easy to work with physically. Lots of fun seeing your code affect things in the real world rather than on a screen. But without my previous GBA experience, it would have been really hard to learn embedded stuff. As it was, I pretty much knew how everything was supposed to work already, so it was just a matter of figuring out the specifics rather than stumbling around cluelessly at first.

 

And being gamedev.net, I assume the OP is going toward game development rather than physical side of electronics, and GBA is one of the most well balanced and fun to program systems I know.

 

Although for really retro stuff, NES is great too.

0

Share this post


Link to post
Share on other sites

Seriously listen to these guys and do not mess around with 16 bit asm + dos.  If you want to start simple pick up a AVR 8bit chip.  There is also PIC but pic uses a banked/paged memory system on a lot of their chips which makes things dumb.  With AVR 8 bit you have about 130 instructions or so and properly aligned memory that is not split off into chunks.  After you get bored with that which you probably won't go an move to ARM.

 

I started with PIC but after getting tired of all the bank switch and crap I moved to AVR and it is much nicer to work with at the asm level.  Eventually I plan to move to ARM and mess about there at some point maybe.

 

I use bare avr chips not the arduino platform because arduino makes it a nasty hack to do any asm with it.

 

The only issue with working with the micro controllers is to really do anything interesting you are going to have to learn some electronics.  I found this the most difficult part is the actual electronics not writing of the firmware which even in asm is relatively easy.

 

Right now I am working on a sound activated trigger switch using a AVR and a Microphone.  Still trying to understand the electronics behind it already understand the firmware part.

Edited by blewisjr
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0