Hey.. I have started learning assembly and have a little problem with indirect far call... I want to split my program in two source file, and let a procedure in one call a procedure in another, both in different segments

This is what I have done so far, the procedure merely changes the contents of register ax

EDIT: I am using TASM and a 8086 architecture

EDIT: I can do the program using a direct far call, but I want to do it with indirect call, as I am learning and want to try all possible methods

Here it the main.asm :

data segment
        a db 10 dup(0)
data ends

code segment
        EXTRN func:far
        EXTRN code2
        assume cs:code,ds:data
START:  mov ax,data
        mov ds,ax
      
        lea bx,a
        mov cx,offset func
        mov [bx],cx
        inc bx
        inc bx
        mov cx,code2
        mov [bx],cx
        mov ax,0
        call dword ptr [bx]

        mov ax,4c00h
        int 21h
code ends
end START

and here is the file containing the procedure... func1.asm

code2 segment public
        public func
        assume cs:code2

        func proc far
        mov ax,0FFFFh
        ret
        func endp

code2 ends

and this is how i am trying to run the program

tasm main.asm
tasm func1.asm
tlink main+func1

It gives me a error that 'code2 is not known'.. i.e. it cant access the value of code2 segment

Solutions/Suggestions??

Plz help me I am completely new to assembly programming..

An indirect far call uses a memory variable to contain a 32-bit
far pointer to the target upon which to transfer execution control.
A far pointer in 16-bit assembly language has the following
format:
XLo-WordXHi-WordX
[OffsetXX][Segment]

Here are some examples:

push SegmentAddress
push offset
RETF ; pops last two items into IP and CS (in that order)
mov bx, offset ptr
mov [bx], myoffset
mov [bx+2], segaddr
; or
mov [ptr], myoffset
mov [ptr+2], segaddr
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.