Learning Assembly

Programming, for all ages and all languages.
Post Reply
jolson88

Learning Assembly

Post by jolson88 »

Hey all, I picked up both the DOS version of Art of Assembly (I don't like the Windows/Linux version since it's not down to the bones), and Assembly Language Step by Step. Being the geek that I am, I want to start learning it by doing simple games (once I know enough). More specifically, I thought it might be fun to get into mode 13h stuff along with the assembly code.

Soooo, here's what I want to bounce off you guys. I don't have linux installed and you have to jump through some hoops to do stuff like mode 13h in Windows (or a lot of other hoops as well since you don't _really_ have straight access to the hardware).

Anyways, I know I currently have a bootloader from the tutorials on the Wiki. I was thinking I would use the bootloader and rather than booting to a "kernel", I would simply boot into a program I wrote in assembly (isn't this almost the way programs were written back in the early days of the PC?). Basically, instead of compiling a "kernel", I would just be compiling by sample "program" that I'm using to mess around with assembly language in. This way, I have full access to the hardware without an OS getting in the way of my experiments. I suppose it's a similar approach to Linus learning the 386 with his terminal emulation program (which eventually evolved into Linux). Well, I guess I actually got the idea last night reading Just For Fun anyways :).

I just wanted to shoot the idea off you guys to see if I'm shooting myself with a loaded gun or if this is actually a good approach to learning assembly language.
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Re:Learning Assembly

Post by Colonel Kernel »

Sounds ok to me. I learned assembly by writing programs to make music with the PC speaker and things like that. They ran in DOS, but if your program isn't going to need anything beyond what the BIOS already provides, then I don't see anything wrong with just running it from a bootloader.

The only catch is that you'll be learning 16-bit 8086 (real-mode) assembly, not the 32-bit superset that you'd want to use in a modern OS (or 64-bit if you're feeling ambitious). I guess it's ok just for learning concepts though.
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
jolson88

Re:Learning Assembly

Post by jolson88 »

Colonel Kernel wrote: The only catch is that you'll be learning 16-bit 8086 (real-mode) assembly, not the 32-bit superset that you'd want to use in a modern OS (or 64-bit if you're feeling ambitious). I guess it's ok just for learning concepts though.
If I leave it raw :). However, my current bootloader already sets up 32-bit PMODE and then jumps to the kernel. So I figure I will have it continue to setup 32-bit PMODE and then just jump to my assembly program stuff :). Of course, who knows, I may want to start with 16 bit just to understand better the whole real vs. protected difference (I know what it is conceptually, but I mean _really_ understand it).

For now, it sounds like I won't be hanging myself so that's what I'll do as I go through the "Assembly Language Step by Step" book.

Thanks Colonel!
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Re:Learning Assembly

Post by Colonel Kernel »

You were talking about using BIOS services for doing video, right? You can't do that from protected mode...
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
jolson88

Re:Learning Assembly

Post by jolson88 »

Duoh! You're right :). Either way, I'm mostly concerned about learning Assembly so I figured I can switch between Real and Protected depending on what I want to do.

Haha, now there's an example why I need to be learning all this :P.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Learning Assembly

Post by Candy »

If you want to boot a realmode kernel, you can try my (new) bootloader. Of course, there's nothing holding you back to write your own, especially since real-mode-only boot loaders are fairly easy to write.
Dex4u

Re:Learning Assembly

Post by Dex4u »

You idea, of a bootable game, is how i started to learn asm, my OS started life as lots of bootable modules that one day i linked by a CLI.
The going to and from pmode, for BIOS function, works well for things like mode swiching etc.

Here are some things that may help you,
1. A bootable demo for going to and from pmode, to swich modes (vesa, so needs vesa2 support )
http://www.dex4u.com/demos/DemoVesa.zip

2. A 2k dos clone http://board.flatassembler.net/topic.php?t=5275

3. A bootable tetris game, that fits in to the bootsector of floppy, all above come with fasm source code and are well commented.
jolson88

Re:Learning Assembly

Post by jolson88 »

Candy wrote: If you want to boot a realmode kernel, you can try my (new) bootloader. Of course, there's nothing holding you back to write your own, especially since real-mode-only boot loaders are fairly easy to write.
Thanks for the offer Candy!! I'll probably just learn to write my own though since the whole purpose of this idea is so that I can intimately learn what is happening :).
jolson88

Re:Learning Assembly

Post by jolson88 »

Dex wrote: You idea, of a bootable game, is how i started to learn asm, my OS started life as lots of bootable modules that one day i linked by a CLI.
The going to and from pmode, for BIOS function, works well for things like mode swiching etc.

Here are some things that may help you,
1. A bootable demo for going to and from pmode, to swich modes (vesa, so needs vesa2 support )
http://www.dex4u.com/demos/DemoVesa.zip

2. A 2k dos clone http://board.flatassembler.net/topic.php?t=5275

3. A bootable tetris game, that fits in to the bootsector of floppy, all above come with fasm source code and are well commented.
Thanks for the samples Dex, I may have to check them out. Although I refuse to move on past them until I understand what every line is actually doing. Yes, I'm a geek, but I'm going to take this whole endeavor seriously (well, not "seriously" as in not fun, just "fun" and "deep" I suppose :P).
DynatOS

Re:Learning Assembly

Post by DynatOS »

Need ASM programming info??? Just visit ASMCommunity, it is a place dedicated to Assembly Language with forums, tutorials, examples, source and more ;)
Post Reply