Files
assm-test/misc/test.asm
T

45 lines
1.1 KiB
NASM

.org 0x100
.db msg "Hello, world!", 0
.db more_stuff "And yet another string!", 0
copy r1, msg
copy r2, 0
loop:
cmp r1, 0
jz loop
add r1, 1
mov r1, 5 ; move the immediate value 5 into r1
add r1,5 ; add 5 into r1
int 21 ; maybe that will call some string drawing BIOS-like routine
ret
; form YYYY YYXX - Y opcode, X modifier
; nop: 0000 0000
; copy: 0000 01XX
; add: 0000 10XX - | Perhaps running these will clear any overflow
; addc: 0000 11XX - | or under flow flags if no errors occur.
; sub: 0001 00XX - | jz should clear the zero flag.
; subb: 0001 01XX - |
; call: 0001 1100 - Always call [imm16]
; jmp: 0010 0000 - Always jmp [imm16] (No short jumps)
; jz: 0010 0100 - Always jz [imm16] (no short jumps)
; cmp: 0010 11XX
; push: 0011 11XX -| pop / push imm16/imm8 | reg
; pop: 0100 00XX -|
;
; imm8 imm16 reg
; mov reg, imm16|reg
; add reg, imm16|reg
; int imm16
; db [label] 'String data here' (Null byte is added implicatly by the assemblier)
;
; enum Type {
; Op,
; Reg,
; Imm16,
; Imm8
; }
; struct Token {
; enum Type type;
; char *value;
; }