Hello,
I'm writing a program that will be stored into EPROM and run on a XT. No DOS, just this program in EPROM. A part of this program has to be copied to another part of memory, 0000:0800h, and should be reached using a far call. I could program two separate BINs, combine the two in some way where the second BIN is stored at a fixed address and use this address in the first BIN. But what I want is to create just one BIN using one source file and tell NASM to assemble a part of the program with another ORG:
org 0
.... program ....
mov ax,0C800h
mov ds,ax ; segment source
xor ax,ax
mov es,ax ; segment destination
mov si,Lab0800 ; offset source
mov di,0800h ; ofsett destination
mov cx,<Length of BIN>
rep movsb
.... rest of program ....
org 0800h
Lab0800:
.... part to be relocated ....
But I already found out two ORGs don't work. What could work? I'm sure it will be something simple but I haven't found it yet.
Thank you for any help!
Kind regards, Ruud Baltissen
Edit:
I bumped into ALIGN and that triggered a thought train. The 6502, the CPU I'm most familiar with, uses absolute addresses when doing a jump or calling a subroutine. The 8088 uses relative addresses. So I wrote a small test program using ALIGN and that does calls and jumps to parts that are more than 512 bytes away and it seems to work. Still I would like either conformation that this indeed works or comment that I'm overlooking something.
Thanks!