[Coco] wdir command?

Robert Gault robert.gault at att.net
Tue Feb 2 08:51:49 EST 2016


Christopher Fox wrote:
> Finally getting a chance to spend more time with my CoCos, both hardware and emu. The new VCC is amazing, btw.
>
> On some of my old OS-9 boot disks, I’ve found a command called wdir that provides a list of windows. Any information on where that might’ve come from? It doesn’t appear to be part of the Nitros-9 distribution?
>
> christopher
>
>

Christopher,

Sorry this took so long. I finally found the source code for the Basic09 program 
wdir. It works with OS-9 LevelII #26-3031 but not with NitrOS-9.
Unfortunately the obvious change of CC3IO to VTIO is not enough to get the 
program working.

Robert

======================================================

PROCEDURE WDir
REM Window Directory
REM Copyright by Kevin Darling Aug 87

REM For Each Window WDir Shows:
REM Window table entry #
REM Window type
REM Block numbers used, with offset into block if 1 block
REM Backlink window table # if overlay, and overlay buffer
REM block begin number.
REM Window begin and size (col,row) numbers
REM Window current cwarea being and size
REM Palette values (0-15) for that screen

REM Really should be rewritten with recursive calls to
REM show all parent backlinks of multiple overlay W's.

REM Set Up Vars and Define Constants:
BASE 0
DIM temp:BYTE
DIM w:INTEGER
DIM WNum:BYTE
DIM sctab:INTEGER
TYPE register=CC:BYTE; D:INTEGER; DP:BYTE; X,Y,U:INTEGER
DIM reg:register
DIM WE(64):BYTE
DIM SysPrc(512):BYTE
DIM D_DevTbl:INTEGER
TYPE table=V_Driv,V_Stat,V_Desc,V_FMgr:INTEGER; V_Usrs:BYTE
DIM devtable(32):table
DIM DrvName:STRING[5]
DIM DevName:STRING[4]
DIM M_Name:INTEGER
DIM cc3io:STRING[5]
DIM SC(32):BYTE
DIM typ$(9)
DIM F_GPrDsc:BYTE
DIM F_CpyMem:BYTE

cc3io="CC3I"+CHR$($CF)
F_GPrDsc=$18
F_CpyMem=$1B

FOR n=0 TO 8
READ typ$(n)
NEXT n
DATA "Same Screen"
DATA "40 Col Text"
DATA "80 Col Text"
DATA "Bad"
DATA "Bad"
DATA "640 Two Color"
DATA "320 Four Color"
DATA "640 Four Color"
DATA "320 Sixtn Color"

REM Get SysPrc Descriptor:
reg.D=256
reg.X=ADDR(SysPrc)
RUN Syscall(F_GPrDsc,reg)

REM Get Offset in System Map to Device Tables:
destination=ADDR(D_DevTbl)
count=2
offset=$80
GOSUB 1000

REM Now Use that Info to Get the Device Table Itself:
destination=ADDR(devtable)
count=SIZE(devtable)
offset=D_DevTbl
GOSUB 1000

REM Main Loop:
REM Check Each Device Entry for CC3IO Driver.
REM If it is, then Get the Window Entry # From Static Storage.
REM (unless type <> window, then treat as VDG)
REM (and skip deleted entries)
FOR DE=0 TO 31

REM Check for Entry in Use:
IF devtable(DE).V_Usrs<>0 THEN
REM Get Driver Name Offset In Descriptor:
destination=ADDR(M_Name)
count=2
offset=devtable(DE).V_Driv+4
GOSUB 1000

REM And Then the Name Itself:
destination=ADDR(DrvName)
offset=M_Name+devtable(DE).V_Driv
count=5
GOSUB 1000
IF DrvName=cc3io THEN
GOSUB 500
ENDIF
ENDIF
NEXT DE
PRINT "---------------------------------------"
END


500 REM ********************************
REM Print Window Entry This Device:
destination=ADDR(M_Name)
offset=devtable(DE).V_Desc+4
count=2
GOSUB 1000
destination=ADDR(DevName)
offset=M_Name+devtable(DE).V_Desc
count=4
GOSUB 1000

PRINT "--------------------------------------- ";
n$=""
FOR c=1 TO 4
t$=MID$(DevName,c,1)
EXITIF ASC(t$)>128 THEN
t$=CHR$(ASC(t$)-128)
n$=n$+t$
ENDEXIT
n$=n$+t$
NEXT c
PRINT n$

REM Check Device Static Memory For Type:
destination=ADDR(temp)
offset=$06+devtable(DE).V_Stat
count=1
GOSUB 1000
IF LAND($80,temp)=0 THEN
PRINT "VDG Screen"
RETURN
ENDIF

REM Else Get Window Entry# From Static Mem:
destination=ADDR(WNum)
offset=$35+devtable(DE).V_Stat
count=1
GOSUB 1000

w=WNum
offset=$1280+w*64
count=64
destination=ADDR(WE)
GOSUB 1000
sctab=WE(0)*256+WE(1)
PRINT "Entry# "; w
IF LAND(sctab,$FF00)=$FF00 THEN
IF LAND(sctab,$FF)=$FE THEN
PRINT "Iniz'd"
ELSE
PRINT "!! DEINIZ or DWSET THIS DEVICE !!"
ENDIF
ELSE
offset=sctab
count=32
destination=ADDR(SC)
GOSUB 1000

PRINT "Window Type :";
wtype=SC(0)
IF wtype=$FF THEN
PRINT "Iniz'd"
RETURN
ENDIF
IF wtype>$80 THEN
wtype=$87-wtype
ELSE
wtype=wtype+4
ENDIF
PRINT USING "i3>",wtype;
PRINT "        "; typ$(wtype)

REM PRINT "Screen Table: ";
REM PRINT USING "h4",sctab
PRINT "Block Number: ";
PRINT USING "h2",SC(1);
IF wtype>2 THEN
PRINT "-";
IF wtype=5 OR wtype=6 THEN
PRINT USING "h2",SC(1)+1
ENDIF
IF wtype=7 OR wtype=8 THEN
PRINT USING "h2",SC(1)+3
ENDIF
ELSE
PRINT "        Offset: ";
PRINT USING "2(h2)",WE($34)-$80; WE($35)
ENDIF

IF WE(2)<>$FF THEN
PRINT "Parent Entry: ";  \ PRINT USING "i2>",WE(2);
PRINT "        Overlay ";
PRINT USING "h2",WE($21)
ENDIF

PRINT "Window Start: "; WE($36); ","; WE($37); "    ";
PRINT "   Size : "; WE($38); ","; WE($39)
PRINT "CWArea Start: "; WE($05); ","; WE($06);
PRINT "       Size : "; WE($07); ","; WE($08)
FOR prn=0 TO 7
PRINT USING "h2",SC(16+prn);
PRINT " ";
NEXT prn
PRINT
FOR prn=8 TO 15
PRINT USING "h2",SC(16+prn);
PRINT " ";
NEXT prn
PRINT
ENDIF
RETURN

1000 REM Copy count at offset in datimage to destination:
reg.D=ADDR(SysPrc)+$40
reg.Y=count
reg.X=offset
reg.U=destination
RUN Syscall(F_CpyMem,reg)
IF LAND(reg.CC,$01)<>0 THEN
PRINT "Error "
PAUSE
END
ENDIF
RETURN



More information about the Coco mailing list