aboutsummaryrefslogtreecommitdiff
path: root/modules/objfmts/bin/tests/bin-farabs.asm
diff options
context:
space:
mode:
Diffstat (limited to 'modules/objfmts/bin/tests/bin-farabs.asm')
-rw-r--r--modules/objfmts/bin/tests/bin-farabs.asm53
1 files changed, 53 insertions, 0 deletions
diff --git a/modules/objfmts/bin/tests/bin-farabs.asm b/modules/objfmts/bin/tests/bin-farabs.asm
new file mode 100644
index 0000000..4d931c1
--- /dev/null
+++ b/modules/objfmts/bin/tests/bin-farabs.asm
@@ -0,0 +1,53 @@
+keybuf equ 0040h:001Eh
+
+absolute 5000h
+label:
+
+section .text
+absval equ 1000h
+
+org 0x100
+; Using seg should yield the segment part.
+mov ax, seg keybuf
+mov ax, seg (0040h:001Eh) ; NASM doesn't understand this syntax
+mov es, ax
+
+; Use without seg should yield just the offset part.
+mov bx, keybuf
+;mov bx, 0040h:001Eh ; Illegal
+
+; Each of the below pairs should be equivalent (and legal) in Yasm.
+; There are some differences from NASM here!
+
+; Defaults to near jump (on both NASM and Yasm)
+jmp keybuf
+
+; Direct far jump.
+jmp 0040h:001Eh
+
+; Force near (non-far) jump (just offset, no segment).
+jmp near keybuf
+jmp near 0040h:001Eh ; Illegal in NASM ("mismatch in operand sizes")
+
+; A couple of jumps to "normal" absolute addresses.
+jmp 0x1e
+jmp 0
+jmp absval
+jmp label
+
+; Non-absolute jump
+label2:
+jmp label2
+
+; Non-relative access
+mov ax, [0]
+mov ax, [label]
+
+; Direct far, explicitly.
+jmp far keybuf ; Illegal in NASM ("value referenced by FAR is not relocatable")
+jmp far 0040h:001Eh ; Illegal in NASM ("mismatch in operand sizes")
+
+keybufptr:
+dw keybuf ; offset part
+dw seg keybuf ; segment part
+