en:docs:mvm:api:1

SVC_ERROREXIT

Brief

Terminate MVM with error message (far pointer to ASCIIZ message on stack)

Input

  • Stack (top) = far pointer (segment:offset) to an ASCIIZ message string

Return

This function does not return. The MVM is terminated and control passes to the host operating system.

Notes

  • The message must be a null‑terminated ASCII string.
  • The far pointer must be pushed onto the stack (segment first, then offset) before issuing the HLT instruction.
  • Because the call never returns, no registers are preserved and the carry flag is undefined.

Binding

MASM

include macrolib.inc
 
    push ds
    push offset msg
    @SvcErrorExit
 
msg db "Fatal error",0

C

#include <svc.h>
 
void main(void) {
    SvcErrorExit("Fatal error");
}

The underlying pragma is defined as:

extern void SvcErrorExit(const char far *msg);
#pragma aux SvcErrorExit = \
    "hlt"           \
    "db  1"         \
    "db  NOT 1"     \
    parm caller [] [msg] \
    modify [ax bx cx dx];

See also

2024/11/07 03:44 · prokushev · 0 Comments