Subversion Repositories pentevo

Rev

Rev 798 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed | ?url?

  1. #pragma once
  2. #include "sysdefs.h"
  3. #include "z80/defs.h"
  4. #include "sndrender/sndrender.h"
  5. #include "savevid.h"
  6.  
  7.  
  8.  
  9. #define EMUL_DEBUG
  10. #define TRASH_PAGE
  11.  
  12. #define PAGE 0x4000
  13. #define MAX_RAM_PAGES 256       // 4Mb RAM
  14. #define MAX_CACHE_PAGES 2       // 32K cache
  15. #define MAX_MISC_PAGES 1        // trash page
  16. #define MAX_ROM_PAGES 64        // 1Mb
  17.  
  18. #define GS4MB //0.37.0
  19. #ifdef MOD_GSZ80
  20.  #define MAX_GSROM_PAGES  32U      // 512Kb
  21.  #ifdef GS4MB
  22.   #define MAX_GSRAM_PAGES 256U     // for gs4mb
  23.  #else
  24.   #define MAX_GSRAM_PAGES 30U      // for gs512 (last 32k unusable)
  25.  #endif
  26. #else
  27.  #define MAX_GSROM_PAGES 0
  28.  #define MAX_GSRAM_PAGES 0
  29. #endif
  30.  
  31. #define MAX_PAGES (MAX_RAM_PAGES + MAX_CACHE_PAGES + MAX_MISC_PAGES + MAX_ROM_PAGES + MAX_GSROM_PAGES + MAX_GSRAM_PAGES)
  32.  
  33. #define RAM_BASE_M  memory
  34. #define CACHE_M     (RAM_BASE_M + MAX_RAM_PAGES*PAGE)
  35. #define MISC_BASE_M (CACHE_M + MAX_CACHE_PAGES*PAGE)
  36. #define ROM_BASE_M  (MISC_BASE_M + MAX_MISC_PAGES*PAGE)
  37.  
  38. #ifdef MOD_GSZ80
  39. #define ROM_GS_M    (ROM_BASE_M + MAX_ROM_PAGES*PAGE)
  40. #define GSRAM_M     (ROM_GS_M + MAX_GSROM_PAGES*PAGE)
  41. #endif
  42.  
  43. #define TRASH_M     (MISC_BASE_M+0*PAGE)
  44.  
  45.  
  46. enum IDE_SCHEME
  47. {
  48.     IDE_NONE = 0,
  49.     IDE_ATM,
  50.     IDE_NEMO, IDE_NEMO_A8, IDE_NEMO_DIVIDE,
  51.     IDE_SMUC,
  52.     IDE_PROFI,
  53.     IDE_DIVIDE
  54. };
  55.  
  56. enum MOUSE_WHEEL_MODE { MOUSE_WHEEL_NONE, MOUSE_WHEEL_KEYBOARD, MOUSE_WHEEL_KEMPSTON }; //0.36.6 from 0.35b2
  57.  
  58. enum MEM_MODEL
  59. {
  60.    MM_PENTAGON = 0,
  61.    MM_SCORP, MM_PROFSCORP,
  62.    MM_PROFI,
  63.    MM_ATM450, MM_ATM710, MM_ATM3,
  64.    MM_KAY,
  65.    MM_PLUS3,
  66.    MM_QUORUM,
  67.    N_MM_MODELS
  68. };
  69.  
  70. enum ROM_MODE { RM_NOCHANGE=0, RM_SOS, RM_DOS, RM_SYS, RM_128, RM_CACHE };
  71.  
  72. const int RAM_128 = 128, RAM_256 = 256, RAM_512 = 512, RAM_1024 = 1024, RAM_4096 = 4096;
  73.  
  74. struct TMemModel
  75. {
  76.    const char *fullname, *shortname;
  77.    MEM_MODEL Model;
  78.    unsigned defaultRAM;
  79.    unsigned availRAMs;
  80. };
  81.  
  82. typedef void (__fastcall *VOID_FUNC)(void);
  83. typedef void (__fastcall *RENDER_FUNC)(unsigned char*,unsigned);
  84.  
  85. struct RENDER
  86. {
  87.    const char *name;
  88.    RENDER_FUNC func;
  89.    const char *nick;
  90.    unsigned flags;
  91. };
  92.  
  93. struct IDE_CONFIG
  94. {
  95.    char image[512];
  96.    unsigned c, h, s;
  97.    u64 lba;
  98.    unsigned char readonly;
  99.    u8 cd;
  100. };
  101.  
  102. enum RSM_MODE { RSM_SIMPLE, RSM_FIR0, RSM_FIR1, RSM_FIR2 };
  103.  
  104. enum SYNC_MODE { SM_SOUND, SM_TSC, SM_VIDEO };
  105.  
  106. struct zxkeymap ;
  107.  
  108. struct CONFIG
  109. {
  110.    unsigned paper;  // start of paper
  111.    unsigned t_line; // t-states per line
  112.    unsigned frame;  // t-states per frame
  113.    unsigned intfq;  // usually 50Hz
  114.    unsigned intlen; // length of INT signal (for Z80)
  115.    unsigned nopaper;// hide paper
  116.  
  117.    unsigned render, driver, fontsize;
  118.  
  119.    unsigned soundbuffer, refresh;
  120.  
  121.    unsigned char flashcolor, noflic, fast_sl, alt_nf;
  122.    unsigned char frameskip, frameskipmax;
  123.    unsigned char flip, fullscr;
  124.  
  125.    unsigned char lockmouse;
  126.    unsigned char detect_video;
  127.    unsigned char tape_traps;
  128.    unsigned char tape_autostart;
  129.    int scrshot;
  130.    char scrshot_dir[FILENAME_MAX];
  131.  
  132.    unsigned char ch_size;
  133.    unsigned char EFF7_mask;
  134.    unsigned char reset_rom;
  135.    unsigned char use_romset;
  136.  
  137.    unsigned char updateb, bordersize;
  138.    unsigned char even_M1, border_4T;
  139.  
  140.    unsigned char floatbus, floatdos;
  141.    bool portff;
  142.  
  143.    // border small
  144.    unsigned mcx_small; // ├юЁшчюэЄры№э√щ ЁрчьхЁ тшфшьюую ¤ъЁрэр (pix)
  145.    unsigned mcy_small; // ┬хЁЄшъры№э√щ ЁрчьхЁ тшфшьюую ¤ъЁрэр (lines)
  146.    unsigned b_top_small; // ╫шёыю тшфшь√ї ёЄЁюъ тхЁїэхую сюЁф■Ёр
  147.    unsigned b_left_small; // ╫шёыю тшфшь√ї яшъёхыхщ ыхтюую сюЁф■Ёр
  148.  
  149.    // border full
  150.    unsigned mcx_full; // ├юЁшчюэЄры№э√щ ЁрчьхЁ тшфшьюую ¤ъЁрэр pix
  151.    unsigned mcy_full; // ┬хЁЄшъры№э√щ ЁрчьхЁ тшфшьюую ¤ъЁрэр lines
  152.    unsigned b_top_full; // ╫шёыю тшфшь√ї ёЄЁюъ тхЁїэхую сюЁф■Ёр
  153.    unsigned b_left_full; // ╫шёыю тшфшь√ї яшъёхыхщ ыхтюую сюЁф■Ёр
  154.  
  155.  
  156.    int modem_port; //, modem_scheme;
  157.    unsigned char fdd_noise;
  158.  
  159.    unsigned char trdos_present, trdos_interleave;
  160.    unsigned char trdos_traps, wd93_nodelay;
  161.    unsigned char trdos_wp[4];
  162.  
  163.    unsigned char cache;
  164.    unsigned char cmos;
  165.    unsigned char smuc;
  166.    unsigned char ula_preset;
  167.  
  168.    unsigned char gs_type;
  169.    unsigned char pixelscroll;
  170.    unsigned char sleepidle;
  171.    unsigned char rsrvd1_;
  172.    unsigned char ConfirmExit;
  173.  
  174.    unsigned char highpriority;
  175.    SYNC_MODE SyncMode;
  176.    bool HighResolutionTimer;
  177.    unsigned char videoscale;
  178.  
  179.    MEM_MODEL mem_model;
  180.    unsigned ramsize, romsize;
  181.    bool Sna128Lock;
  182.  
  183.    IDE_SCHEME ide_scheme;
  184.    IDE_CONFIG ide[2];
  185.    unsigned char ide_skip_real;
  186.    unsigned char cd_aspi;
  187.  
  188.    unsigned char soundfilter; //Alone Coder (IDC_SOUNDFILTER)
  189.    unsigned char RejectDC;
  190.    struct
  191.    {
  192.       unsigned fq, ayfq, saa1099fq;
  193.       int covoxFB, covoxDD, sd, saa1099;
  194.       int beeper_vol, micout_vol, micin_vol, ay_vol, aydig_vol,
  195.           covoxFB_vol, covoxDD_vol, sd_vol, gs_vol, bass_vol;
  196.       VOID_FUNC do_sound;
  197.       unsigned char enabled, gsreset, dsprimary;
  198.       unsigned char ay_chip, ay_scheme, ay_stereo, ay_vols, ay_samples;
  199.       unsigned ay_stereo_tab[6], ay_voltab[32];
  200.    } sound;
  201.  
  202.    struct {
  203.       unsigned firenum;
  204.       unsigned char altlock, fire, firedelay;
  205.       unsigned char paste_hold, paste_release, paste_newline;
  206.       unsigned char mouse, mouseswap, kjoy, keymatrix, joymouse;
  207.       bool fjoy; // fuller joystick
  208.       unsigned char keybpcmode;
  209.       signed char mousescale;
  210.       unsigned char mousewheel; // enum MOUSE_WHEEL_MODE //0.36.6 from 0.35b2
  211.       zxkeymap *active_zxk;
  212.       unsigned JoyId;
  213.    } input;
  214.  
  215.    struct {
  216.       unsigned char enabled;
  217.       unsigned char flash_ay_kbd;
  218.       unsigned char perf_t;
  219.       unsigned char reserved1;
  220.       unsigned bandBpp;
  221.       #define NUM_LEDS 7
  222.       unsigned ay;
  223.       unsigned perf;
  224.       unsigned load;
  225.       unsigned input;
  226.       unsigned time;
  227.       unsigned osw;
  228.       unsigned memband;
  229.    } led;
  230.  
  231.    struct {
  232.       unsigned char mem_swap;
  233.       unsigned char xt_kbd;
  234.       unsigned char reserved1;
  235.    } atm;
  236.  
  237.    unsigned char use_comp_pal;
  238.    unsigned pal, num_pals;      // selected palette and total number of pals
  239.    unsigned minres;             // min. screen x-resolution
  240.    unsigned scanbright;         // scanlines intensity
  241.  
  242.    struct {
  243.       unsigned char mix_frames;
  244.       unsigned char mode; // RSM_MODE
  245.    } rsm;
  246.  
  247.    char sos_rom_path[FILENAME_MAX];
  248.    char dos_rom_path[FILENAME_MAX];
  249.    char zx128_rom_path[FILENAME_MAX];
  250.    char sys_rom_path[FILENAME_MAX];
  251.    char atm1_rom_path[FILENAME_MAX];
  252.    char atm2_rom_path[FILENAME_MAX];
  253.    char atm3_rom_path[FILENAME_MAX];
  254.    char scorp_rom_path[FILENAME_MAX];
  255.    char prof_rom_path[FILENAME_MAX];
  256.    char profi_rom_path[FILENAME_MAX];
  257. //[vv]   char kay_rom_path[FILENAME_MAX];
  258.    char plus3_rom_path[FILENAME_MAX];
  259.    char quorum_rom_path[FILENAME_MAX];
  260.  
  261.    #ifdef MOD_GSZ80
  262.    unsigned gs_ramsize;
  263.    char gs_rom_path[FILENAME_MAX];
  264.    #endif
  265.  
  266.    #ifdef MOD_MONITOR
  267.    char sos_labels_path[FILENAME_MAX];
  268.    #endif
  269.  
  270.    char ngs_sd_card_path[FILENAME_MAX];
  271.  
  272.    unsigned char zc;
  273.    char zc_sd_card_path[FILENAME_MAX];
  274.  
  275.    char atariset[64]; // preset for atari mode
  276.    char zxkeymap[64]; // name of ZX keys map
  277.    char keyset[64]; // short name of keyboard layout
  278.    char appendboot[FILENAME_MAX];
  279.    char workdir[FILENAME_MAX];
  280.    u8 profi_monochrome;
  281.  
  282.    struct
  283.    {
  284.       char exec[VS_MAX_FFPATH]; // ffmpeg path/name
  285.       char parm[VS_MAX_FFPARM]; // enc. parameters for ffmpeg
  286.       char vout[VS_MAX_FFVOUT]; // output video file name
  287.       char newcons;             // open new console for ffmpeg
  288.    } ffmpeg;
  289.  
  290.    bool ula_plus;
  291. };
  292.  
  293. struct TEMP
  294. {
  295.    unsigned char win9x;// if we have old OS //Dexus
  296.    unsigned rflags;    // render_func flags
  297.    unsigned border_add, border_and;   // for scorpion 4T border update
  298.    unsigned char *base, *base_2;  // pointers to Spectrum screen memory
  299.    unsigned char rom_mask, ram_mask;
  300.    unsigned char evenM1_C0; // C0 for scorpion, 00 for pentagon
  301.    unsigned char hi15; // 0 - 16bit color, 1 - 15bit color, 2 - YUY2 colorspace
  302.    unsigned snd_frame_samples;  // samples / frame
  303.    unsigned snd_frame_ticks;    // sound ticks / frame
  304.    unsigned cpu_t_at_frame_start;
  305.  
  306.    unsigned gx, gy, gdx, gdy; // updating rectangle (used by GDI renderer)
  307.    RECT client;               // updating rectangle (used by DD_blt renderer)
  308.    bool Minimized;            // window is minimized
  309.    HDC gdidc;
  310.    unsigned ox, oy, obpp, ofq; // destination video format
  311.    unsigned scx, scy; // multicolor area (320x240 or 384x300), used in MCR renderer
  312.    unsigned odx, ody; // offset to border in surface, used only in flip()
  313.    unsigned rsx, rsy; // screen resolution
  314.    unsigned b_top, b_left, b_right, b_bottom; // border frame used to setup MCR
  315.    unsigned scale; // window scale (x1, x2, x3, x4)
  316.    unsigned mon_scale; // window scale in monitor mode(debugger)
  317.  
  318.    unsigned ataricolors[0x100];
  319.    unsigned shift_mask; // for 16/32 bit modes masks low bits of color components
  320.  
  321.    struct { // led coords
  322.       unsigned char *ay;
  323.       unsigned char *perf;
  324.       unsigned char *load;
  325.       unsigned char *input;
  326.       unsigned char *time;
  327.       unsigned char *osw;
  328.       unsigned char *memband;
  329.       unsigned char *fdd;
  330.  
  331.       __int64 tape_started;
  332.    } led;
  333.    unsigned char profrom_mask;
  334.    unsigned char comp_pal_changed;
  335.  
  336.    // CPU features
  337.    unsigned char mmx, sse, sse2;
  338.    u64 cpufq;        // x86 t-states per second
  339.    unsigned ticks_frame; // x86 t-states in frame
  340.  
  341.    unsigned char vidblock, sndblock, inputblock, frameskip;
  342.    bool PngSupport;
  343.    bool ZlibSupport;
  344.    unsigned gsdmaaddr;
  345.    u8 gsdmaon;
  346.    u8 gs_ram_mask;
  347.  
  348.    u8 offset_vscroll;
  349.    u8 offset_vscroll_prev;
  350.    u8 offset_hscroll;
  351.    u8 offset_hscroll_prev;
  352.  
  353.    char RomDir[FILENAME_MAX];
  354.    char SnapDir[FILENAME_MAX];
  355.    char HddDir[FILENAME_MAX];
  356.    char SdDir[FILENAME_MAX];
  357.    char LastSnapName[FILENAME_MAX]; // ╚ь  яюёыхфэхую чруЁєцхээюую Їрщыр схч Ёрё°шЁхэш 
  358. };
  359.  
  360. extern TEMP temp;
  361. extern unsigned sb_start_frame;
  362.  
  363. // ╬Є ¤Єюую enum'р чртштшЄ яюЁ фюъ ёЄЁюъ т ьрёёштх ay_schemes
  364. enum AY_SCHEME
  365. {
  366.    AY_SCHEME_NONE = 0,
  367.    AY_SCHEME_FULLER, // fuller фюыцхэ шфЄш юс чрЄхы№эю фю single
  368.    AY_SCHEME_SINGLE,
  369.    AY_SCHEME_PSEUDO,
  370.    AY_SCHEME_QUADRO,
  371.    AY_SCHEME_POS,
  372.    AY_SCHEME_CHRV,
  373.    AY_SCHEME_MAX
  374. };
  375.  
  376. #include "wd93.h"
  377. #include "fdd.h"
  378. #include "hddio.h"
  379. #include "hdd.h"
  380. #include "input.h"
  381. #include "modem.h"
  382.  
  383. #if defined(MOD_GSZ80) || defined(MOD_GSBASS)
  384. #include "bass.h"
  385. #include "snd_bass.h"
  386. #endif
  387.  
  388. #ifdef MOD_GSBASS
  389. #include "gshlbass.h"
  390. #include "gshle.h"
  391. #endif
  392.  
  393. #define EFF7_4BPP       0x01
  394. #define EFF7_512        0x02
  395. #define EFF7_LOCKMEM    0x04
  396. #define EFF7_ROCACHE    0x08
  397. #define EFF7_GIGASCREEN 0x10
  398. #define EFF7_HWMC       0x20
  399. #define EFF7_384        0x40
  400. #define EFF7_CMOS       0x80
  401.  
  402. // ┴шЄ√ яюЁЄр 00 фы  ътюЁєьр
  403. static const u8 Q_F_RAM = 0x01;
  404. static const u8 Q_RAM_8 = 0x08;
  405. static const u8 Q_B_ROM = 0x20;
  406. static const u8 Q_BLK_WR = 0x40;
  407. static const u8 Q_TR_DOS = 0x80;
  408.  
  409. enum SNAP
  410. {
  411.    snNOFILE, snUNKNOWN, snTOOLARGE,
  412.    snSP, snZ80, snSNA_48, snSNA_128,
  413.    snTAP, snTZX, snCSW,
  414.    snPAL,
  415.    // ─шёъют√х ЇюЁьрЄ√ т ъюэЎх, фы  эшї юЄфхы№эр  яЁютхЁър яю эрышўш■ фшёъютющ яюфёшёЄхь√
  416.    snHOB, snSCL, snTRD, snFDI, snTD0, snUDI, snISD, snPRO, snDSK, snIPF
  417. };
  418.  
  419. struct NVRAM
  420. {
  421.    enum EEPROM_STATE { IDLE = 0, RCV_CMD, RCV_ADDR, RCV_DATA, SEND_DATA, RD_ACK };
  422.    unsigned address;
  423.    unsigned char datain, dataout, bitsin, bitsout;
  424.    unsigned char state;
  425.    unsigned char prev;
  426.    unsigned char out;
  427.    unsigned char out_z;
  428.  
  429.    void write(unsigned char val);
  430. };
  431.  
  432. struct COMPUTER
  433. {
  434.    unsigned char p7FFD, pFE, pEFF7, pXXXX;
  435.    unsigned char pDFFD, pFDFD, p1FFD, pFF77;
  436.    u8 p7EFD; // gmx
  437.    u8 p00, p80FD; // quorum
  438.    __int64 t_states; // inc with conf.frame by each frame
  439.    unsigned frame_counter; // inc each frame
  440.    unsigned char aFE, aFB; // ATM 4.50 system ports
  441.    unsigned pFFF7[8]; // ATM 7.10 / ATM3(4Mb) memory map
  442.    // |7ffd|rom|b7b6|b5..b0| b7b6 = 0 for atm2
  443.  
  444.    u8 wd_shadow[5]; // 2F, 4F, 6F, 8F, AF
  445.  
  446.    unsigned aFF77;
  447.    unsigned active_ay;
  448.    u8 pBF; // ATM3
  449.    u8 pBE; // ATM3
  450.  
  451.    unsigned char flags;
  452.  
  453.    // ╓тхЄ сюЁф■Ёр (Єю, ўЄю т√тюфшЄё  т яюЁЄ сюЁф■Ёр, чэрўхэшх 0..7, шыш 0..F (фы  ATM, PROFI))
  454.    // чэрўхэшх тёхуфр фюыцэю с√Є№ < 0x10, Є.ъ. фы  Ёрчьэюцхэш  ЎтхЄр шёяюы№чєхЄё  єьэюцхэшх эр ъюэёЄрэЄє 0x11001100
  455.    unsigned char border_attr;
  456.    unsigned char cmos_addr;
  457.    unsigned char pVD;
  458.  
  459.    #ifdef MOD_VID_VD
  460.    unsigned char *vdbase;
  461.    #endif
  462.  
  463.    unsigned char pFFBA, p7FBA; // SMUC
  464.    unsigned char res1, res2;
  465.  
  466.    unsigned char p0F, p1F, p4F, p5F; // soundrive
  467.    struct WD1793 wd;
  468.    FDD fdd[4];
  469.    struct NVRAM nvram;
  470.    struct {
  471.       __int64 edge_change;
  472.       unsigned char *play_pointer; // or NULL if tape stopped
  473.       unsigned char *end_of_tape;  // where to stop tape
  474.       unsigned index;    // current tape block
  475.       unsigned tape_bit;
  476.       bool stopped;
  477.       SNDRENDER sound;
  478.    } tape;
  479.    unsigned char comp_pal[0x40]; // ╘юЁьрЄ ярышЄЁ√ GggRrrBb (ЇюЁьрЄ ULA+)
  480.    unsigned char ide_hi_byte_r, ide_hi_byte_w, ide_hi_byte_w1, ide_read, ide_write; // high byte in IDE i/o
  481.    unsigned char profrom_bank;
  482.  
  483.    u8 ula_plus_group;
  484.    u8 ula_plus_pal_idx;
  485.    bool ula_plus_en;
  486.  
  487.    COMPUTER();
  488. };
  489.  
  490. // bits for COMPUTER::flags
  491. #define CF_DOSPORTS     0x01    // tr-dos ports are accessible
  492. #define CF_TRDOS        0x02    // DOSEN trigger
  493. #define CF_SETDOSROM    0x04    // tr-dos ROM become active at #3Dxx
  494. #define CF_LEAVEDOSRAM  0x08    // DOS ROM will be closed at executing RAM
  495. #define CF_LEAVEDOSADR  0x10    // DOS ROM will be closed at pc>#4000
  496. #define CF_CACHEON      0x20    // cache active
  497. #define CF_Z80FBUS      0x40    // unstable data bus
  498. #define CF_PROFROM      0x80    // PROF-ROM active
  499.  
  500. #define TAPE_QUANTUM 64
  501. struct tzx_block
  502. {
  503.    unsigned char *data;
  504.    unsigned datasize;    // data size, in bytes
  505.    unsigned pause;
  506.    union {
  507.       struct {
  508.          unsigned pilot_t, s1_t, s2_t, zero_t, one_t;
  509.          unsigned pilot_len;
  510.       };
  511.       struct {
  512.          unsigned numblocks, numpulses;
  513.       };
  514.       unsigned param;
  515.    };
  516.    unsigned char type; // 0-playable, 1-pulses, 10-20 - info, etc...
  517.    unsigned char crc; // xor of all bytes
  518.    char desc[128];
  519. };
  520.  
  521. struct SNDVAL {
  522.    union {
  523.       unsigned data;
  524.       struct {
  525.          short left, right;
  526.       };
  527.    };
  528. };
  529.  
  530. struct virtkeyt {
  531.    const char *name;
  532.    unsigned short virtkey;
  533. };
  534.  
  535. struct keyports
  536. {
  537.   volatile unsigned char *port1, *port2;
  538.   unsigned char mask1, mask2;
  539. };
  540.  
  541. struct zxkey {
  542.   const char *name;
  543.   volatile unsigned char * /*const*/ port; //Alone Coder
  544.   /*const*/ unsigned char mask; //Alone Coder
  545. };
  546.  
  547. struct zxkeymap {
  548.   const char *name;
  549.   zxkey *zxk;
  550.   unsigned zxk_size ;
  551. } ;
  552.  
  553. struct action {
  554.    const char *name;
  555.    void (*func)();
  556.    unsigned short k1, k2, k3, k4;
  557. };
  558.  
  559. typedef void (*TColorConverter)(u8 *dst, u8 *scrbuf, int dx);
  560. void ConvBgr32ToBgr24(u8 *dst, u8 *scrbuf, int dx);
  561. void ConvYuy2ToBgr24(u8 *dst, u8 *scrbuf, int dx);
  562. void ConvRgb16ToBgr24(u8 *dst, u8 *scrbuf, int dx);
  563. void ConvRgb15ToBgr24(u8 *dst, u8 *scrbuf, int dx);
  564. void ConvPal8ToBgr24(u8 *dst, u8 *scrbuf, int dx);
  565. extern TColorConverter ConvBgr24;
  566. // flags for video filters
  567.                                 // misc options
  568. #define RF_BORDER   0x00000002   // no multicolor painter, read directly from spectrum memory
  569. #define RF_MON      0x00000004   // not-flippable surface, show mouse cursor
  570. #define RF_DRIVER   0x00000008   // use options from driver
  571. //#define RF_VSYNC    0x00000010   // force VSYNC
  572. #define RF_D3D      0x00000010   // use d3d for windowed mode
  573. #define RF_GDI      0x00000020   // output to window
  574. #define RF_CLIP     0x00000040   // use DirectDraw clipper for windowed mode
  575. #define RF_OVR      0x00000080   // output to overlay
  576.  
  577.                                 // main area size
  578. #define RF_1X       0x00000000   // 256x192,320x240 with border (default)
  579. #define RF_2X       0x00000100   // default x2
  580. #define RF_3X       0x00000001   // default x3
  581. #define RF_4X       0x00000200   // default x4
  582. #define RF_64x48    0x00000400U  // 64x48  (for chunky 4x4)
  583. #define RF_128x96   0x00000800U  // 128x96 (for chunky 2x2)
  584.  
  585. #define RF_8        0x00000000   // 8 bit (default)
  586. #define RF_8BPCH    0x00001000   // 8-bit per color channel. GDI mode => 32-bit surface. 8-bit mode => grayscale palette
  587. #define RF_YUY2     0x00002000   // pixel format: 16bit, YUY2
  588. #define RF_16       0x00004000   // hicolor mode (RGB555/RGB565)
  589. #define RF_32       0x00008000   // true color
  590.  
  591. #define RF_USEC32   0x00010000  // use c32tab
  592. #define RF_USE32AS16 0x0020000  // c32tab contain hi-color WORDS
  593. #define RF_USEFONT  0x00040000  // use font_tables
  594. #define RF_PALB     0x00080000  // palette for bilinear filter
  595. #define RF_COMPPAL  0x00100000  // use palette from ATM palette registers
  596. #define RF_GRAY     0x00200000  // grayscale palette
  597. #define RF_D3DE     0x00400000  // use d3d for full screen mode
  598.  
  599. #define RF_MONITOR (RF_MON | RF_GDI | RF_2X)
  600.  
  601. extern unsigned frametime;
  602. extern unsigned nmi_pending;
  603.  
  604. bool ConfirmExit();
  605. BOOL WINAPI ConsoleHandler(DWORD CtrlType);
  606. void showhelp(const char *anchor = nullptr);
  607.