• Register

Being the lowest programming language in terms of levels, the Assembly language is used to communicate with processors due to its correlation with machine instructions.

It can either be obtained automatically after compiling a high level language, or written from scratch, and then converted to machine code via an assembler.

As a consequence of having multiple architectures related to different machines, there isn’t one global assembly language, but a different one for each company. Intel and Motorola are the 2 most popular companies that have designed a special assembly language that is used to communicate with their processors.

The motorola syntax is consistent. Its pattern is quite simple:

LABEL      OPCODE     OPERANDS

In which the label is the given name to the instruction, and is usually used to iterate through the instruction via branching.

The opcode is a code recognized by the machine that performs any of the following instructions:

 – Loading (Read) and Storing(Write) instructions

 – Arithmetic operations

 – Branching

The operands are usually registers, and could either be data registers or address registers.

A basic hello world assembly 68k program is attached within this article.

                              org                $10000                 ; Start the program at 10000
                              lea                stringHello,A0      ; lea is used to load the string into the address register A0 so you can show it to the screen
                              trap              #15                        ; this instruction is used to indicate an IO act
                              dc.w              7                           ; dc.w supports operands from 0 to 8, with each having a different role and 7 prints the 
                                                                                  ; string pointed to in A0, that ends with a null address content

                              stop              $15000                 ; Stop the program at 15000

stringHello           dc.b               'Hello world' ,0    ; this instruction assigns the string 'hello world' to the label: stringHello

 

100 points
3