[Nasm-bugs] [Bug 3392826] NASM Listing address defect if [org VALUE] not zero

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Tue Dec 6 12:25:24 PST 2022


https://bugzilla.nasm.us/show_bug.cgi?id=3392826

--- Comment #11 from Erdogan Tan <erdogantan at singlix.com> ---
(In reply to Erdogan Tan from comment #9)
> (In reply to Erdogan Tan from comment #4)
> > ; NASM test (deneme) file
> > ; MSDOS.SYS principle simulation (for testing NASM's response)
> > 
> > ; Erdogan Tan - 6/12/2022
> > 
> > ; A sample MSDOS '.COM' file
> > ; nasm deneme.asm -l deneme.txt -o deneme.com -Z error.txt
> > ; (DATA section is used for '.SYS' file -like MSDOS kernel- simulation) 
> > 
> > ; [BITS 16]	; (x86 real mode)
> > 
> > ; DOS CODE segment simulation
> > 
> > section .text	; code segment (DOSCODE)
> > 
> > 	[org 100h] ; 3DD0h for MSDOS 5.0 kernel (DOSCODE)
> > 		   ; (BIOSCODE+BIOSDATA+DOSDATA size)
> > start:
> > 	jmp	short kod3
> > kod1ptr:
> > 	dw	kod1
> > kod0:
> > 	int	20h
> > kod1:
> > 	mov	si, [deneme3]
> > 	mov	ah, 0Eh
> > 	sub	bx,bx
> > 	; CRLF
> > 	mov	al, 0Dh
> > 	int	10h
> > 	mov	al, 0Ah
> > 	int	10h
> > kod2:
> > 	; print 'DENEME.' on screen
> > 	lodsb
> > 	int	10h
> > 	cmp	al, '.'
> > 	jne	short kod2
> > 	;times	130 db 90h
> > 	;jmp	kod0
> > 	; CRLF & exit
> > 	mov	al, 0Dh
> > 	int	10h
> > 	mov	al, 0Ah
> > 	int	10h
> > 	jmp	kod0
> > kod3:
> > 	jmp	word [kod1ptr]
> > 
> > 	nop
> > 
> > align 16
> > 
> > ; DOS data segment simulation
> > 
> > section .data vstart=0	; data segment (DOSDATA)
> > 	
> > deneme0: dw deneme1
> > deneme1: dw deneme2
> > deneme2:
> > 	db 'deneme...'
> > here:
> > 	burasi equ $
> > deneme3:
> > 	dw burasi ; dw here
> >  	db 0Dh, 0Ah, 0
> 
> Note: for correct running above sample code... DS must be set before kod1.
> for example: kod4 is 'nop' address label at the end of code section. /// mov
> ax,cs - mov dx,kod4 - add dx,15 - shr dx,4 - add ax,dx - mov ds,ax - then
> mov si,[deneme3]


Corrected :

; NASM test (deneme) file
; MSDOS.SYS principle simulation (for testing NASM's response)

; Erdogan Tan - 6/12/2022

; A sample MSDOS '.COM' file
; nasm deneme.asm -l deneme.txt -o deneme.com -Z error.txt
; (DATA section is used for '.SYS' file -like MSDOS kernel- simulation) 

; [BITS 16]     ; (x86 real mode)

; DOS CODE segment simulation

section .text   ; code segment (DOSCODE)

        [org 100h] ; 3DD0h for MSDOS 5.0 kernel (DOSCODE)
                   ; (BIOSCODE+BIOSDATA+DOSDATA size)
start:
        jmp     short kod3
kod1ptr:
        dw      kod1
kod0:
        int     20h
kod1:
        mov     ax, cs
        mov     dx, kod4
        add     dx, 15
        shr     dx, 4
        add     ax, dx
        mov     ds, ax
        mov     si, [deneme1] ; mov si, deneme2
        mov     ah, 0Eh
        mov     bx, 7
        ; CRLF
        mov     al, 0Dh
        int     10h
        mov     al, 0Ah
        int     10h
kod2:
        ; print 'DENEME.' on screen
        lodsb
        int     10h
        cmp     al, '.'
        jne     short kod2
        ;times  130 db 90h
        ;jmp    kod0
        ; CRLF & exit
        mov     al, 0Dh
        int     10h
        mov     al, 0Ah
        int     10h
        jmp     kod0
kod3:
        jmp     word [kod1ptr] ; ds = cs

        nop
kod4:

align 16

; DOS data segment simulation

section .data vstart=0  ; data segment (DOSDATA)

deneme0: dw deneme1
deneme1: dw deneme2
deneme2:
        db 'deneme...'
here:
        burasi equ $
deneme3:
        dw burasi ; dw here
        db 0Dh, 0Ah, 0

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.


More information about the Nasm-bugs mailing list