youngstorm 0 Light Poster

I am reading "Assembly Language step-by-step" 2nd Ed. by Jeff Duntemann, using nasm and alink. Full source code is a bottom. When I linked this code I got this error "Warning - no stack". The program ran fine. I decided to add the following code, just to see what would happen. I did NOT expect it to work, but it did.

SEGMENT stack stack
resb 64
stacktop:


What I don't understand is why it worked when there is no data or code segments. Is this a flat or segment model? What is happen here? The code shown below is with the above code included. First here are the commands I use to assemble and link code.

>nasm test2.asm -f obj -o test2.obj
>nasm test3.asm -f obj -o test3.obj
>alink test3.obj test2.obj

This is test2.asm

[BITS 16]

EXTERN scrollXLines, gotoXY

[SECTION .text]

..start:
    mov al, 0
    call scrollXLines
    mov dl, 20
    mov dh, 7
    call gotoXY
    mov ax, 4c00h
    int 21h

This is test3.asm

[BITS 16]

[SECTION .text]

GLOBAL scrollXLines, gotoXY
    
scrollXLines:
    mov cl, 05        ; x starts 
    mov ch, 05        ; y starts
    mov DX, 2479
    mov dl, 10        ; x ends
    mov dh, 10        ; y ends
    mov bh, 7h
    mov ah, 6h
    int 10h
    ret

gotoXY:
    mov ah, 2h
    mov bh, 0
    int 10h
    ret

SEGMENT stack stack     ; These 3 lines are added because alink 
resb 64                 ; complains about no stack.
stacktop:
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.