home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d1xx
/
d101
/
psintrp.lha
/
PsIntrp
/
console.a
< prev
next >
Wrap
Text File
|
1987-09-05
|
4KB
|
224 lines
xref abortps
xref the_window
* xdef con_signal_number
section one
include "ps.h"
lref FindTask,45
lref AllocSignal,51
lref FreeSignal,52
lref AddPort,55
lref RemPort,56
lref GetMsg,58
lref OpenDevice,70
lref CloseDevice,71
lref DoIO,72
lref SendIO,73
callex macro
move.l A6,-(SP)
move.l 4,A6
jsr _LVO\1(A6)
move.l (SP)+,A6
endm
xdef start_console
xdef stop_console
xdef conmayread
xdef conputchar
xdef conputstr
nt_msgport equ 4
pa_signal equ 0
pa_ignore equ 2
cmd_reset equ 1
cmd_read equ 2
cmd_write equ 3
cmd_update equ 4
cmd_clear equ 5
cmd_stop equ 6
cmd_start equ 7
cmd_flush equ 8
start_console
move.l the_window,o_window
move.l #128,o_length
*
lea console_name,A0
moveq #0,D0 unit
lea out_request,A1 IORequest
moveq #0,D1 flags
callex OpenDevice
*
tst.l D0
bne abortps
* was opened
move.b #nt_msgport,ln_type
* clr.b port_flags
move.b #pa_ignore,port_flags
moveq #-1,D0
callex AllocSignal
move.b D0,con_signal_number
moveq #0,D0 current task
move.l D0,A1
callex FindTask
move.l D0,this_task
lea console_port,A1
callex AddPort
move.l #console_port,reply_port
move.l #out_request,A1
move.l #in_request,A0
moveq #11,D2
1$ move.l (A1)+,(A0)+
dbra D2,1$
bra conin
stop_console
moveq #0,D0
move.b con_signal_number,D0
bls 1$
callex FreeSignal
1$
lea console_port,A1
callex RemPort
lea out_request,A1
callex CloseDevice
rts
conmayread
lea console_port,A0
callex GetMsg
tst.l D0
bne 1$
moveq #-1,D0
rts
1$
moveq #0,D0
move.b con_in_buffer,D0
move.l D0,-(SP)
bsr conin
move.l (SP)+,D0
rts
conin
move.w #cmd_read,i_command
move.l #con_in_buffer,i_data
moveq #1,D0
move.l D0,i_length
lea in_request,A1
callex SendIO
rts
conputchar
move.w #cmd_write,o_command
lea con_out_buffer,A0
move.b D0,(A0)
move.l A0,o_data
moveq #1,D0
move.l D0,o_length
lea out_request,A1
callex DoIO
rts
conputstr
move.w #cmd_write,o_command
move.l D2,o_data
move.l D3,o_length
lea out_request,A1
callex DoIO
move.l o_actual,D0
rts
console_name
dc.b 'console.device',0
section two,bss
out_request
ds.b 14 LN
reply_port
ds.l 1 reply port
ds.w 1 length
ds.l 2 device node pointer & unit
o_command
ds.w 1
ds.b 2 flags & error
o_actual
ds.l 1 actual length
o_length
ds.l 1
o_window
o_data
ds.l 2
in_request
ds.b 14 LN
ds.l 1
ds.w 1
ds.l 2
i_command
ds.w 1
ds.b 2
ds.l 1
i_length
ds.l 1
i_data
ds.l 2
* message port
console_port
* LN = A A B B A
ds.l 1
ds.l 1
* type of LN & pri & name
ln_type
ds.b 1
ds.b 1
ds.l 1
port_flags
ds.b 1 ;flags
con_signal_number
ds.b 1 ;signal bit num
this_task
ds.l 3 ;task & next 14b. is LH
ds.b 6
* end of message port
con_in_buffer
ds.b 2
con_out_buffer
ds.b 2
end