HEX_addict
Posts: 14
Joined: Wed Jun 11, 2014 12:40 pm
Location: Romania

Re: Coding in HEX

Mon Jun 23, 2014 9:45 pm

dwelch67 wrote:I assume when you say hex you mean machine code?

Actually a number of us have been able to program the GPU using its instruction set thanks to HH and his work and the folks helping out there, now I believe Broadcom has published that info.

The arm instruction set is significantly easier than the x86 instruction set, much easier to program, if you can program x86 machine code you can do pretty much anything else.

If you cant operate an assembler or compiler you are not going to get very far anyway, spend a few more seconds and get those working. For example, simply load an sd card with the off the shelf raspbian or whatever os, which has the tools already built and ready to use. Or just get the pre-built ones from codesourcery (now mentor graphics) or https://launchpad.net/gcc-arm-embedded. Much easier than trying to encode branches and other instructions if you dont have a working assembler to show you how to do it. You only need binutils if you dont want to use C.
When I say HEX i mean: (see the picture)
cmd-PRINT A.gif
cmd com - Print A in Debug
cmd-PRINT A.gif (22.14 KiB) Viewed 4237 times
I take the HEX code B4 02 B2 41 CD 21 CD, and I write it, with HxD Hexeditor, in sector 0 of the Disckete. I write also 55 AA at the end of the sector 0, and reboot.

Some of you are able to program the GPU but maybe I ask too much.

ARM instruction are easyer than x86 but only me don't understand... (for the moment). :cry:

What is that GCC? Is a Assembler for ARM? It's working also for Raspberry Pi?

User avatar
joan
Posts: 15094
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Coding in HEX

Mon Jun 23, 2014 9:55 pm

GCC is the Gnu Compiler Collection. http://gcc.gnu.org/

HEX_addict
Posts: 14
Joined: Wed Jun 11, 2014 12:40 pm
Location: Romania

Re: Coding in HEX

Mon Jun 23, 2014 10:04 pm

DougieLawson wrote: Best of luck, it's taken Linus (and an army of acolytes) since 1991 to get their OS to the current status. So I'll look forward to your new super secure OS appearing in 2037.
Linus? Who is this man? He used an army to program an OS? :lol: Anddd... since 1991? :o maybe he takes so much time because he used an army. Army is good only for wars, not for computers. :lol: He finished his OS at the end? What is the name of his OS?

fordcars
Posts: 10
Joined: Thu Jun 26, 2014 6:23 pm

Re: Coding in HEX

Thu Jun 26, 2014 6:25 pm

He wrote a nice little OS called Linux :)

LlyrP
Posts: 22
Joined: Tue May 21, 2013 3:31 pm
Location: Edinburgh
Contact: Website

Re: Coding in HEX

Thu Jun 26, 2014 7:15 pm

Are you trolling or are you actually serious?

"Who is this Linus guy". Seriously....

On the off chance you are serious, his OS is called Linux and has been improved constantly since then. The small army of acolytes consists of some of the best minds in the computer science field, as well as some of the best known hackers (as in coders) out there with help from giant multinationals like IBM, Novell and even Microsoft have contributed code to it.

Learn ARM assembler. Learn to use the GCC (or Keil, whatever) arm toolchain. Then study it's output and see how you can improve it. As much as I respect your enthusiasm you are trying to fly before you can walk.

Don't bother writing plain hex because compilers/assemblers can do it much better and way faster that you ever will.

Sorry if I sound harsh but you sound like you are in way above your head and someone needed to say it.

L
Use your own judgement when following any instructions from the forum. I take no responsibility if you fry anything...
--
LlyrP :: http://llyrpenrose.com/

User avatar
jojopi
Posts: 3353
Joined: Tue Oct 11, 2011 8:38 pm

Re: Coding in HEX

Thu Jun 26, 2014 9:01 pm

HEX_addict wrote:I take the HEX code B4 02 B2 41 CD 21 CD, and I write it, with HxD Hexeditor, in sector 0 of the Disckete. I write also 55 AA at the end of the sector 0, and reboot.
This crashes the PC. Your code attempts to print an A using DOS interrupt 21h, but by putting it in the boot sector you have loaded it instead of DOS, and only BIOS interrupts are available to you.

Try B8 41 0E BB 07 00 CD 10 EB FE.

marked
Posts: 218
Joined: Fri Jul 29, 2011 4:25 pm

Re: Coding in HEX

Fri Jun 27, 2014 8:12 am

Feel like I'm about to fall down a deep dark hole with only a grue and Ralph Brown's Interrupt List for company...

env_explosion
Posts: 1
Joined: Sun Jul 06, 2014 6:46 am

Re: Coding in HEX

Sun Jul 06, 2014 8:08 am

So I decide to program my Raspberry Pi only in HEX. I want to write an OS impossible to brake, so only in HEX I can see exactly what I write.
(Sorry, can't find where to quote user. Maybe because I'm on mobile.)

So let me get this straight, you want to write a whole operating system in "HEX code"? Do you realize that an operating system is NOT a simple project that you can finish in a month, writing in machine language? You are saying you want to write the equivalent of Linux (assuming your OS you are writing is secure/stable) in its compiled form. This would be very impractical, and very hard to manage.
That's why I hate also C, and because of C exist hackers. If I have somebody to help me I can build a server imposible to brake.
I will do it anyway starting from next year when I will have enough money to eat, and stay relax.
I need only one month to read books of Assembler for x86, one month to makesmall exercises in ASM, and one month to programming the server.
Sometimes I'm asking...how much cost me a machine who can build me my own processor/SOC and my own Raspberry Pi? I can make it 10-20 times faster only by chanching the logic from inside him. I lose time from my brain trying to find how the processor working, instead make programs on Raspberry Pi. If a company will sell a kit to make your own Raspberyy Pi, i will change the world. Windows and Linux will be just history. I cane make every kind of program, but only in HEX. :(
If u find time, put here the code in HEX and ASM, to print a character on screen.
Please learn the difference between a hacker and a cracker. Hacker is misused, as you are doing.

You should not hate on C at all. C is actually a very useful and powerful language. Learn it. It's awesome. It even has inline asm if you really are that addicted to it.

Try making your own processor, you didn't describe how you want your processor made.

And make your own Pi.

What do you mean you can make it 10-20 times faster by "chanching the logic from inside him"?

If you lose time thinking of how the processor is working, then maybe you should find a language where you don't worry about the processor all the time? And you're switching to the Pi because you are confused by a processor?

I'm pretty sure that the Pi has a processor also.

A kit for the Pi would be interesting, soldering that many parts.

Go ahead and challenge Windows/Linux. I'm guessing your OS would be open source, but maybe not. Anyways, if it was, I'm not sure too many people would help.

That really is not good, writing in hex only, any programmer would tell you. If you decided "boy, I better learn the hardest possible thing that you could program in and use it for every single program I make", you should really learn something else.

So the Windows print to screen thing looks simple. If you want to print with no OS at all, you would need a bootloader (I'm pretty sure) and video output (and a print function, etc..).

But go ahead, make an OS in hex.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13374
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Coding in HEX

Sun Jul 06, 2014 12:34 pm

why not use octal, the base-8 numbering system. 177 025 172 003 105. If programming in hex has magical properties, programming in octal would have it even more so. :mrgreen:

and don't forget nibbles, the base-4 numbering system. 0 3 6 2 A E 7 D 5 3 9 0 B, half as much as hex, so double as powerful :?: :twisted: :roll:

then the ultimate, binary. 000110100100101000101010101001010010010010101000011010010001010100100100101.
infinite power :!:

:lol:


I apologize if the sounds harsh, but lets face it this is all nonsense! Programming directly in "hex" is simply deriving yourself of tools like assemblers that make creating "hex files" simpler, Doing without them make creating software harder, not more capable.

its just a simple trick if you can memorize a line of hex that on one particular system produces an 'A' on screen, not very useful outside that particular system, or if you want to do something beyond that.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6259
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Coding in HEX

Sun Jul 06, 2014 12:40 pm

I thought real programmers used butterflies.

Edit: But to address the actual topic:

Code: Select all

02D9A0E3
050000EB
FEFFFFEA
001080E5
1EFF2FE1
000090E5
1EFF2FE1
1EFF2FE1
10402DE9
5C009FE5
F9FFFFEB
0717C0E3
011781E3
4C009FE5
F3FFFFEB
48009FE5
0118A0E3
F0FFFFEB
0040A0E3
0400A0E1
014084E2
F0FFFFEB
010654E3
FAFFFF1A
28009FE5
0118A0E3
E7FFFFEB
0040A0E3
0400A0E1
014084E2
E7FFFFEB
010654E3
FAFFFF1A
ECFFFFEA
04002020
1C002020
28002020
That's dwelch's blinker example.

User avatar
rpdom
Posts: 17721
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Coding in HEX

Sun Jul 06, 2014 1:25 pm

mahjongg wrote:why not use octal, the base-8 numbering system. 177 025 172 003 105. If programming in hex has magical properties, programming in octal would have it even more so. :mrgreen:
Oh gods, don't remind me :(

Although I never had to program in octal, I spent many years decoding octal dumps[1], converting the code back into assembly instructions, then working out which COBOL instruction they were processing, in order to tell the young programmers where their code was failing and why.

[1] I didn't spend "many years" on each dump. Normally about an hour or so. Just that was part of my job as mainframe sysadmin and tech support for some years before I started migrating to unix and linux.[2]

[2] Yay, footnotes :-)

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Coding in HEX

Sat Jul 12, 2014 1:58 pm

This is how "real programmers" work.

The Story of Mel, from the jargon file.

No, Mr HEX_addict, by the definition above, you are not a "real programmer". And even if you were, your code would perhaps be beautiful, but it would also be unmaintainable. Use the proper tools.

Also, TEH MODERATERS R HIPEYS WIHTOUT SNES OF HUMAR

ghans
Posts: 7883
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Coding in HEX

Mon Jul 14, 2014 8:10 am

I wondered where that post went .. nice story though.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

MyNickNameIsTaken
Posts: 1
Joined: Thu Jul 17, 2014 1:29 pm

Re: Coding in HEX

Thu Jul 17, 2014 3:07 pm

Hello.
I googled something about MBR and Raspberry and found this link.
There is everything neccessary including the tutorials.
Thanks for that.

mimi123
Posts: 583
Joined: Thu Aug 22, 2013 3:32 pm

Re: Coding in HEX

Thu Jul 31, 2014 12:51 pm

A thing to the OP.

If you have such a brain , code a mandelbrot in Malbodge !
Will be a great lesson to you.

If you *really* do that , then you've done the impossible.

colinh
Posts: 95
Joined: Tue Dec 03, 2013 11:59 pm
Location: Munich

Re: Coding in HEX

Thu Mar 26, 2015 11:18 am

HEX_addict wrote:That's why I hate also C, and because of C exist hackers. If I have somebody to help me]I can build a server imposible to brake.
I will do it anyway starting from next year when I will have enough money to eat, and stay relax.
I need only one month to read books of Assembler for x86, one month to makesmall exercises in ASM, and one month to programming the server.
Sometimes I'm asking...how much cost me a machine who can build me my own processor/SOC and my own Raspberry Pi? I can make it 10-20 times faster only by chanching the logic from inside him. I lose time from my brain trying to find how the processor working, instead make programs on Raspberry Pi. If a company will sell a kit to make your own Raspberyy Pi, i will change the world. Windows and Linux will be just history. I cane make every kind of program, but only in HEX. :(
If u find time, put here the code in HEX and ASM, to print a character on screen.
and
HEX_addict wrote:I was funy right? :| Butttt.... If I was speak right? :|
You know, you have right. I will make a site where i will put my exercises in x86 HEX & ASM. I will sell All my books and things, to have money to eat, and I will keep only my bed, my TV, my I will do it anyway starting from next year, my pet fishes and my computers. From tomorrow I will wake up at 8:00 and I will sleep at 22:00-23:00. Three months I said?...3 months will be.
God please, be with me!
Please, don't close here till I will put the link from my site.

If I read the first post right, "I will do it anyway starting from next year", and this three month thing, then, if he sold his cheap China chear and out of order table, we can expect this imposible to brake server, possibly with a 10-20 times faster custom built RPi within a week!!! :o

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6259
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Coding in HEX

Thu Mar 26, 2015 1:03 pm

No need to bump an old thread just to mock someone.

Return to “Bare metal, Assembly language”