A2osX/INC/A2osX.I.txt

495 lines
14 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
* KERNEL CONSTANTS DEFINITON
*--------------------------------------
K.ENV.SIZE .EQ 256
K.EVT.MAX .EQ 16
K.DEV.MAX .EQ 16
K.FLT.MAX .EQ 8
K.PS.MAX .EQ 64
*--------------------------------------
* Aux ZP
*--------------------------------------
ZPKERNEL .EQ $0
*--------------------------------------
ZPMEMMGR .EQ $8
*--------------------------------------
pCode .EQ $10
pData .EQ $12
pStack .EQ $14
pLib .EQ $16
pDrv .EQ $18
pPs .EQ $1A
pDev .EQ $1C
pEvent .EQ $1E
*--------------------------------------
* $3A-$3F ProDOS Block Device Drivers Main
* $5E-$C8 RESERVED APPLESOFT Main/Aux (ROM Call, no need to switch back MainZP)
*--------------------------------------
ZPDRV .EQ $80
ZPBIN .EQ $90
ZPLIB .EQ $A0 32 bytes for TCPIP
*--------------------------------------
* Memory Map
*--------------------------------------
A2osX.SaveSM .EQ $100 Aux
A2osX.SaveSX .EQ $101 Aux
*--------------------------------------
* Main $200 -> 2FF : (Used By ProDOS,Clock DRV....)
* Main $300 -> 3EF : <free>
* Main $3F0 -> 3FF : SYS Vectors (reset,IRQ...)
* Aux $200 -> 3FD : /RAM Driver
* Aux $3FE -> 3FF : IRQ Vector
*--------------------------------------
UsrBuf256 .EQ $0200 Main
*--------------------------------------
*D.STACK.BASE .EQ $0300 $03EF...
D.STACK.TOP .EQ $03F0 ...Down to $0300
*--------------------------------------
*** $3F0-$3FF IRQ Handler.... ***
*--------------------------------------
* Main/Aux $400 -> $7FF : Console Screen
* Main/Aux $800 -> $BFF : System Screen
*--------------------------------------
KrnBuf256 .EQ $0C00 Main
*--------------------------------------
MLICALL.PARAMS .EQ $0D00 Main, $12 bytes min !!!!
KrnSTAT .EQ $0D12
*--------------------------------------
*** Z80 Reserved $0F00-10FF***
*--------------------------------------
Z80STACK .EQ $0FFF (0FFFFh) Down to $0F00
Z80JMP .EQ $1000 (00000h) Up To $10FF
*--------------------------------------
EvtMgr.Table .EQ $1100 K.EVT.MAX*S.EVT.SIZE=32*8=256b
*--------------------------------------
DevMgr.Table .EQ $1200 K.DEV.MAX*S.DEV.SIZE=16*16=256b
*--------------------------------------
FltMgr.Table .EQ $1300 K.FLT.MAX*S.FLT.SIZE=8*32=256b
*--------------------------------------
TskMgr.Table .EQ $1400 K.PS.MAX*S.PS.SIZE=64*16=1k
*--------------------------------------
* MemMgr : $1800->$1FFF MAIN/AUX (2 kBytes)
*--------------------------------------
MemMgr.Table .EQ $1800
MemMgr.HiMem .EQ $1800 Slot 0 is Reserved
MemMgr.Free .EQ $1802
MemMgr.LoMem .EQ $1804
MemMgr.LastSlot .EQ $1806
*--------------------------------------
MemMgr.MLoMem .EQ $2000
MemMgr.MHiMem .EQ $BE00
MemMgr.XLoMem .EQ $2000
MemMgr.XHiMem .EQ $C000
*--------------------------------------
DevMgr.HiMem .EQ $FFFA Protect IRQ vectors in Aux LC
*--------------------------------------
* A2osX GLOBAL PAGE
* $BE00->$BE0F : Public Vetors
*--------------------------------------
A2osX.SYSCALL .EQ $BE00
A2osX.LIBCALL .EQ $BE03
A2osX.MLICALL .EQ $BE06
*--------------------------------------
pCodeJmp .EQ $BE10
pLibJmp .EQ $BE13
pDrvJmp .EQ $BE16
pDevJmp .EQ $BE19
*--------------------------------------
* $BEE0->$BEEF : Public Variables
*--------------------------------------
A2osX.ASCREEN .EQ $BEE0 Active Screen
A2osX.SCRNDEVS .EQ $BEE1 -> $BEE4 (4 devices)
A2osX.CPUTYPE .EQ $BEE6
A2osX.CPUSPEED .EQ $BEE7 (->255.99 Mhz)
A2osX.Z80SLOT .EQ $BEEA
A2osX.TIMER16 .EQ $BEEC
A2osX.RANDOM16 .EQ $BEEE
*--------------------------------------
* $BEF0->$BEFF : Kernel Config Block
*--------------------------------------
A2osX.HZ .EQ $BEF0
*--------------------------------------
H.BIN.HEADER .EQ 0
H.BIN.HEADER.DRV65 .EQ $4CD8 6502:cld,jmp abs
H.BIN.HEADER.LIB65 .EQ $7CD8 6502:cld,jmp (abs,x)
H.BIN.HEADER.BIN65 .EQ $7CD8 6502:cld,jmp (abs,x)
H.BIN.HEADER.LIB80 .EQ $A28D Z80:
H.BIN.HEADER.BIN80 .EQ $A28D Z80:
H.BIN.JMP .EQ 2
H.BIN.CODE.TYPE .EQ 4
H.BIN.VERSION .EQ 5
H.BIN.CODE.LEN .EQ 8
*
H.BIN.EXE.DS.SIZE .EQ 10
H.BIN.EXE.REL.TABLE .EQ 16
*
H.BIN.DRV.HEADER.O .EQ 10
H.BIN.DRV.CODE.O .EQ 12
H.BIN.DRV.CODE.LEN .EQ 14
H.BIN.DRV.REL.TABLE .EQ 0
*--------------------------------------
* A2osX.SYSCALL Functions Indexes
*--------------------------------------
SYS.COutA .EQ $00 SYS.FPUTCA
* .EQ $02 SYS.FGETC
SYS.PStrOutYA .EQ $04 SYS.FPUTSYA
* .EQ $06 SYS.FGETS
SYS.HexOutA .EQ $08
SYS.HexOutYA .EQ $0A
SYS.DecOutA .EQ $0C
SYS.DecOutYA .EQ $0E
*--------------------------------------
SYS.NewPStrYA .EQ $10
SYS.PStrCpy .EQ $12
SYS.PStrCat .EQ $14
SYS.PStrMatch .EQ $16
SYS.PStrUprYA .EQ $18
SYS.PStrLwrYA .EQ $1A
SYS.PStrFTime .EQ $1C
SYS.PStr2StrArrayYA .EQ $1E
*--------------------------------------
SYS.ExecProcessNewEnvYA .EQ $20
SYS.ExecProcessYA .EQ $22
SYS.CreateProcessNewEnvYA .EQ $24
SYS.CreateProcessYA .EQ $26
SYS.GetPSByIDA .EQ $28
* .EQ $2A
SYS.Sleep .EQ $2C
* .EQ $2E
*--------------------------------------
SYS.GetArgC .EQ $30
SYS.GetArgA .EQ $32
SYS.ExpandPStrYA .EQ $34
* .EQ $36
SYS.PutEnvYA .EQ $38
SYS.SetEnv .EQ $3A
SYS.GetEnvYA .EQ $3C
SYS.UnsetEnvYA .EQ $3E
*--------------------------------------
SYS.FileSearch .EQ $40
SYS.GetFullPathYA .EQ $42
SYS.LoadFile .EQ $44
SYS.SaveFile .EQ $46
* .EQ $48
* .EQ $4A
* .EQ $4C
* .EQ $4E
*--------------------------------------
SYS.LoadDrvYA .EQ $50
SYS.LoadLibYA .EQ $52
SYS.UnloadLibA .EQ $54
SYS.LoadExeYA .EQ $56
SYS.TimeYA .EQ $58
SYS.CTime2Time .EQ $5A
SYS.PTime2Time .EQ $5C
* .EQ $5E
*--------------------------------------
SYS.FOPEN .EQ $60
SYS.FOPEN.R .EQ $01 Open For Read
SYS.FOPEN.W .EQ $02 Open For Write
SYS.FOPEN.A .EQ $04 Append
SYS.FOPEN.T .EQ $08 Open/Append in Text mode
SYS.FOPEN.X .EQ $80 Create if not exists
SYS.FCLOSEA .EQ $62
SYS.FREAD .EQ $64
SYS.FWRITE .EQ $66
SYS.FFLUSH .EQ $68
SYS.FSEEK .EQ $6A
SYS.FSEEK.SET .EQ $00
SYS.FSEEK.CUR .EQ $01
SYS.FSEEK.END .EQ $02
SYS.FTELL .EQ $6C
SYS.FEOF .EQ $6E
SYS.REMOVE .EQ $70
SYS.RENAME .EQ $72
SYS.STAT .EQ $74
* .EQ $76
SYS.OPENDIRYA .EQ $78
SYS.READDIRA .EQ $7A
SYS.CLOSEDIRA .EQ $7C
SYS.MKDIRYA .EQ $7E
*--------------------------------------
SYS.GetMem .EQ $80
SYS.FreeMemA .EQ $82
SYS.GetMemPtrA .EQ $84
SYS.GetMemByIDA .EQ $86
SYS.GetMemByNameYA .EQ $88
SYS.LoadStockObjectYA .EQ $8A
SYS.GetStockObjectA .EQ $8C
SYS.FreeStockObject .EQ $8E
*--------------------------------------
SYS.GetDevByIDA .EQ $90
SYS.GetDevByNameYA .EQ $92
SYS.GetDevInfoA .EQ $94
SYS.GetKeyboardEvent .EQ $96
SYS.MKNOD .EQ $FF
SYS.MKFIFO .EQ $FF
*--------------------------------------
* ProDOS ERROR CODES : $00->$5F
* Lib ERROR CODES : $80->$BF
* Kernel ERROR CODES : $C0->$FF
*--------------------------------------
MEMMGR.ERROOM .EQ $FF Out Of Memory Error
MEMMGR.ERROOH .EQ $FE Out Of Handle Error
*--------------------------------------
DEVMGR.ERROOM .EQ $EF Out Of Memory Error
DEVMGR.ERROOH .EQ $EE Out Of Handle Error
DEVMGR.ERRICL .EQ $ED Invalid Command Line
DEVMGR.ERRNOHW .EQ $EC No Hardware
DEVMGR.ERRDNF .EQ $EB Device Not Found Error
DEVMGR.ERRUNSUP .EQ $EA Unsupported Function
*--------------------------------------
TSKMGR.ERROOH .EQ $DF Out Of Handle Error
TSKMGR.ERRNSP .EQ $DD No Such Process Error
*--------------------------------------
SYSMGR.ERRSYN .EQ $CF Syntax Error
SYSMGR.ERRENVF .EQ $CE Env is Full
SYSMGR.ERRIBIN .EQ $CD Invalid BIN format
SYSMGR.ERRFTB .EQ $CC File Too Big Error
SYSMGR.ERRFNF .EQ $CB File Not Found Error
*--------------------------------------
* MEM STRUCT
*--------------------------------------
S.MEM.F .EQ 0
S.MEM.F.AUX .EQ %10000000 Request Stock Object
S.MEM.F.INIT0 .EQ %01000000 Fill with "0"
S.MEM.F.CODE .EQ %00100000
S.MEM.F.NOMOVE .EQ %00010000
S.MEM.F.ALIGN .EQ %00001000
S.MEM.F.INUSE .EQ %10000000 (Internal Flag)
S.MEM.REFCNT .EQ 1
S.MEM.OWNERPID .EQ 2
S.MEM.BIN .EQ 3
S.MEM.PTR .EQ 4
S.MEM.LEN .EQ 6
*
S.MEM .EQ 8
*--------------------------------------
* DEV STRUCT
*--------------------------------------
S.DEV.CODE .EQ 0 cld,jmp...
S.DEV.JMP .EQ 2 ...(code,x)
S.DEV.ID .EQ 4
S.DEV.F .EQ 5
S.DEV.F.INUSE .EQ %10000000
S.DEV.F.BUSY .EQ %01000000
S.DEV.F.SHARE .EQ %00100000 Device is shareable
S.DEV.F.IRQ .EQ %00010000 Device is irq driven
S.DEV.F.EVENT .EQ %00001000 Device is event driven
S.DEV.F.COUT .EQ %00000100 Device supports Char OUT
S.DEV.F.BLOCK .EQ %00000010
S.DEV.F.CHAR .EQ %00000001
S.DEV.NAME .EQ 6 5 Bytes : LEN+NUL KBD CON COMx LPTx ETHx
*
S.DEV .EQ 16
*--------------------------------------
S.DEVINFO.TYPE .EQ 0
S.DEVINFO.TYPE.CHAR .EQ %00000001
S.DEVINFO.TYPE.XY .EQ %00000010
S.DEVINFO.TYPE.NET .EQ %00000011
S.DEVINFO.TYPE.GFX .EQ %00000100
S.DEVINFO.FLAGS .EQ 1
S.DEVINFO.NET.FLAGS.ARPOFFLOAD .EQ %00000001
S.DEVINFO.NET.FLAGS.IPOFFLOAD .EQ %00000010
S.DEVINFO.NET.MAC .EQ 2
S.DEVINFO.NET.STATUS .EQ 8
S.DEVINFO.NET.STATUS.OK .EQ $80
S.DEVINFO.NET.STATUS.FD .EQ $40
S.DEVINFO.NET.STATUS.10 .EQ $01
S.DEVINFO.NET.STATUS.100 .EQ $02
S.DEVINFO.NET.STATUS.1000 .EQ $03
*--------------------------------------
* Generic Driver Functions
*--------------------------------------
DEVMGR.OPEN .EQ 0
DEVMGR.GETEVENT .EQ 2
DEVMGR.COUT .EQ 4
DEVMGR.CLOSE .EQ 6
DEVMGR.GETINFO .EQ 8
DEVMGR.IRQ .EQ 10
*--------------------------------------
DEVMGR.SELECT .EQ 12
*--------------------------------------
* 'NET' Class Driver Functions
*--------------------------------------
DEVMGR.NET.SEND .EQ 12
DEVMGR.SETIPCFG .EQ 14
*--------------------------------------
* 'GFX' Class Driver Functions
*--------------------------------------
DEVMGR.GFX.SETPIXEL .EQ 14
DEVMGR.GFX.GETPIXEL .EQ 16
DEVMGR.GFX.HLINE .EQ 18
DEVMGR.GFX.VLINE .EQ 20
DEVMGR.GFX.BITBLT .EQ 22
*--------------------------------------
* PS STRUCT
*--------------------------------------
S.PS.F .EQ 0
S.PS.F.INUSE .EQ %10000000
S.PS.F.HOLD .EQ %01000000
S.PS.F.EVENT .EQ %00100000
S.PS.F.ENV .EQ %00010000
S.PS.F.SLEEP .EQ %00001000
S.PS.F.INIT .EQ %00000100
S.PS.ID .EQ 1
S.PS.PID .EQ 2
S.PS.hCS .EQ 3
S.PS.hDS .EQ 4
S.PS.hPREFIX .EQ 5
S.PS.hENV .EQ 6
S.PS.hCMDLINE .EQ 7
*S.PS.hARGS .EQ 8
S.PS.hINDEV .EQ 9
S.PS.hOUTDEV .EQ 10
S.PS.hERRDEV .EQ 11
S.PS.CID .EQ 12
S.PS.LASTERROR .EQ 13
S.PS.PC .EQ 14
*
S.PS .EQ 16
*--------------------------------------
* LIB Function Indexes
*--------------------------------------
LIBMGR.LOAD .EQ 0
LIBMGR.UNLOAD .EQ 2
*--------------------------------------
* Task Function Indexes
*--------------------------------------
TSKMGR.INIT .EQ 0
TSKMGR.RUN .EQ 2
TSKMGR.DOEVENT .EQ 4
TSKMGR.QUIT .EQ 6
*--------------------------------------
* EVENT STRUCT
*--------------------------------------
S.EVT.F .EQ 0
S.EVT.F.T10TH .EQ %10000000
S.EVT.F.T1SEC .EQ %01000000
S.EVT.F.hMEM2 .EQ %00100000 Indicates That S.EVT.DATAHI is a hMem
S.EVT.F.hMEM1 .EQ %00010000 Indicates That S.EVT.DATALO is a hMem
S.EVT.F.NET .EQ %00000100
S.EVT.F.MOUSE .EQ %00000010
S.EVT.F.KEY .EQ %00000001
S.EVT.hDEV .EQ 1
S.EVT.DATA .EQ 2
S.EVT.DATALO .EQ 2
S.EVT.DATAHI .EQ 3
S.EVT.DATAW1 .EQ 4
S.EVT.DATAW2 .EQ 6
*
S.EVT .EQ 8
*--------------------------------------
S.TIME.CENTURY .EQ 0 19,20,21....
S.TIME.YEAR .EQ 1 0.99
S.TIME.MONTH .EQ 2 1..12
S.TIME.DAY .EQ 3 1..31
S.TIME.HOUR .EQ 4 0..23
S.TIME.MINUTE .EQ 5 0..59
S.TIME.SECOND .EQ 6 0..61
S.TIME.WDAY .EQ 7 1..7
*
S.TIME .EQ 8
*--------------------------------------
* S.STAT
*--------------------------------------
S.STAT.MODE .EQ 0
S.STAT.MODE.XO .EQ $0001
S.STAT.MODE.WO .EQ $0002
S.STAT.MODE.RO .EQ $0004
S.STAT.MODE.XG .EQ $0008
S.STAT.MODE.WG .EQ $0010
S.STAT.MODE.RG .EQ $0020
S.STAT.MODE.XU .EQ $0040
S.STAT.MODE.WU .EQ $0080
S.STAT.MODE.RU .EQ $0100
S.STAT.MODE.SST .EQ $0200
S.STAT.MODE.SGID .EQ $0400
S.STAT.MODE.SUID .EQ $0800
S.STAT.DEV .EQ 2 WORD
S.STAT.UID .EQ 4 WORD
S.STAT.GID .EQ 6 WORD
S.STAT.INO .EQ 8 QWORD
S.STAT.NLINK .EQ 16 WORD
S.STAT.SIZE .EQ 18 DWORD
S.STAT.ATIME .EQ 22 DWORD
S.STAT.MTIME .EQ 26 DWORD
S.STAT.CTIME .EQ 30 DWORD
S.STAT.BLOCKS .EQ 34 DWORD
S.STAT.BLKSIZE .EQ 38 WORD
S.STAT.PRODOS.TYPE .EQ 40 BYTE
S.STAT.PRODOS.AUXTYPE .EQ 41 WORD
*
S.STAT .EQ 43
*--------------------------------------
* S.FILE for FOPEN,FREAD......
*--------------------------------------
S.FILE.HANDLER .EQ 0 0=KRNL,!0=hDEV,hLIB (LIBNFS,LIBTCPIP.....)
S.FILE.TYPE .EQ 1
S.FILE.TYPE.REG .EQ 1
S.FILE.TYPE.DIR .EQ 2
S.FILE.TYPE.BLK .EQ 3
S.FILE.TYPE.CHR .EQ 4
S.FILE.TYPE.LNK .EQ 5
S.FILE.TYPE.SOCK .EQ 6
S.FILE.TYPE.FIFO .EQ 7
S.FILE.PRODOS.REF .EQ 2
S.FILE.PRODOS.IOBUF .EQ 3
*
S.FILE.PRODOS .EQ 4
*
* no S.FILE,Variable size
*--------------------------------------
* S.DIR for OpenDir,ReadDir,CloseDir
*--------------------------------------
S.DIR.HANDLER .EQ 0
S.DIR.F .EQ 1
S.DIR.F.NOMORE .EQ $80
S.DIR.PRODOS.REF .EQ 2
S.DIR.PRODOS.IOBUF .EQ 3
S.DIR.PRODOS.EL .EQ 4
S.DIR.PRODOS.EPB .EQ 5
S.DIR.PRODOS.FC .EQ 6
*
S.DIR.PRODOS .EQ 8
* no S.DIR
*--------------------------------------
* S.DIRENT for ReadDir
*--------------------------------------
S.DIRENT.NAME .EQ 0
* Variable size
S.DIRENT.STAT .EQ S.STAT
*--------------------------------------
S.PFT.PATH .EQ 0
S.PFT.HANDLER .EQ 23
S.PFT.DATA .EQ 24 8 bytes OPAQUE data for handler
*
S.PFT .EQ 32
*--------------------------------------
MAN
SAVE INC/A2OSX.I