qemu-cr16/tests/tcg/cr16c/macros.inc
Jonas Bewig 005bf105aa
WIP
2025-04-14 09:07:59 +02:00

64 lines
944 B
PHP

.macro RESET
movw $0x0B00, r0
movw $0x0A01, r1
movw $0x0902, r2
movw $0x0803, r3
movw $0x0704, r4
movw $0x0605, r5
movw $0x0506, r6
movw $0x0407, r7
movw $0x0308, r8
movw $0x0209, r9
movw $0x010A, r10
movw $0x000B, r11
.endm
.macro EXPECT expected, in
cmpw $\expected, \in
bne .fail
.endm
.macro EXPECT_COND cond
b\cond 1f
br .fail
1:
.endm
.macro ENDING
movw $0, r0
excp UND
.endm
.macro FAIL_HANDLER
.fail:
movw $1, r0
excp UND
.endm
/* Helper macro to set the carry flag */
/* Sets r10 to one */
.macro SETC
movw $-1, r10
addw $2, r10
.endm
/* Helper macro to clear the carry flag */
/* Sets r10 to one */
.macro CLEARC
movw $0, r10
addw $1, r10
.endm
/* Helper macro to set the signed overflow flag */
/* Sets r11 to zero */
.macro SETF
movw $-0x8000, r11
addw $-0x8000, r11
.endm
/* Helper macro to clear the signed overflow flag */
/* Sets r11 to zero */
.macro CLEARF
movw $-1, r11
addb $1, r11
.endm