Category : Assembly Language Source Code
Archive   : AS11.ZIP
Filename : PSEUDO.C

 
Output of file : PSEUDO.C contained in archive : AS11.ZIP
/*
* pseudo --- pseudo op processing
*/

#define RMB 0 /* Reserve Memory Bytes */
#define FCB 1 /* Form Constant Bytes */
#define FDB 2 /* Form Double Bytes (words) */
#define FCC 3 /* Form Constant Characters */
#define ORG 4 /* Origin */
#define EQU 5 /* Equate */
#define ZMB 6 /* Zero memory bytes */
#define FILL 7 /* block fill constant bytes */
#define OPT 8 /* assembler option */
#define NULL_OP 9 /* null pseudo op */

struct oper pseudo[] = {
"bsz", PSEUDO, ZMB, 0,
"end", PSEUDO, NULL_OP,0,
"equ", PSEUDO, EQU, 0,
"fcb", PSEUDO, FCB, 0,
"fcc", PSEUDO, FCC, 0,
"fdb", PSEUDO, FDB, 0,
"fill", PSEUDO, FILL, 0,
"nam", PSEUDO, NULL_OP,0,
"name", PSEUDO, NULL_OP,0,
"opt", PSEUDO, OPT, 0,
"org", PSEUDO, ORG, 0,
"pag", PSEUDO, NULL_OP,0,
"page", PSEUDO, NULL_OP,0,
"rmb", PSEUDO, RMB, 0,
"spc", PSEUDO, NULL_OP,0,
"ttl", PSEUDO, NULL_OP,0,
"zmb", PSEUDO, ZMB, 0
};

/*
* do_pseudo --- do pseudo op processing
*/
do_pseudo(op)
int op; /* which op */
{
char fccdelim;
int j;
int fill;
char *skip_white();

if( op != EQU && *Label )
install(Label,Pc);

P_force++;
switch(op){
case RMB: /* reserve memory bytes */
if( eval() ){
Pc += Result;
f_record(); /* flush out bytes */
}
else
error("Undefined Operand during Pass One");
break;
case ZMB: /* zero memory bytes */
if( eval() )
while( Result-- )
emit(0);
else
error("Undefined Operand during Pass One");
break;
case FILL: /* fill memory with constant */
eval();
fill = Result;
if( *Optr++ != ',' )
error("Bad fill");
else{
Optr = skip_white(Optr);
eval();
while( Result-- )
emit(fill);
}
break;
case FCB: /* form constant byte(s) */
do{
Optr = skip_white(Optr);
eval();
if( Result > 0xFF ){
if(!Force_byte)
warn("Value truncated");
Result = lobyte(Result);
}
emit(Result);
}while( *Optr++ == ',' );
break;
case FDB: /* form double byte(s) */
do{
Optr = skip_white(Optr);
eval();
eword(Result);
}while( *Optr++ == ',' );
break;
case FCC: /* form constant characters */
if(*Operand==EOS)
break;
fccdelim = *Optr++;
while( *Optr != EOS && *Optr != fccdelim)
emit(*Optr++);
if(*Optr == fccdelim)
Optr++;
else
error("Missing Delimiter");
break;
case ORG: /* origin */
if( eval() ){
Old_pc = Pc = Result;
f_record(); /* flush out any bytes */
}
else
error("Undefined Operand during Pass One");
break;
case EQU: /* equate */
if(*Label==EOS){
error("EQU requires label");
break;
}
if( eval() ){
install(Label,Result);
Old_pc = Result; /* override normal */
}
else
error("Undefined Operand during Pass One");
break;
case OPT: /* assembler option */
P_force=0;
if( head(Operand,"l") )
Lflag=1;
else if( head(Operand,"nol"))
Lflag=0;
else if( head(Operand,"c")){
Cflag=1;
Ctotal=0;
}
else if( head(Operand,"noc"))
Cflag=0;
else if( head(Operand,"contc")){
Cflag=1;
}
else
error("Unrecognized OPT");
break;
case NULL_OP: /* ignored psuedo ops */
P_force=0;
break;
default:
fatal("Pseudo error");
}
}


  3 Responses to “Category : Assembly Language Source Code
Archive   : AS11.ZIP
Filename : PSEUDO.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/