flat assembler
Message board for the users of flat assembler.

Index > Main > Defining Segments?

Author
Thread Post new topic Reply to topic
Meister



Joined: 09 Feb 2008
Posts: 10
Meister 16 Jan 2010, 18:06
Hello. I'm still writing my on OS (for real mode). To make larger Applications, it is necessary to define segments in a source-code. For example:

mov ax,gfx
mov es,ax
.
.
.
.
gfx: <- own segment
include "picture.dat"

txt: <- another segment
.
.
.


How can i solve this with Flatasm? Question
(I still use compat.inc to create 80286-code)
Post 16 Jan 2010, 18:06
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 16 Jan 2010, 19:21
Meister,

This depends on executable format your OS supports. For MZ exe there is segment directive.
Post 16 Jan 2010, 19:21
View user's profile Send private message Reply with quote
Meister



Joined: 09 Feb 2008
Posts: 10
Meister 16 Jan 2010, 19:27
Mhh..there is no special format. every application starts with a header:

.include "compat.inc"
.286

org $0000

db "APL"
db 0 ; class
db 1,19 ; Min. OS-Version
start:
....code...

The OS loads an Application until a) the end of file is reached or b) the current Sector-buffer > Himem (himem is the last segment available for Apl-files - above himem there are residents/drivers).
Post 16 Jan 2010, 19:27
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 16 Jan 2010, 19:30
Meister,

Are programs loaded at fixed address (or they should be self-relocatable)?
Post 16 Jan 2010, 19:30
View user's profile Send private message Reply with quote
Meister



Joined: 09 Feb 2008
Posts: 10
Meister 16 Jan 2010, 19:39
The APL-Files always starts at $0800:$0000 (residents also start at offset $0000, but with another segment)
Post 16 Jan 2010, 19:39
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 16 Jan 2010, 19:44
Meister,

In this case linear address for (probably 16-byte aligned) label gfx will be $8000+gfx and logical will be ($800+gfx/16):0.
Post 16 Jan 2010, 19:44
View user's profile Send private message Reply with quote
Meister



Joined: 09 Feb 2008
Posts: 10
Meister 16 Jan 2010, 19:47
How can i align labels with Fasm? And how can i load this "label-segment" ? I'm thinking about writing different 64K-Binarys and joined them to a big file. But then "File A" do not know where in "file B" is the address of label xy.... Sad
Post 16 Jan 2010, 19:47
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 16 Jan 2010, 19:59
Meister,

As you might guess, "align directive aligns code or data to the specified boundary".

Good way to learn how to do something is to examine how it's done already. Are you familiar with executable formats (DOS COM/MZ-EXE, for example)?
Post 16 Jan 2010, 19:59
View user's profile Send private message Reply with quote
Meister



Joined: 09 Feb 2008
Posts: 10
Meister 16 Jan 2010, 20:05
COM yes, EXE no Smile Thank you for your help. I think i will solve this problem by looking to other formats Smile at the moment, 64K is enough (the largest application is about 10K, a harddrive test program) Smile
Post 16 Jan 2010, 20:05
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.