Complete Rewrite #4 : keep it simple!!!

This commit is contained in:
Rémy GIBERT 2015-11-10 21:48:42 +01:00
parent 502cc3ba38
commit a95b687065
3 changed files with 359 additions and 26 deletions

View File

@ -1,7 +0,0 @@
PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
MAN
SAVE INC/A2OSX.API.I

View File

@ -26,7 +26,28 @@ ZPDRV .EQ $80
ZPBIN .EQ $90
ZPLIB .EQ $A0
*--------------------------------------
* $C0 -> $FF KERNEL RESERVED
* $B0 -> $FF KERNEL RESERVED
*--------------------------------------
ZPMemMgr .EQ $B0
ZPSysScr .EQ $C0
ZPDevMgr .EQ $D0
ZPTskMgr .EQ $E0
*--------------------------------------
R.VCPU16 .EQ $F0
R.AX .EQ R.VCPU16
R.AL .EQ R.VCPU16
R.AH .EQ R.VCPU16+$1
R.BX .EQ R.VCPU16+$2
R.BL .EQ R.VCPU16+$2
R.BH .EQ R.VCPU16+$3
R.CX .EQ R.VCPU16+$4
R.CL .EQ R.VCPU16+$4
R.CH .EQ R.VCPU16+$5
R.DX .EQ R.VCPU16+$6
R.DL .EQ R.VCPU16+$6
R.DH .EQ R.VCPU16+$7
*--------------------------------------
* Memory Map
*--------------------------------------
A2osX.SaveSM .EQ $100 Aux
A2osX.SaveSX .EQ $101 Aux
@ -36,21 +57,51 @@ A2osX.SaveSX .EQ $101 Aux
* Main $3F0 -> 3FF : SYS Vectors (reset,IRQ...)
* Aux $200 -> 3FD : /RAM Driver
* Aux $3FE -> 3FF : IRQ Vector
* Main/Aux $400 -> $7FF : Console Screen
* Main/Aux $800 -> $BFF : System Screen
*--------------------------------------
TmpBuffer256 .EQ $0200 Main
*--------------------------------------
D.STACK.BASE .EQ $0300 $03EF...
D.STACK.TOP .EQ $03F0 ...Down to $0300
*--------------------------------------
*** IRQ Handler ***
*--------------------------------------
* Main/Aux $400 -> $7FF : Console Screen
* Main/Aux $800 -> $BFF : System Screen
*--------------------------------------
*** Z80 Reserved ***
*--------------------------------------
Z80STACK .EQ $0FFF (0FFFFh) Down to $0F00
Z80JMP .EQ $1000
*--------------------------------------
MLICALL.PARAMS .EQ $1100
DevMgr.Table .EQ $1200 K.DEV.MAX*S.DEV.SIZE=32*16=512b
*--------------------------------------
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
*--------------------------------------
* A2osX GLOBAL PAGE
* $BE00->$BE0F : Public Vetors
*--------------------------------------
A2osX.SYSCALL .EQ $BE00
A2osX.LIBCALL .EQ $BE02
A2osX.SLEEP .EQ $BE04
A2osX.LIBCALL .EQ $BE03
A2osX.MLICALL .EQ $BE06
A2osX.ROMCALL .EQ $BE09
*--------------------------------------
pDevJmp .EQ $BE10
pCodeJmp .EQ $BE13
pLibJmp .EQ $BE16
*--------------------------------------
* $BEE0->$BEFF : Public Variables
*--------------------------------------
@ -60,18 +111,278 @@ A2osX.SCREENS.C .EQ %00000010 Console Screen
A2osX.SCREENS.G .EQ %00000100 Graphic Screen
A2osX.ASCREEN .EQ $BEE1 Active Screen
A2osX.CSCREEN.DEV .EQ $BEE2
A2osX.GSCREEN.DEV .EQ $BEE3
A2osX.TIMER16 .EQ $BEE4
A2osX.RANDOM16 .EQ $BEE6
A2osX.CPUTYPE .EQ $BEE8
A2osX.CPUSPEED .EQ $BEE9
A2osX.Z80SLOT .EQ $BEEA
*--------------------------------------
*** Z80 Reserved ***
* Kernel Entry Point
*--------------------------------------
*** IRQ Handler ***
KERNEL.SYSCALL .EQ $D000
KERNEL.COLDBOOT .EQ $D100
*--------------------------------------
* KERNEL CONSTANTS DEFINITON
*--------------------------------------
K.TIMER16RESOLUTION .EQ 5 every 5 VBL (50hz), so 100ms
*--------------------------------------
K.ENV.SIZE .EQ $100
K.DEV.MAX .EQ 32
K.PS.MAX .EQ 64
*--------------------------------------
K.NETCFG.MAX .EQ 4
K.NETCFG.SIZE .EQ 128
K.PROTOID.ATALK .EQ 0
K.PROTOID.ETALK .EQ 1
K.PROTOID.IP .EQ 2
K.PROTOID.SPARE .EQ 3
K.ARPCACHE.SIZE .EQ 10
K.DNSCACHE.SIZE .EQ 10
K.UDPTABLE.SIZE .EQ 16
K.TCPTABLE.SIZE .EQ 16
K.ETH.FRAME.LEN .EQ 1514
K.IP.TTL .EQ 64
K.DNS.MAXLEN .EQ 64
K.DYNPORT.START .EQ 49152
K.DYNPORT.END .EQ 65535
K.DYNPORT.MAX .EQ 64
*--------------------------------------
H.BIN.HEADER .EQ 0
H.BIN.HEADER.DRV65 .EQ $4C8D 6502:cld,jmp abs
H.BIN.HEADER.LIB65 .EQ $7C8D 6502:cld,jmp (abs,x)
H.BIN.HEADER.BIN65 .EQ $7C8D 6502:cld,jmp (abs,x)
H.BIN.HEADER.DRV80 .EQ $A28D Z80:
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.BIN.DS.SIZE .EQ 10
H.BIN.DEV.HEADER.O .EQ 10
H.BIN.DRV.CODE.O .EQ 12
H.BIN.DRV.CODE.LEN .EQ 14
H.BIN.RELOC.TABLE .EQ 16
*--------------------------------------
* A2osX.SYSCALL Functions Indexes
*--------------------------------------
SYS.GetMem .EQ $00
SYS.FreeMemA .EQ $02
SYS.GetMemPtrA .EQ $04
SYS.GetMemByIDA .EQ $06
SYS.GetMemByNameA .EQ $08
SYS.GetMemByNameYA .EQ $0A
*--------------------------------------
SYS.NewPStrYA .EQ $10
SYS.PStrCpyA .EQ $12
SYS.PStrCat .EQ $14
SYS.PStrCmp .EQ $16
SYS.PStrGetTkn .EQ $18
*--------------------------------------
SYS.LoadBinA .EQ $20
SYS.LoadLibYA .EQ $22
SYS.UnloadLibA .EQ $24
SYS.LoadDrvA .EQ $26
*--------------------------------------
SYS.ExpandPStrA .EQ $30
SYS.ExpandPStrYA .EQ $32
SYS.GetEnvVarH .EQ $34
SYS.GetEnvVarP .EQ $36
SYS.SetEnvVarH .EQ $38
SYS.SetEnvVarP .EQ $3A
SYS.DelEnvVarH .EQ $3C
SYS.DelEnvVarP .EQ $3E
*--------------------------------------
SYS.MLICreateFile .EQ $40
SYS.MLICreateDirA .EQ $42
SYS.MLICreateDirYA .EQ $44
SYS.MLIDestroyA .EQ $46
SYS.MLIDestroyYA .EQ $48
SYS.MLIRename .EQ $4A
SYS.MLISetFileInfo .EQ $4C
SYS.MLIGetFileInfoA .EQ $4E
SYS.MLIGetFileInfoYA .EQ $50
SYS.MLIOnline .EQ $52
SYS.MLISetPrefixA .EQ $54
SYS.MLISetPrefixYA .EQ $56
SYS.MLIGetPrefixA .EQ $58
SYS.MLIGetPrefixYA .EQ $5A
SYS.MLIOpenA .EQ $5C
SYS.MLIOpenYA .EQ $5E
SYS.MLINewLine .EQ $60
SYS.MLIRead .EQ $62
SYS.MLIWrite .EQ $64
SYS.MLICloseA .EQ $66
SYS.MLIFlushA .EQ $68
SYS.MLISetMark .EQ $6A
SYS.MLIGetMarkA .EQ $6A
SYS.MLISetEOF .EQ $6C
SYS.MLIGetEOFA .EQ $70
SYS.MLISetBuf .EQ $72
SYS.MLIGetBuf .EQ $74
SYS.MLIGetTime .EQ $76
SYS.MLIAllocIRQ .EQ $78
SYS.MLIDeallocIRQ .EQ $7A
SYS.MLIReadBlock .EQ $7C
SYS.MLIWriteBlock .EQ $7E
*--------------------------------------
SYS.GetDevByIDA .EQ $80
SYS.GetDevByNameA .EQ $82
SYS.GetDevByNameYA .EQ $84
SYS.GetKeyboardEvent .EQ $88
*--------------------------------------
SYS.ExecProcessNewEnvA .EQ $90
SYS.ExecProcessA .EQ $92
SYS.CreateProcessNewEnvA .EQ $94
SYS.CreateProcessA .EQ $96
SYS.GetPSByIDA .EQ $98
SYS.Sleep .EQ $9C
*--------------------------------------
SYS.CheckPrefixA .EQ $A0
SYS.FileSearch .EQ $A2
SYS.LoadFileA .EQ $A4
SYS.LoadFileYA .EQ $A6
SYS.ListDirInitA .EQ $A8
SYS.ListDirNextA .EQ $AA
SYS.ListDirCloseA .EQ $AC
*--------------------------------------
SYS.AddNetCfg .EQ $B0
SYS.SetNetCfg .EQ $B2
SYS.GetNetCfgA .EQ $B4
SYS.ClrNetCfgA .EQ $B6
*--------------------------------------
SYS.ScreenSelectA .EQ $C0
SYS.SysScrPPSTRA .EQ $C4
SYS.SysScrPPSTRYA .EQ $C6
*--------------------------------------
* ERROR CODES
*--------------------------------------
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.ERRNICL .EQ $ED Invalid Command Line
DEVMGR.ERRNOHW .EQ $EC No Hardware
DEVMGR.ERRDNF .EQ $EB Device Not Found Error
*--------------------------------------
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.ERRIDIR .EQ $CD Invalid Directory
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.SIZE .EQ 8
*--------------------------------------
* BIN STRUCT
*--------------------------------------
S.BIN.CODE .EQ 0
*--------------------------------------
* DEV STRUCT
*--------------------------------------
S.DEV.CODE .EQ 0
S.DEV.JMP .EQ 2
S.DEV.F .EQ 4
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 5 5 Bytes : LEN+NUL KBD CON COMx LPTx ETHx
*
S.DEV.SIZE .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
*--------------------------------------
* 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
*--------------------------------------
* 'XY' Class Driver Functions
*--------------------------------------
DEVMGR.XY.SETPOS .EQ 12
*--------------------------------------
* 'NET' Class Driver Functions
*--------------------------------------
DEVMGR.NET.SEND .EQ 12
*--------------------------------------
* 'GFX' Class Driver Functions
*--------------------------------------
DEVMGR.GFX.SETPIXEL .EQ 12
DEVMGR.GFX.GETPIXEL .EQ 14
DEVMGR.GFX.HLINE .EQ 16
DEVMGR.GFX.VLINE .EQ 18
DEVMGR.GFX.BITBLT .EQ 20
*--------------------------------------
* 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.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.hCMD .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.SIZE .EQ 16
*--------------------------------------
* LIB Function Indexes
*--------------------------------------
@ -85,5 +396,43 @@ TSKMGR.RUN .EQ 2
TSKMGR.DOEVENT .EQ 4
TSKMGR.QUIT .EQ 6
*--------------------------------------
* EVENT STRUCT
*--------------------------------------
S.EVT.F .EQ 0
S.EVT.F.SYS .EQ %10000000
S.EVT.F.WND .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.TIMER .EQ %00001000
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.SIZE .EQ 8
*--------------------------------------
* S.LISTDIR STRUCT
*--------------------------------------
S.LISTDIR.hONLINE .EQ 0
S.LISTDIR.ONLINEPTR .EQ 1
S.LISTDIR.REFNUM .EQ 2 ref_num file
S.LISTDIR.hIOBUF .EQ 3 hMem to ProDOS IO buffer
S.LISTDIR.hREADBUF .EQ 4 hMem to 512 Read Buffer
S.LISTDIR.EL .EQ 5 entry_length
S.LISTDIR.EIB .EQ 6 ENTRY_INDEX in block
S.LISTDIR.EPB .EQ 7 entry_per_block
S.LISTDIR.BLKPTR .EQ 8 entry PTR in block
S.LISTDIR.FI .EQ 10 FILE_INDEX in DIR
S.LISTDIR.FC .EQ 12 file_count
S.LISTDIR.hPATH .EQ 14 Pattern for file filtering
S.LISTDIR.hPATTERN .EQ 15 Pattern for file filtering
*
S.LISTDIR.SIZE .EQ 16
*--------------------------------------
MAN
SAVE INC/A2OSX.I

View File

@ -1,9 +0,0 @@
PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
MAN
SAVE INC/KERNEL.I