Path: news.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!zaphod.mps.ohio-state.edu!wupost!waikato.ac.nz!comp.vuw.ac.nz!actrix!David.Empson Newsgroups: comp.sys.apple2 Subject: Re: Initializing 8-bit SYS programs Message-ID: <1993Mar3.064553.14757@actrix.gen.nz> From: David.Empson@bbs.actrix.gen.nz Date: Wed, 3 Mar 1993 06:45:53 GMT Sender: David.Empson@actrix.gen.nz (David Empson) References: <1993Mar1.233904.5916@msuvx2.memst.edu> Organization: Actrix Information Exchange Lines: 48 In article <1993Mar1.233904.5916@msuvx2.memst.edu> connolly@msuvx2.memst.edu writes: > I've noticed that certain 8-bit system programs won't run right if > launched after certain other system programs. ... Agreed. One that particularly annoys me (but I haven't been able to isolate fully) is ShrinkIt, which crashes into the monitor SOMETIMES on startup. When writing your own SYS programs, I'd say be as pessimistic as possible - assuming NOTHING about the machine's state and initialize everything. If you're using text mode, call $FB2F, $FE89 and $FE93 before trying to use COUT, etc. If you're on a IIe, 80-column mode might be active, so manually disable 80-column store and 80-column video, and select the primary character set. (The IIgs and possibly IIc will clean up after 80-column mode if you call $FE93.) You should also make sure the stack pointer is set to $01FF (LDX #$FF, TXS). I discovered that Aztec C doesn't do this, and paritcularly on the IIc, enhanced IIe and IIgs, you tended to get random crashes when the stack eventually worked its way down to $0100 and an interrupt occurred. You can be reasonably sure that the ProDOS entry conditions will be OK - the pathname of the application will be at $0280, but it might be a partial pathname. You should initialize the ProDOS memory bitmap as required. There probably are guidelines for programs entering/exiting in the ProDOS Technical Reference Manual and/or ProDOS technical notes (handling of the /RAM disk comes to mind). I haven't read them recently. Can't think of anything else off-hand. > So at least I would like to know: what should *my* text-based system > programs initialize so that they'll run right? Is any different > initialization needed for a program with graphics-only display? > (I program inAztec C and assembler on a IIe and run on that machine and > on a IIgs.) I don't know how you'd do this in Aztec C - I haven't used any of its standard I/O routines in much code (I wrote my own). -- David Empson Internet: David.Empson@bbs.actrix.gen.nz EMPSON_D@kosmos.wcc.govt.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand