Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: I learned Basic c and some assembler...what now?  (Read 1380 times)

gigaraptor487

  • Bay Watcher
  • Escaped Lunatic now civilised
    • View Profile
I learned Basic c and some assembler...what now?
« on: September 13, 2013, 06:41:41 pm »

Basically i read a C book over a weekend and began writing stuff. Within a fortnight i had two projects implemented(a game where you must grab as much food as possible in 30 seconds and a roguelike demo) and moved onto basic 8086 assembler(basically up to bootloaders and associated interrupts but no real implementation of segmented real mode(although i think i understand it)), with that i wrote a basic bootloader with an output function(well its called) and a failed input function(echoes text, but for some reason won't copy AL to the array element like it is supposed to).

So what i am asking the massive community of programmers on bay12 is what should i do next with my knowledge or where can i acquire more knowledge(especially for OS-less enviroments) or what i should do as i am genuinley clueless on what to do next.

Thanks for reading.
Logged
Hehe, you thought there would be an interesting sig here

I now run a program which brings old multiplayer games back to life : click

Tellemurius

  • Bay Watcher
  • Positively insane Tech Thaumaturgist
    • View Profile
Re: I learned Basic c and some assembler...what now?
« Reply #1 on: September 15, 2013, 11:50:52 pm »

Next understand the usage of telnet and hack routers, understand the usage of serial ports and hack everything.

Aptus

  • Bay Watcher
  • Indeed ôo
    • View Profile
Re: I learned Basic c and some assembler...what now?
« Reply #2 on: September 16, 2013, 12:50:21 am »

So what i am asking the massive community of programmers on bay12 is what should i do next with my knowledge or where can i acquire more knowledge(especially for OS-less enviroments) or what i should do as i am genuinley clueless on what to do next.

Thanks for reading.

Buy a microcontroller, decide on something silly you want it to do, put your nose in the documentation and go ham?
Logged

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: I learned Basic c and some assembler...what now?
« Reply #3 on: September 16, 2013, 07:25:22 am »

So what i am asking the massive community of programmers on bay12 is what should i do next with my knowledge or where can i acquire more knowledge(especially for OS-less enviroments) or what i should do as i am genuinley clueless on what to do next.

Thanks for reading.

Buy a microcontroller, decide on something silly you want it to do, put your nose in the documentation and go ham?


He could get an Arduino, that would basically give him everything he needs to get some basic stuff up and running, like the archetypal home-built weather station or something like that. Alternatively, a Raspberry Pi comes with a network and graphics capabilities, but that may be a bit heavy-handed for a first project.
« Last Edit: September 16, 2013, 07:28:04 am by Virex »
Logged

Tellemurius

  • Bay Watcher
  • Positively insane Tech Thaumaturgist
    • View Profile
Re: I learned Basic c and some assembler...what now?
« Reply #4 on: September 16, 2013, 10:15:07 am »

So what i am asking the massive community of programmers on bay12 is what should i do next with my knowledge or where can i acquire more knowledge(especially for OS-less enviroments) or what i should do as i am genuinley clueless on what to do next.

Thanks for reading.

Buy a microcontroller, decide on something silly you want it to do, put your nose in the documentation and go ham?


He could get an Arduino, that would basically give him everything he needs to get some basic stuff up and running, like the archetypal home-built weather station or something like that. Alternatively, a Raspberry Pi comes with a network and graphics capabilities, but that may be a bit heavy-handed for a first project.
Pi is really easy if you know how to use serial and GPIO ports and its in linux so its OS supported.

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: I learned Basic c and some assembler...what now?
« Reply #5 on: September 16, 2013, 11:53:12 am »

This is a little belated, but--

Beaglebone and Raspberry Pi are both ARM, and not x86 based. This means that many of the things done with x86 realmode assembler (what the OP was talking about with Segment:offset memory space, and pals) simply wont apply. Assembler is VERY much CPU specific, unlike C. (C was created in part, to help overcome this issue with Assembler languages)

I would instead suggest that the OP get either BOCHS or DosBox, since they represent a very consistent and virtualized x86 machine capable of running assembler programs.  Both are able to boot a REAL dos disk image, which means access to DEBUG and pals.  (Getting your hands on a REAL realmode x86 machine these days is like herding cats.) They are also free, and if he uses FreeDOS, that is free too. He can make and test boot loaders to his heart's content this way, without actually having to write to physical media, and in the case of BOCHS, can have a built in stack-trace debugger to help things along.

Theoretically, EVERY intel and AMD based system on the planet still starts in realmode if it uses an IBM PC compliant BIOS bootstrap process. (EFI and UEFI are different.) This means that if you are writing OS launchers like GRUB, you are likely to be writing x86 realmode assembler, like the OP is trying to learn.  I used to know a guy who was a veritable wizard at this, but that was many many years ago.  Instead, I will simply pass on what he told me: "You can find an amazing wealth of community created tutorials and primers on the various news groups and boards."  (that should date about when this conversation took place. He was not referring to the modern internet, but to Usenet, and actual dialup BBS boards.) Much of that information is still available, if you go spelunking.

For instance, realmode assembler playtime is now often intermixed with other "realmode programming" playtime, like with good old Qbasic. (another retro realmode language that has a subfollowing is Pascal, so try sites dedicated to that too.) Qbasic is, as basically everyone knows who's used it, "Very limited". (that's an understatement.)  However, it lets you put in-line assembler into the programs you make with it. You can even just inject a dumb noop loop with an entire program written in assembler, and then tell the QB compiler to make it into a program for you.  As such, many of the more sexxyful QB programs and libs out there make copious use of the incalculably faster assembly routines to do heavy lifting, called using QB modular format.

This means, among other things, that you can find a real wealth of realmode assembler tutorials and primers in the many still existing QB fansites, like this one.

You can just ignore the QB stuff, since that isnt what you are looking for-- and focus on the assembler morsels instead.
« Last Edit: September 16, 2013, 12:03:43 pm by wierd »
Logged

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: I learned Basic c and some assembler...what now?
« Reply #6 on: September 16, 2013, 12:12:10 pm »

As for WHAT to do next:

Play with oldschool DOS TSR programs. (Terminate, Stay resident)

These are usually programs that add a service routine to memory, and a pointer in the interrupt vector array. These are things like disk drivers, mouse pointers, and pals, but can also be other things, like soft-bioses for custom hardware devices.

Your average PC has a number of useful ports you can make use of in realmode to do nifty and fun-filled activities, the most well exploited of which, being the PC Parallel port.  This is essentially a package of 16 GPIO pins, and a +5v with a ground.  I don't think I need to explain how sexy that is. :D 



Logged

Tellemurius

  • Bay Watcher
  • Positively insane Tech Thaumaturgist
    • View Profile
Re: I learned Basic c and some assembler...what now?
« Reply #7 on: September 16, 2013, 12:24:48 pm »

Everybody should know ARM assembly though, its a alot more  easy to get into other than x86.
also learn and build UNIX, its like god for IT

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: I learned Basic c and some assembler...what now?
« Reply #8 on: September 16, 2013, 12:55:40 pm »

I've switched my home desktop to linux some years ago, and as I grow ever more accustomed to it, it reminds me of the hidden CP/M underpinnings behind old school DOS, but with improved security, and threading.

The deal here, is that the OP wants to learn about bare metal.  Beaglebone and RPi are good high level educators, but not so good at low level, since the hardware is an obfuscated blob of silicon, that Broadcomm refuses to release REAL whitepapers for.  As such, you dont really get a REAL "naked computer" experience from it.  Replacing the linux on that SDCard with a custom loader and kernel, and expecting to make use of it raw and unfettered is not an exercise for the novice.

The x86 platform however, has COPIOUS amounts of documentation written on it, and you most certainly CAN get raw, bare metal control over it, if you learn all the ins and outs of the architecture.  (You can get 64bit wide mode by initiating the CPU in realmode with a boot loader, loading a second stub program into memory, switching modes, and jumping execution. That gives you access to the full 64bit size registers, the full 64bit memory address space, and all that jazz. You can do some SERIOUS foot pounding on a modern rig! But to get there, you need to know realmode ASM, and 32bit protected mode extensions, before even attempting to play in 64bit land. That is because the instruction set and methodologies were built cumulatively.)

Logged

Tellemurius

  • Bay Watcher
  • Positively insane Tech Thaumaturgist
    • View Profile
Re: I learned Basic c and some assembler...what now?
« Reply #9 on: September 16, 2013, 01:07:13 pm »

hey im just giving suggestions man for difficulty and OP didn't specify :P


Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: I learned Basic c and some assembler...what now?
« Reply #10 on: September 16, 2013, 02:15:53 pm »

This is a little belated, but--

Beaglebone and Raspberry Pi are both ARM, and not x86 based. This means that many of the things done with x86 realmode assembler (what the OP was talking about with Segment:offset memory space, and pals) simply wont apply. Assembler is VERY much CPU specific, unlike C. (C was created in part, to help overcome this issue with Assembler languages)


While the available commands and memory layout differ, both ARM and x86 are essentially the same kind of processor. It's not like one of them is a vector processor or anything. It should be relatively easy to pick up one if you're familiar with the other.
Logged

gigaraptor487

  • Bay Watcher
  • Escaped Lunatic now civilised
    • View Profile
Re: I learned Basic c and some assembler...what now?
« Reply #11 on: September 16, 2013, 02:22:43 pm »

Damn thanks everyone, didn't expect this many replies.
Logged
Hehe, you thought there would be an interesting sig here

I now run a program which brings old multiplayer games back to life : click