-
Notifications
You must be signed in to change notification settings - Fork 22
/
kickstart_process_descriptor.a65
86 lines (75 loc) · 3.01 KB
/
kickstart_process_descriptor.a65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
; Process descriptor block (fixed 256 bytes)
;
; This needs to have information about the current running task,
; and also hold information about the current open files, if any.
; Process description (first 128 bytes)
currenttask_block:
; Tasks are idenfied by what amounts to an 8-bit process id.
; Process ID #$FF is special, and indicates that it is the operating system/hypervisor
; that is active. This affects how results are return from system calls, so that they
currenttask_id:
.byte $FF
; Name of task (16 characters, unused characters should be null)
currenttask_name:
.byte "OPERATING SYSTEM"
; Make sure we don't over-flow the available space
.checkpc currenttask_block+[$80]
.advance currenttask_block+[$80],$00
; Now we have file control blocks for the open files/directories.
; We have only 128 bytes for these, so not many files can be open at a time!
; This also means that we don't keep much information about a file in here.
; For example, name, permissions/attributes and so on must be requested seprately
; using trap_dos_fstat. As a result, we can fit a few more open files in here, to
; make life easy for programmers. 128 bytes / 32 bytes = 4 open files, which seems
; a fairly minimal number.
currenttask_filedescriptor0:
; Which logical drive the file resides on
; (or $FF for a free descriptor block = closed file.
; we put this in the first byte for convience for checking
; if a file descriptor is free).
currenttask_filedescriptor0_drivenumber:
.byte $00
; Starting cluster in file system
; (used so that we can seek around in the file)
currenttask_filedescriptor0_startcluster:
.byte $00,$00,$00,$00
; Current cluster in file system
currenttask_filedescriptor0_currentcluster:
.byte $00,$00,$00,$00
; Current sector within current cluster
currenttask_filedescriptor0_sectorincluster:
.byte $00
; Length of file
currenttask_filedescriptor0_filelength:
.byte $00,$00,$00,$00
; Position in file indicated by the buffer
currenttask_filedescriptor0_bufferposition:
.byte $00,$00,$00,$00
; Cluster of the directory in which this file resides
currenttask_filedescriptor0_directorycluster:
.byte $00,$00,$00,$00
; Which entry this file is within the containing directory
currenttask_filedescriptor0_entryindirectory:
.word $0000
; Buffer address in target task used for this file
; (32-bit virtual address, so that the buffer can be paged out)
currenttask_filedescriptor0_bufferaddress:
.byte $00,$00,$00,$00
; bytes loaded into buffer
currenttask_filedescriptor0_bytesinbuffer:
.word $0000
; current offset within buffer
currenttask_filedescriptor0_offsetinbuffer:
.word $0000
; The other three file descriptors follow the same format as the first
.checkpc currenttask_block+[$A0]
.advance currenttask_block+[$A0],$00
currenttask_filedescriptor1:
.checkpc currenttask_block+[$C0]
.advance currenttask_block+[$C0],$00
currenttask_filedescriptor2:
.checkpc currenttask_block+[$E0]
.advance currenttask_block+[$E0],$00
currenttask_filedescriptor3:
.checkpc currenttask_block+[$100]
.advance currenttask_block+[$100],$00