Add Some BARC to Your 8080 - The Listing

Listing 1: The BARC Utility Routines. This listing contains the absolute octal code of the BARC routines. The notation <*> is used to indicate the absolute page address of the routines, which are loaded on a page boundary. When (for example) loading the routines at location 010/000, substitute the page address of 010 for the <*> every time it is seen in the listing. The code is in octal, for an 8080 computer. Refer to the "legend" box for explanations of some of the mnemonics in the commentary of this listing.


   Split
   Octal
  Address  Octal Code            Label  Op     Operand  Commentary

  <*> 000  353                   SASNT	XCHG		USRRET=PLAD to DRDE; UDRDE to DRHL;
  <*> 001  343                   	XTHL		UDRDE to TOS; FRRET to DRHL;
  <*> 002  305                   	PUSH	B	UDRBC to TOS;
  <*> 003  365                   	PUSH	PSW	UDRPSW&A to TOS;
  <*> 004  353                   	XCHG		USRRET=-PLAD to DRHL; FRRET to DRDE;
  <*> 005  303 021 <*>	          	JMP	FRNTD	Go load only one field addr
                                			  and length parameter;
  <*> 010  353                   DASNT	XCHG		USRRET=PLAD to DRDE; UDRDE to DRHL;
  <*> 011  343                   	XTHL		UDRDE to TOS; FRRET to DRHL;
  <*> 012  305                   	PUSH	B	UDRBC to TOS;
  <*> 013  365                   	PUSH	PSW	UDRPSW&A to TOS;
  <*> 014  353                   	XCHG		USRRET=PLAD to DRHL; FRRET to DRDE;
  <*> 015  116                   	MOV	C,M	FIELD1 addr LOB to SRC;
  <*> 016  043                   	INX	H	Incr USRRET=-PLAD (+1 DASNT);
  <*> 017  106                   	MOV	B,M	FIELD1 addr HOB to SRB;
  <*> 020  043                   	INX	H	Incr USRRET=PLAD (+2 DASNT);
  <*> 021  325                   FRNTD	PUSH	D	FRRET to TOS;
  <*> 022  136                   	MOV	E,M	FIELD/FIELD2 addr LOB to SRE;
  <*> 023  043                   	INX	H	Incr USRRET=PLAD (+3 DASNT; +1 SASNT);
  <*> 024  126                   	MOV	D,M	FIELD/FIELD2 addr HOB to SRD;
  <*> 025  043                   	INX	H	Incr USRRET=PLAD (+4 DASNT;+2 SASNT);
  <*> 026  176                   	MOV	A,M	Length/Size param to SRA;
  <*> 027  043                   	INX	H	Incr USRRET=PLAD (+5 DASNT;+3 SASNT);
  <*> 030  343                   	XTHL		True USRRET to TOS; FRRET to DRHL;
  <*> 031  345                   	PUSH	H	FRRET to TOS;
  <*> 032  147                   	MOV	H,A	Length/Size param to SRH;
  <*> 033  311                   	RET		Return to calling function routine;
  <*> 034  343                   DASXR	XTHL		UDRHL to TOS; FRRET=FRCOMMAND
                                			  address to TOS;
  <*> 035  042 051 <*>          	SHLD	DASFC+1	Store FRCOMMAND address in CALL;
  <*> 040  341                   	POP	H	TOS=UDRHL to DRHL clear return;
  <*> 041  343                   	XTHL		UDRHL to TOS; USRRET=PLAD to DRHL;
  <*> 042  315 010 <*>          	CALL	DASNT	Call DASNT to load parameters;
  <*> 045  032                   DASXL	LDAX	D	Indexed FIELD2 char to SRA;
  <*> 046  157                   	MOV	L,A	Move into SRL;
  <*> 047  012                   	LDAX	B	Indexed FIELD1 char to SRA;
  <*> 050  315 000 000           DASFC	CALL	Q'000000' Call the execution commands;
  <*> 053  002                   	STAX	B	Store result in indexed FIELD1;
  <*> 054  003                   	INX	B	Incr FIELD1 address index;
  <*> 055  023                   	INX	D	Incr FIELD2 address index;
  <*> 056  045                   	DCR	H	Decrement length/size;
  <*> 057  302 045 <*>          	JNZ	DASXL	Loop until count is zero;
  <*> 062  341                   FRXIT	POP	H	True USRRET to DRHL;
  <*> 063  301                   	POP	B	UDRPSW&A to DRBC;
  <*> 064  170                   	MOV	A,B	USRA to SRA; PSW=FRPSW;
  <*> 065  301                   FRXT2	POP	B	TOS=UDRBC to DRBC;
  <*> 066  321                   	POP	D	TOS=UDRDE to ORDE;
  <*> 067  343                   	XTHL		True USRRET to TOS; TOS=UDRHL to DRHL;
  <*> 070  311                   	RET		Return to user; regs+user regs;
  <*> 071  315 034 <*>           NCHR	CALL	DASXR	CALL DASXR execution control rtn
                                			  passing address of following;
  <*> 074  245                   	ANA	L	Logical AND SRL to SRA;
  <*> 075  311                   	RET		Return to DASXR;
  <*> 076  315 034 <*>           OCHR	CALL	DASXR	See NCHR comment at address 071;
  <*> 101  265                   	ORA	L	Logical OR SRL to SRA;
  <*> 102  311                   	RET		Return to DASXR;
  <*> 103  315 034 <*>           XCHR	CALL	DASXR	See NCHR comment at address 071;
  <*> 106  255                   	XRA	L	Logical XOR SRL to SRA;
  <*> 107  311                   	RET		Return to DASXR;
  <*> 110  315 034 <*>           MVCHR	CALL	DASXR	See NCHR comment at address 071;
  <*> 113  175                   	MOV	A,L	Move SRL to SRA;
  <*> 114  311                   	RET		Return to DASXR;
  <*> 115  315 034 <*>           SWCHR	CALL	DASXR	See NCHR comment at address 071;
  <*> 120  022                   	STAX	D	SRA to indexed FIELD2 char;
  <*> 121  175                   	MOV	A,L	Move SRL to SRA;
  <*> 122  311                   	RET		Return to DASXR;
  <*> 123  315 034 <*>           CLCHR	CALL	DASXR	See NCHR comment at address 071;
  <*> 126  275                   	CMP	L	Compare SRL to SRA;
  <*> 127  310                   	RZ		Return to DASXR if equal;
  <*> 130  077                   	CMC		Else reverse inequality flag;
  <*> 131  341                   	POP	H	Clear return address by popping;
  <*> 132  303 062 <*>          	JMP	FRXIT	Bust out to function exit logic;
  <*> 135  343                   SASIX	XTHL		UDRHL to TOS; FRRET=FRCOMMAND
                                			  address to TOS;
  <*> 136  042 155 <*>          	SHLD	SASIC+1	Store FRCOMMAND address in CALL;
  <*> 141  341                   	POP	H	TOS=UDRHL to DRHL clear return;
  <*> 142  343                   	XTHL		UDRHL to TOS; USRRET=PLAD to DRHL;
  <*> 143  315 000 <*>          	CALL	SASNT	Call SASNT to load Parameters;
  <*> 146  343                   	XTHL		USRRET=PLAD+3 to DRHL; FDRHL to TOS;
  <*> 147  176                   	MOV	A,M	Immediate character value to SRL;
  <*> 150  043                   	INX	H	Incr USRRET=PLAD (+4 immed group);
  <*> 151  343                   	XTHL		True USRRET to TOS; FDRHL to DRHL;
  <*> 152  157                   	MOV	L,A	Move ICV to SRL;
  <*> 153  032                   SASIL	LDAX	D	Indexed FIELD char to SRA;
  <*> 154  315 000 000           SASIC	CALL	Q'000000' CALL the execution commands;
  <*> 157  022                   	STAX	D	Store result in indexed FIELD;
  <*> 160  023                   	INX	D	Incr FIELD address Index;
  <*> 161  045                   	DCR	H	Decrement length/size;
  <*> 162  302 153 <*>          	JNZ	SASIL	Loop until count is zero;
  <*> 165  303 062 <*>          	JMP	FRXIT	Jump to funct routine exit logic;
  <*> 170  315 135 <*>           NICH	CALL	SASIX	CALL SASIX execution control rtn
                                			  passing address of following;
  <*> 173  245                   	ANA	L	Logical AND SRL=ICV to SRA;
  <*> 174  311                   	RET		Return to SASIX;
  <*> 175  315 135 <*>           OICH	CALL	SASIX	See NICH comment at address 170;
  <*> 200  265                   	ORA	L	Logical OR SRL to SRA;
  <*> 201  311                   	RET		Return to the SASIX routine;
  <*> 202  315 135 <*>           XICH	CALL	SASIX	See NICH comment at address 170;
  <*> 205  255                   	XRA	L	Logical XOR SRL to SRA;
  <*> 206  311                   	RET		Return to SASIX;
  <*> 207  315 135 <*>           MVICH	CALL	SASIX	See NICH comment at address 170;
  <*> 212  175                   	MOV	A,L	Move SRL to SRA;
  <*> 213  311                   	RET		Return to SASIX;
  <*> 214  343                   VALFX	XTHL		UDRHL to TOS; FRRET=FRCOMMAND
                                			  address to DRHL;
  <*> 215  042 227  <*>	          	SHLD	VALFC+1	Store FRCOMMAND address in CALL;
  <*> 220  341                   	POP	H	TOS=UDRHLto DRHL clear return;
  <*> 221  343                   	XTHL		UDRHL to TOS; USRRET=PLAD to DRHL;
  <*> 222  315 000 <*>	         	CALL	SASNT	Call SASNT to load parameters;
  <*> 225  032	                 VALFL	LDAX	D	Indexed FIELD character to SRA;
  <*> 226  315 000 000           VALFC	CALL	Q'000000' CALL the execution commands;
  <*> 231  302 062 <*>         		JNZ	FRXIT	If character not valid exit;
  <*> 234  023                   	INX	D	Incr FIELD address Index;
  <*> 235  045                   	DCR	H	Decrement length/size;
  <*> 236  302 225 <*>         		JNZ	VALFL	Loop until count Is zero;
  <*> 241  303 062 <*>         		JMP	FRXIT	Jump to exit all chars valid;
  <*> 244  315 214 <*>           VALAS	CALL	VALFX	CALL VALFX execution control rtn
                                			  passing address of following;
  <*> 247  376 050               VALAC	CPI	Q'040'	Is SRA a space?
  <*> 251  310                   	RZ		Return to VALFX if equal;
  <*> 252  376 145               VALAO	CPI	Q'101'	Is SRA an 'A'?
  <*> 254  330                   	RC		Return to VALFX if less than 'A';
  <*> 255  376 204               	CPI	Q'132'	Is SRA a 'Z'
  <*> 257  310                   VALXT	RZ		Return to VALFX if equal;
  <*> 260  320                   	RNC		Return to VALFX if greater;
  <*> 261  277                   	CMP	A	Compare SRA to SRA force Z=1;
  <*> 262  311                   	RET		Return to VALFX char is valid;
  <*> 263  315 214 <*>           VALNS	CALL	VALFX	See VALAS comment at addr 244;
  <*> 266  376 074               VALNC	CPI	Q'060'	Is SRA a '0'?
  <*> 270  330                   	RC		Return to VALFX if less;
  <*> 271  376 107               	CPI	Q'071'	Is SRA a '9'
  <*> 273  303 257 <*>         		JMP	VALXT	Jump to validation exit logic;
  <*> 276  315 214 <*>           VALOS	CALL	VALFX	See VALAS comment at addr 244;
  <*> 301  376 074               VALOC	CPI	Q'060'	Is SRA a '0'?
  <*> 303  330                   	RC		Return to VALFX if less;
  <*> 304  376 103               	CPI	Q'067'	Is SRA a '7'?
  <*> 306  303 257 <*>         		JMP	VALXT	Jump to valicfation exit logic;
  <*> 311  315 214 <*>           VALXS	CALL	VALFX	See VALAS comment at addr 244;
  <*> 314  315 247 <*>           VALXC	CALL	VALAC	Call VALAC utility routine;
  <*> 317  310                   	RZ		Return to VALFX if alphabetic;
  <*> 320  315 266 <*>         		CALL	VALNC	Call VALNC utility routine;
  <*> 323  311                   	RET		Return to VALFX;
  <*> 324  315 214 <*>           VALHS	CALL	VALFX	See VALAS comment at addr 244;
  <*> 327  315 266 <*>           VALHC	CALL	VALNC	Call VALNC utility routine;
  <*> 332  310                   	RZ		Return to VALFX if numeric;
  <*> 333  376 145               	CPI	Q'101'	Is SRA an 'A'?
  <*> 335  330                   	RC		Return to VALFX if less;
  <*> 336  376 152               	CPI	Q'106'	Is SRA an 'F'?
  <*> 340  303 257 <*>         		JMP	VALXT	Jump to validation exit logic;
  <*> 343  343                   MVSYM	XTHL		UDRHL to TOS; USRRET=PLAD to DRHL;
  <*> 344  315 010 <*>         		CALL	DASNT	Call DASNT function entry rtn;
  <*> 347  343                   	XTHL		USRRET=PLAD+5 to DRHL; FDRHL to TOS;
  <*> 350  176                   	MOV	A,M	Move stop char to SRA;
  <*> 351  043                   	INX	H	Incr USRRET=TRUERET=PLAD+6;
  <*> 352  343                   	XTHL		True USRRET to TOS; FRDHL to DRHL;
  <*> 353  157                   	MOV	L,A	Move stop char from SRA to SRL;
  <*> 354  345                   	PUSH	H	DRHL to TOS for length moved calc;
  <*> 355  032                   MVSYL	LDAX	D	Indexed FIELD2 char to SRA;
  <*> 356  275                   	CMP	L	Compare it to stop char;
  <*> 357  312 371 <*>         		JZ	MVSYX	If equal go to MVSYM exit logic;
  <*> 362  002                   	STAX	B	Else store in indexed FIELD1;
  <*> 363  003                   	INX	B	Incr FIELD1 address Index;
  <*> 364  023                   	INX	D	Incr FIELD2 address index;
  <*> 365  045                   	DCR	H	Decrement length/size;
  <*> 366  302 355 <*>         		JNZ	MVSYL	Loop until count is zero;
  <*> 371  361                   MVSYX	POP	PSW	DRHL from 354 is popped SRA=len;
  <*> 372  224                   	SUB	H	Subtr remaining len = moved len,
  <*> 373  341                   	POP	H	True USRRET to DRHL;
  <*> 374  301                   	POP	B	UDRPSW&A discarded by this pop;
  <*> 375  303 065 <*>         		JMP	FRXT2	Exit skipping SRA restore;
[Hier als 8080-Assembler Programm und hier als Z80-Assembler Programm]

Eingescanned von Werner Cirsovius
September 2002
© BYTE Publications Inc.