Hard Light Productions Forums

Off-Topic Discussion => Programming => Topic started by: sigtau on November 13, 2011, 12:25:09 pm

Title: Teaching myself assembly
Post by: sigtau on November 13, 2011, 12:25:09 pm
As a boredom-killer for when I'm out of town and unable to use my game dev machine, I have taken up the clumsy art and exact science that is assembly code.  Toying around with the x86 instruction set at the moment, and I just wrote my first real piece of code:

Code: [Select]
org 100h

; set screen to 80x23 chars, 16 colors
mov al,3     
int 10h

; enable all 16 colors
mov bx,0
int 10h

; set the segment register
mov ax,0b800h
mov ds,ax                 

; print the characters
; every other byte is used because
; the first byte assigned is the ascii character
mov [02h], 'H'
mov [04h], 'e'
mov [06h], 'l'
mov [08h], 'l'
mov [0ah], 'o'
mov [0ch], ','
mov [0eh], ' '
mov [10h], 'W'
mov [12h], 'o'
mov [14h], 'r'
mov [16h], 'l'
mov [18h], 'd'

; Functionally the same as "press any key to continue"
mov ah,0
int 16h


ret


Now, none of this is really all that difficult--it's the protected mode stuff that really is a mind-rape to me.  Where would you guys recommend I look to to leran more?
Title: Re: Teaching myself assembly
Post by: Thaeris on November 13, 2011, 12:40:22 pm
...

The only assembly language I know is G-code for CNC machines. Good luck with whatever you intend to do with what you're working with!
Title: Re: Teaching myself assembly
Post by: JGZinv on November 13, 2011, 01:14:54 pm
Don't know how much it will be a help, but here's some pages on cracking assembly and related tutorials.

http://web.archive.org/web/20100426095113/http://home.online.no/~reopsahl/files/assem.htm

http://win32assembly.online.fr/tutorials.html
Title: Re: Teaching myself assembly
Post by: Nuke on November 13, 2011, 07:54:00 pm
youre better off learning asm on something with a smaller instruction set, like a microcontroller.

theres also this if you want to continue using x86
http://www.returninfinity.com/baremetal.html
Title: Re: Teaching myself assembly
Post by: LHN91 on November 13, 2011, 08:36:41 pm
Any assembly I've learned was on a 68k. Significantly less mid-rapey than x86. May be a better base to start with.

EDIT: and there are plenty of free emulators to test the 68k code out on.
Title: Re: Teaching myself assembly
Post by: portej05 on March 09, 2012, 06:19:50 am
Assembly is the devil's own because doing anything really useful (writing to the screen/etc) is extremely platform specific.
Best way to get into assembly is to use it. Seems to be easiest to do that under Linux (but watch out for AT&T style syntax instead of Intel style syntax).

Hope you've been finding assembly not too bad!