Here is a first attempt at writing a module that just prints "Hello world!".
It shows the basic structure of a module as well as the IPC/IPE/IPR instructions that allow modules to call each others.
; HelloWorld.asm
Section Trampoline
; init:
Entry 0
IPE
; nothing to initialise
IPR
; run:
Entry 1
IPE
; no check of who's calling.
jmp main
Section Module
main:
; get the number/ID of the module that writes
; on the console, by calling service "ModuleLookup"
; from module #1
set 1 R1
set mod_str R2
IPC ModuleLookup R1
; result: module ID in R1
; write a string of characters on the console
; by calling the service "WriteString"
; in the module designated by par R1
set mesg_str R2
IPC WriteString R1
IPR ; end of program.
Section PublicConstants
mod_str: as8 "console"
mesg_str: as8 "Hello world!"I'm a bit concerned that the IPC instruction has a rather long latency but... Prefetching would make it even more complicated, I suppose.
Yann Guidon / YGDES
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.