Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #1202 > unrolled thread
| Started by | Dagen Brock <DagenBrock@gmail.com> |
|---|---|
| First post | 2014-04-05 07:23 -0700 |
| Last post | 2014-04-08 13:00 -0700 |
| Articles | 8 — 5 participants |
Back to article view | Back to comp.sys.apple2.programmer
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
| From | Dagen Brock <DagenBrock@gmail.com> |
|---|---|
| Date | 2014-04-05 07:23 -0700 |
| Subject | S16, OMF and Segments |
| Message-ID | <25ce127b-ac26-4a8f-80ed-7cddbec7435d@googlegroups.com> |
Can anyone suggest a good starting point for learning about segmented programming for the Apple IIgs? All of my programs thus far have been simple enough to have a small code segment and the rest of the memory needs are met by allocating space with the Memory Manager tools and loading assets off the disk as needed. However, with the release of the awesome OMF Analyzer by Brutal Deluxe and some other French guy's cracking video (*wink*) for Fast Break that also mentioned segments, it's got me thinking I'm missing out on a lot of flexibility by not leveraging more advanced 65816/GSOS programming (and compiling/linking) practices. I know such a focused tutorial might not exist, but if someone knows of a good chapter in a book, maybe that would help me understand. I have the toolbox refs and a very good, but limited, book by Roger Wagner, "Apple IIGS Machine Language for Beginners". My style is to use tools sparingly, only to play nice so I can launch from and return to Finder. And I use Merlin 16+, so I'd prefer something less about desktop programming or Orca. I suppose I should start with the technotes and see what I can find out about S16/OMF. But I'd really appreciate any quick pointers anyone can give me.
[toc] | [next] | [standalone]
| From | mmphosis <mmphosis@macgui.com> |
|---|---|
| Date | 2014-04-05 17:11 +0000 |
| Message-ID | <mmphosis-1396717872@macgui.com> |
| In reply to | #1202 |
Programming the 65816 by David Eyes/Ron Lichty The 65816 has instructions to access 24 bits of memory at a time: the entire 16 Mb (16777216 bytes) of memory are available. JMP to a 24 bit address, load a 24 bit address, store to a 24 bit address. There is a "bank" register that adds that extra 8 bits to the 16 bit address space. <rant>I remember from the x86 world and the 680x0 world back then it was the tools and some of the earlier processors that set these seemingly arbitrary low limits on the address space. 32k text sizes, and 32K branch islands on the Mac, and the horrors of segmented memory on the PC. I would stay away from the idea of "segmented" memory and look at the entire big flat memory space.</rant>
[toc] | [prev] | [next] | [standalone]
| From | Dagen Brock <DagenBrock@gmail.com> |
|---|---|
| Date | 2014-04-05 13:09 -0700 |
| Message-ID | <eac910e3-2d80-4ae7-a68e-2302d6c488e2@googlegroups.com> |
| In reply to | #1203 |
Well, I guess I should specify that I'm talking more about segments within the various executable file formats. I'm familiar with the Bank register. I'm more interested in things like dynamically loading segments as needed or communicating to external segments in a DLL like situation if that's possible. I suppose this is probably in the later GSOS/toolbox documentation. Anyway, that book is awesome, but more for the CPU than the IIgs platform.
[toc] | [prev] | [next] | [standalone]
| From | Antoine Vignau <antoine.vignau@laposte.net> |
|---|---|
| Date | 2014-04-05 22:59 -0700 |
| Message-ID | <e02c5cab-c53d-4e9e-8402-884ba088d945@googlegroups.com> |
| In reply to | #1202 |
Hi Dagen, There are some references in OMF Analyzer: - Apple IIgs GS/OS Reference, Appendix F : Object Module Format version 2.1 - Merlin 16+ documentation by Glen Bredon, Roger Wagner Publishing - ORCA / M 2.0 documentation by Mike Westerfield From Merlin, in the editor window, type openapple-O then LINK filename A filename should look (more or less) like this (this is the one I wrote for Tool018) * Expansion linker file LKV $2 VER $2 TYP TOL ; $BC * Assemble files ASM MainPart ASM CopyBits ASM JumpTable ASM Pictures ASM SeedFill ASM PixelMap * Now link files KND $0000 LNK MainPart.L SAV Tool018 KND $0000 LNK CopyBits.L SAV Tool018 KND $0002 LNK JumpTable.L SAV Tool018 KND $8000 LNK Pictures.L SAV Tool018 KND $8000 LNK SeedFill.L SAV Tool018 KND $8000 LNK PixelMap.L SAV Tool018 END * Execute commands CMD CRUNCH Tool018 CMD XPRESS Tool018
[toc] | [prev] | [next] | [standalone]
| From | ozkfest@gmail.com |
|---|---|
| Date | 2014-04-07 06:37 -0700 |
| Message-ID | <defbd832-893c-40ba-9ce2-e22faee25a43@googlegroups.com> |
| In reply to | #1202 |
On Sunday, April 6, 2014 1:23:51 AM UTC+11, Dagen Brock wrote: > Can anyone suggest a good starting point for learning about segmented programming for the Apple IIgs? Hi Dagen, My understanding is that if you want to create a program that requires more than a bank of memory - exceeding (for example) 32k of executable code and 32k or relocation dictionary - then you will need to break that executable code up into segments of no more than 32k in size. Merlin 16+ provides the linker directive SAV to support the creation of segments. The whole Merlin 16 chapter on linkers is interesting reading on this topic, however LINKER.XL is the relevant linker for creating IIgs applications. http://www.apple-iigs.info/doc/fichiers/merlin816.pdf See pages 150-163 As an example, here is the Marinetti Init linker file http://marinetti.cvs.sourceforge.net/viewvc/marinetti/MOSP/Marinetti/Init/I.ALL.S?revision=1.12&view=markup Which firstly assembles all the source files and then links them together into 8 segments. Perhaps you'd like to use OMF Analyzer on the Marinetti Init and compare it with the Marinetti Init source code on Sourceforge to aid your understanding of what is going on. I also wonder if the Programmer's Introduction to the Apple IIgs covers this topic. Sadly, I can't refer to it now and have not found it online. Regards, Andrew
[toc] | [prev] | [next] | [standalone]
| From | Antoine Vignau <antoine.vignau@laposte.net> |
|---|---|
| Date | 2014-04-07 13:23 -0700 |
| Message-ID | <62fdf821-10d2-45de-b974-3be42572eb95@googlegroups.com> |
| In reply to | #1206 |
@ Andrew, the limit is 64K, not 32K and this is for code segments. Data segments can be >64K (see Tunnels of Armageddon) Merlin16+ uses different linkers, that's right. The LKV opcode (see in my previous message) should be sufficient to tell the software to use the latest OMF linker. Here follows the first lines of the Tool018 source code under Merlin 16+. The use of REL + DSK filename.l are mandatory for the linker to assemble the different parts of the fies. The "Programmers introduction" book does not handle multi-segment files. Antoine * * Tool $12: QuickDraw Auxiliary * * (c) 1993, Apple * (s) 2008, Brutal Deluxe Software * mx %00 rel dsk MainPart.L lst off *----------- use MainPart.E use MainPart.X use 4/Ctl.Macs use 4/Int.Macs use 4/Locator.Macs use 4/Mem.Macs use 4/Menu.Macs use 4/Misc.Macs use 4/QD.Macs use 4/Resource.Macs use 4/Util.Macs use 4/Window.Macs *----------- ADRL $00000018 ADRL QDAuxBootInit-1
[toc] | [prev] | [next] | [standalone]
| From | "Bill Buckels" <bbuckels@mts.net> |
|---|---|
| Date | 2014-04-08 07:07 -0500 |
| Message-ID | <li0oqb$dtg$1@speranza.aioe.org> |
| In reply to | #1207 |
"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
[toc] | [prev] | [next] | [standalone]
| From | Dagen Brock <DagenBrock@gmail.com> |
|---|---|
| Date | 2014-04-08 13:00 -0700 |
| Message-ID | <a2fe99c1-371e-4bff-abd8-53813d8d3634@googlegroups.com> |
| In reply to | #1208 |
Thanks everyone. This is all very helpful information. I will try to find time to study this in detail, but for now I think I can continue to develop using my current model of a simple single code segment and dynamically handled assets. For me, the real value in learning more about segments at this point would be to have a better understanding of other people's programs. Nothing I write is that complex (yet).
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.apple2.programmer
csiph-web