aboutsummaryrefslogtreecommitdiff
path: root/modules/objfmts/bin/tests/bin-farabs.asm
blob: 4d931c1e956d8fb99ba6d28c411c30e6e4a70bc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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