|
|
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: #include "header.h"
8: #include "mainapp.h"
1.1.1.3 root 9: #include "mpu680x0.h"
1.1 root 10: #include "pluto.h"
11: #include "vm.h"
12:
1.1.1.3 root 13: void cli_halt_callback(void *);
14:
1.1 root 15: // wxApp と相似にするためのクラス
16: class CLIApp
17: {
18: public:
1.1.1.4 root 19: int OnInit();
1.1 root 20: bool Parse();
1.1.1.3 root 21: [[noreturn]] void OnCreate();
1.1 root 22:
23: int ac;
24: char **av;
25: };
26:
27: int
28: main(int ac, char *av[])
29: {
1.1.1.2 root 30: std::unique_ptr<CLIApp> app(new CLIApp());
1.1 root 31:
32: // wxApp とよく似せるため
33: app->ac = ac;
34: app->av = av;
1.1.1.4 root 35: return app->OnInit();
1.1 root 36: }
37:
38: // ここがエントリポイント(のつもり)
1.1.1.4 root 39: int
1.1 root 40: CLIApp::OnInit()
41: {
1.1.1.4 root 42: int rv;
43:
1.1.1.6 ! root 44: // CLI 側では関係ないが wx 側で必要なので初期化は2ステージに分かれている
! 45: rv = gMainApp.Init1(true, ac, av);
1.1.1.4 root 46: if (rv != MainApp::PASS) {
47: return rv;
1.1 root 48: }
1.1.1.6 ! root 49: if (!gMainApp.Init2()) {
1.1.1.4 root 50: return EXIT_FAILURE;
1.1 root 51: }
52:
1.1.1.6 ! root 53: // VM にコールバックを登録
! 54: if (gMPU680x0) {
! 55: gMPU680x0->SetHaltCallback(cli_halt_callback, NULL);
! 56: }
! 57:
1.1 root 58: // メインウィンドウに相当するところ
59: OnCreate();
60:
1.1.1.4 root 61: return EXIT_SUCCESS;
1.1 root 62: }
63:
64: // メインウィンドウ作成後のイベントに相当するところ
65: void
66: CLIApp::OnCreate()
67: {
1.1.1.6 ! root 68: // 電源投入
1.1 root 69: gVM->PowerButton();
70:
71: // ?
72: for (;;) {
73: sleep(1);
74: }
75: }
1.1.1.3 root 76:
77: // m680x0 ダブルバスフォールト時に呼ばれるコールバック。
78: void
79: cli_halt_callback(void *dummy)
80: {
81: // どうする?
82: warnx("Double bus fault has occurred in VM");
83: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.