waterbender
Posts: 2
Joined: Sun Sep 18, 2016 6:57 am

Graphics+Raspbian+Assembly

Sun Sep 18, 2016 7:19 am

Hi, all!
I am starting my adventures with the RPi mostly for use in an educational environment, so I admit myself a total beginner.

While I have been able to get around most of what I have set myself out to do, there's one tiny single thing that's causing me a great headache: creating a graphical program using pure assembly language (not so tiny, I know). There is a lot of information on how to set up the messaging systems for both main and video processors in a bare-metal approach for framebuffer, but I'd like to use an OS as long as it is possible. I would like to do a simple windowed or full screen application (whichever is easier) and being able to write text to it at a given position, draw figures, color pixels, get input from keyboard, change colors (8 bit RGBA or similar is more than enough). No use of the mouse is necessary.

The chosen OS was Raspbian for a simple reason: it came in my SD card and I have been tinkering everything around it so far; I don't think I have the time to restart with a different OS at this point but I will definitely consider it for future projects.

My specific question: does any one know of a guide/tutorial/manual/example/other that addresses building (very simple) graphical applications using assembly language with Raspbian on top of an RPi 3 Model B (or that it applies to an scenario such as this)?

Thanks in advance for any information!

P.S.: Since there is no assembly section in the forum and there is a graphics programming, I figured this would be the best place for my topic. Forgive me if it was not so in the end.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23309
Joined: Sat Jul 30, 2011 7:41 pm

Re: Graphics+Raspbian+Assembly

Sun Sep 18, 2016 2:52 pm

DO you want to write all the graphis code yourself? Like line drawing, polygon fill etc. Or do you want to use the OpenVG libraries?

If the former, you should be able to write something like a GTK app that creates window, write you own frame buffer code, then blit you own framebuffer to the window for display. Write as much as you want in assembler.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

waterbender
Posts: 2
Joined: Sun Sep 18, 2016 6:57 am

Re: Graphics+Raspbian+Assembly

Sun Sep 18, 2016 3:00 pm

Thanks for the advice. Exactly the first option you said is what I would like to do.
Do you happen to know of any material that might help me get started on this?

I will run some searches with GTK included to see what I come by, so far I've only tried to find how to make use of framebuffer and the answer is mostly for bare metal development.

raysan5
Posts: 37
Joined: Tue Sep 30, 2014 4:44 pm
Location: Barcelona
Contact: Website

Re: Graphics+Raspbian+Assembly

Sun Sep 18, 2016 9:41 pm

Hi waterbender,

Maybe you can try raylib (www.raylib.com) to do some simple graphics (and more). It's not assembly but it's C, quite low level also.

You can just download library and examples from github (https://github.com/raysan5/raylib) and there is some usage information from Raspberry Pi on the wiki (https://github.com/raysan5/raylib/wiki/ ... spberry-Pi)

I created raylib to teach videogames programming to my students and I've been using it for three years now with great results...

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23309
Joined: Sat Jul 30, 2011 7:41 pm

Re: Graphics+Raspbian+Assembly

Mon Sep 19, 2016 10:53 am

waterbender wrote:Thanks for the advice. Exactly the first option you said is what I would like to do.
Do you happen to know of any material that might help me get started on this?

I will run some searches with GTK included to see what I come by, so far I've only tried to find how to make use of framebuffer and the answer is mostly for bare metal development.
You just need GTK to give some sort of output device for your own framebuffer. You could use dispmanx as an alternative which is native Pi hardware blitting.

As for help of writing you own graphics primitives, any elderly Computer Graphics textbook should have a load of stuff in. Good luck. I did this sort of thing on BBC micro's in the dim and distant past.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

Return to “Graphics programming”