Game development with assembly. Where to start?

Started by
22 comments, last by MarkS_ 8 years, 5 months ago

Have you considered old school game programming ie vga based game? Or homebrew development for the GBA?

Another hobby thing you could look into is SIMD coding using intrinsics.

That sounds very interesting. How do go about doing that?

Are you trying to learn asm or just take a rest from your project? If this is just for short distraction then try something completely else ( I did that and keep coming back to it, also just for fun) - write something for any of old 8 bit consoles or computers. My favourite is Atari 2600 VCS and 6502 assembler language (look for Stella emulator, it's not only emulator, it's very sophisticated and full featured debugger! If only developers could have such tool in 80s ;)). VCS is very simple in terms of architecture, but because of constraints incredibly challenging (today if feels like solving a puzzle rather than making a game;)). This will not teach you any modern assembler, but will show you basics of ANY asm. For many years rules didn't change, while knowing 6502 you will be able if not write, then at least read modern asm code. It may appear very handy during debugging mysterious issues.

At first it was just a distraction but honestly after I made few small programs in assembly I really started loving the language. I will check out Stella.

Thanks ^_^

Advertisement


That sounds very interesting. How do go about doing that?

Which one? Old school PC, GBA, or SSE1-4 with intrinsics?

-potential energy is easily made kinetic-


That sounds very interesting. How do go about doing that?

Which one? Old school PC, GBA, or SSE1-4 with intrinsics?

ooh nvm. I found all three of those on my own happy.png

I do need to do more research about SSE because all i know about it, is that it's some kind of intersection set for the cpu. that's all. I'm reading about it right now.

Thanks.


At first it was just a distraction but honestly after I made few small programs in assembly I really started loving the language. I will check out Stella.

Also, if you find retro-programming interesting and inspiring I recommend to read the book "Racing the beam" smile.png Despite you can't make any commercial game any more using those old technologies, there are few things you will learn. One is very important - you will learn to treasure any given hardware resources, you will start thinking "cycles" and "memory" even including size of the generated code, and also you will be always thinking, what the compiler may do to your code during compilation. These are skills very often skipped by modern age programmers, but in video games, where every millisecond of frame counts - still valuable. That's why it's good from time to time to reach for ancient stuff, for learning, for exercise, and to remember that hardware resources are not made of rubber, they won't stretch smile.png Thinking "assembler" is valuable good thing. I worked with many programmers who, when saw a crash in place of code with no source code, couldn't do anything. Sometimes just by looking at the disassembled crash place, and understanding basics of assembler (loading, storing, moving, branching, jumping, comparing, pushing/popping, simple arithmetic, registers, memory access) you may look at actually any code and figure out what's going on there having just vague knowledge about the device low-level architecture. Those things haven't changed lot since 8-bit platforms. Sure we have more sophisticated multi-core CPUs, larger instruction sets etc. but basic principles stayed unchanged. Also hardware oriented approach keeps coming back ( like for example with PS1/PS2/PS3 ) so it's really good to know what it takes to work with directly with metal.

Having a very old in the past introduction in my education of embeded controlers. Z80 and 6800?
Which faded away out of my head.

For modern game programming. ASM is a to low level solution C/ C++ is as low as I want to go.
If I go for ASM then it wil be for practical use of those modern CPU extentions.
Math libs using SSE2 as its very common in mainstream CPU.
But AVX AVX256 and the upcoming 512 is not. First for fun. With practical option for it.
It will be very new to me to.

mate, nobody makes a game in bloody assembly

o wait

Skyscraper development with a hammer and nails. Where to start?

There I fixed your title for you :)

No, on a more serious note this is possible. I think though other replies have neglected one important point. Are you asking how to make an oldschool 256 colour game with 320x200 screen resolution and adlib sound etc? Or, are you just planning to interface modern apis using assembly and if so are you aiming for 32 or 64 Bit as I personally consider 64 Bit much more elegant.

You need to look up mode 13h and vga registers, possibly Ralph brown's interrupt list, if you want to develop raw dos style graphics without relying on windows and 3d acceleration. You will also need to know how to draw your own lines and triangles. Look up bresenhams line drawing algorithm to get you started.

Enjoy!

Skyscraper development with a hammer and nails. Where to start?

There I fixed your title for you smile.png

No, on a more serious note this is possible. I think though other replies have neglected one important point. Are you asking how to make an oldschool 256 colour game with 320x200 screen resolution and adlib sound etc? Or, are you just planning to interface modern apis using assembly and if so are you aiming for 32 or 64 Bit as I personally consider 64 Bit much more elegant.

You need to look up mode 13h and vga registers, possibly Ralph brown's interrupt list, if you want to develop raw dos style graphics without relying on windows and 3d acceleration. You will also need to know how to draw your own lines and triangles. Look up bresenhams line drawing algorithm to get you started.

Enjoy!

I have actually started learning assembly using 64bit. So it would be nice to keep using that. Although I don't think there is a difference between the two other than the cpu registers name. like rax register for 64 bit vs eax register for 32bit.

But I have been looking into NES game development. It looks very interesting. Honestly If I can display a pixel on the screen and move it using the keyboard I would call that a success. For now I'm using ascii graphics.

I will check out what you just posted. Thanks happy.png

Again I can't stress this enough. This is just for fun. I need to clear my head from C# and SharpDX and HLSL. It's annoying at times.


Although I don't think there is a difference between the two other than the cpu registers name. like rax register for 64 bit vs eax register for 32bit.

The difference is more than that. X64 uses a different and nicer calling convention which avoids use of the stack for the first few parameters (something like the first 16 which covers most functions and methods). see: https://en.m.wikipedia.org/wiki/X86_calling_conventions

There's lots more that just makes it a nicer environment because you have a ton node registers to avoid stashing things on stack and in memory locations, it's a little more like RISC and easier to optimise, and more compiler friendly. Things like the massive address space support things like position independent code (PIE) and IMHO these things are awesome.

If you really want a trial by fire try writing a simple 64 bit operating system... smile.png... I did, it was fun. See; https://brainbox.cc/stash/projects/RR/repos/retrorocket/browse/kernel64

Feel free to reuse my code... Have fun!

x64 has changed some of the memory addressing encodings to be RIP-relative, instead of having fixed displacements (and switch tables) being patched by a relocation-aware loader. I mainly deal with disassembly rather than assembly, so I'm not sure what this looks like from the writing-new-code perspective. It was a major difference in the disassembler.

This topic is closed to new replies.

Advertisement