mirror of
https://github.com/pnx/m16vm
synced 2026-07-03 11:43:39 +02:00
asm/hello_world.as: use some hex!
This commit is contained in:
parent
de29a981bd
commit
2c734dc300
1 changed files with 27 additions and 27 deletions
|
|
@ -1,33 +1,33 @@
|
||||||
|
|
||||||
; -- Store "Hello World" string in memory.
|
; -- Store "Hello World" string in memory.
|
||||||
movl $1, 72 ; H
|
movl $0x1, 72 ; H
|
||||||
sw $0, $1, 0
|
sw $0x0, $0x1, 0
|
||||||
movl $1, 69 ; E
|
movl $0x1, 69 ; E
|
||||||
sw $0, $1, 1
|
sw $0x0, $0x1, 1
|
||||||
movl $1, 76 ; L
|
movl $0x1, 76 ; L
|
||||||
sw $0, $1, 2
|
sw $0x0, $0x1, 2
|
||||||
sw $0, $1, 3
|
sw $0x0, $0x1, 3
|
||||||
movl $1, 79 ; O
|
movl $0x1, 79 ; O
|
||||||
sw $0, $1, 4
|
sw $0x0, $0x1, 4
|
||||||
movl $1, 32 ; Space
|
movl $0x1, 32 ; Space
|
||||||
sw $0, $1, 5
|
sw $0x0, $0x1, 5
|
||||||
movl $1, 87 ; W
|
movl $0x1, 87 ; W
|
||||||
sw $0, $1, 6
|
sw $0x0, $0x1, 6
|
||||||
movl $1, 79 ; O
|
movl $0x1, 79 ; O
|
||||||
sw $0, $1, 7
|
sw $0x0, $0x1, 7
|
||||||
movl $1, 82 ; R
|
movl $0x1, 82 ; R
|
||||||
sw $0, $1, 8
|
sw $0x0, $0x1, 8
|
||||||
movl $1, 76 ; L
|
movl $0x1, 76 ; L
|
||||||
sw $0, $1, 9
|
sw $0x0, $0x1, 9
|
||||||
movl $1, 68 ; D
|
movl $0x1, 68 ; D
|
||||||
sw $0, $1, 10
|
sw $0x0, $0x1, 10
|
||||||
|
|
||||||
; -- setup print loop.
|
; -- setup print loop.
|
||||||
movl $1, 1 ; Load 1 in R1 (used for increment the counter)
|
movl $0x1, 1 ; Load 1 in R1 (used for increment the counter)
|
||||||
_start:
|
_start:
|
||||||
ld $15, $0, 0 ; Load memory address stored in R0 into R15
|
ld $0xF, $0x0, 0 ; Load memory address stored in R0 into R15
|
||||||
int $10, 2 ; Print character
|
int $0xA, 2 ; Print character
|
||||||
add $0, $0, $1 ; Add 1 (R1) to counter (R0)
|
add $0x0, $0x0, $0x1 ; Add 1 (R1) to counter (R0)
|
||||||
beq $15, $2, 1 ; Branch to "noop" (skipping next instruction) if R15 = 0 (R2 holds 0)
|
beq $0xF, $0x2, 1 ; Branch to "noop" (skipping next instruction) if R15 = 0 (R2 holds 0)
|
||||||
jmp _start ; jump back to "_start" label
|
jmp _start ; jump back to "_start" label
|
||||||
noop
|
noop
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue