Annotation of nono/vm/human68k.h, revision 1.1.1.1

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2017 Y.Sugahara (moveccr)
                      4: //
                      5: 
                      6: #pragma once
                      7: 
                      8: #include "device.h"
                      9: #include "ram.h"
                     10: #include "m68030.h"
                     11: 
                     12: // Human68k console emulator
                     13: 
                     14: // Human68k 構造
                     15: class Human68k : public Device {
                     16:        typedef Device inherited;
                     17:  public:
                     18:        // .X ファイルのヘッダ構造
                     19:        struct XFileHeader {
                     20:                uint8  magic[2];                // +00 識別子 'HU'
                     21:                uint8  unused1;
                     22:                uint8  loadmode;                // +03 ロードモード
                     23:                uint32 base_addr;               // +04 ベースアドレス
                     24:                uint32 exec_addr;               // +08 実行開始アドレス
                     25:                uint32 text_size;               // +0c テキストサイズ
                     26:                uint32 data_size;               // +10 データサイズ
                     27:                uint32 bss_size;                // +14 BSS サイズ
                     28:                uint32 reloc_size;              // +18 再配置テーブルサイズ
                     29:                uint32 symbol_size;             // +1c シンボルサイズ
                     30:                uint32 scdline_size;    // +20 SCD 行番号テーブルサイズ
                     31:                uint32 scdsym_size;             // +24 SCD シンボルテーブルサイズ
                     32:                uint32 scdstr_size;             // +28 SCD 文字列テーブルサイズ
                     33:                uint32 unused2[4];
                     34:                uint32 module_offset;   // +3c モジュールリストの位置
                     35:        } __packed;
                     36: 
                     37:        // .Z ファイルのヘッダ構造
                     38:        struct ZFileHeader {
                     39:                uint16 magic1;                  // +00 第一識別子 $601a
                     40:                uint32 text_size;               // +02 テキストサイズ
                     41:                uint32 data_size;               // +06 データサイズ
                     42:                uint32 bss_size;                // +0a BSS サイズ
                     43:                uint8  unused[8];
                     44:                uint32 base_addr;               // +16 実行開始アドレス
                     45:                uint16 magic2;                  // +1a 第二識別子 $ffff
                     46:        } __packed;
                     47: 
                     48:        // Human68k File
                     49:        struct File {
                     50:                int fd = -1;                    // unix fd
                     51:                char *filename = NULL;
                     52:        };
                     53: 
                     54:        Human68k(const char *file, const char *arg);
                     55:        virtual ~Human68k();
                     56: 
                     57:        virtual bool Init();
                     58: 
                     59:        bool FLineOp(m68kcpu *cpu);
                     60: 
                     61:  private:
                     62:        // Human Emulation API
                     63:        int32 OpenFile(uint32 fileaddr, uint16 atr, int mode);
                     64:        int32 CloseFile(int32 fileno);
                     65:        int32 WriteFile(int32 fileno, uint32 dataaddr, uint32 size);
                     66:        void FputsFile(int32 fileno, uint32 dataaddr);
                     67: 
                     68:        void IOCS(m68kcpu *cpu);
                     69: 
                     70:        bool LoadR(uint8 *memfile, uint size);
                     71:        bool LoadX(uint8 *memfile, uint size);
                     72:        bool LoadZ(uint8 *memfile, uint size);
                     73:        bool LoadMem(uint32 addr, uint8 *src, uint size);
                     74: 
                     75:        bool isext(const char *file, const char *ext);
                     76: 
                     77:        RAMDevice *ram = NULL;
                     78: 
                     79:        const char *human68k_file = NULL;
                     80:        const char *human68k_arg = NULL;
                     81: 
                     82:        uint32 boot_addr = 0;           // ローダプログラムアドレス
                     83:        uint32 load_addr = 0;           // ロードアドレス
                     84:        uint32 load_size = 0;           // ロードサイズ
                     85: 
                     86:        uint32 base_addr = 0;           // ベースアドレス(ファイルの値)
                     87:                                                                // ベースアドレスはload_addr決定で使用される
                     88:        uint32 exec_addr = 0;           // 実行開始アドレス
                     89: 
                     90:        uint32 text_size = 0;           // テキストセクションサイズ
                     91:        uint32 data_size = 0;           // データセクションサイズ
                     92:        uint32 bss_size = 0;            // BSS セクションサイズ(記録用)
                     93: 
                     94:        const uint32 default_load_addr = 0x20000;
                     95: 
                     96:        static const int FilesCount = 256;
                     97:        File Files[FilesCount] {};
                     98: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.