mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-09-28 03:54:55 +00:00
.zero and .full device drivers
This commit is contained in:
parent
2b1afe29bf
commit
764853b72c
@ -2,7 +2,7 @@
|
||||
|
||||
.INCLUDE: /src/gno/paths.mk
|
||||
|
||||
TARGETS = $(OBJ_DIR)modem $(OBJ_DIR)printer $(OBJ_DIR)null
|
||||
TARGETS = $(OBJ_DIR)modem $(OBJ_DIR)printer $(OBJ_DIR)null $(OBJ_DIR)zero $(OBJ_DIR)full
|
||||
|
||||
build: all
|
||||
|
||||
@ -23,6 +23,15 @@ $(OBJ_DIR)null: null.o
|
||||
$(LD) $(LDFLAGS) -o $@ $<
|
||||
chtyp -t 187 -a 32257 $@
|
||||
|
||||
$(OBJ_DIR)zero: zero.o
|
||||
$(LD) $(LDFLAGS) -o $@ $<
|
||||
chtyp -t 187 -a 32257 $@
|
||||
|
||||
$(OBJ_DIR)full: full.o
|
||||
$(LD) $(LDFLAGS) -o $@ $<
|
||||
chtyp -t 187 -a 32257 $@
|
||||
|
||||
|
||||
$(OBJ_DIR)console: console.o inout.o box.o conpatch.o
|
||||
$(LD) $(LDFLAGS) -o $@ $<
|
||||
chtyp -t 187 -a 32257 $@
|
||||
@ -30,6 +39,8 @@ $(OBJ_DIR)console: console.o inout.o box.o conpatch.o
|
||||
$(OBJ_DIR)modem:: modem.r; $(CATREZ) -d $@ $<
|
||||
$(OBJ_DIR)printer:: printer.r; $(CATREZ) -d $@ $<
|
||||
$(OBJ_DIR)null:: null.r; $(CATREZ) -d $@ $<
|
||||
$(OBJ_DIR)zerp:: zero.r; $(CATREZ) -d $@ $<
|
||||
$(OBJ_DIR)full:: full.r; $(CATREZ) -d $@ $<
|
||||
$(OBJ_DIR)console:: console.r; $(CATREZ) -d $@ $<
|
||||
|
||||
release: all
|
||||
@ -52,9 +63,11 @@ install:
|
||||
box.o: box.mac console.equates
|
||||
conpatch.asm: conpatch.mac
|
||||
console.root: port.mac console.equates kern.equates ../gno/inc/tty.inc
|
||||
full.root: port.mac ../gno/inc/tty.inc
|
||||
inout.root: inout.mac console.equates kern.equates ../gno/inc/tty.inc
|
||||
msccf.root: sccf.mac equates md.equates sccf.asm ../gno/inc/tty.inc
|
||||
null.root: port.mac ../gno/inc/tty.inc
|
||||
port.root: port.mac equates ../gno/inc/tty.inc
|
||||
psccf.root: sccf.mac equates pr.equates sccf.asm ../gno/inc/tty.inc
|
||||
zero.root: port.mac ../gno/inc/tty.inc
|
||||
|
||||
|
118
kern/drivers/full.asm
Normal file
118
kern/drivers/full.asm
Normal file
@ -0,0 +1,118 @@
|
||||
************************************************************
|
||||
*
|
||||
* FULL device driver
|
||||
*
|
||||
************************************************************
|
||||
|
||||
case on
|
||||
mcopy port.mac
|
||||
copy ../gno/inc/tty.inc
|
||||
|
||||
|
||||
Header START
|
||||
|
||||
ds t_open
|
||||
* For speed/simplicity we use a non-standard, non-documented line
|
||||
* discipline for the .null device
|
||||
dc i4'Init2'
|
||||
dc i4'DeInit'
|
||||
dc i4'IOCTL'
|
||||
dc i4'Read'
|
||||
dc i4'Write'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
ds t_signalIO-editInd
|
||||
dc i4'NoFunc' ; t_signalIO
|
||||
dc i2'$FFFF' ; t_select_proc
|
||||
dc i4'Select' ; t_select
|
||||
dc i4'0' ; t_selwakeup jmp set during install
|
||||
|
||||
NoFunc anop
|
||||
rtl
|
||||
END
|
||||
|
||||
Init2 START
|
||||
result equ 0
|
||||
subroutine (2:devNum),2
|
||||
stz result
|
||||
return 2:result
|
||||
END
|
||||
|
||||
DeInit START
|
||||
subroutine (2:devNum),0
|
||||
return
|
||||
END
|
||||
|
||||
Write START
|
||||
*
|
||||
* returns ENOSPC / volumeFull
|
||||
*
|
||||
count equ 0
|
||||
retval equ 2
|
||||
subroutine (2:reqCount,4:dataPtr,2:devNum),4
|
||||
lda #$48
|
||||
sta retval
|
||||
stz count
|
||||
return 4:count
|
||||
END
|
||||
|
||||
Read START
|
||||
*
|
||||
* .full read returns infinite zeros.
|
||||
*
|
||||
count equ 0
|
||||
retval equ 2
|
||||
subroutine (2:reqCount,4:dataPtr,2:devNum),4
|
||||
stz retval
|
||||
lda reqCount
|
||||
sta count
|
||||
|
||||
lsr a
|
||||
beq last
|
||||
tax
|
||||
ldy #0
|
||||
lda #0
|
||||
loop anop
|
||||
sta [dataPtr],y
|
||||
iny
|
||||
iny
|
||||
dex
|
||||
bne loop
|
||||
|
||||
last anop
|
||||
* at this point:
|
||||
* a = 0
|
||||
* c = 1 if reqCount is odd.
|
||||
bcc out
|
||||
|
||||
short m
|
||||
ldy reqCount
|
||||
dey
|
||||
sta [dataPtr],y
|
||||
long m
|
||||
|
||||
out anop
|
||||
return 4:count
|
||||
END
|
||||
|
||||
IOCTL START
|
||||
retval equ 0
|
||||
subroutine (4:tioc,4:dataPtr,2:devNum),2
|
||||
stz retval
|
||||
return 2:retval
|
||||
END
|
||||
|
||||
Select START
|
||||
res equ 0
|
||||
subroutine (2:ttyn,2:which,2:pid),2
|
||||
lda #1
|
||||
sta res
|
||||
return 2:res
|
||||
END
|
||||
|
33
kern/drivers/full.rez
Normal file
33
kern/drivers/full.rez
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Resources for version and comment
|
||||
*
|
||||
*/
|
||||
|
||||
#define PROG "/dev/full"
|
||||
#define DESC "FULL Device Driver\n"
|
||||
|
||||
#include "Types.rez"
|
||||
#include "builddate.rez"
|
||||
|
||||
/*
|
||||
* Version
|
||||
*/
|
||||
resource rVersion (1, purgeable3) {
|
||||
{ 1, 0, 0, /* Version */
|
||||
release, /* development|alpha|beta|final|release */
|
||||
0 }, /* non-final release number */
|
||||
verUS, /* Country */
|
||||
PROG, /* Program name */
|
||||
DESC
|
||||
BUILD_DATE
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Comment
|
||||
*/
|
||||
resource rComment (1, purgeable3) {
|
||||
PROG "\n"
|
||||
DESC
|
||||
BUILD_DATE
|
||||
};
|
117
kern/drivers/zero.asm
Normal file
117
kern/drivers/zero.asm
Normal file
@ -0,0 +1,117 @@
|
||||
************************************************************
|
||||
*
|
||||
* ZERO device driver
|
||||
*
|
||||
************************************************************
|
||||
|
||||
case on
|
||||
mcopy port.mac
|
||||
copy ../gno/inc/tty.inc
|
||||
|
||||
Header START
|
||||
|
||||
ds t_open
|
||||
* For speed/simplicity we use a non-standard, non-documented line
|
||||
* discipline for the .null device
|
||||
dc i4'Init2'
|
||||
dc i4'DeInit'
|
||||
dc i4'IOCTL'
|
||||
dc i4'Read'
|
||||
dc i4'Write'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
dc i4'NoFunc'
|
||||
ds t_signalIO-editInd
|
||||
dc i4'NoFunc' ; t_signalIO
|
||||
dc i2'$FFFF' ; t_select_proc
|
||||
dc i4'Select' ; t_select
|
||||
dc i4'0' ; t_selwakeup jmp set during install
|
||||
|
||||
NoFunc anop
|
||||
rtl
|
||||
END
|
||||
|
||||
Init2 START
|
||||
result equ 0
|
||||
subroutine (2:devNum),2
|
||||
stz result
|
||||
return 2:result
|
||||
END
|
||||
|
||||
DeInit START
|
||||
subroutine (2:devNum),0
|
||||
return
|
||||
END
|
||||
|
||||
Write START
|
||||
*
|
||||
* .zero write is a data sink.
|
||||
*
|
||||
count equ 0
|
||||
retval equ 2
|
||||
subroutine (2:reqCount,4:dataPtr,2:devNum),4
|
||||
stz retval
|
||||
lda reqCount
|
||||
sta count
|
||||
return 4:count
|
||||
END
|
||||
|
||||
Read START
|
||||
*
|
||||
* .zero read returns infinite zeros.
|
||||
*
|
||||
count equ 0
|
||||
retval equ 2
|
||||
subroutine (2:reqCount,4:dataPtr,2:devNum),4
|
||||
stz retval
|
||||
lda reqCount
|
||||
sta count
|
||||
|
||||
lsr a
|
||||
beq last
|
||||
tax
|
||||
ldy #0
|
||||
lda #0
|
||||
loop anop
|
||||
sta [dataPtr],y
|
||||
iny
|
||||
iny
|
||||
dex
|
||||
bne loop
|
||||
|
||||
last anop
|
||||
* at this point:
|
||||
* a = 0
|
||||
* c = 1 if reqCount is odd.
|
||||
bcc out
|
||||
|
||||
short m
|
||||
ldy reqCount
|
||||
dey
|
||||
sta [dataPtr],y
|
||||
long m
|
||||
|
||||
out anop
|
||||
return 4:count
|
||||
END
|
||||
|
||||
IOCTL START
|
||||
retval equ 0
|
||||
subroutine (4:tioc,4:dataPtr,2:devNum),2
|
||||
stz retval
|
||||
return 2:retval
|
||||
END
|
||||
|
||||
Select START
|
||||
res equ 0
|
||||
subroutine (2:ttyn,2:which,2:pid),2
|
||||
lda #1
|
||||
sta res
|
||||
return 2:res
|
||||
END
|
||||
|
33
kern/drivers/zero.rez
Normal file
33
kern/drivers/zero.rez
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Resources for version and comment
|
||||
*
|
||||
*/
|
||||
|
||||
#define PROG "/dev/zero"
|
||||
#define DESC "ZERO Device Driver\n"
|
||||
|
||||
#include "Types.rez"
|
||||
#include "builddate.rez"
|
||||
|
||||
/*
|
||||
* Version
|
||||
*/
|
||||
resource rVersion (1, purgeable3) {
|
||||
{ 1, 0, 0, /* Version */
|
||||
release, /* development|alpha|beta|final|release */
|
||||
0 }, /* non-final release number */
|
||||
verUS, /* Country */
|
||||
PROG, /* Program name */
|
||||
DESC
|
||||
BUILD_DATE
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Comment
|
||||
*/
|
||||
resource rComment (1, purgeable3) {
|
||||
PROG "\n"
|
||||
DESC
|
||||
BUILD_DATE
|
||||
};
|
@ -9,3 +9,5 @@ null 0 .null
|
||||
modem 2 .ttya
|
||||
printer 1 .ttyb
|
||||
# console 3 .ttco
|
||||
zero 4 .zero
|
||||
full 5 .full
|
||||
|
Loading…
Reference in New Issue
Block a user