Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #1208

Re: S16, OMF and Segments

From "Bill Buckels" <bbuckels@mts.net>
Newsgroups comp.sys.apple2.programmer
Subject Re: S16, OMF and Segments
Date 2014-04-08 07:07 -0500
Organization Aioe.org NNTP Server
Message-ID <li0oqb$dtg$1@speranza.aioe.org> (permalink)
References <25ce127b-ac26-4a8f-80ed-7cddbec7435d@googlegroups.com> <defbd832-893c-40ba-9ce2-e22faee25a43@googlegroups.com> <62fdf821-10d2-45de-b974-3be42572eb95@googlegroups.com>

Show all headers | View raw


"Antoine Vignau" <antoine.vignau@laposte.net> wrote:
>the limit is 64K, not 32K and this is for code segments. Data segments can 
>be > 64K

Hi Antoine,

The Orca C Manual has a very complete explanation of how segments and memory 
models work. For anyone who might want to write in C for the IIgs RTFM! For 
everyone else, it's a really well-written manual, and like the Microsoft C 
Manuals of the that era, has much to do with segmented architecture, and 
linking segments, and memory models.

Segments and Memory Models are not exclusive to Orca C nor to the Apple 
IIgs. The segmented architecture of the IBM-PC necessitated the use of 
segmented programming using exactly the same methodology for every 16 bit C 
program ever written on the PC. The practice of including arrays, including 
graphics arrays in their own data segment is a common one for a 16 bit 
program in C.

By default, Orca C's linker  produces expressed OMF 2.0 programs but 
expression can be turned-off as an option, which is necessary if a 
programmer wants to use loader calls to load segments by number (Page 142). 
By default OMF 2.0 programs produced by the linker are compacted, but this 
can also be turned-off (Page 141). Bank relative or relocatable options are 
also available with this linker.

>see Tunnels of Armageddon

See the following pages of the Orca C Manual:

Page 16 - Segmentation and Memory Models

Page 206 - memorymodel pragma
    Small Model - Default
    Large Model - #pragma memorymodel 1

The code segment in an Orca C program must not exceed 64K in either the 
Small Memory Model or the Large Memory Model. Different link libraries are 
needed for each model just as on the IBM-PC.

Page 269 - Segment Statement

**************

Additional Reading

Also of importance in any C program is the stack. Max stackspace in an Orca 
C program can be between 10K and 16 K. By default it is 8K and is allocated 
from bank 0 (main memory).

I have no idea if this post is even on-topic. But what caught my attention 
in this thread was the reference to 32K as being a constraint. 32K is too 
limited.

Bill

Back to comp.sys.apple2.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

S16, OMF and Segments Dagen Brock <DagenBrock@gmail.com> - 2014-04-05 07:23 -0700
  Re: S16, OMF and Segments  mmphosis <mmphosis@macgui.com> - 2014-04-05 17:11 +0000
    Re: S16, OMF and Segments Dagen Brock <DagenBrock@gmail.com> - 2014-04-05 13:09 -0700
  Re: S16, OMF and Segments Antoine Vignau <antoine.vignau@laposte.net> - 2014-04-05 22:59 -0700
  Re: S16, OMF and Segments ozkfest@gmail.com - 2014-04-07 06:37 -0700
    Re: S16, OMF and Segments Antoine Vignau <antoine.vignau@laposte.net> - 2014-04-07 13:23 -0700
      Re: S16, OMF and Segments "Bill Buckels" <bbuckels@mts.net> - 2014-04-08 07:07 -0500
        Re: S16, OMF and Segments Dagen Brock <DagenBrock@gmail.com> - 2014-04-08 13:00 -0700

csiph-web