1 |
243 |
winston |
;The MIT License
|
2 |
|
|
;
|
3 |
|
|
;Copyright (c) 2009 Dylan Smith
|
4 |
|
|
;
|
5 |
|
|
;Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
|
|
;of this software and associated documentation files (the "Software"), to deal
|
7 |
|
|
;in the Software without restriction, including without limitation the rights
|
8 |
|
|
;to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
|
|
;copies of the Software, and to permit persons to whom the Software is
|
10 |
|
|
;furnished to do so, subject to the following conditions:
|
11 |
|
|
;
|
12 |
|
|
;The above copyright notice and this permission notice shall be included in
|
13 |
|
|
;all copies or substantial portions of the Software.
|
14 |
|
|
;
|
15 |
|
|
;THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
|
|
;IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
|
|
;FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
|
|
;AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
|
|
;LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
|
|
;OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21 |
|
|
;THE SOFTWARE.
|
22 |
|
|
|
23 |
|
|
; Definitions for streams.
|
24 |
|
|
|
25 |
|
|
; Flags that describe what kind of stream we have.
|
26 |
|
|
ISFILE equ 1
|
27 |
|
|
RDONLY equ 2
|
28 |
|
|
ISDIR equ 4
|
29 |
308 |
winston |
ISCTRL equ 8
|
30 |
243 |
winston |
|
31 |
|
|
; Bit positions for the above
|
32 |
|
|
BIT_ISFILE equ 0
|
33 |
|
|
BIT_RDONLY equ 1
|
34 |
|
|
BIT_ISDIR equ 2
|
35 |
308 |
winston |
BIT_ISCTRL equ 3
|
36 |
243 |
winston |
|
37 |
252 |
winston |
; Offsets for stream metadata.
|
38 |
|
|
STRM_WRITEBUF equ 0 ; Write buffer number
|
39 |
|
|
STRM_READBUF equ 1 ; Read buffer number
|
40 |
|
|
STRM_WRITEPTR equ 2 ; Write pointer
|
41 |
|
|
STRM_READPTR equ 3 ; Read pointer
|
42 |
|
|
STRM_FD equ 4 ; File/socket/dir handle
|
43 |
|
|
STRM_FLAGS equ 5 ; Flags bitfield
|
44 |
|
|
STRM_REMAINING equ 6 ; Remaining buffer size
|
45 |
|
|
|
46 |
308 |
winston |
; State variables - offsets (note offset 5 is STRM_FLAGS)
|
47 |
|
|
OFS_FLAGS equ 0
|
48 |
|
|
OFS_CURCMD equ 1
|
49 |
|
|
OFS_CURSTATE equ 2
|
50 |
|
|
OFS_STREAM equ 3
|
51 |
317 |
winston |
OFS_CURDATA equ 6
|
52 |
308 |
winston |
|
53 |
|
|
; Definitions.
|
54 |
|
|
BUFMETADATA equ 0x1000
|
55 |
|
|
BUFDATASZ equ 8
|
56 |
|
|
|
57 |
|
|
; Command definitions for the control channel
|
58 |
|
|
CMD_POLLALL equ 'p'
|
59 |
|
|
|
60 |
380 |
winston |
STREAM_ROM_ID equ 0x02
|
61 |
|
|
INTERPWKSPC equ 0x3000
|