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

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

unix.superglobalmegacorp.com

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