I recently got the Frotz ZCode interpreter working on VAX OpenVMS. Although it runs, it exits with an error. If someone could tell me where I went wrong here, I'd be grateful! The error only appears if Frotz doesn't run any games. I'm guessing that it's something to do with the way that VMS interprets the return code.
For this run, it errs on exit. It looks bad ('access violation'!), but it isn't, is it?
$ frotz -h
option requires an argument -- h
%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=851E411B, PC
%TRACE-F-TRACEBACK, symbolic stack dump follows
module name routine name line rel PC abs PC
DUMB_INIT os_process_arguments 4481 000001A4 0000FA7C
MAIN main 2227 0000002B 000067F7
For this run, it exits okay.
$ frotz [-.ZIP.DATA]ZORK1.DATA
West of House Score: 0 Moves: 0
ZORK I: The Great Underground Empire
Copyright (c) 1981, 1982, 1983 Infocom, Inc. All rights reserved.
ZORK is a registered trademark of Infocom, Inc.
Revision 88 / Serial number 840726
West of House
You are standing in an open field west of a white house, with a boarded
There is a small mailbox here.
West of House Score: 0 Moves: 1
It is securely anchored.
Your score is 0 (total of 350 points), in 1 move.
This gives you the rank of Beginner.
Do you wish to leave the game? (Y is affirmative): >y
This is my second attempt at getting an open-source application to run on VMS. Since my VMS is running in SIMH, I'm wondering if I could run SIMH in VMS in SIMH (I like recursive emulation).
The access violation is a bug, either in the original code or the port, because a stack trace is being generated. If you were simply returning the same code for an access violation, no stack trace would be generated.
Tracing it down needs more information. Running a debug version of the ported code with the debugger set to break on exception, and then do a show calls.
All code ported from Unix needs to be compiled with the _POSIX_EXIT=1, and that the main() routine needs to explicitly call exit(xxx) instead of having main exit or a return from main(). The newer Alpha/IA64 compilers have a /MAIN=POSIX_EXIT that will make sure of this, but for VAX, you have to do this manually.
If you do not make sure that the POSIX version of exit() is called, then you need to make sure that the program only returns valid VMS exit status codes instead of Unix ones.