; Copyright 2018 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
;
; Sources:
;   GS/OS Reference Manual
;   Orca/M 2.0 assembler manual
;   NiftyList data file

*SYNOPSIS GS/OS public addresses and constants.

gsos_inline_ent     @ $e100a8 4     ;GS/OS inline call entry point
gsos_stack_ent      @ $e100b0 4     ;GS/OS stack call entry point

*TAG AppleIIgs-GSOS-Functions

; Class 0 ProDOS 16 calls.
P16_ALLOC_INTERRUPT = $0031         ;(Int#,@Code)
P16_CHANGE_PATH     = $0004         ;(@Path1,@Path2)
P16_CLEAR_BACKUP_BIT = $000B        ;(@Path)
P16_CLOSE           = $0014         ;(Ref)
P16_CREATE          = $0001         ;(@Path,Acc,Typ,Aux/4,StT,CrD,CrT)
P16_DEALLOC_INTERTUPT = $0032       ;(Int#)
P16_DESTROY         = $0002         ;(@Path)
P16_D_INFO          = $002C         ;(Dev#,@DevName)
P16_ERASE_DISK      = $0025         ;(@DevName,@VolName,fsID)
P16_EXPAND_PATH     = $000E         ;(@PathIn,@PathOut,Flags)
P16_FLUSH           = $0015         ;(Ref)
P16_FORMAT          = $0024         ;(@DevName,@VolName,fsID)
P16_GET_BOOT_VOL    = $0028         ;(@Buff)
P16_GET_DEV_NUM     = $0020         ;(@DevName,Dev#)
P16_GET_DIR_ENTRY   = $001C         ;(Ref#,z,Bs,Dis,@Bf,dEnt/36)
P16_GET_EOF         = $0019         ;(Ref,EOF/4)
P16_GET_FILE_INFO   = $0006         ;(@P,a,t,xt/4,s,cDT,mDT,b/4)
P16_GET_LAST_DEV    = $0021         ;(Dev#)
P16_GET_LEVEL       = $001B         ;(Level)
P16_GET_MARK        = $0017         ;(Ref,Pos/4)
P16_GET_NAME        = $0027         ;(@Buff)
P16_GET_PREFIX      = $000A         ;(Pfx#,@Buff)
P16_GET_VERSION     = $002A         ;(Version)
P16_NEWLINE         = $0011         ;(Ref,Mask,Char)
P16_OPEN            = $0010         ;(Ref,@Path,xxx/4)
P16_QUIT            = $0029         ;(@Path,Flags)
P16_READ            = $0012         ;(Ref,@Where,Count/4,xfCount/4)
P16_READ_BLOCK      = $0022         ;(Dev#,@Where,Blk#/4)
P16_SET_EOF         = $0018         ;(Ref,EOF/4)
P16_SET_FILE_INFO   = $0005         ;(@P,a,t,xt/4,z,cD,cT,mD,mT)
P16_SET_LEVEL       = $001A         ;(Level)
P16_SET_MARK        = $0016         ;(Ref,Pos/4)
P16_SET_PREFIX      = $0009         ;(Pfx#,@Prefix)
P16_VOLUME          = $0008         ;(@DevN,@VolN,Blks/4,FreeBlks/4,fsID)
P16_WRITE           = $0013         ;(Ref,@Where,Count/4,xfCount/4)
P16_WRITE_BLOCK     = $0023         ;(Dev#,@Where,Blk#/4)

; Class 1 GS/OS calls.  Names match the macros defined in Orca/M's M16.GSOS
; (i.e. they all end with "GS" except for FSTSpecific).
AddNotifyProcGS     = $2034         ;(1:@proc)
BeginSessionGS      = $201D         ;(0:)
BindIntGS           = $2031         ;(3:IntNum,VecRefNum,@handler)
ChangePathGS        = $2004         ;(2-3:@P1,@P2,TrustMeFlag)
ClearBackupBitGS    = $200B         ;(1:@P)
CloseGS             = $2014         ;(1:ref)
CreateGS            = $2001         ;(1-7:@P,Acc,Typ,Aux/4,Stg,EOF/4,rEOF/4)
DControlGS          = $202E         ;(5:n,code,@ctlList,count/4,xfer/4)
DelNotifyProcGS     = $2035         ;(1:@proc)
DestroyGS           = $2002         ;(1:@P)
DInfoGS             = $202C         ;(2-10:n,@n,chr,B/4,sl,unit,ver,dTyp,@hd,@nx)
DReadGS             = $202F         ;(6:n,@bf,count/4,blk/4,blkSz,xfer/4)
DRenameGS           = $2036         ;(2:n,@newName)
DStatusGS           = $202D         ;(5:n,statusReq,@statList,count/4,xfer/4)
DWriteGS            = $2030         ;(6:n,@bf,count/4,blk/4,blkSz,xfer/4)
EndSessionGS        = $201E         ;(0:)
EraseDiskGS         = $2025         ;(1-6:@DevN,@VolN,gotFS,wantFS,flags,realVolName)
ExpandPathGS        = $200E         ;(2-3:@InPath,@OutPath,UpcaseFlg)
FlushGS             = $2015         ;(1-2:ref,flags)
FormatGS            = $2024         ;(1-6:@DevN,@VolN,gotFS,wantFS,flags,realVolName)
FSTSpecific         = $2033         ;(2+...)
GetBootVolGS        = $2028         ;(1:@n)
GetDevNumberGS      = $2020         ;(2:@DevN,devnum)
GetDirEntryGS       = $201C         ;(5-17:rf,fl,bs,ds,@n,n,T,EOF/4,b/4,c/8,m/8,A,X/4,FS,@o,resEOF/4,resBk/4)
GetEOFGS            = $2019         ;(2:ref,eof/4)
GetFileInfoGS       = $2006         ;(2-12:@P,A,T,X/4,S,c/8,m/8,@Opt,EOF/4,B/4,rEOF/4,rB/4)
GetFSTInfoGS        = $202B         ;(2-7:n,fs,@n,ver,attr,bSz,mxV/4,mxF/4)
GetLevelGS          = $201B         ;(1-2:level,levelMode)
GetMarkGS           = $2017         ;(2:ref,pos/4)
GetNameGS           = $2027         ;(1:@n)
GetPrefixGS         = $200A         ;(2:pfxNum,@Pfx)
GetRefInfoGS        = $2039         ;(2-5:ref,acc,@path,resNum,level)
GetRefNumGS         = $2038         ;(2-6:@path,ref,acc,res,case,disp)
GetStdRefNumGS      = $2037         ;(2:pfxNum,refNum)
GetSysPrefsGS       = $200F         ;(1:prefs)
GetVersionGS        = $202A         ;(1:version)
JudgeNameGS         = $2007         ;(3-6:fileSysID,Descr,@Rules,MaxLen,@Path,Result)
NewLineGS           = $2011         ;(4:ref,ANDmask,NumChars,@NLtable)
NullGS              = $200D         ;(0:)
OpenGS              = $2010         ;(2-15:ref,@P,Acc,fork,gotAcc,+GET_FILE_INFO)
OSShutdownGS        = $2003         ;(1:Flags)
QuitGS              = $2029         ;(0-2:@P,flags)
ReadGS              = $2012         ;(4-5:ref,@buff,count/4,xfer/4,cacheFlg)
ResetCacheGS        = $2026         ;(0:)
SessionStatusGS     = $201F         ;(1:status)
SetEOFGS            = $2018         ;(3:ref,base,displ/4)
SetFileInfoGS       = $2005         ;(2-12:@P,A,T,X/4,,c/8,m/8,@Opt,,,,)
SetLevelGS          = $201A         ;(1-2:level,levelMode)
SetMarkGS           = $2016         ;(3:ref,base,displ/4)
SetPrefixGS         = $2009         ;(1-2:pfxNum,@Pfx)
SetStdRefNum        = $203a         ;(2:pfxNum,refNum)
SetSysPrefsGS       = $200C         ;(1:prefs)
UnbindIntGS         = $2032         ;(1:IntNum)
VolumeGS            = $2008         ;(2-8:@DevN,@vnOut,blks/4,free/4,fSys,BlkSz,char,devID)
WriteGS             = $2013         ;(4-5:ref,@buff,count/4,xfer/4,cacheFlg)

; Shell calls.  These are used just like GS/OS calls.  See chapter 24
; in the Orca/M 2.0 manual and M16.Shell.
SH_ChangeVector     = $010C
SH_ConsoleOut       = $011A
SH_Direction        = $010F
SH_Error            = $0105
SH_Execute          = $010D
SH_ExpandDevices    = $0114
SH_Export           = $0116
SH_FastFile         = $010E
SH_GetCommand       = $011D
SH_GetIODevices     = $011C
SH_GetLang          = $0103
SH_GetLInfo         = $0101
SH_InitWildcard     = $0109
SH_Keypress         = $011E
SH_NextWildcard     = $010A
SH_PopVariables     = $0117
SH_PushVariables    = $0118
SH_ReadIndexed      = $0108
SH_ReadKey          = $011f
SH_ReadVariable     = $010B
SH_Redirect         = $0110
SH_Set              = $0106
SH_SetIODevices     = $011B
SH_SetLang          = $0104
SH_SetLInfo         = $0102
SH_SetStopFlag      = $0119
SH_Stop             = $0113
SH_UnsetVariable    = $0115
SH_Version          = $0107

SH_ChangeVectorGS   = $014C
SH_ConsoleOutGS     = $015A
SH_DirectionGS      = $014F
SH_ErrorGS          = $0145
SH_ExecuteGS        = $014D
SH_ExpandDevicesGS  = $0154
SH_ExportGS         = $0156
SH_FastFileGS       = $014E
SH_GetCommandGS     = $015D
SH_GetIODevicesGS   = $015C
SH_GetLangGS        = $0143
SH_GetLInfoGS       = $0141
SH_InitWildcardGS   = $0149
SH_KeypressGS       = $015E
SH_NextWildcardGS   = $014A
SH_PopVariablesGS   = $0157
SH_PushVariablesGS  = $0158
SH_ReadIndexedGS    = $0148
SH_ReadKeyGS        = $015f
SH_ReadVariableGS   = $014B
SH_RedirectGS       = $0150
SH_SetGS            = $0146
SH_SetIODevicesGS   = $015B
SH_SetLangGS        = $0144
SH_SetLInfoGS       = $0142
SH_SetStopFlagGS    = $0159
SH_StopGS           = $0153
SH_UnsetVariableGS  = $0155
SH_VersionGS        = $0147
