nancygold's Journal
 
[Most Recent Entries] [Calendar View] [Friends View]

Tuesday, June 25th, 2024

    Time Event
    10:38p
    Going further...
    During the initialization stage, the game calls function 1600h of the `int 2fh`.
    //virtual dos machine interface 0x2F:0x1600 interrupt results
    #define VDM_NONE      0
    #define VDM_OTHER_VM  0x01
    #define VDM_SYSTEM_VM 0xFF
    #define VDM_HIMEM_SYS 0x80
    #define NO_VDM(r) ((r)==VDM_NONE || (r) == VDM_HIMEM_SYS)
    uint8_t vdm_query() {
      asm {
        mov ax, 0x1600
        int 0x2f
        xor ah, ah
      }
      return _AL;
    }



    That interrupt is very special, and the function 1600h is even more special.
    Basically the game checks for the presence of Windows 3.1, and configures the PC Speaker accordingly
    https://www.geoffchappell.com/notes/dos/interrupts/2Fh/16h/00h.htm

    Here is another gem...
    //again, crufty code with '}' repeating two times...
    //BTW, Borland C++ 3.0 ctype.h had isprint(c)
    byte is_printable(char *buf, char c) {
      UNUSED(buf);
      return isalnum(c) || c == ':' || c == '.' || c == '\\' || c == '}' || c == '!'
        || c == '@' || c == '#' || c == '$' || c == '%' || c == '^' || c == '&'
        || c == '(' || c == ')' || c == '-' || c == '_' || c == '{' || c == '}'
        || c == '~' || c == '`';
    }
    


    Current Mood: amused

    << Previous Day 2024/06/25
    [Calendar]
    Next Day >>

About LJ.Rossia.org