User avatar
Jim JKla
Posts: 2218
Joined: Sun Jan 29, 2012 11:15 pm
Location: Newcastle upon Tyne UK

Re: How does raspberry pi OS work?

Wed Jul 23, 2014 8:44 pm

In assembler you are dealing directly with registers with only a limited commands.

That DOS is built on a different arangement of registers. Even DR DOS
Noob is not derogatory the noob is just the lower end of the noob--geek spectrum being a noob is just your first step towards being an uber-geek ;)

If you find a solution please post it in the wiki the forum dies too quick

jran1216
Posts: 87
Joined: Wed Jun 25, 2014 3:45 pm

Re: How does raspberry pi OS work?

Wed Jul 23, 2014 8:50 pm

No not my pi...

And that's what I expected. Surely you could just use complex libraries instead though?
If worst comes to worst you could always try to sum up the function for other systems if needed?

Does assembly have arguments?

jran1216
Posts: 87
Joined: Wed Jun 25, 2014 3:45 pm

Re: How does raspberry pi OS work?

Wed Jul 23, 2014 8:52 pm

Oh no hang on different arrangement. That would be hard. Still possible?

Ah and is that how Microsoft patented it?

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

Re: How does raspberry pi OS work?

Wed Jul 23, 2014 9:01 pm

Assembly is mostly a set of low-level CPU instructions, like "MOV R0, #12" which puts the value 12 in the 32-bit CPU register called R0. It also has some arithmetic instructions and comparisons. Arm instructions can be conditionally executed.

What do you mean by "arguments" in this context?

User avatar
Cancelor
Posts: 778
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: How does raspberry pi OS work?

Wed Jul 23, 2014 9:06 pm

The first step will be to learn a language. For one component to talk to another requires a pre defined set of rules, syntax, vocabulary and protocol otherwise there is no communication, just meaningless rubbish. In your case I would recommend English; it's well know, tried and tested and once mastered it is a wonderful way to communicate.
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

jran1216
Posts: 87
Joined: Wed Jun 25, 2014 3:45 pm

Re: How does raspberry pi OS work?

Wed Jul 23, 2014 9:15 pm

No I meant arguments to join switches together but actually from that the command joins together binaries right? So no arguments are needed, the processors power is the amount of switches then. Or silicone thingies rather. So motherboard building must be pretty complex. If I'm right, is there a universal build to them? I mean there must be an activation somewhere. Is that the triggers, assigning a switch or switches to a certain part of the board?

Yeah perhaps I shouldn't abandon english. I'll exercise it :P .
Yeah or perhaps learn. Its a shame really isn't it, I am British.

jran1216
Posts: 87
Joined: Wed Jun 25, 2014 3:45 pm

Re: How does raspberry pi OS work?

Wed Jul 23, 2014 9:44 pm

Yeah anyway it sort of is, sort of isn't. Well I think I'm good to muddle through initiation process on my own.
I will try to post more constructive comments in the future.
And exercise my English.

Seriously, thanks. You have all helped a lot. Binaries in computers were always a sticky situation for me and something I got confused about in school. You have made my day by enabling me to realise a heck of a lot of things.

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

Re: How does raspberry pi OS work?

Wed Jul 23, 2014 10:21 pm

Binaries in computers to interface with silicon. In the memory uses "switches", at least conceptually. But switches also indeed for the triggers, often in a certain part of the board. But the Rasperry Pi is triggered without switches (except for the conceptual ones in silicon). Board designers make extensive use of quantum mechanics and thermodynamics, but in their brains not consciously in their actions. That's what's great about physics. The initiation process starts with a "1" (or a "0" depending on which end you look at) so the build IS universal.

Edit: I just reread my post and realised that it wasn't clear. You *must* use simple libraries because the processor has no intrinsic support for complexes. You can *emulate* them, but the resulting libraries and switches are incoherent and possibly self-referential. And we don't want to open that can of worms, do we?

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: How does raspberry pi OS work?

Wed Jul 23, 2014 10:38 pm

jran1216 wrote:So motherboard building must be pretty complex. If I'm right, is there a universal build to them?
http://www.raspberrypi.org/documentatio ... /README.md

A processor (CPU) can only execute machine code, which is a long list of binary instructions. Each machine code instruction (which may or may not have arguments associated with it) tells the CPU to do one specific thing. And by combining lots and lots of different instructions (which includes arithmetic, tests, loops, branches, etc. etc.) you get a working program.

However people find it a bit hard to write programs in binary ;) 0010101010101011111100010110111000111100001

So instead they write programs in assembly language, such as in http://www.cl.cam.ac.uk/projects/raspbe ... orials/os/
(Each assembly language instruction corresponds to one of the binary machine-code instructions.)
Then they run a program called an 'assembler' (or a 'compiler' if you're using a higher-level language) which takes this human-readable assembly language and turns it into a binary (containing machine-code instructions). And then they tell the operating system to load the binary into the CPU and execute it (i.e. run your program).
It's a bit more complicated than that, but that's kinda the high-level gist.

I'm guessing you might find http://computer.howstuffworks.com/boolean.htm interesting... :idea:

User avatar
DougieLawson
Posts: 40214
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How does raspberry pi OS work?

Wed Jul 23, 2014 10:51 pm

The definitive textbook is: http://www.amazon.co.uk/The-Computer-La ... 0721402860 we had a first edition copy of that in 1971.
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

jran1216
Posts: 87
Joined: Wed Jun 25, 2014 3:45 pm

Re: How does raspberry pi OS work?

Wed Jul 23, 2014 10:53 pm

No no more questions. Thanks for the link.

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

Re: How does raspberry pi OS work?

Thu Jul 24, 2014 5:59 am

jran1216 wrote:That being said does assembly code include arguments? If so I'll use assembly code.
Oh, lots. Which assembler to use, what syntax is best, how best to load constants...

jran1216
Posts: 87
Joined: Wed Jun 25, 2014 3:45 pm

Re: How does raspberry pi OS work?

Sun Jul 27, 2014 5:40 pm

I do actually have another question and hopefully this post is not dead.
With screens are they going to be a standard in computing. Hence standard output which was explained in linux a pocket guide. There must have been a time in computing which actually enabled a display in computing. Say for example we have a heads up display or a display of radars. There must be a spectrum of a colour sent to the right pixel. Say again for example we have a real switch and if this real switch is switched on, then if or elseif another switch is switched on then different functions would be accessed. Is it all just powered silicone again to display an image on screen, from, and this is where I'm getting stuck and need some help a relay between two bits of information. Say for example we would be sitting infront of a radar screen and seeing a line moving radially through a circle. Does an amount of power assigned binarilly assign the colour, position, and two positions just happen one consecutive move after another.

If I'm totally wrong just put "totally wrong"

Thanks

P.S. is a string named a string because it strings together binaries.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: How does raspberry pi OS work?

Sun Jul 27, 2014 6:09 pm

jran1216 wrote:With screens are they going to be a standard in computing.
Um??? :shock:
http://en.wikipedia.org/wiki/Video_Graphics_Array
http://en.wikipedia.org/wiki/Hdmi
http://en.wikipedia.org/wiki/Digital_Visual_Interface
http://en.wikipedia.org/wiki/Displayport

Lots of different display standards...
There must have been a time in computing which actually enabled a display in computing.
Yeah, the first "displays" used by computers were e.g. a bunch of lamps or LEDs.
http://www.computinghistory.org.uk/big/78/Altair-8800/
Is it all just powered silicone again to display an image on screen, from, and this is where I'm getting stuck and need some help a relay between two bits of information.
Typically you write your "display image" into "display RAM" (e.g. on a graphics card) and then the display processor scans through the display RAM, either outputting an analogue signal (in the case of VGA) or a digital signal (in the case of HDMI). The timing of the output signal needs to be very accurate in order to meet the relevant display standards, which is why the process updating the image in display RAM (by the CPU) is typically separate from the process that converts that into an output signal (the display hardware).
P.S. is a string named a string because it strings together binaries.
In computing terms a "string" usually refers to a string (sequence) of ASCII characters. E.g. the sequence of characters 'h', 'e', 'l', 'l' and 'o' can also be referred to as the string "hello".

dwelch67
Posts: 968
Joined: Sat May 26, 2012 5:32 pm

Re: How does raspberry pi OS work?

Sun Jul 27, 2014 6:28 pm

Problems in general are broken down into manageable pieces. So are computers and everything that goes with it.

Assembly language arguments. No there are not really any. You have general purpose registers which are really no different than variables in a high level program. You assign values to them and just like any language there is a fixed set of things you can do to them at the lowest level for that language, for assembly you can do things like add, subtract, and, or, xor, etc. As well as use them to hold addresses or data when performing a store or load.

How do we use that to make the computer do things well first off there is the processor core, the registers and the operations you can do on that core. Then outside that is a layer where addresses and data and read/write controls leave the processor, this address space can be just plain memory itself, or sometimes rom and often peripherals. Like a uart, or usb controller, disk controller, video, etc.

These peripherals are blobs of logic themselves that have layers, a uart for example manages the timing of the signals on the uart tx output as well as sampling and decoding or at least trying to the signal coming into the rx input. It converts to and from serial and parallel, and provides registers with which we talk to the uart. These are called registers which is the correct name but are a little different than the registers in the cpu core. The registers we often call general purpose registers in the cpu core are wired to the logic that does adding and subtracting and memory operations and such. The registers in the uart are wired to the logic in the uart that does shifting and clock dividing and decoding and such. At the next higher level there needs to be address decoding between the processor core and the peripherals. To mail something to your mom it has to leave your house and make it to your moms house this requires some higher level infrastructure, the post office, drivers, delivery people, and an address encoding that everyone understands and uses. Same here to get data to/from the peripherals we have that infrastructure built into the chips as well as between chips.

Video is just another one of these layers, a bit more complicated in that you need a lot of bits in order to maintain a separate color for each pixel for many pixels. You need a way to determine within that memory which pixels belong to which rows and columns and such. Within the monitor you need a way to display those things, etc. This is somewhat "simplified" by again defining a transport mechanism between the video card and the monitor. Going back to analog televisions and ntsc and pal and such which defined the number of scan lines how the data was timed, what the voltage levels mean, how to know the beginning of a scan line or when or what a refresh looks like and so on. Then the tv people work their side of that interface and the source people work their side. Over time we have created more definitions to handle a larger number of pixels and colors and higher refresh rates. but the fundamentals have not changed in any way. The processor does its thing, programmers know how to program the processor and are given an address map of where the peripherals are. The peripherals are designed to do a job and with internal layers of tasks being divided up they do those jobs, they also provide a local map for programmers on how to control that peripheral. Peripherals with external interfaces conform to some agreed upon protocol, usb, serial/uart, spi, i2c, video (hdmi, vga), etc.

Older video cards the main cpu had to do all the video processing, deciding each pixel and color. But now most video cards have processors on board that can do that for you depending on what you are doing. There is a GPU on the raspberry pi's main chip that can assist you. Even if your arm software determines every pixel and color you still put it in a shared memory space so that the GPU can drive the actual video peripheral for you. We dont have direct exposure to that peripheral. Similar to having the postal worker deliver a card to your mom for you rather than you delivering it yourself.

Doesnt matter how old or new the technology is, we can generally only handle so much information at one time, so we break problems down into managable parts, we divide the tasks up among different individuals or groups and define interface specifications between each member or team and then go off and implement each of those parts. Even when writing software application ourselves it makes sense to break the problem into manageable parts. Computers are built and operate this way as well. cpu, peripherals, address and data busses between them. Even the transistors and wiring between them are done in this way. There is very little if any magic to it...And it is all easily understandable once you realize there is no magic...

David

dwelch67
Posts: 968
Joined: Sat May 26, 2012 5:32 pm

Re: How does raspberry pi OS work?

Sun Jul 27, 2014 6:39 pm

A radar screen, you have a physical radar spinning on top of something, as that radar dish spins, slowly, it sends out a signal and listens for a reflection it can tell how far away the item reflecting, if any, is based on its technology. That reflection signal is drawn along the line being refreshed on that radar scope (display), if the reflection is stronger the signal is stronger and there is more energy on the beam that his the phosphor on the scope, making it glow brighter for a little while. this can all be done completely analog without any software at all, and was back then.

Now modern times and flat panel displays. There are a gazillion individual transistors in the display probably one or more per color per pixel. Transistors can be though of both as amplifiers and switches (once you amplify to the maximum or minimum level for that output). The displays we use are flipping those transitors on and off to make each pixel. But there are not a gazillion individual wires in the cable between the computer and display, certainly not between your phone and your chromecast. The video card uses memory to keep track of what it wants each pixel to be using many bits per color per pixel, then it collects that information and serializes it according to the rules for that interface (vga, hdmi, etc), and then the monitor reverses the process decoding each pixels colors and then driving that pixel based on the technology for that monitor, an older crt type or tv type monitor would steer an analog beam of energy for each color and based on the amount of energy it beamed onto the phosphor you would get different levels of that color. lighter or darker reds and greens and blues. just like the radar scope but linearly not radial.

If you dont already know all of this stuff please take it one thing at a time. You fortunately live in a time where all of this information is readily available almost for free (need a computer and internet connection).

David

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

Re: How does raspberry pi OS work?

Sun Jul 27, 2014 6:53 pm

Like AndrewS said, most screen implementations are based on just a block of memory that maps to the individual dots (pixels) on the actual video device.

Each memory location contains information about how much Red, Green and Blue brightness to use for that pixel. There are many different ways of specifying the colour levels. Earlier computers only had two colour levels and those were black or white. That took just 1 "bit" or 1/8th of a byte to store.

Now we often uses 16 bits or 24 bits to store the colour values. In 24 bits that would be 8 each for Red, Green, and Blue giving 256 different colour levels for each dot giving about 16 million available colours for each dot. The video hardware translates all that into a continuous video signal of the correct type for us.

We very rarely write directly to the screen memory, usually relying on driver software where we can say "draw this shape at that location" or "move that block of dots from here to there". If we do write direct to the screen memory we call it a "framebuffer" as it is a memory buffer containing the current "frame" of the video output.

I've simplified this a lot and skipped some stuff, but it should give you the general idea.

jran1216
Posts: 87
Joined: Wed Jun 25, 2014 3:45 pm

Re: How does raspberry pi OS work?

Sun Jul 27, 2014 8:34 pm

Ok thanks for your help. Its a fantastic way to get into gpio.
Yeah I will have to read up on the subject or alternatively just accept computers are getting less complex even though technically more complex and read into registers. Thanks again.

hldswrth
Posts: 108
Joined: Mon Sep 10, 2012 4:14 pm

Re: How does raspberry pi OS work?

Tue Jul 29, 2014 8:36 am

An interesting twist on the screen/memory topic - originally CRTs were used *as memory*. By controlling the beam to light spots on the screen and measuring electrical differences in the beam when going over these spots, you could store bits of information - I think originally 32x32 or 1024 bits per CRT. I got this from "Turing's Cathedral" which was a very interesting read about the birth of the electronic computer.

User avatar
Jim JKla
Posts: 2218
Joined: Sun Jan 29, 2012 11:15 pm
Location: Newcastle upon Tyne UK

Re: How does raspberry pi OS work?

Tue Jul 29, 2014 9:02 am

Tommy Flowers originaly used mercury tubes to store a charge.

I was allways given to believe cathode storage did not come till after Turings death. ;)
Noob is not derogatory the noob is just the lower end of the noob--geek spectrum being a noob is just your first step towards being an uber-geek ;)

If you find a solution please post it in the wiki the forum dies too quick

jran1216
Posts: 87
Joined: Wed Jun 25, 2014 3:45 pm

Re: How does raspberry pi OS work?

Tue Jul 29, 2014 5:03 pm

Yeah must have occurred as a completely different ballpark back then. Reading into the origins of c and that seems to have taken a lot of ache or fun, doesn't matter ultimately quite a feat. Going back to what you said though that's pretty cool.
Me being me though surely at the time they didn't have all the communication that's inbuilt into a computer at the present so the processor would need that communication. Was the signal both ways? Say for example the red, blue and green colours that are sent through the wire are being displayed still as a digital image. Wouldn't it need to process the image being displayed to be able to loop the next image in? Say for example again an image is being displayed, the processors being used as an image processor. Surely the assembly will not run until a signal is sent back. And that's because the code that has been created for assembly needs a loop.
Biting my fingers here.

jran1216
Posts: 87
Joined: Wed Jun 25, 2014 3:45 pm

Re: How does raspberry pi OS work?

Tue Jul 29, 2014 6:03 pm

I'm guessing that's a no binary bloke that majestically deleted his answer? Well I give up on computing, but it was interesting to know how things work.

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: How does raspberry pi OS work?

Tue Jul 29, 2014 6:29 pm

jran1216 wrote:I'm guessing that's a no binary bloke that majestically deleted his answer? Well I give up on computing, but it was interesting to know how things work.
I deleted his 'answer' because he had no real posts and made the account solely for the purpose of trolling you.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: How does raspberry pi OS work?

Tue Jul 29, 2014 6:43 pm

jran1216 wrote:Was the signal both ways? Say for example the red, blue and green colours that are sent through the wire are being displayed still as a digital image. Wouldn't it need to process the image being displayed to be able to loop the next image in? Say for example again an image is being displayed, the processors being used as an image processor. Surely the assembly will not run until a signal is sent back. And that's because the code that has been created for assembly needs a loop.
Not quite sure what you're asking here, but usually the display-processor and the CPU run asynchronously, i.e. independently and at the same time. (some simplifications made for the sake of convenience)
Whatever image is currently in display-memory, the display-processor will scan through and output to your display-device (e.g. monitor connected to the VGA port). Even if the CPU does "nothing", the display-processor will keep scanning through the display memory over and over again, continually outputting the image over VGA.
And so whenever the CPU *does* change the image in display memory, the display-processor doesn't even "know" and just keeps scanning through display-memory, outputting the stored values over VGA.

But obviously if the CPU starts updating display-memory at the same time that the display-processor is outputting the current frame, you'll get half the previous frame, and half of the next frame drawn on the screen. So the display-processor sends an "interrupt" to the CPU that it's finished drawing the current frame, and so the CPU can then use the time between the end of the last frame, and the start of the next frame, to update the display-memory, before the display-processor starts outputting the next frame. And this is the mechanism e.g. used by games to stop the infamous "display tearing".

Some of my terminology may not be accurate ;) :oops:

jran1216
Posts: 87
Joined: Wed Jun 25, 2014 3:45 pm

Re: How does raspberry pi OS work?

Tue Jul 29, 2014 7:09 pm

Ohnestly when I started to get trolled I thought I had better find something in this forum and quick. Thanks for all the hard work but if you can be trolled there's something to learn. I'm deleting my account and giving up on computing. If I had made sense in all I was told I would have just moved elsewhere at this point. I am doomed to be a user of a pi without creation.

Return to “Bare metal, Assembly language”