;	A L T O   E X E C U T I V E
; LocalTab.asm -- Assembly-language code and strings - LocalTab.asm
; Copyright Xerox Corporation 1979, 1980, 1983
; Last modified January 8, 1983  3:58 PM by Boggs

	.BEXT	LOCALTABLE, TYPE, DELETE, QUERY
	.BEXT	DIAGNOSE, RELEASE, UserBootFrom
	.BEXT	Install, Resume, BootKeys, SetTime
	.BEXT	Dump, Load, Copy, Rename, LogIn
	.BEXT	StandardRam, MesaBanks
	.BEXT	Ftp, Chat, Scavenger, NetExec, EBoot
	.BEXT	Qfd, WriteSortedDirectory, Partition

	.BEXT	ExecRelease, ReleaseString

	.BEXT	CallWithNArgs, GetLCChar

	.SREL

LOCALTABLE:	START
ExecRelease:	ExecReleaseS
ReleaseString:	ReleaseStringS
CallWithNArgs:	CallWithNArgsC
GetLCChar:	.GetLCChar

	.NREL

	0

ExecReleaseS:
	.TXT	"*300XEROX*301 Alto Executive/12"
ReleaseStringS:
	.TXT	", Released January 8, 1983*N"


;	Calls @p1 with p2 arguments p3, p4, p5, ...
;	The circumlocution is so that if the call fails due to
;	an overlay fault, it can be re-executed later later.

GetFrame = 370
StArgs = 367
Return = 366

CallWithNArgsC:
	STA	3,1,2
	JSR@	GetFrame
	24	; 4 fixed + 20 formals
	JSR@	StArgs
	LDA	0,4,2	; first formal
	STA	0,localPStatic
	LDA	0,5,2	; second formal
	STA	0,NParams
	LDA	3,Three
	LDA	1,Five	; third formal-1 (frame-relative)
	SUB#	0,3,SNR

	LDA	1,10,2	; three args -> fifth formal

	STA	1,3,2	; ExtraArgs for this call
	LDA	0,6,2	; third formal
	LDA	1,7,2	; fourth formal
	JSRII	localPStatic
NParams:
	0
	JMP@	Return

Three:	3
Five:	5
localPStatic: 0

;	GetLCChar(s,i) returns the i'th character of the string s
;	with upper case mapped to lower case
.GetLCChar:
	STA	3,1,2
	MOV	0,3	; s
	MOVZR	1,0	; i/2
	ADD	0,3	; s+i/2
	LDA	0,0,3	; word containing desired character
	MOVR#	1,1,SNC	; skip if i odd
	 MOVS	0,0	; swap bytes
	LDA	1,c377
	AND	1,0	; isolate desired character
	LDA	1,c132	; $Z
	SLEU	0,1	; skip if le $Z
	 JMP	GCDone
	LDA	1,c101	; $A
	SGEU	0,1	; skip if ge $A
	 JMP	GCDone
	LDA	1,c40
	ADD	1,0	; convert upper case to lower
GCDone:	LDA	3,1,2
	JMP	1,3

c377:	377
c132:	132
c101:	101
c40:	40


; Keeping these alphabetical (by command name) will help speed things up

START:
	QUERY
	.TXT	"?."

	UserBootFrom
	.TXT	"Bootfrom.~."

	BootKeys
	.TXT	"BootKeys.~."

	Chat
	.TXT	"Chat.~."

	Copy
	.TXT	"Copy.~."

	DELETE
	.TXT	"Delete.~."

	Dump
	.TXT	"Dump.~."

	EBoot
	.TXT	"EtherBoot.~."

	Qfd
	.TXT	"FileStat.~." ; not called Qfd so Q still means Quit.~

	Ftp
	.TXT	"Ftp.~."

	Install
	.TXT	"Install.~."

	Load
	.TXT	"Load.~."

	LogIn
	.TXT	"LogIn.~."

	MesaBanks
	.TXT	"MesaBanks.~."

	NetExec
	.TXT	"NetExec.~."

	Partition
	.TXT	"Partition.~."

	DIAGNOSE
	.TXT	"Quit.~."

	RELEASE
	.TXT	"Release.~."

	Rename
	.TXT	"Rename.~."

	Resume
	.TXT	"Resume.~."

	Scavenger
	.TXT	"Scavenger.~."

	SetTime
	.TXT	"SetTime.~."

	StandardRam
	.TXT	"StandardRam.~."

	TYPE
	.TXT	"Type.~."

	WriteSortedDirectory
	.TXT	"WriteDirectory.~."

	0


	.END