Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/planix-v0/sys/src/cmd/gs/src/zdosio.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/* Copyright (C) 1992, 1999 Aladdin Enterprises.  All rights reserved.
2
 
3
  This software is provided AS-IS with no warranty, either express or
4
  implied.
5
 
6
  This software is distributed under license and may not be copied,
7
  modified or distributed except as expressly authorized under the terms
8
  of the license contained in the file LICENSE in this distribution.
9
 
10
  For more information about licensing, please refer to
11
  http://www.ghostscript.com/licensing/. For information on
12
  commercial licensing, go to http://www.artifex.com/licensing/ or
13
  contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14
  San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15
*/
16
 
17
/* $Id: zdosio.c,v 1.4 2002/02/21 22:24:54 giles Exp $ */
18
/* MS-DOS direct I/O operators. */
19
/* These should NEVER be included in a released configuration! */
20
#include "dos_.h"
21
#include "ghost.h"
22
#include "oper.h"
23
#include "store.h"
24
 
25
/* <port> .inport <word> */
26
private int
27
zinport(i_ctx_t *i_ctx_p)
28
{
29
    os_ptr op = osp;
30
 
31
    check_type(*op, t_integer);
32
    make_int(op, inport((int)op->value.intval));
33
    return 0;
34
}
35
 
36
/* <port> .inportb <byte> */
37
private int
38
zinportb(i_ctx_t *i_ctx_p)
39
{
40
    os_ptr op = osp;
41
 
42
    check_type(*op, t_integer);
43
    make_int(op, inportb((int)op->value.intval));
44
    return 0;
45
}
46
 
47
/* <port> <word> .outport - */
48
private int
49
zoutport(i_ctx_t *i_ctx_p)
50
{
51
    os_ptr op = osp;
52
 
53
    check_type(*op, t_integer);
54
    check_type(op[-1], t_integer);
55
    outport((int)op[-1].value.intval, (int)op->value.intval);
56
    pop(1);
57
    return 0;
58
}
59
 
60
/* <port> <byte> .outportb - */
61
private int
62
zoutportb(i_ctx_t *i_ctx_p)
63
{
64
    os_ptr op = osp;
65
 
66
    check_type(*op, t_integer);
67
    check_int_leu(op[-1], 0xff);
68
    outportb((int)op[-1].value.intval, (byte) op->value.intval);
69
    pop(1);
70
    return 0;
71
}
72
 
73
/* <loc> .peek <byte> */
74
private int
75
zpeek(i_ctx_t *i_ctx_p)
76
{
77
    os_ptr op = osp;
78
 
79
    check_type(*op, t_integer);
80
    make_int(op, *(byte *) (op->value.intval));
81
    return 0;
82
}
83
 
84
/* <loc> <byte> .poke - */
85
private int
86
zpoke(i_ctx_t *i_ctx_p)
87
{
88
    os_ptr op = osp;
89
 
90
    check_type(*op, t_integer);
91
    check_int_leu(op[-1], 0xff);
92
    *(byte *) (op[-1].value.intval) = (byte) op->value.intval;
93
    pop(1);
94
    return 0;
95
}
96
 
97
/* ------ Operator initialization ------ */
98
 
99
const op_def zdosio_op_defs[] =
100
{
101
    {"1.inport", zinport},
102
    {"1.inportb", zinportb},
103
    {"2.outport", zoutport},
104
    {"2.outportb", zoutportb},
105
    {"1.peek", zpeek},
106
    {"2.poke", zpoke},
107
    op_def_end(0)
108
};