User avatar
Burngate
Posts: 6401
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: What is the LOWEST level language??

Sun Oct 07, 2012 2:28 pm

rurwin wrote:Writing a dot to the screen is, in fact, not the simplest operation of a computer, it is one of the most complex. You wont find any information on how to do that in any assembler manual. All you will find is how to move numbers about, how to add and subtract numbers, and so forth. To write a dot on the screen, first of all you need to get access to the screen, (by writing the right numbers into the memory locations used as control registers by the memory management unit), put it into the right mode, (by writing the right numbers into the memory locations used as control registers by the video hardware), and work out where the dot is in memory and what value it should have. That is a significant number of assembler instructions.
Possibly, on a real computer. But not necessarily true for a hypothetical one.

Consider the memory management unit - is it part of the computer, or is it part of the peripherals? One could imagine a computer without a MMU.
In that case, the address bus comes out of the computer, and is decoded in hardware - gates, a mixture of NANDs and inverters. We could decide that 1k of the address space will be for the screen, and route the bottom ten address lines to our screen hardware. The rest of the address bus goes into a large NAND gate, to select that 1k of address space
Our screen hardware will consist of a small dual-port ram and a Teletext chip, with appropriate electronics to light up the CRT

To write to the screen, we only need to write to that 1k of address space. We can do it from boot-up in bare-metal with almost no coding.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4257
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: What is the LOWEST level language??

Sun Oct 07, 2012 2:41 pm

As the very earliest of micro-computers were built. Albeit even the Acorn Atom had multiple display modes. Maybe the Commodore Pet worked like that.

But you still have to work out which pixel you want and what its value should be, and that is multiple assembler instructions. For example, if the screen is 1024 pixels wide, each 8 bits, then the assembler would look like this:

Code: Select all

Yposition EQU 100
Xposition EQU 200
Colour EQU 42
ScreenBase EQU $8000
LDA Yposition
SAL 10          ; Shift accumulator left 10 bits
ADD Xposition
TAX              ; transfer accumulator to index register X
LDA Colour
STA ScreenBase,[X]

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: What is the LOWEST level language??

Sun Oct 07, 2012 2:47 pm

I guess that's where macros can help

tekim
Posts: 13
Joined: Fri Sep 28, 2012 7:14 pm
Location: U.K.

Re: What is the LOWEST level language??

Mon Oct 15, 2012 3:43 pm

Of course in any modern computer that is impossible, because all the logic is inside the computer chip, sealed inside plastic and implemented in a single piece of silicon.
The above quote {rurwin} would not appear to be absolutely the case as this Celeron powered system
loads a microcode patch on booting up. Presumably supplied by Intel and held in the bios to be written into the processors ram (not the system ram) .

To answer the original question regardings switching a pixel on/off surely a poke instruction to a
suitable address with the correct data would suffice. As I think has been stated previously.

Cheers,

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4257
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: What is the LOWEST level language??

Mon Oct 15, 2012 3:59 pm

A poke instruction is in BASIC, which is a high level language. Even so you need to know the X coordinate, the Y coordinate, the screen base address, what to do to those three numbers to generate the address of the pixel. Then you need to calculate the value of the pixel. For example:

Code: Select all

POKE SCREEN+(X+Y*MAX_X)/PIXELS_PER_BYTE, PIXEL_VALUE << (8/PIXELS_PER_BYTE)
In addition you would need code to map the screen into your address space, because unlike the BBC Microcomputer, it usually is not there.

All this assumes that the screen can be memory mapped. That's actually unlikely on the RaspPi. The code to write a pixel may devolve to something like this:

Code: Select all

F = open("/dev/vc0");
write(F, sizeof(int), &WritePixel);
write(F, sizeof(int), &XCoordinate);
write(F, sizeof(int), &YCoordinate);
write(F, sizeof(int), &PixelValue);
close(F);

Witzo
Posts: 7
Joined: Mon Jan 07, 2013 9:38 pm
Location: The Hague, NL
Contact: Website

Re: What is the LOWEST level language??

Mon Feb 04, 2013 8:32 pm

Alex Chadwick from Cambridge University explains how to colour pixels on the screen, in assembly, in this course:

http://www.cl.cam.ac.uk/freshers/raspbe ... ml#postman

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

Re: What is the LOWEST level language??

Mon Feb 04, 2013 8:45 pm

There is an argument that Fanagalo (sometimes spelt Fanakalo) must be the lowest level language. :D
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

Cloudcentric
Posts: 982
Joined: Fri Sep 14, 2012 9:13 am

Re: What is the LOWEST level language??

Mon Feb 04, 2013 8:49 pm

I know everything about nothing"

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4257
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: What is the LOWEST level language??

Mon Feb 04, 2013 9:08 pm

The simplest computer language of all has to be OISC, a language with only one instruction.

But on any given machine, the lowest level language that it implements must be either:
  1. The lowest level language accessible to programmers, or
  2. The lowest level language that runs on an instruction-cycle implementation.
The first is the machine code, and the second is probably a micro-code of some sort.

The instruction-cycle is the lowest level that results in a general-purpose machine. But if you don't admit that the instruction-cycle is the limit, then it has to be the hardware.

Return to “Off topic discussion”