hello2.asm

(1/1)

Richard Marks:
hello2.asm

Code:

; hello2.asm
; coded by Richard Marks for the ECPU virtual computer emulator v0.0.4
; will output "Hello ECPU World!\n" continuously until you kill it with
; CTRL+C
var 0
set 72
print
set 101
print
set 108
print
set 108
print
set 111
print
set 32
print
set 69
print
set 67
print
set 80
print
set 85
print
set 32
print
set 87
print
set 111
print
set 114
print
set 108
print
set 100
print
set 33
print
set 10
print
jmp 0


Save that as a plain text file named hello2.asm and run it through the assembler:
Code:

$ ./ecpu-assembler hello2.asm
ECPU Virtual Microcomputer Emulation Device Program Assembler v0.0.5 AR2-031009

(C) Copyright 2009, Richard Marks, CCPS Solutions, Undefined Aeon Software.
www.ccpssolutions.com - www.uasoft.info

Assembling.Assembling:#0x00000001: var 0
.Assembling:#0x00000002: set 72
.Assembling:#0x00000003: print
.Assembling:#0x00000004: set 101
.Assembling:#0x00000005: print
.Assembling:#0x00000006: set 108
.Assembling:#0x00000007: print
.Assembling:#0x00000008: set 108
.Assembling:#0x00000009: print
.Assembling:#0x0000000A: set 111
.Assembling:#0x0000000B: print
.Assembling:#0x0000000C: set 32
.Assembling:#0x0000000D: print
.Assembling:#0x0000000E: set 69
.Assembling:#0x0000000F: print
.Assembling:#0x00000010: set 67
.Assembling:#0x00000011: print
.Assembling:#0x00000012: set 80
.Assembling:#0x00000013: print
.Assembling:#0x00000014: set 85
.Assembling:#0x00000015: print
.Assembling:#0x00000016: set 32
.Assembling:#0x00000017: print
.Assembling:#0x00000018: set 87
.Assembling:#0x00000019: print
.Assembling:#0x0000001A: set 111
.Assembling:#0x0000001B: print
.Assembling:#0x0000001C: set 114
.Assembling:#0x0000001D: print
.Assembling:#0x0000001E: set 108
.Assembling:#0x0000001F: print
.Assembling:#0x00000020: set 100
.Assembling:#0x00000021: print
.Assembling:#0x00000022: set 33
.Assembling:#0x00000023: print
.Assembling:#0x00000024: set 10
.Assembling:#0x00000025: print
.Assembling:#0x00000026: jmp 0
.Finished.
Assembled 38 lines into 38 instructions and 58 bytes


Run the assembled binary through the emulator:
Code:

$ ./ecpu-emulator hello2.bin
ECPU Virtual Microcomputer Emulation Device v0.0.5 AR2-031009

(C) Copyright 2009, Richard Marks, CCPS Solutions, Undefined Aeon Software.
www.ccpssolutions.com - www.uasoft.info

Hello ECPU World!
Hello ECPU World!
Hello ECPU World!
Hello ECPU World!
Hello ECPU World!
Hello ECPU World!
Hello ECPU World!
Hello ECPU World!
Hello ECPU World!
Hello ECPU World!
Hello ECPU World!
Hello ECPU World!
Hello ECPU World!
... pressed CTRL+C to kill the infinite loop here

Navigation

[0] Message Index