tmcpu_isa_assembler/hello_world.asm

42 lines
581 B
NASM
Raw Permalink Normal View History

2023-05-08 21:59:54 +00:00
nop
nop
2023-05-08 16:19:10 +00:00
ldi ra, 0x01
ldi rb, 0x02
add rc, ra rb ; should be 3
out 0x02, rc ; displays 03 on the numeric display
ldi ra, 0b10100000 ; load the num for red and blue into ra
2023-05-08 21:59:54 +00:00
mrm 0x001, ra
mrm 0x003, ra
mrm 0x01e, ra
mrm 0x02e, ra
mrm 0x02f, ra
mrm 0x030, ra
mrm 0x031, ra
mrm 0x023, ra
; Draw a smiley face
; Test the normalizer
ldi ra, 0b10100101
lsh rb, ra
; Expands to:
; add rb, ra ra
cmp ra rb
; Expands to:
; sub ra, ra rb
cpy rc, rb
; Expands to:
; ldi r0, 0
; add rc, rb r0
not rd, rc
; Expands to:
; ldi r0, 0
; nor rd, rc r0
; test validation
in ra, 0x02
out 0x03, rb