Archived

This topic is now archived and is closed to further replies.

jimiwa

I want to write a game in assembler

Recommended Posts

jimiwa    122
Yes I know it sounds crazy. I have the feeling I''m going to get a lot of replies saying DONT DO IT, but I''m posting this anyway. I want to write a simple 2d game in assembler just for the fun of it. I have not yet programmed in assembler but I want to look into it and I am willing to learn and ready for a challenge. The thing I don''t know is if it will be possible with the computers I have currently - i.e. graphics support. On my laptop I have an Intel 830M graphics controller. I found NO documentation on an internet search for assembler language with this card. Same thing with my parent''s computer, no luck on the internet search for assemler language programming for that graphics card. That computer has a 64mb NVIDIA GeForce2 MX with TVOut. I was wondering, and I would have to wait a few years until I could buy another computer, if I got an older cheap computer with a different video card if it would be possible to do this and if there would be documentation on graphics programming for an older video card. What video card has the best documentation on graphics programming? Also, I don''t know if windows graphics assembler programming requires specific video card support or if it supports all cards in general. If it can be in general, I think this would be the route to go but I don''t know. Anyway, I know I have to learn assembler very well first before I can go on to write a game, and I''m willing to do that. I actually even thought about buying an Apple IIe or IIgs because I had an apple IIe when I was a kid and it may be worth something as an antique years down the road anyway. I''m kind of confused as to which route to take, that''s why I''m posting this. I''m wondering what others think the best route to take would be. Thanks.

Share this post


Link to post
Share on other sites
dcosborn    674
It depends on what sort of graphics programming you plan to do. If you're looking at VGA, you might start here.

SVGA is more complicated, but still do-able depending on the amount of work you want to put into this. Google will turn up lots of SVGA. I've got a huge book on SVGA on my shelf that I never really got into because it looked pretty complex and just wasn't necessary anymore.

Interfacing directly with the graphics card would basically mean writing a driver and, since its really hardware dependent, I wouldn't go that route. Plus you'd need interface documentation. I'm not sure if the company would be willing to provide that. Could be worth a try though.

Another option is to go through OpenGL or DirectX, which can be done under assembly just as well as a high-level language.

[edited by - dcosborn on May 24, 2004 12:31:57 AM]

Share this post


Link to post
Share on other sites
FireNet    187
Huh best of luck.Try gathering as much info as you can.VGA would be easy to find info on.Many old tutorials had a lot of assembler in them when I first looked into graphics programming.Anyway try programmershaven.com for the VGA Trainers by Dethnor they have quite a bit in asm code.

Share this post


Link to post
Share on other sites
izzo    437
The standard MCGA 320x200x256 video mode (commonly known as mode 13h) would be the easiest thing to use. Using that in real mode is dead easy. Check out this little platformer that I wrote in assembly language. It uses real mode and mode 13h.

sam

Share this post


Link to post
Share on other sites
mikeman    2942
I can't understand why you want to get in such trouble.
If you're goint to write a game for Windows(MASM32),then you will end up using GDI,DirectX or OpenGL for rendering.Using assembly does not mean that you have total control over the hardware,because your program still runs in user mode,unless you are willing to write a driver.Most of your rendering code will be just API calls using INVOKE.It will be like a C program with MOV instructions.
Unless you mean that you want to write a DOS game.But I really don't think it should be your first project,considering you have no knowledge of assembly,and 16-bit assembly is very difficult(segmented memory is a real nightmare).

[edited by - mikeman on May 25, 2004 7:44:52 AM]

Share this post


Link to post
Share on other sites
jimiwa    122
Tell me if I this is right-
have I misunderstood how assembly graphics programming works?
(probably because I know little about it)
I was under the impression that to program assembly graphics you
had to write code specifically for each graphics card you
want to support. I must be wrong about this because the person
who posted the sample platform game wrote that in assembly and
it works on my graphics card- i.e. you can write assembler graphics
compatible for most cards without specific instructions for every
type of card you want to support?

Share this post


Link to post
Share on other sites
dcosborn    674
Back in the day, the industry came up with various video-hardware standards like CGA, EGA, VGA, SVGA. If a hardware manufacturer supported those standards on their cards, programmers could use a common interface to operate them. This is why izzo''s platformer works on your video card.

Share this post


Link to post
Share on other sites
quote:
Original post by jimiwa
Tell me if I this is right-
have I misunderstood how assembly graphics programming works?
(probably because I know little about it)
I was under the impression that to program assembly graphics you
had to write code specifically for each graphics card you
want to support. I must be wrong about this because the person
who posted the sample platform game wrote that in assembly and
it works on my graphics card- i.e. you can write assembler graphics
compatible for most cards without specific instructions for every
type of card you want to support?


Everyone seems to think you want to program this game in DOS.

If that game was for Windows and it was 2d, they used DirectDraw or GDI.

Share this post


Link to post
Share on other sites
Codexus    118
Well I don''t see the point of writing the game entirely in assembler if it''s going to use OpenGL or DirectX ^^ but if you want to do some low-level stuff, DOS programming is an option, it seems our modern graphics cards are still compatible with VGA and Mode X so why not. Another intersting option is to use an emulator and code for an old console or computer. (SNES, gameboy, amiga there are a lot to choose from).

Share this post


Link to post
Share on other sites
Eddie Zehoo    122
Hi jimiwa
I''ve (tried) to do an RTS game in SVGA in assembly + DJGPP (its a variation of C++) before on DOS (thats about 7-8 years back)... Since it was on DOS, it was tough to be able to do even simple stuff like setting screen/color mode for anything above VGA mode (320 x 200) for graphics cards. So, an Internet organisation came up with VESA drivers.. I think some older graphic cards still supports VESA... VESA is a standard that allows your ASM/C application to call hardware-independent functions to do stuff like setting screen modes (SVGA only).. If I remember well, the concept then was pretty much as it is now- you initialized the screen mode,grabbed yourself a screen buffer from VESA, put stuff in that buffer, then blit it to the screen.

If you intend to use ASM for game programming, firstly : determine if you wanna do the game in pure DOS , DOS mode in windows or Windows only. Secondly, find out what screen mode you want to use. Izzo is right. The easiest thing to use is 320x200 (mode 13h). Well, you CAN still make a game look good in mode 13h . ''Flashback'' & ''Out of this world'' ran on mode 13h.

I''m sure you can setup something higher than mode 13h on a modern graphics card like geforce. But frankly, if you''re gonna want to avoid DirectX, then its going to be tough, because I can''t tell you for sure if VESA is still being enforced in practice.

In a nutshell, use mode 13h.

Regards,
Ed Tal


00000100-00100011-10000000

Share this post


Link to post
Share on other sites
PeterTarkus    122
Don''t waste your time. Instead, why not spend your time learning how to augment C++ with inline assembler in your games. DOS is beyond dead, you will come away with a lot of knowledge but what will you have really gained? Nobody really programs in pure assembler for the last 10 years now. Nobody really programs VGA cards anymore, the industry is way beyond that now.

If you really have to do it I wish you luck but I think you are just wasting your time. I could be wrong. But I doubt it on this one.

Share this post


Link to post
Share on other sites
Codexus    118
Oh and one more thing about DOS programming. Normal DOS use 8086 16bit assembler by default. I guess you''ll want to avoid that as it''s a nightmare with segment pointers, difficult access to memory beyond the first 640k and stuff like that.
The Watcom compiler had a very good way to set-up 32bit under DOS and is now free. You should look into that. Now these 32bits modes were not that compatible with Windows''s DOS mode if I remember correctly. So that might be a problem.

Share this post


Link to post
Share on other sites
Ra    1062
Just to let you know, it''s assembly... not assembler.
"assembler" is the thing that converts your assembly to opcodes.

Share this post


Link to post
Share on other sites
jimiwa    122
I''m interested in programming in DOS mode for Windows.
I have Windows XP.
I''d like to write games that would run well on old computers.
I''m also interested in assembly language because it would be
a challenge. I think what got me into the idea is I dreamed
that I got an apple IIe. (I used to have one when I was a kid)
then I decided I wanted to get one and write assembly language
games for it, just because I envisioned myself becoming an
assembly language programmer when I was younger, but I never
ended up learning it. I figured I might as well do assembly
language for DOS since that would be the closest I could get
to that without actually going out and getting an old apple.
Also, it would be something different - simply the fact that
most game programmers don''t think of writing in assembly makes
me more interested in it.

Share this post


Link to post
Share on other sites
dcosborn    674
Why not consider programming the Nintendo Gameboy Advance? I looks like a more modern version of the sort of thing you want to do. There''ll be a bigger community around it to encourage you.

Share this post


Link to post
Share on other sites
izzo    437
Go for it! I personally think it''s a lot of fun (though I don''t do it that much anymore). Assembly language is used when programming the PS2 and GBA. Granted, the entire game isn''t written in assembly, but rather it is used as an optimisation tool. So learning assembly language certainly won''t be a waste of time (not that any intellectual pursuit is a waste of time if you''re doing it for your own enjoyment).

Check out the Art of Assembly Language Programming to start with. Other keywords to use in google are "mode 13h", "320x200", "graphics", "MCGA". If you want to access higher resolution modes without having to write drivers for every video card out there, you can use the VBA (VESA BIOS Extensions) - a set of standard extensions to the video BIOS that the VESA organisation came up with. They let you access common video modes in a video card-independent manner.

You''d probably want to use protected mode (i.e. flat memory model) to access the frame buffer for anything above 320x200 though. This is probably a bit too much info for now, so you should read the art of asm. and learn about how the x86 architecture is organised and its various operating modes. These things matter when you''re programming in assembly language.

cheers
sam

Share this post


Link to post
Share on other sites