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

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

unix.superglobalmegacorp.com

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