fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
1;-----------------------------------------------------------------------------
2; pce
3;-----------------------------------------------------------------------------
4
5;-----------------------------------------------------------------------------
6; File name: pcemsg.asm
7; Created: 2004-09-17 by Hampa Hug <hampa@hampa.ch>
8; Copyright: (C) 2004-2020 Hampa Hug <hampa@hampa.ch>
9;-----------------------------------------------------------------------------
10
11;-----------------------------------------------------------------------------
12; This program is free software. You can redistribute it and / or modify it
13; under the terms of the GNU General Public License version 2 as published
14; by the Free Software Foundation.
15;
16; This program is distributed in the hope that it will be useful, but
17; WITHOUT ANY WARRANTY, without even the implied warranty of
18; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19; Public License for more details.
20;-----------------------------------------------------------------------------
21
22
23; pcemsg [msg [val]]
24; send a message to the emulation core
25
26
27%include "pce.inc"
28
29
30section .text
31
32 org 0x100
33
34 jmp start
35
36
37msg_usage db "pcemsg version ", PCE_VERSION_STR , 0x0d, 0x0a
38 db 0x0d, 0x0a
39 db "usage: pcemsg [msg [val]]", 0x0d, 0x0a
40 db 0x00
41
42msg_notpce db "pcemsg: not running under PCE", 0x0d, 0x0a, 0x00
43msg_error db "pcemsg: error", 0x0d, 0x0a, 0x00
44
45
46%define PCE_USE_PRINT_STRING 1
47%define PCE_USE_PARSE_OPT 1
48%define PCE_USE_HOOK_CHECK 1
49%define PCE_USE_HOOK 1
50
51%include "pce-lib.inc"
52
53
54start:
55 mov ax, cs
56 mov ds, ax
57 mov es, ax
58
59 cld
60
61 call pce_hook_check
62 jc .notpce
63
64 mov si, 0x0080 ; parameters
65
66 lodsb ; paramter size
67 mov cl, al
68 xor ch, ch
69
70 mov di, str_msg
71 call pce_parse_opt
72 jc .usage
73
74 mov di, str_val
75 call pce_parse_opt
76
77 mov si, str_msg
78 mov di, str_val
79 mov ax, PCE_HOOK_SET_MSG
80 call pce_hook
81 jc .error
82
83.done_ok:
84 xor al, al
85
86.exit:
87 mov ah, 0x4c
88 int 0x21
89 int 0x20
90
91.usage:
92 mov si, msg_usage
93 call pce_print_string
94 jmp .done_ok
95
96.error:
97 mov si, msg_error
98 jmp .done_err
99
100.notpce:
101 mov si, msg_notpce
102 ;jmp .done_err
103
104.done_err:
105 call pce_print_string
106 mov al, 0x01
107 jmp .exit
108
109
110section .bss
111
112str_msg resb 256
113str_val resb 256