The Hello World in assembly language.
This file must be named 1.asm and be saved to the Scripts/Asm_1 subdirectory in the universe directory.
To see the result, you must open the display panel : click on the "hardware" button in order to open it.
Listing #1 : Hello World
; HELLO WORLD
; *******************************************
; * *
; * Hello World *
; * *
; *******************************************
; Definitions for the Video Circuit registers
VIDEO_MODE = 0x80000100
VIDEO_ADDRESS = 0x80000104
VIDEO_CONTROL = 0x80000108
.org 0
; Init the video chip
move.l #VIDEO_ADDRESS,r0 ; Address of the chip register for video pointer.
move.l #VideoMemory,r1 ; Address of the video memory.
move.l r1,(r0) ; Put the video memory address to the video pointer register of the video chip.
move.l #VIDEO_MODE,r0 ; Address of the chip register for video mode.
movex.n #1,r1 ; Value for the text mode 1 (40x30).
move.l r1,(r0) ; Put the video mode value in the register for video mode
; Copy the text to display into the screen memory
move.l #TextToDisplay,r0 ; Address of the text string to display.
move.l #VideoMemory,r1 ; Address of the video memory.
Loop: move.b (r0),r2 ; Get source data
beq End ; If data is zero, terminate the loop
inclr ; increment source pointer
move.b r2,(r1) ; Put data to destination
inclr ; increment destination pointer
bra Loop ; Continue loop
End: sleep ; Do nothing and relinquish the allowed quantum of time.
bra End ; Loop forever
TextToDisplay: .data.b ("HELLO WORLD",0)
VideoMemory: .reserve.b 1200 ; 40x30 display = 1200 bytes