Programming in raw hex - possible?
Programming in raw hex - possible?
Here's something I've been getting the hump about; every time I've tried to assemble a piece of assembly code (when I was trying to learn how to program in assembly), it just wouldn't work, so I've been thinking - would it be possible (even if not practical), in your opinion, to write some simple programs in raw machine code? So, say I was writing a bootloader for an operating system, would a person perhaps be able to code it in a hex editor (this is assuming they have already written it in assembly language, and are just translating it), save it as a binary file, and then write it to the boot sector of the disk?
Have a day.
i am sure that is the hard way, if you can do this.
When you debugging again and again, you begin to understand by reading the opcodes (in hex view binary) like h@ckers do (if you have good memory).
BUT this does not means that you can also write in hex.
If you cannot write in assembler, how you will do the same thing from more difficult way ???
When you debugging again and again, you begin to understand by reading the opcodes (in hex view binary) like h@ckers do (if you have good memory).
BUT this does not means that you can also write in hex.
If you cannot write in assembler, how you will do the same thing from more difficult way ???
Keep coding...
...the sky is the limit
AsteriOS project: http://www.mindfields.gr/main/index.php ... &Itemid=27
...the sky is the limit
AsteriOS project: http://www.mindfields.gr/main/index.php ... &Itemid=27
Wasnt there a member here that started doing that? (Using machine code instead assembly--theres a thread about it)
I wonder how thats going now...
I wonder how thats going now...
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
hardcoding!!!11111
Yes, of course you can! Its called hardcoding.
The bigest Problem are the jump addresses. So most people use the nop command to fill space aftet "blocks" of commends. The adventage of this: you can make small changes on a block, and dont have to change jump addresses to this block or other blocks after the edited one.
You also have to callculate some values from binary to hex. But thats not very hard.
The bigest Problem are the jump addresses. So most people use the nop command to fill space aftet "blocks" of commends. The adventage of this: you can make small changes on a block, and dont have to change jump addresses to this block or other blocks after the edited one.
You also have to callculate some values from binary to hex. But thats not very hard.
- crazygray1
- Member
- Posts: 168
- Joined: Thu Nov 22, 2007 7:18 pm
- Location: USA,Hawaii,Honolulu(Seriously)
That was me, and yes it's going fine though I'm not writing the Bootloader right now that's what I'll be doing...neon wrote:Wasnt there a member here that started doing that? (Using machine code instead assembly--theres a thread about it)
I wonder how thats going now...
Codname: Cipher
Working On: Design Doc(CFFS file system)
Working On: Design Doc(CFFS file system)
yes you can do it, especially, with some kind of machineS.
http://www.homebrewcpu.com/photo_gallery.htm etc etc
http://www.homebrewcpu.com/photo_gallery.htm etc etc
Actaully he wrote software in C. The minicomputer switches editing of memory is a nostalgic/debugging thing.binutils wrote:yes you can do it, especially, with some kind of machineS.
http://www.homebrewcpu.com/photo_gallery.htm etc etc
here ya go
those are the only codes I know how to use, but I know from typing in numbers and debugging my x86Lib project, that 0x00 is add modrm, 0x10 is adc modrm, and 0xF0 is lock
other than that, I have nothing memorized...
I could imagine writing simple programs in hex, but the addressing would be the hellish part, I would have to make a program that lets me use some sort of symbol table and compiles my hex code to resolve to the right addresses...lol...kinda pointless then though...
Code: Select all
0x90 ;nop
0xF4 ;hlt
other than that, I have nothing memorized...
I could imagine writing simple programs in hex, but the addressing would be the hellish part, I would have to make a program that lets me use some sort of symbol table and compiles my hex code to resolve to the right addresses...lol...kinda pointless then though...
Perhaps, lately.Tyler wrote:Actaully he wrote software in C. The minicomputer switches editing of memory is a nostalgic/debugging thing.binutils wrote:yes you can do it, especially, with some kind of machineS.
http://www.homebrewcpu.com/photo_gallery.htm etc etc
--William Bruce Buzbee wrote: ...
7/7/2002
Lots of progress on the microcode rewrite. It looks like I'm going to end up with about half the microcode as the previous version. This is due to my more aggressive use of field decoding in the compacted microcode structure.
...
http://www.homebrewcpu.com/mcode_index.htm etc etc
PS: http://en.wikipedia.org/wiki/Microcode
Re: Programming in raw hex - possible?
If your Assembly codes don't work, how are you expecting to be able to write something even more low-level than that. It is like saying "I can't hold a 1 kilogram dumbbell but now I think I should start lifting 20 tons bulldozers off of the ground".toots wrote:Here's something I've been getting the hump about; every time I've tried to assemble a piece of assembly code (when I was trying to learn how to program in assembly), it just wouldn't work, so I've been thinking - would it be possible (even if not practical), in your opinion, to write some simple programs in raw machine code? So, say I was writing a bootloader for an operating system, would a person perhaps be able to code it in a hex editor (this is assuming they have already written it in assembly language, and are just translating it), save it as a binary file, and then write it to the boot sector of the disk?
Writing code in anything low-level than Assembly is an utter waste of time. I sometimes think of writing Assembly codes as a waste of time also. If you have lots of time, then go for it but at the end of the day, you will be somebody who has learned to program in hex. Does anybody really care? Sometimes the level of difficulty of something is not directly associated with the level of appreciation you will achieve from it. But then again, it is all preference. Learning how to write BrainFuck programs is a waste of time but it helps you develop your mind even further so that's why many people still code in BrainFuck for the heck of it.
Back to your main topic, if you don't know how to write code in Assembly, learning how to write code in binary won't help you at all. If you didn't know how to use Front Page or DreamWeaver and you got stuck in creating a table for example, then you could use your HTML skills to manually edit the HTML file. But suppose your code doesn't work in assembly because instead of LEA EAX , [EDX + (ECX*0x04) + 22] you have LEA EAX , [EDX + (EDX*0x04) + 22]. How do you think your coding in binary abilities would help you fix this?
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
CD21 - interrupt 0x21 (Go DOS!)
Its actually a 2byte opcode, CDnn. where nn is the interrupt number.
Of course, you can always check up on the processor manuals for the complete list...
Its actually a 2byte opcode, CDnn. where nn is the interrupt number.
Of course, you can always check up on the processor manuals for the complete list...
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}