[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BRUN HGR pics?



In article <52sq14$n9h@login.freenet.columbus.oh.us>
dalloff@freenet.columbus.oh.us (Dave Althoff) writes:
}Whoops!  I screwed up!
}
}Dave Althoff (dalloff@freenet.columbus.oh.us) wrote:
}: Steve Jensen (sjensen@cello.gina.calstate.edu) wrote:
}: : I need a program that modifies HGR pics so they can be viewed when
}: : BRUN from Applesoft.  I had this years ago but seem to have lost it.
}: : Can anyone help?
}
}: You need to append the following code to the beginning of the file:
}: (assumes full-page display of HGR Page #1 at $2000)
}
}: 1FF1- 48       PHA
}: 1FF2- AD 50 C0 LDA $C050
}: 1FF5- AD 52 C0 LDA $C052
}: 1FF8- AD 54 C0 LDA $C054
}: 1FFB- AD 57 C0 LDA $C057
}: 1FFE- 68       PLA
}: 1FFF- 60       RTS
}
}: To save the amended file...
}: BSAVE IMAGE,A$1FF1,L$200A
}
}Hmmm...That will work, except that it will crash... at least, it will
}crash under DOS 3.3.  I don't know if the entry point got moved under
}ProDOS, but under DOS 3.3, executable files should end with a JMP $9DBF to
}warm-start DOS for a clean re-entry to Applesoft.  I think the same can be
}accomplished with a JMP $03D0, and I think that vector still exists under
}ProDOS.  So the code should be amended as follows:
}
} 1FF1- AD 50 C0 LDA $C050
} 1FF4- AD 52 C0 LDA $C052
} 1FF7- AD 54 C0 LDA $C054
} 1FFA- AD 57 C0 LDA $C057
} 1FFD- 4C D0 03 JMP $03D0
}
} To save the amended file...
} BSAVE IMAGE,A$1FF1,L$200A
}
}That should solve the problem.  8-)

Actually, it's probably not as much of a problem as you think.  You're
thinking of the bug where DOS 3.3's BRUN sometimes crashes when the
machine-language program returns, right?  As I understand it, that crash
only happens if the machine-language program does I/O through the standard
input and output vectors.  Since your machine-language stub never calls
COUT or KEYIN, it's probably perfectly safe just ending with RTS.

The problem with exiting by JMP $3D0 (which is the preferred address for
this function, since $9DBF is "undocumented," and doesn't work with ProDOS)
is that it always returns to the BASIC command prompt.  If a BASIC program
says PRINT CHR$(4)"BRUN IMAGE", the program exits as soon as the BRUN
command finishes, instead of continuing with the next BASIC statement.
Exiting by RTS allows the BASIC program to continue running.


ProDOS doesn't suffer from the BRUN bug, so in ProDOS a machine-language
program is free to print through COUT and then exit however it wants...RTS,
JMP $3D0, or whatever.

               - Neil Parker
-- 
Neil Parker                       | No cute quote, no cute ASCII art, no cute
nparker@cie-2.uoregon.edu         | disclaimer, no deposit, no return....
nparker@cie.uoregon.edu           | (This space intentionally left blank:
http://cie-2.uoregon.edu/~nparker |                                           )