hey TeKRoMaNCeR:
read que's dos programmer's reference. it explains all. very good book. old but very informative. it even tells you who/what MZ is. (MZ is the first 2 characters of any .exe progs in the dos realm) talks about "created by.. stuffs".
Printable View
hey TeKRoMaNCeR:
read que's dos programmer's reference. it explains all. very good book. old but very informative. it even tells you who/what MZ is. (MZ is the first 2 characters of any .exe progs in the dos realm) talks about "created by.. stuffs".
Que Programmers.... who's the author, I'll look for it... =]
Also... Terr.. you seem to be the expert in this.. Is there a class like that... very obsolete learning...? I mean.. yeah, I'm gonna take binary coding when it's available (when I meet all the prerequisites)... But.. I think more than ever, we should learn how to build a computer from scratch... let's say we had.. uh.. inexplicably a crazy emp war.. and everything was fried.... who would build the comps? Bill Gates? And what.. sell them for 100k a piece? Ha.. I'll build my own thanks.. you know... our technology doubles every 3 months.. are we gonna be the aliens visiting other planets taking over their resources? Hehe.. I don't know.. advice... sleep IS your friend... The computer is a good friend too.. but... it's like my dog, it always wants to play... and doesn't realize the value of sleep.. END POST! NOW!.. zzzzzzz
Well, the making of a motherboard aside, if your wanting to write your own OS in Assembly, and are using an Intel Processor, I have *somewhere* alot of technical documentation from Intel with heaps of assembly information.. If you want it, I'm sure I could dig through my hard drive and find it for you...
Additionally, one of my friends attempted to write his own in Assembly, and I'm sure he has some resources that would be quite helpful for you..
Hey Terr: Have you read William Gibsons book "The difference engine"???? I have just started the same.
After reading "Neuromancer" and "Mona Lisa Overdrive" just could not resist the idea of "what if" the difference engine had actually worked.
The civil war (U.S) might have been a monsterous affair, not to mention the "war to end all wars". :)
With All the binary in the Air for this thread, i thought i'd change it slightly, and say ... this is where hex comes into play.
U dont program in binary, u can however program in hex. Assemblers are very simple Compilers basicly, Assembly is the lowest form of language to people, but when u assemble it, it gets converted into hex. It is this that gets executed by the processor (after conversion into binary).
So from this i'll do a simple example .....
Using most versions of DOS comes a simple debugger ("Debug.exe") using this u can program .com files in assembly, and it will convert the whole file into hex. now with .com files they are an exact copy of the program code (no header info besides the identifyer), they are limited in size to 64k.
if u start debug up preceded by a non existant file name it just gives u a
-
Hit A to enter assemble mode.
it will display the first memory adderss and await input.
then enter your first Assembly instruction.
Hit enter, then enter next instruction...... etc
when done, leave a blank line and just hit enter.
it should look something like this:
C:\>debug blah.com
-A
0B31:0100 mov ax,4c
0B31:0102 int 21h
0B31:0104
-
back to the -
from here we need to enter the amount of bytes to save to the file.
this is stored in the CX register.
so if u type rcx , it will display the current value and prompt u for a new value.
u need to enter the the difference between your start address (in this case 100 (for all com files) ) and your finish address (in my case 104).
so the total leaving 4, so put 4 in CX.
then just hit w to write the data to the file and q if u want to quit.
the output will contain your hexadecimal equivalent to your assembly instructions.
The file will run as a normal .com file (all it does is return control to DOS, if u write anything bigger u need those 2 instructions on the end or the program will crash after execute).
all so simple ...
What the file contains in ascii : ¨YL ¨T!
The Hexadecimal reprisentation in the file each represents an Assembly instruction ... eg 2B 4C (as the first 2 bytes in the file) This is the same as mov AX,4C
u get idea.
using debug u can display the results of your program using the T and the prompt, that will trace through the code and u can see the memory addresses, hex opcodes, operands and registers. quite a powerfull tool (although not as strong as gdb :) )
And thats basicly how it works. if u know the hex opcodes your blown in (there are hundreds of thousands and very between processor platforms).
heh, sorry this post was a little big, just wanted to explain it well. (although i am drunk and tired).
:D
Underneath your C++ programming is actual Assembler (which in its self is represented by Hex code). All your compiler does is change what you wrote, using its language specific rules, into the processor specific assembler code. Remember that this is a computer doing the conversion so in no way is it perfect.
An example of a reason to want to program in assembler is sometimes you might find that a program has one specific error in it that you are unable to fix normally. In this case you would have to go underneath and manually change the Assembler representation of that code to fix the bug. Many compilers will output your code into Assembler if you're interested in taking a look or changing things.
Continuing, there are different processors and all processors are slightly different depending on their manufacturer and architecture. The MC68HC11 processor made by motorola has, for example, a built in stack. Other processors (ie. AMD and Intel) might not. Another characteristic that is specific to processors is the hex code for different commands (ie. Hex for LDAA which means load accumulator A for the 68HC is 86). Different processors will have different numbers of accumulators, different sizes of accumulators, store the program code in different spots in memory, handle interupts differently, etc etc.
As for programming an OS in Hex/Binary, my advice is DON'T. If you have the urge for programming it in assembler, go right ahead but it will take you a very long time. There is a reason that high-level languages were invented. Though they waste a lot of assembler code, your compiler is a lot better at remembering where you stored that variable in memory, etc.
On the other side of things: Programs written in Assembler are FAST! Like I said, compilers waste a good deal of commands in assembler and that means processor time. I have had prof's who swear by assembler (they all seemed a little nutz to me though). If you're interested in learning I've put up a sample program in my yahoo briefcase. It's just a vending machine, nothing special, and was written specifically for the 68HC11. Don't have a motorola processor? Don't worry, I included a compiler and simulator with the program in the zip. See the readme for info.
The link to it is here: http://briefcase.yahoo.com/grande_stronzo
As for MAKING your own mother board. Well, I don't know how up to date your circuit analysis is but... ;)
Hey, thanks for all the enlightening messages.. I think I'm gonna wait until I actually take a class on it.. I don't think it's something I'd be very good at learning on my own..
I'm hungry..
hey man enode..that is great knowledge about assembly .
i am very much interested in assembly as i am a C and unix programmer...but u see i am not getting ..basic tutorials on the net which teaches u about assembly.
u know just like "Assembly for beginners or for dummies" as i want to learn assembly language.
so can u pls tell me from where can i get this type of documents or tutorials on assembly.
i am requesting to all of u if anybody knows ..from where willl i get basic tutorials on Assembly programming.
thank u.....
intruder..... :borg:
Try here: UVic CSC 230 Lecture Slides. Like I said, your local uni is your best source of info. People have to learn it somehow...Quote:
Originally posted by intruder
i am requesting to all of u if anybody knows ..from where willl i get basic tutorials on Assembly programming.
thanks a lot friend stronzo i went to that site and got very good documents on assembly...thanks a lot once again..Quote:
Originally posted by Stronzo
Try here: UVic CSC 230 Lecture Slides. Like I said, your local uni is your best source of info. People have to learn it somehow...
intruder...