.PAGE
;******************************************************
;*						      *
;*		    TABLES			      *
;*						      *
;*  COPYRIGHT (c) 1982, 1983 SAGE Computer Technology *
;*  All Rights Reserved				      *
;*						      *
;******************************************************

; GS instruction length [ Mask, Instruction skeleton, Instruction size ]

TRANLEN
	.WORD	0F0FFH,06000H,4 ;Bcc, BRA, BSR	Long
	.WORD	0F000H,06000H,2 ;		Short
	.WORD	0F0F8H,050C8H,4 ;DBcc
	.WORD	0FFB8H,04E90H,2 ;JMP or JSR	(Ax)
	.WORD	0FFB8H,04EA8H,4 ;		d(Ax)
	.WORD	0FFB8H,04EB0H,4 ;		d(Ax,Ry)
	.WORD	0FFBFH,04EB8H,4 ;		XXXX.W
	.WORD	0FFBFH,04EB9H,6 ;		XXXXXX.L
	.WORD	0FFBFH,04EBAH,4 ;		d(PC)
	.WORD	0FFBFH,04EBBH,4 ;		d(PC,Ry)
	.WORD	0FFF0H,04E40H,2 ;TRAP
	.WORD	0,0,0		;End of table
	
; Status table for status register

STAT
	.BYTE	1,"T"		;Trace bit
	.BYTE	2,"S"		;Supervisor bit
	.BYTE	9,"X"		;Extend bit
	.BYTE	1,"N"		;Negative bit
	.BYTE	1,"Z"		;Zero bit
	.BYTE	1,"V"		;Overflow bit
	.BYTE	1,"C"		;Carry bit
	.BYTE	0,0		;End of table
	
	
; Command and subcommand tables

;	Debugger command list

	.MACRO	RAPOS		;Relative Address POsition
	.BYTE	<%1-%2>&0FFH	;Lower 8 bits of address
	.BYTE	<%1-%2>//256	;Upper 8 bits of address
	.ENDM
	
CMNDCHAR
	.BYTE	14		;number of commands , 1
	
	.BYTE	"D"		;Display command
	RAPOS	CMD,CMNDCHAR
	.BYTE	"S"		;Substitute command
	RAPOS	CMS,CMNDCHAR
	.BYTE	"F"		;Fill command
	RAPOS	CMF,CMNDCHAR
	.BYTE	"$"		;Set standard base register
	RAPOS	CM_BASE,CMNDCHAR
	.BYTE	"M"		;Move command
	RAPOS	CMM,CMNDCHAR
	.BYTE	"P"		;Port I/O
	RAPOS	CMPX,CMNDCHAR
	.BYTE	"T"		;Trace command
	RAPOS	CMT,CMNDCHAR
	.BYTE	"G"		;Go command
	RAPOS	CMG,CMNDCHAR
	.BYTE	"W"		;Save memory
	RAPOS	CMW,CMNDCHAR
	.BYTE	"L"		;Load memory
	RAPOS	CML,CMNDCHAR
	.BYTE	0		;Trace continuation
	RAPOS	CMTC,CMNDCHAR
	.BYTE	"I"		;Initialize system
	RAPOS	CMI,CMNDCHAR
	.BYTE	"A"		;Disassebler
	RAPOS	CMA,CMNDCHAR
	.BYTE	"E"		;Exercise
	RAPOS	CME,CMNDCHAR
	.BYTE	"X"		;Examine memory for
	RAPOS	CMX,CMNDCHAR

;	Display subcommand group

SCMD
	.BYTE	9		;Subgroup size ,1
	
	.BYTE	"M"		;Display memory
	RAPOS	CMDM,SCMD
	.BYTE	"R"		;Display all registers
	RAPOS	CMDR,SCMD
	.BYTE	"D"		;Display Data registers
	RAPOS	CMDD,SCMD
	.BYTE	"A"		;Display Address registers
	RAPOS	CMDA,SCMD
	.BYTE	"P"		;Display program counter
	RAPOS	CMDPC,SCMD
	.BYTE	"S"		;Display status register
	RAPOS	CMDSR,SCMD
	.BYTE	"U"		;Display user stack
	RAPOS	CMDUS,SCMD
	.BYTE	"$"		;Display base registers
	RAPOS	CMDB,SCMD
	.BYTE	"B"		;Display breakpoint registers
	RAPOS	CMDBR,SCMD
	.BYTE	"T"		;Display TRAP-tracing status
	RAPOS	CMDT,SCMD

;	Substitute subcommand group

SCMS
	.BYTE	9		;Subgroup size ,1
	
	.BYTE	"M"		;Substitute memory
	RAPOS	CMSM,SCMS
	.BYTE	"R"		;Substitute all registers
	RAPOS	CMSR,SCMS
	.BYTE	"D"		;Substitute Data registers
	RAPOS	CMSD,SCMS
	.BYTE	"A"		;Substitute Address registers
	RAPOS	CMSA,SCMS
	.BYTE	"P"		;Substitute program counter
	RAPOS	CMSPC,SCMS
	.BYTE	"S"		;Substitute status register
	RAPOS	CMSSR,SCMS
	.BYTE	"U"		;Substitute user stack
	RAPOS	CMSUS,SCMS
	.BYTE	"$"		;Substitute base register
	RAPOS	CMSB,SCMS
	.BYTE	"B"
	RAPOS	CMSBR,SCMS
	.BYTE	"T"
	RAPOS	CMST,SCMS

;	Fill subcommands

SCMF
	.BYTE	2		;Number of fill commands , 1
	
	.BYTE	"B"		;Fill byte
	RAPOS	CMFB,SCMF
	.BYTE	"W"		;Fill word
	RAPOS	CMFW,SCMF
	.BYTE	"L"		;Fill long word
	RAPOS	CMFL,SCMF

;	Port I/O subcommands

SCMP
	.BYTE	2		;Number of port I/O commands
	.BYTE	"I"		;Port input command
	RAPOS	CMPIX,SCMP
	.BYTE	"O"		;Port output command
	RAPOS	CMPO,SCMP
	.BYTE	"S"		;Set auxillary baud rate
	RAPOS	CMPS,SCMP
	
;	Port input subcommands

SCMPI
	.BYTE	1		;Number of port input commands
	.BYTE	"B"		;Port byte input
	RAPOS	CMPIB,SCMPI
	.BYTE	"W"		;Port word input
	RAPOS	CMPIW,SCMPI
	
;	Port output subcommands

SCMPO
	.BYTE	1		;Number of port output commands
	.BYTE	"B"		;Port byte output
	RAPOS	CMPOB,SCMPO
	.BYTE	"W"		;Port word output
	RAPOS	CMPOW,SCMPO
	
;	Execute subcommands

SCMG
	.BYTE	 2		;Number of execute subcommands-1
	.BYTE	"O"		;Reset breakpoints
	RAPOS	CMGO,SCMG
	.BYTE	"C"		;Go without breakpoint reset
	RAPOS	CMGC,SCMG
	.BYTE	"S"		;Go subroutine with break
	RAPOS	CMGS,SCMG
	
;	Trace subcommands

SCMT
	.BYTE	3		;Number of trace commands
	.BYTE	"B"		;Begin tracing
	RAPOS	CMTB,SCMT
	.BYTE	"E"		;End tracing mode
	RAPOS	CMTE,SCMT
	.BYTE	"R"		;Begin tracing with register print
	RAPOS	CMTR,SCMT
	.BYTE	"N"		;Trace next group of instructions
	RAPOS	CMTN,SCMT
	
;	Save memory subcommands

SCMW
	.BYTE	1		;Number of save commands , 1
	.BYTE	"A"		;Auxillary port
	RAPOS	CMWA,SCMW
	.BYTE	"F"		;Floppy
	RAPOS	CMWF,SCMW
	
;	Load memory subcommands

SCML
	.BYTE	2		;Number of save commands , 1
	.BYTE	"A"		;Auxillary port
	RAPOS	CMLA,SCML
	.BYTE	"T"		;Terminal
	RAPOS	CMLT,SCML
	.BYTE	"F"		;Floppy Load command
	RAPOS	CMLF,SCML

;	Initialization subcommands

SCMI
	.BYTE	6		;Number of initialization commands , 1
	.BYTE	"F"		;Initialize from floppy
	RAPOS	CMIF,SCMI
	.BYTE	"H"		;Initialize from hard disk
	RAPOS	CMIH,SCMI
	.BYTE	"G"		;Initialize from GHIB (488 bus)
	RAPOS	CMIG,SCMI
	.BYTE	"S"		;Initialize system
	RAPOS	CMIS,SCMI
	.BYTE	"V"		;Initialize trap vectors
	RAPOS	SETTRAP,SCMI
	.BYTE	"C"		;Initialize CRT (Clear CRT)
	RAPOS	CMIC,SCMI
	.BYTE	"T"		;Initialize trace & trap 15 vectors
	RAPOS	CMIT,SCMI

;	Disassembler subcommands

SCMA
	.BYTE	1		;Number of disassembler commands , 2
	.BYTE	"D"		;Disassemble memory
	RAPOS	CMAD,SCMA
	.BYTE	"R"		;Arithmetic number
	RAPOS	CMAR,SCMA

;	Exercise subcommands
SCME
	.BYTE	1		;Number of exercise commands , 2
	.BYTE	"R"		;Exercise floppy read
	RAPOS	CMER,SCME
	.BYTE	"W"		;Exercise floppy write
	RAPOS	CMEW,SCME

;	Examine memory subcommands
SCMX
	.BYTE	3		;Number of exercise commands - 1
	.BYTE	"B"		;Examine memory for byte
	RAPOS	CMXB,SCMX
	.BYTE	"W"		;Examine memory for word
	RAPOS	CMXW,SCMX
	.BYTE	"L"		;Examine memory for long word
	RAPOS	CMXL,SCMX
	.BYTE	"M"		;Examine memory for string
	RAPOS	CMXM,SCMX

	.ALIGN	2		;Assure on word boundry
.PAGE
;****************************************
;*					*
;*	  DISASSEBLER TABLES		*
;*					*
;* Note: The disassembler code would	*
;*	 not fit in the current proms.	*
;*					*
;****************************************

;Disassembler commands

;Bit command subcommands

BITFUNC
	.ASCII	"TST"		;Bit test
	.BYTE	0
	.ASCII	"CHG"		;Bit change
	.BYTE	0
	.ASCII	"CLR"		;Bit clear
	.BYTE	0
	.ASCII	"SET"		;Bit set
	.BYTE	0
	
;Immediate instructions

INSTRI
	.ASCII	"ORI"		;OR immediate
	.BYTE	0
	.ASCII	"ANDI"		;AND immediate
	.ASCII	"SUBI"		;SUB immediate
	.ASCII	"ADDI"		;ADD immediate
	.ASCII	"B"		;Bit function
	.BYTE	0,0,0
	.ASCII	"EORI"		;EOR immediate
	.ASCII	"CMPI"		;CMP immediate
	
;Instruction operation size (byte, word, long)

INSSIZE
	.ASCII	".B"		;Byte operation
	.WORD	0
	.ASCII	".W"		;Word operation
	.WORD	0
	.ASCII	".?"		;Illegal size
	.WORD	0
	.ASCII	".L"		;Long word operation
	.WORD	0

;Instructions for misc commands

INSTMIS1
	.ASCII	"NEGX"
	.ASCII	"CLR"
	.BYTE	0
	.ASCII	"NEG"
	.BYTE	0
	.ASCII	"NOT"
	.BYTE	0
	.WORD	0
	.WORD	0
	.ASCII	"TST"
	.BYTE	0
INSTMIS2
	.ASCII	"TRAP"
	.ASCII	"TRAP"
	.ASCII	"LINK"
	.ASCII	"UNLK"
INSTMIS3
	.ASCII	"RESE"
	.ASCII	"NOP"
	.BYTE	0
	.ASCII	"STOP"
	.ASCII	"RTE"
	.BYTE	0
	.ASCII	"4E74"
	.ASCII	"RTS"
	.BYTE	0
	.ASCII	"TRAP"
	.ASCII	"RTR"
	.BYTE	0
INSTMIS4
	.ASCII	"JSR"
	.BYTE	0
	.ASCII	"JMP"
	.BYTE	0
	.ASCII	"CHK"
	.BYTE	0
	.ASCII	"LEA"
	.BYTE	0
	.ASCII	"DIVU"
	.ASCII	"DIVS"
	.ASCII	"MULU"
	.ASCII	"MULS"

;Branch condition codes

BRACOND
	.ASCII	"RA"		;True - BRA
	.ASCII	"F"		;False
	.BYTE	0
	.ASCII	"HI"		;High
	.ASCII	"LS"		;Low or same
	.ASCII	"CC"		;Carry clear
	.ASCII	"CS"		;Carry set
	.ASCII	"NE"		;Not equal
	.ASCII	"EQ"		;Equal
	.ASCII	"VC"		;Overflow clear
	.ASCII	"VS"		;Overflow set
	.ASCII	"PL"		;Plus
	.ASCII	"MI"		;Minus
	.ASCII	"GE"		;Greater than or equal
	.ASCII	"LT"		;Less than
	.ASCII	"GT"		;Greater than
	.ASCII	"LE"		;Less than or equal

;Condition codes

CONDCODE
	.ASCII	"T"		;True
	.BYTE	0
	.ASCII	"F"		;False
	.BYTE	0
	.ASCII	"HI"		;High
	.ASCII	"LS"		;Low or same
	.ASCII	"CC"		;Carry clear
	.ASCII	"CS"		;Carry set
	.ASCII	"NE"		;Not equal
	.ASCII	"EQ"		;Equal
	.ASCII	"VC"		;Overflow clear
	.ASCII	"VS"		;Overflow set
	.ASCII	"PL"		;Plus
	.ASCII	"MI"		;Minus
	.ASCII	"GE"		;Greater than or equal
	.ASCII	"LT"		;Less than
	.ASCII	"GT"		;Greater than
	.ASCII	"LE"		;Less than or equal

;Arithmetic and logic commands

ARITHINS
	.ASCII	"OR"
	.WORD	0
	.ASCII	"SUB"
	.BYTE	0
	.ASCII	"EOR"
	.BYTE	0
	.ASCII	"CMP"
	.BYTE	0
	.ASCII	"AND"
	.BYTE	0
	.ASCII	"ADD"
	.BYTE	0
	
;Arithmetic instructions to A registers

ARITHTOA
	.ASCII	"SUBA"
	.ASCII	"ADDA"
	
;Decimal and extend instructions

DECINS
	.ASCII	"SBCD"
	.ASCII	"SUBX"
	.WORD	0
	.WORD	0
	.ASCII	"CMPA"
	.ASCII	"ABCD"
	.ASCII	"ADDX"
	
;Shift and rotate instructions

SHFINS
	.ASCII	"ASR"
	.BYTE	0
	.ASCII	"LSR"
	.BYTE	0
	.ASCII	"ROXR"
	.ASCII	"ROR"
	.BYTE	0
	.ASCII	"ASL"
	.BYTE	0
	.ASCII	"LSL"
	.BYTE	0
	.ASCII	"ROXL"
	.ASCII	"ROL"
	.BYTE	0

                                                                                                                                                                                                                                                                                                                                                                         