hi phillid!

who told you that you are insane writing OS in assembly?! simply saying you are not!
assembly language is far more *intimately* connected to the processor than C could ever be atleast in the next couple of millenniums! C is bounded by voluntary and involuntary optimizations and takes away "grass root" control out of your hands.
if you are a **real** programmer assembly should appear cooler to you than C. It means you are a very good programmer.. well atleast theoretically.
- How do I have variables in assembly? Do I have to write to memory addresses and use several of them as variables?
you don't have C like variables in assembly (though in GAS - GNU Assembler you can have variable like stuff). you define memory locations, initialized and uninitialized, using
db directive for byte ("unsigned char" in C),
dw for word ("unsigned int" in C) and others like
dd for doubleword (simply "a couple of
words". "unsigned long" in C). like "var db 0x10". so here you defined a initialized memory location "var" with value "0x10". google assembly tutorials and you find lots of simply explaining tutorials.
- How do I store-up input from the user (using int 0x16) in a variable (or address)?
you can take input characters from user and store them into such a memory location character by character and end the string with a 0 (representing NULL). look into tutorials i suggested and you'll find answers in detail.
- How do I perform conditional IF statements? All I have found is '%IF' which is only for the compiler to run.
traditionally and practically there are no "if" constructs in assembly by name "if". the "%if" you are referring to is nasm specific conditional (macro like i guess) so not much useful in most situations. what you can (and should) do in assembly is to create loops and conditional jumps to *simulate* C IFs in assembly code. trust me they are the real *optimized* form of code generated by your C compiler also when you tell it to optimize your code. so you can pre-optimize your code using assembly

! cool eh? an example:
Code: Select all
test_condition:
mov ax,0x0ff ; moving 0x0ff into ax register
cmp ax,0x0ff ; compare value in ax reg to 0x0ff
je .1 ; is ax = 0x0ff? if YES jump to label ".1". if NO continue on next line..
mov ax,0x0bad ; its not! move 0x0bad (meant "bad") into ax..
jmp .2 ; we are done. so lets go to the *end* instead of passing through ".1"..
.1:
mov ax,0x0c001 ; it is! then move 0x0c001 (meant "cool" ;-) ) into ax..
.2:
hope it helps
see you!
regards