├── 09 ├── ASSIST09.ASM ├── Makefile ├── as9src │ ├── Makefile │ ├── as.c │ ├── as.h │ ├── as9 │ ├── as9.c │ ├── as9_changes.txt │ ├── as9n.c │ ├── do9.c │ ├── eval.c │ ├── ffwd.c │ ├── output.c │ ├── pseudo.c │ ├── symtab.c │ ├── table9.h │ └── util.c ├── assist09-6850.asm ├── assist09-6850.lst ├── assist09-6850.s19 ├── cputest.asm ├── cputest.lst └── cputest.s19 ├── COPYING ├── Makefile ├── Makefile.00 ├── Makefile.09 ├── NOTES ├── README.md ├── TODO ├── asm6800.c ├── asm6800.h ├── asm6809.c ├── assist.bin ├── cyfix ├── dblank.dsk ├── doc ├── crteditor.gif ├── exorterm.md ├── mdos-intro.md ├── mdos-ref.md ├── mdos-tech.md ├── notes.md ├── usage.md └── williams.jpg ├── edos.c ├── exbug-1.2.bin ├── exbug.bin ├── exbug09.bin ├── exor.c ├── exor.h ├── exorterm.c ├── exorterm.h ├── facts ├── facts09 ├── flex.dsk ├── fortran ├── circle.sa ├── data.sa ├── fortran.md └── test.cf ├── imdx.c ├── lpf.c ├── mdos.c ├── mdos.dsk ├── mdos09.dsk ├── mon.c ├── mpl ├── dft.sa ├── fact.sa ├── hello.sa ├── mplad.md ├── mplnews.sa ├── readme.md ├── test.sa └── test1.sa ├── sblank.dsk ├── sim6800.c ├── sim6800.h ├── sim6809.c ├── swtbug.bin ├── unasm.c ├── unasm6800.c ├── unasm6800.h ├── unasm6809.c ├── utils.c └── utils.h /09/Makefile: -------------------------------------------------------------------------------- 1 | AS9=as9src/as9 2 | 3 | all: assist09-6850.s19 cputest.s19 4 | 5 | assist09-6850.s19: assist09-6850.asm 6 | $(AS9) assist09-6850.asm -l s19 now 7 | 8 | cputest.s19: cputest.asm 9 | $(AS9) cputest.asm -l s19 now 10 | -------------------------------------------------------------------------------- /09/as9src/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | SRCH= \ 4 | as.h \ 5 | table9.h \ 6 | # 7 | 8 | SRCC= \ 9 | as9.c \ 10 | as.c \ 11 | do9.c \ 12 | eval.c \ 13 | ffwd.c \ 14 | output.c \ 15 | pseudo.c \ 16 | symtab.c \ 17 | util.c \ 18 | # 19 | 20 | # This is peculiar, as9 only includes other files. 21 | # The main program sits in as.c 22 | as9 : $(SRCC) $(SRCH) ; gcc -g $< -o $@ 23 | #as9 : $(SRCC) $(SRCH) ; gcc -g -DDEBUG $< -o $@ 24 | 25 | as9.tgz : $(SRCC) $(SRCH) as9 changes.doc Makefile; tar cfz $@ $^ 26 | 27 | as9.zip : $(SRCC) $(SRCH) as9n.c as9 as9.exe as9_changes.txt Makefile; zip $@ $^ 28 | 29 | m6809src.zip : assist09.asm forth9.asm ; zip $@ $^ 30 | 31 | testrom : as9 32 | as9 rom.asm -l c s bin s19 cre 33 | diff -b -B rom.lst results/rom.lst 34 | diff -b -B rom.bin results/rom.bin 35 | diff -b -B rom.s19 results/rom.s19 36 | 37 | testassist09 : as9 38 | as9 assist09.asm -l c s bin s19 cre now 39 | diff -b -B assist09.lst results/assist09.lst 40 | diff -b -B assist09.bin results/assist09.bin 41 | diff -b -B assist09.s19 results/assist09.s19 42 | 43 | testforth9 : as9 44 | as9 forth9.asm -l c s bin s19 cre 45 | diff -b -B forth9.lst results/forth9.lst 46 | diff -b -B forth9.bin results/forth9.bin 47 | diff -b -B forth9.s19 results/forth9.s19 48 | 49 | test : testrom testassist09 testforth9 50 | -------------------------------------------------------------------------------- /09/as9src/as.c: -------------------------------------------------------------------------------- 1 | char mapdn(); 2 | char *alloc(); 3 | /* 4 | * as --- cross assembler main program 5 | * This requries a very peculiar set of arguments: 6 | * First come *all* the file names. 7 | * Then comes the first option, with a dash 8 | * Then come the, possibly multichar, options without dash. 9 | */ 10 | main(argc,argv) 11 | int argc; 12 | char **argv; 13 | { 14 | char **np; 15 | char *pc; 16 | FILE *fopen(); 17 | int j = 0; 18 | 19 | if(argc < 2){ 20 | printf("Usage: %s [files]\n",argv[j]); 21 | exit(1); 22 | } 23 | Argv = argv; 24 | initialize(); 25 | while ( (jclass == PSEUDO ) 276 | do_pseudo(i->opcode); 277 | else{ 278 | if( *Label )install(Label,Pc); 279 | if(Cflag)Cycles = i->cycles; 280 | do_op(i->opcode,i->class); 281 | if(Cflag)Ctotal += Cycles; 282 | } 283 | 284 | if ( Wflag && 2 == Pass ) 285 | if ( EOS!=*Optr ) { 286 | /* Yes I'm ashamed f this hack, (AH) */ 287 | if ( ']' == *Optr ) Optr += 1; 288 | Optr = skip_white(Optr); 289 | if ( EOS!=*Optr && ';'!=*Optr ){ 290 | printf("<<<%s>>>\n", Optr); 291 | warn("Comment doesnot start with comment symbol"); 292 | } 293 | } 294 | } 295 | -------------------------------------------------------------------------------- /09/as9src/as.h: -------------------------------------------------------------------------------- 1 | /* 2 | * machine independent definitions and global variables 3 | */ 4 | 5 | typedef int bool; 6 | 7 | #define YES 1 8 | #define NO 0 9 | #define ERR (-1) 10 | 11 | #define MAXBUF 256 /* Line buffer */ 12 | #define MAXOP 10 /* longest mnemonic */ 13 | #define MAXLAB 80 /* Label */ 14 | #define MAXPATH 256 15 | #define E_LIMIT 32 16 | #define P_LIMIT 64 17 | 18 | /* Character Constants */ 19 | #define NEWLINE '\n' 20 | #define TAB '\t' 21 | #define BLANK ' ' 22 | #define EOS '\0' 23 | 24 | /* Opcode Classes */ 25 | #define INH 0 /* Inherent */ 26 | #define GEN 1 /* General Addressing */ 27 | #define IMM 2 /* Immediate only */ 28 | #define REL 3 /* Short Relative */ 29 | #define P2REL 4 /* Long Relative */ 30 | #define P1REL 5 /* Long Relative (LBRA and LBSR)*/ 31 | #define NOIMM 6 /* General except for Immediate */ 32 | #define P2GEN 7 /* Page 2 General */ 33 | #define P3GEN 8 /* Page 3 General */ 34 | #define RTOR 9 /* Register To Register */ 35 | #define INDEXED 10 /* Indexed only */ 36 | #define RLIST 11 /* Register List */ 37 | #define P2NOIMM 12 /* Page 2 No Immediate */ 38 | #define P2INH 13 /* Page 2 Inherent */ 39 | #define P3INH 14 /* Page 3 Inherent */ 40 | #define GRP2 15 /* Group 2 (Read/Modify/Write) */ 41 | #define LONGIMM 16 /* Immediate mode takes 2 bytes */ 42 | #define BTB 17 /* Bit test and branch */ 43 | #define SETCLR 18 /* Bit set or clear */ 44 | #define CPD 19 /* compare d 6811 */ 45 | #define XLIMM 20 /* LONGIMM for X 6811 */ 46 | #define XNOIMM 21 /* NOIMM for X 6811 */ 47 | #define YLIMM 22 /* LONGIMM for Y 6811 */ 48 | #define YNOIMM 23 /* NOIMM for Y 6811 */ 49 | #define FAKE 24 /* convenience mnemonics 6804 */ 50 | #define APOST 25 /* A accum after opcode 6804 */ 51 | #define BPM 26 /* branch reg plus/minus 6804 */ 52 | #define CLRX 27 /* mvi x,0 6804 */ 53 | #define CLRY 28 /* mvi y,0 6804 */ 54 | #define LDX 29 /* mvi x,expr 6804 */ 55 | #define LDY 30 /* mvi y,expr 6804 */ 56 | #define MVI 31 /* mvi 6804 */ 57 | #define EXT 32 /* extended 6804 */ 58 | #define BIT 33 /* bit manipulation 6301 */ 59 | #define SYS 34 /* syscalls (really swi) */ 60 | #define PSEUDO 35 /* Pseudo ops */ 61 | 62 | /* global variables */ 63 | int Line_num =0; /* current line number */ 64 | int Err_count =0; /* total number of errors */ 65 | char Line[MAXBUF] = {0}; /* input line buffer */ 66 | char Label[MAXLAB] = {0}; /* label on current line */ 67 | char Op[MAXOP] = {0}; /* opcode mnemonic on current line */ 68 | char Operand[MAXBUF] = {0}; /* remainder of line after op */ 69 | char *Optr =0; /* pointer into current Operand field */ 70 | int Result =0; /* result of expression evaluation */ 71 | int Force_word =0; /* Result should be a word when set */ 72 | int Force_byte =0; /* Result should be a byte when set */ 73 | int Pc =0; /* Program Counter */ 74 | int Old_pc =0; /* Program Counter at beginning */ 75 | 76 | int Last_sym =0; /* result of last lookup */ 77 | 78 | int Pass =0; /* Current pass # */ 79 | int N_files =0; /* Number of files to assemble */ 80 | FILE *Fd =0; /* Current input file structure */ 81 | int Cfn =0; /* Current file number 1...n */ 82 | int Ffn =0; /* forward ref file # */ 83 | int F_ref =0; /* next line with forward ref */ 84 | char **Argv =0; /* pointer to file names */ 85 | 86 | int E_total =0; /* total # bytes for one line */ 87 | int E_bytes[E_LIMIT] = {0}; /* Emitted held bytes */ 88 | int E_pc =0; /* Pc at beginning of collection*/ 89 | 90 | int Lflag = 0; /* listing flag 0=nolist, 1=list */ 91 | int Bflag = 0; /* binary flag 0=nobinary, 1=binary */ 92 | int Oflag = 0; /* s19 flag 0=noS19, 1=S19 */ 93 | int Cflag = 0; /* cycles flag 0=nocycles, 1=cycles */ 94 | int Sflag = 0; /* symbol flag 0=nosymbol, 1=symbol */ 95 | int Rflag = 0; /* crf flag 0=nocrf, 1=crf */ 96 | /* Warn about comment not starting with comment sign ';' '*' */ 97 | int Wflag = 1; /* warning flag 0=none, 1=warning*/ 98 | 99 | int P_force = 0; /* force listing line to include Old_pc */ 100 | int P_total =0; /* current number of bytes collected */ 101 | int P_bytes[P_LIMIT] = {0}; /* Bytes collected for listing */ 102 | 103 | int Cycles = 0; /* # of cycles per instruction */ 104 | long Ctotal = 0; /* # of cycles seen so far */ 105 | int N_page = 0; /* new page flag */ 106 | int Page_num = 2; /* page number */ 107 | 108 | struct link { /* linked list to hold line numbers */ 109 | int L_num; /* line number */ 110 | struct link *next; /* pointer to next node */ 111 | }; 112 | 113 | struct nlist { /* basic symbol table entry */ 114 | char *name; 115 | int def; 116 | struct nlist *Lnext ; /* left node of the tree leaf */ 117 | struct nlist *Rnext; /* right node of the tree leaf */ 118 | struct link *L_list; /* pointer to linked list of line numbers */ 119 | }; 120 | 121 | struct oper { /* an entry in the mnemonic table */ 122 | char *mnemonic; /* its name */ 123 | char class; /* its class */ 124 | int opcode; /* its base opcode */ 125 | char cycles; /* its base # of cycles */ 126 | }; 127 | 128 | struct nlist *root; /* root node of the tree */ 129 | 130 | FILE *Objfil =0; /* S19 file's file descriptor*/ 131 | FILE *Binfil =0; /* Binary file's file descriptor*/ 132 | FILE *Lstfil =0; /* List file's file descriptor*/ 133 | FILE *Symfil =0; /* Symbol file's file descriptor*/ 134 | FILE *Crffil =0; /* Crf file's file descriptor*/ 135 | 136 | char Obj_name[MAXPATH] = " "; 137 | char Bin_name[MAXPATH] = " "; 138 | char Lst_name[MAXPATH] = " "; 139 | char Sym_name[MAXPATH] = " "; 140 | char Crf_name[MAXPATH] = " "; 141 | -------------------------------------------------------------------------------- /09/as9src/as9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhallen/exorsim/e44e17218a7ef00d7ff9a658461118db9b3b08ba/09/as9src/as9 -------------------------------------------------------------------------------- /09/as9src/as9.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "as.h" 4 | #include "table9.h" 5 | #include "as.c" 6 | #include "do9.c" 7 | #include "pseudo.c" 8 | #include "eval.c" 9 | #include "symtab.c" 10 | #include "util.c" 11 | #include "ffwd.c" 12 | #include "output.c" 13 | -------------------------------------------------------------------------------- /09/as9src/as9_changes.txt: -------------------------------------------------------------------------------- 1 | 2 | 2023 jul 16 Joe Allen, Boston USA: 3 | 4 | It was not allowing "Extended Indirect" mode, I've added support for this, 5 | but the syntax is non-standard as follows: 6 | 7 | leay [address,] 8 | 9 | Generates 0x9F for the indexing byte. 10 | 11 | It will also allow this: 12 | 13 | leay address, 14 | 15 | Generates 0x8F for the indexing byte. Not sure if this works 16 | on the 6809, maybe better to use ldy #address. 17 | 18 | 19 | 2004 dec 29 Albert van der Horst HCC Forth gg The Netherlands. 20 | Changes to as9 in behalf of porting to Linux. 21 | 22 | I put my changes in the public domain. 23 | 24 | 25 | This assembler is very wel documented, because the Motorola 26 | documentation for the 68h11 assembler still applies: 27 | as11v2.pdf 28 | 29 | See also the changes made by Mike Pashea (in particular a list 30 | file instead of stdout.) His and mine changes are on top of 31 | the Motorola documentation. 32 | 33 | Some bugs removed, in particular pointing to non-existing 34 | memory. 35 | 36 | I added a warning option ``w'' that is default on. 37 | The warning is about possible ill-formed comment. 38 | A star is an operator, so it is from now on only accepted 39 | at the start of a line. It serves as current program 40 | counter too. 41 | Other comment must now start with a comment symbol ``;''. 42 | This is incompatible with old Motorola Listings such as assist09.asm. 43 | Therefore this is a warning only, and can be disabled by the 44 | ``now'' option. 45 | 46 | NOTE: an expression that serves as an operand cannot contain 47 | white space e.g. ``bar - foo'' is interpreted as bar with 48 | ``- foo'' as comment. The ``w'' option being default of is intended to 49 | save you from this horror. 50 | 51 | All errors are flagged with ``ERROR'' such that you 52 | can find them in a long listing. 53 | 54 | If an error relates to data, such as an undefined symbol, 55 | that data is printed. 56 | 57 | File names can now be a comfortable 256 char's but still 58 | no check. (Was 9+dot+3, i.e. MSDOS file in working 59 | directory!). Labels can now be 80 chars, was 16. 60 | Lines can now be 256. 61 | 62 | The attempt at case insensitive comparison was replaced by 63 | a call to strncasecmp(). Other calls to tolower() strchr() 64 | where introduced were appropriate. 65 | 66 | Bugs : 67 | 68 | The w (warning) option sometimes gives spurious warnings, 69 | especially after a D operand. 70 | They must be ignored. (Getting this right would require 71 | more of a cleanup, than I'm prepared to do just now.) 72 | 73 | Sometimes an infinity of data was allocated on 32 bits machines 74 | (gigabytes), in programs that are incorrect anyway. This used to crash 75 | the assembler. It is not totally sure that the cleanups have removed 76 | this problem. If the assembler crashes you are advised to look for 77 | places where you allocate space with a length unknown in the first 78 | pass. 79 | 80 | The MS-DOS version still has a null pointer assignment. This seems 81 | not to interfere with the working of the program. 82 | 83 | This source is an example of bad style: early c-programming done by 84 | BASIC and assembler programmers. Don't blame me for ``int Oflag'' in 85 | header files, global variables hidden in unexpected places, prototypes 86 | within function bodies, no output to stderr, non-idiomatic variable 87 | names, idiosyncratic option specification etc. 88 | -------------------------------------------------------------------------------- /09/as9src/as9n.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define strncasecmp strncmp 4 | #include "as.h" 5 | #include "table9.h" 6 | #include "as.c" 7 | #include "do9.c" 8 | #include "pseudo.c" 9 | #include "eval.c" 10 | #include "symtab.c" 11 | #include "util.c" 12 | #include "ffwd.c" 13 | #include "output.c" 14 | -------------------------------------------------------------------------------- /09/as9src/eval.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eval --- evaluate expression 3 | * 4 | * an expression is constructed like this: 5 | * 6 | * expr ::= expr + term | 7 | * expr - term ; 8 | * expr * term ; 9 | * expr / term ; 10 | * expr | term ; 11 | * expr & term ; 12 | * expr % term ; 13 | * expr ^ term ; 14 | * 15 | * term ::= symbol | 16 | * * | 17 | * constant ; 18 | * 19 | * symbol ::= string of alphanumerics with non-initial digit 20 | * 21 | * constant ::= hex constant | 22 | * binary constant | 23 | * octal constant | 24 | * decimal constant | 25 | * ascii constant; 26 | * 27 | * hex constant ::= '$' {hex digits}; 28 | * 29 | * octal constant ::= '@' {octal digits}; 30 | * 31 | * binary constant ::= '%' { 1 | 0 }; 32 | * 33 | * decimal constant ::= {decimal digits}; 34 | * 35 | * ascii constant ::= ''' any printing char; 36 | * 37 | */ 38 | eval() 39 | { 40 | int left,right; /* left and right terms for expression */ 41 | char o; /* operator character */ 42 | 43 | #ifdef DEBUG 44 | printf("Evaluating %s\n",Optr); 45 | #endif 46 | Force_byte = NO; 47 | Force_word = NO; 48 | if(*Optr=='<'){ 49 | Force_byte++; 50 | Optr++; 51 | } 52 | else if(*Optr=='>'){ 53 | Force_word++; 54 | Optr++; 55 | } 56 | left = get_term(); /* pickup first part of expression */ 57 | 58 | while( is_op(*Optr)){ 59 | o = *Optr++; /* pickup connector and skip */ 60 | right = get_term(); /* pickup current rightmost side */ 61 | switch(o){ 62 | case '+': left += right; break; 63 | case '-': left -= right; break; 64 | case '*': left *= right; break; 65 | case '/': left /= right; break; 66 | case '|': left |= right; break; 67 | case '&': left &= right; break; 68 | case '%': left %= right; break; 69 | case '^': left = left^right; break; 70 | } 71 | } 72 | 73 | Result= left; 74 | #ifdef DEBUG 75 | printf("Result=%x\n",Result); 76 | printf("Force_byte=%d Force_word=%d\n",Force_byte,Force_word); 77 | #endif 78 | return(YES); 79 | } 80 | 81 | /* 82 | * is_op --- is character an expression operator? 83 | */ 84 | is_op(c) 85 | char c; 86 | { 87 | if( any(c,"+-*/&%|^")) 88 | return(YES); 89 | return(NO); 90 | } 91 | 92 | 93 | /* 94 | * get_term --- evaluate a single item in an expression 95 | */ 96 | get_term() 97 | { 98 | char hold[MAXBUF]; 99 | char *tmp; 100 | int val = 0; /* local value being built */ 101 | int minus; /* unary minus flag */ 102 | struct nlist *lookup(),*pointer; 103 | struct link *pnt,*bpnt; 104 | 105 | if( *Optr == '-' ){ 106 | Optr++; 107 | minus =YES; 108 | } 109 | else 110 | minus = NO; 111 | 112 | while( *Optr == '#' ) Optr++; 113 | 114 | /* look at rest of expression */ 115 | 116 | if(*Optr=='%'){ /* binary constant */ 117 | Optr++; 118 | while( any(*Optr,"01")) 119 | val = (val * 2) + ( (*Optr++)-'0'); 120 | } 121 | else if(*Optr=='@'){ /* octal constant */ 122 | Optr++; 123 | while( any(*Optr,"01234567")) 124 | val = (val * 8) + ((*Optr++)-'0'); 125 | } 126 | else if(*Optr=='$'){ /* hex constant */ 127 | Optr++; 128 | while( any(*Optr,"0123456789abcdefABCDEF")) 129 | if( *Optr > '9' ) 130 | val = (val * 16) + 10 + (mapdn(*Optr++)-'a'); 131 | else 132 | val = (val * 16) + ((*Optr++)-'0'); 133 | } 134 | else if( any(*Optr,"0123456789")){ /* decimal constant */ 135 | while(*Optr >= '0' && *Optr <= '9') 136 | val = (val * 10) + ( (*Optr++)-'0'); 137 | } 138 | else if(*Optr=='*'){ /* current location counter */ 139 | Optr++; 140 | val = Old_pc; 141 | } 142 | else if(*Optr=='\''){ /* character literal */ 143 | Optr++; 144 | if(*Optr == EOS) 145 | val = 0; 146 | else 147 | val = *Optr++; 148 | } 149 | else if( alpha(*Optr) ){ /* a symbol */ 150 | tmp = hold; /* collect symbol name */ 151 | while(alphan(*Optr)) 152 | *tmp++ = *Optr++; 153 | *tmp = EOS; 154 | pointer = lookup(hold); 155 | if (pointer != NULL) 156 | { 157 | if (Pass == 2) 158 | { 159 | pnt = pointer->L_list; 160 | bpnt = NULL; 161 | while (pnt != NULL) 162 | { 163 | bpnt = pnt; 164 | pnt = pnt->next; 165 | } 166 | pnt = (struct link *) alloc(sizeof(struct link)); 167 | if (bpnt == NULL) 168 | pointer->L_list = pnt; 169 | else bpnt->next = pnt; 170 | pnt->L_num = Line_num; 171 | pnt->next = NULL; 172 | } 173 | val = Last_sym; 174 | } 175 | else{ 176 | if(Pass==1){ /* forward ref here */ 177 | fwdmark(); 178 | if( !Force_byte ) 179 | Force_word++; 180 | val = 0; 181 | } 182 | } 183 | if(Pass==2 && Line_num==F_ref && Cfn==Ffn){ 184 | if( !Force_byte ) 185 | Force_word++; 186 | fwdnext(); 187 | } 188 | } 189 | else 190 | /* none of the above */ 191 | /* This could be an operand like ,Y++ */ 192 | val = 0; 193 | 194 | if(minus) val=-val; 195 | #ifdef DEBUG 196 | printf("Term=%x\n",val); 197 | 198 | #endif 199 | return val; 200 | } 201 | -------------------------------------------------------------------------------- /09/as9src/ffwd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * file I/O version of forward ref handler 3 | */ 4 | 5 | #define FILEMODE 0644 /* file creat mode */ 6 | #define UPDATE 2 /* file open mode */ 7 | #define ABS 0 /* absolute seek */ 8 | 9 | int Forward =0; /* temp file's file descriptor */ 10 | char Fwd_name[] = { "Fwd_refs" } ; 11 | 12 | /* 13 | * fwdinit --- initialize forward ref file 14 | */ 15 | fwdinit() 16 | { 17 | Forward = creat(Fwd_name,FILEMODE); 18 | if(Forward <0) 19 | fatal("Can't create temp file"); 20 | close(Forward); /* close and reopen for reads and writes */ 21 | Forward = open(Fwd_name,UPDATE); 22 | if(Forward <0) 23 | fatal("Forward ref file has gone."); 24 | #ifndef DEBUG 25 | unlink(Fwd_name); 26 | #endif 27 | } 28 | 29 | /* 30 | * fwdreinit --- reinitialize forward ref file 31 | */ 32 | fwdreinit() 33 | { 34 | F_ref = 0; 35 | Ffn = 0; 36 | lseek(Forward,0L,ABS); /* rewind forward refs */ 37 | read(Forward,&Ffn,sizeof(Ffn)); 38 | read(Forward,&F_ref,sizeof(F_ref)); /* read first forward ref into mem */ 39 | #ifdef DEBUG 40 | printf("First fwd ref: %d,%d\n",Ffn,F_ref); 41 | #endif 42 | } 43 | 44 | /* 45 | * fwdmark --- mark current file/line as containing a forward ref 46 | */ 47 | fwdmark() 48 | { 49 | write(Forward,&Cfn,sizeof(Cfn)); 50 | write(Forward,&Line_num,sizeof(Line_num)); 51 | } 52 | 53 | /* 54 | * fwdnext --- get next forward ref 55 | */ 56 | fwdnext() 57 | { 58 | int stat; 59 | 60 | stat = read(Forward,&Ffn,sizeof(Ffn)); 61 | #ifdef DEBUG 62 | printf("Ffn stat=%d ",stat); 63 | #endif 64 | stat = read(Forward,&F_ref,sizeof(F_ref)); 65 | #ifdef DEBUG 66 | printf("F_ref stat=%d ",stat); 67 | #endif 68 | if( stat < 2 ){ 69 | F_ref=0;Ffn=0; 70 | } 71 | #ifdef DEBUG 72 | printf("Next Fwd ref: %d,%d\n",Ffn,F_ref); 73 | #endif 74 | } 75 | -------------------------------------------------------------------------------- /09/as9src/output.c: -------------------------------------------------------------------------------- 1 | /* 2 | * stable --- prints the symbol table in alphabetical order 3 | */ 4 | stable(ptr) 5 | 6 | struct nlist *ptr; 7 | { 8 | if (ptr != NULL) 9 | { 10 | stable (ptr->Lnext); 11 | fprintf (Symfil,"%-10s %04x\n",ptr->name,ptr->def); 12 | stable (ptr->Rnext); 13 | } 14 | } 15 | /* 16 | * cross -- prints the cross reference table 17 | */ 18 | cross(point) 19 | 20 | struct nlist *point; 21 | { 22 | struct link *tp; 23 | int i = 1; 24 | if (point != NULL) 25 | { 26 | cross (point->Lnext); 27 | fprintf (Crffil,"%-10s %04x *",point->name,point->def); 28 | tp = point->L_list; 29 | while (tp != NULL) 30 | { 31 | if (i++>10) 32 | { 33 | i=1; 34 | fprintf(Crffil,"\n "); 35 | } 36 | fprintf (Crffil,"%04d ",tp->L_num); 37 | tp = tp->next; 38 | } 39 | fprintf (Crffil,"\n"); 40 | cross (point->Rnext); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /09/as9src/pseudo.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pseudo --- pseudo op processing 3 | */ 4 | 5 | #define RMB 0 /* Reserve Memory Bytes */ 6 | #define FCB 1 /* Form Constant Bytes */ 7 | #define FDB 2 /* Form Double Bytes (words) */ 8 | #define FCC 3 /* Form Constant Characters */ 9 | #define ORG 4 /* Origin */ 10 | #define EQU 5 /* Equate */ 11 | #define ZMB 6 /* Zero memory bytes */ 12 | #define FILL 7 /* block fill constant bytes */ 13 | #define OPT 8 /* assembler option */ 14 | #define NULL_OP 9 /* null pseudo op */ 15 | #define PAGE 10 /* new page */ 16 | 17 | struct oper pseudo[] = { 18 | "bsz", PSEUDO, ZMB, 0, 19 | "end", PSEUDO, NULL_OP,0, 20 | "equ", PSEUDO, EQU, 0, 21 | "fcb", PSEUDO, FCB, 0, 22 | "fcc", PSEUDO, FCC, 0, 23 | "fdb", PSEUDO, FDB, 0, 24 | "fill", PSEUDO, FILL, 0, 25 | "nam", PSEUDO, NULL_OP,0, 26 | "name", PSEUDO, NULL_OP,0, 27 | "opt", PSEUDO, OPT, 0, 28 | "org", PSEUDO, ORG, 0, 29 | "pag", PSEUDO, PAGE, 0, 30 | "page", PSEUDO, PAGE, 0, 31 | "rmb", PSEUDO, RMB, 0, 32 | "spc", PSEUDO, NULL_OP,0, 33 | "ttl", PSEUDO, NULL_OP,0, 34 | "zmb", PSEUDO, ZMB, 0 35 | }; 36 | 37 | /* 38 | * do_pseudo --- do pseudo op processing 39 | */ 40 | do_pseudo(op) 41 | int op; /* which op */ 42 | { 43 | char fccdelim; 44 | int j; 45 | int fill; 46 | char *skip_white(); 47 | 48 | if( op != EQU && *Label ) 49 | install(Label,Pc); 50 | 51 | P_force++; 52 | switch(op){ 53 | case RMB: /* reserve memory bytes */ 54 | if( eval() ){ 55 | Pc += Result; 56 | f_record(); /* flush out bytes */ 57 | } 58 | else 59 | error("Undefined Operand during Pass One"); 60 | break; 61 | case ZMB: /* zero memory bytes */ 62 | if( eval() ) 63 | while( Result-- ) 64 | emit(0); 65 | else 66 | error("Undefined Operand during Pass One"); 67 | break; 68 | case FILL: /* fill memory with constant */ 69 | eval(); 70 | fill = Result; 71 | if( *Optr++ != ',' ) 72 | error("Bad fill"); 73 | else{ 74 | Optr = skip_white(Optr); 75 | eval(); 76 | while( Result-- ) 77 | emit(fill); 78 | } 79 | break; 80 | case FCB: /* form constant byte(s) */ 81 | do{ 82 | Optr = skip_white(Optr); 83 | eval(); 84 | if( Result > 0xFF ){ 85 | if(!Force_byte) 86 | warn("Value truncated"); 87 | Result = lobyte(Result); 88 | } 89 | emit(Result); 90 | }while( *Optr++ == ',' ); 91 | Optr -= 1; 92 | break; 93 | case FDB: /* form double byte(s) */ 94 | do{ 95 | Optr = skip_white(Optr); 96 | eval(); 97 | eword(Result); 98 | }while( *Optr++ == ',' ); 99 | Optr -= 1; 100 | break; 101 | case FCC: /* form constant characters */ 102 | if(*Operand==EOS) 103 | break; 104 | fccdelim = *Optr++; 105 | while( *Optr != EOS && *Optr != fccdelim) 106 | emit(*Optr++); 107 | if(*Optr == fccdelim) 108 | Optr++; 109 | else 110 | error("Missing Delimiter"); 111 | break; 112 | case ORG: /* origin */ 113 | if( eval() ){ 114 | Old_pc = Pc = Result; 115 | f_record(); /* flush out any bytes */ 116 | } 117 | else 118 | error("Undefined Operand during Pass One"); 119 | break; 120 | case EQU: /* equate */ 121 | if(*Label==EOS){ 122 | error("EQU requires label"); 123 | break; 124 | } 125 | if( eval() ){ 126 | install(Label,Result); 127 | Old_pc = Result; /* override normal */ 128 | } 129 | else 130 | error("Undefined Operand during Pass One"); 131 | break; 132 | case OPT: /* assembler option */ 133 | P_force=0; 134 | if( head(Operand,"l") ) 135 | Lflag=1; 136 | else if( head(Operand,"nol") ) 137 | Lflag=0; 138 | else if( head(Operand,"c") ){ 139 | Cflag=1; 140 | Ctotal=0; 141 | } 142 | else if( head(Operand,"noc") ) 143 | Cflag=0; 144 | else if( head(Operand,"contc") ) 145 | Cflag=1; 146 | else if ( head(Operand,"s") ) 147 | Sflag = 1; 148 | else if ( head(Operand,"cre") ) 149 | Rflag = 1; 150 | else if ( head(Operand,"bin") ) 151 | Bflag = 1; 152 | else if ( head(Operand,"s19") ) 153 | Oflag = 1; 154 | else 155 | errors("Unrecognized OPT", Operand); 156 | break; 157 | case PAGE: /* go to a new page */ 158 | P_force=0; 159 | N_page = 1; 160 | if (Pass == 2 ) 161 | if (Lflag) 162 | { 163 | fprintf (Lstfil,"\f"); 164 | fprintf (Lstfil,"%-10s",Argv[Cfn]); 165 | fprintf (Lstfil," "); 166 | fprintf (Lstfil,"page %3d\n",Page_num++); 167 | } 168 | break; 169 | case NULL_OP: /* ignored psuedo ops */ 170 | P_force=0; 171 | break; 172 | default: 173 | fatal("Pseudo error"); 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /09/as9src/symtab.c: -------------------------------------------------------------------------------- 1 | /* 2 | * install --- add a symbol to the table 3 | */ 4 | install(str,val) 5 | char *str; 6 | int val; 7 | { 8 | struct link *lp; 9 | struct nlist *np,*p,*backp; 10 | struct nlist *lookup(); 11 | int i; 12 | 13 | if( !alpha(*str) ){ 14 | error("Illegal Symbol Name"); 15 | return(NO); 16 | } 17 | if( (np = lookup(str)) != NULL ){ 18 | if( Pass==2 ){ 19 | if( np->def == val ) 20 | return(YES); 21 | else{ 22 | error("Phasing Error"); 23 | return(NO); 24 | } 25 | } 26 | error("Symbol Redefined"); 27 | return(NO); 28 | } 29 | /* enter new symbol */ 30 | #ifdef DEBUG 31 | printf("Installing %s as %d\n",str,val); 32 | #endif 33 | np = (struct nlist *) alloc(sizeof(struct nlist)); 34 | if( np == (struct nlist *)ERR ){ 35 | error("Symbol table full"); 36 | return(NO); 37 | } 38 | np->name = alloc(strlen(str)+1); 39 | if( np->name == (char *)ERR ){ 40 | error("Symbol table full"); 41 | return(NO); 42 | } 43 | strcpy(np->name,str); 44 | np->def = val; 45 | np->Lnext = NULL; 46 | np->Rnext = NULL; 47 | lp = (struct link *) alloc(sizeof(struct link)); 48 | np->L_list = lp; 49 | lp->L_num = Line_num; 50 | lp->next = NULL; 51 | p = root; 52 | backp = NULL; 53 | while (p != NULL) 54 | { 55 | backp = p; 56 | i = strcmp (str,p->name); 57 | if (i<0) 58 | p=p->Lnext; 59 | else p=p->Rnext; 60 | } 61 | if (backp == NULL) 62 | root = np; 63 | else if (strcmp(str,backp->name)<0) 64 | backp->Lnext = np; 65 | else backp->Rnext = np; 66 | return (YES); 67 | } 68 | 69 | /* 70 | * lookup --- find string in symbol table 71 | */ 72 | struct nlist * 73 | lookup(name) 74 | char *name; 75 | { 76 | struct nlist *np; 77 | int i; 78 | 79 | np = root; 80 | while (np != NULL) 81 | { 82 | i = strcmp(name,np->name); 83 | if (i == 0) 84 | { 85 | Last_sym = np->def; 86 | return (np); 87 | } 88 | else if (i < 0) 89 | np = np->Lnext; 90 | else np = np->Rnext; 91 | } 92 | Last_sym = 0; 93 | if (Pass == 2) 94 | errors( "symbol Undefined on pass 2", name ); 95 | return (NULL); 96 | } 97 | 98 | 99 | #define NMNE (sizeof(table)/ sizeof(struct oper)) 100 | #define NPSE (sizeof(pseudo)/ sizeof(struct oper)) 101 | /* 102 | * mne_look --- mnemonic lookup 103 | * 104 | * Return pointer to an oper structure if found. 105 | * Searches both the machine mnemonic table and the pseudo table. 106 | */ 107 | struct oper * 108 | mne_look(str) 109 | char *str; 110 | { 111 | struct oper *low,*high,*mid; 112 | int cond; 113 | 114 | /* Search machine mnemonics first */ 115 | low = &table[0]; 116 | high = &table[ NMNE-1 ]; 117 | while (low <= high){ 118 | mid = low + (high-low)/2; 119 | if( ( cond = strcmp(str,mid->mnemonic)) < 0) 120 | high = mid - 1; 121 | else if (cond > 0) 122 | low = mid + 1; 123 | else 124 | return(mid); 125 | } 126 | 127 | /* Check for pseudo ops */ 128 | low = &pseudo[0]; 129 | high = &pseudo[ NPSE-1 ]; 130 | while (low <= high){ 131 | mid = low + (high-low)/2; 132 | if( ( cond = strcmp(str,mid->mnemonic)) < 0) 133 | high = mid - 1; 134 | else if (cond > 0) 135 | low = mid + 1; 136 | else 137 | return(mid); 138 | } 139 | 140 | return(NULL); 141 | } 142 | -------------------------------------------------------------------------------- /09/as9src/table9.h: -------------------------------------------------------------------------------- 1 | struct oper table[] = { 2 | /* 3 | MNE CLASS BASE CYCLES */ 4 | 5 | "abx", INH, 58, 3, 6 | "adca", GEN, 137, 2, 7 | "adcb", GEN, 201, 2, 8 | "adda", GEN, 139, 2, 9 | "addb", GEN, 203, 2, 10 | "addd", LONGIMM,195, 4, 11 | "anda", GEN, 132, 2, 12 | "andb", GEN, 196, 2, 13 | "andcc",IMM, 28, 3, 14 | "asl", GRP2, 8, 4, 15 | "asla", INH, 72, 2, 16 | "aslb", INH, 88, 2, 17 | "asr", GRP2, 7, 4, 18 | "asra", INH, 71, 2, 19 | "asrb", INH, 87, 2, 20 | "bcc", REL, 36, 3, 21 | "bcs", REL, 37, 3, 22 | "beq", REL, 39, 3, 23 | "bge", REL, 44, 3, 24 | "bgt", REL, 46, 3, 25 | "bhi", REL, 34, 3, 26 | "bhs", REL, 36, 3, 27 | "bita", GEN, 133, 2, 28 | "bitb", GEN, 197, 2, 29 | "ble", REL, 47, 3, 30 | "blo", REL, 37, 3, 31 | "bls", REL, 35, 3, 32 | "blt", REL, 45, 3, 33 | "bmi", REL, 43, 3, 34 | "bne", REL, 38, 3, 35 | "bpl", REL, 42, 3, 36 | "bra", REL, 32, 3, 37 | "brn", REL, 33, 3, 38 | "bsr", REL, 141, 7, 39 | "bvc", REL, 40, 3, 40 | "bvs", REL, 41, 3, 41 | "clr", GRP2, 15, 4, 42 | "clra", INH, 79, 2, 43 | "clrb", INH, 95, 2, 44 | "cmpa", GEN, 129, 2, 45 | "cmpb", GEN, 193, 2, 46 | "cmpd", P2GEN, 131, 5, 47 | "cmps", P3GEN, 140, 5, 48 | "cmpu", P3GEN, 131, 5, 49 | "cmpx", LONGIMM,140, 4, 50 | "cmpy", P2GEN, 140, 5, 51 | "com", GRP2, 3, 4, 52 | "coma", INH, 67, 2, 53 | "comb", INH, 83, 2, 54 | "cpx", LONGIMM,140, 4, /* for compatibility with old code */ 55 | "cwai", IMM, 60, 20, 56 | "daa", INH, 25, 2, 57 | "dec", GRP2, 10, 4, 58 | "deca", INH, 74, 2, 59 | "decb", INH, 90, 2, 60 | "eora", GEN, 136, 2, 61 | "eorb", GEN, 200, 2, 62 | "exg", RTOR, 30, 8, 63 | "inc", GRP2, 12, 4, 64 | "inca", INH, 76, 2, 65 | "incb", INH, 92, 2, 66 | "jmp", GRP2, 14, 1, 67 | "jsr", NOIMM, 141, 5, 68 | "lbcc", P2REL, 36, 6, 69 | "lbcs", P2REL, 37, 6, 70 | "lbeq", P2REL, 39, 6, 71 | "lbge", P2REL, 44, 6, 72 | "lbgt", P2REL, 46, 6, 73 | "lbhi", P2REL, 34, 6, 74 | "lbhs", P2REL, 36, 6, 75 | "lble", P2REL, 47, 6, 76 | "lblo", P2REL, 37, 6, 77 | "lbls", P2REL, 35, 6, 78 | "lblt", P2REL, 45, 6, 79 | "lbmi", P2REL, 43, 6, 80 | "lbne", P2REL, 38, 6, 81 | "lbpl", P2REL, 42, 6, 82 | "lbra", P1REL, 22, 5, 83 | "lbrn", P2REL, 33, 5, 84 | "lbsr", P1REL, 23, 9, 85 | "lbvc", P2REL, 40, 6, 86 | "lbvs", P2REL, 41, 6, 87 | "lda", GEN, 134, 2, 88 | "ldb", GEN, 198, 2, 89 | "ldd", LONGIMM,204, 3, 90 | "lds", P2GEN, 206, 4, 91 | "ldu", LONGIMM,206, 3, 92 | "ldx", LONGIMM,142, 3, 93 | "ldy", P2GEN, 142, 4, 94 | "leas", INDEXED,50, 2, 95 | "leau", INDEXED,51, 2, 96 | "leax", INDEXED,48, 2, 97 | "leay", INDEXED,49, 2, 98 | "lsl", GRP2, 8, 4, 99 | "lsla", INH, 72, 2, 100 | "lslb", INH, 88, 2, 101 | "lsr", GRP2, 4, 4, 102 | "lsra", INH, 68, 2, 103 | "lsrb", INH, 84, 2, 104 | "mul", INH, 61, 11, 105 | "neg", GRP2, 0, 4, 106 | "nega", INH, 64, 2, 107 | "negb", INH, 80, 2, 108 | "nop", INH, 18, 2, 109 | "ora", GEN, 138, 2, 110 | "orb", GEN, 202, 2, 111 | "orcc", IMM, 26, 3, 112 | "pshs", RLIST, 52, 5, 113 | "pshu", RLIST, 54, 5, 114 | "puls", RLIST, 53, 5, 115 | "pulu", RLIST, 55, 5, 116 | "rol", GRP2, 9, 4, 117 | "rola", INH, 73, 2, 118 | "rolb", INH, 89, 2, 119 | "ror", GRP2, 6, 4, 120 | "rora", INH, 70, 2, 121 | "rorb", INH, 86, 2, 122 | "rti", INH, 59, 15, 123 | "rts", INH, 57, 5, 124 | "sbca", GEN, 130, 2, 125 | "sbcb", GEN, 194, 2, 126 | "sex", INH, 29, 2, 127 | "sta", NOIMM, 135, 2, 128 | "stb", NOIMM, 199, 2, 129 | "std", NOIMM, 205, 3, 130 | "sts", P2NOIMM,207, 4, 131 | "stu", NOIMM, 207, 3, 132 | "stx", NOIMM, 143, 3, 133 | "sty", P2NOIMM,143, 4, 134 | "suba", GEN, 128, 2, 135 | "subb", GEN, 192, 2, 136 | "subd", LONGIMM,131, 4, 137 | "swi", INH, 63, 19, 138 | "swi2", P2INH, 63, 20, 139 | "swi3", P3INH, 63, 20, 140 | "sync", INH, 19, 4, 141 | "sys", SYS, 0, 19, 142 | "tfr", RTOR, 31, 6, 143 | "tst", GRP2, 13, 4, 144 | "tsta", INH, 77, 2, 145 | "tstb", INH, 93, 2 146 | 147 | }; 148 | -------------------------------------------------------------------------------- /09/as9src/util.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fatal --- fatal error handler 3 | */ 4 | fatal(str) 5 | char *str; 6 | { 7 | printf("%s\n",str); 8 | exit(-1); 9 | } 10 | 11 | /* 12 | * error --- error in a line 13 | * print line number and error 14 | */ 15 | error(str) 16 | char *str; 17 | { 18 | if(N_files > 1) 19 | printf("%s,",Argv[Cfn]); 20 | printf("%d: ",Line_num); 21 | printf("ERROR %s\n",str); 22 | Err_count++; 23 | } 24 | /* 25 | * errors --- error in a line 26 | * print line number and error and string 27 | */ 28 | errors(char *msg, char *str) 29 | { 30 | if(N_files > 1) 31 | printf("%s,",Argv[Cfn]); 32 | printf("%d: ",Line_num); 33 | printf("ERROR %s\n %s\n",msg,str); 34 | Err_count++; 35 | } 36 | /* 37 | * warn --- trivial error in a line 38 | * print line number and error 39 | */ 40 | warn(str) 41 | char *str; 42 | { 43 | if(N_files > 1) 44 | printf("%s,",Argv[Cfn]); 45 | printf("%d: ",Line_num); 46 | printf("Warning --- %s\n",str); 47 | } 48 | 49 | 50 | /* 51 | * delim --- check if character is a delimiter 52 | * Slightly bizar: !@#$%^&()_+ are all accepted 53 | * as valid label characters. 54 | * Blank and the comment sign are delimiters. 55 | */ 56 | delim(c) 57 | char c; 58 | { 59 | if( any(c," :;\t\n") || EOS==c ) 60 | return(YES); 61 | return(NO); 62 | } 63 | 64 | /* 65 | * skip_white --- move pointer to next non-whitespace char 66 | */ 67 | char *skip_white(ptr) 68 | char *ptr; 69 | { 70 | while( any(*ptr," \n\t\r") ) 71 | ptr++; 72 | return(ptr); 73 | } 74 | 75 | /* 76 | * eword --- emit a word to code file 77 | */ 78 | eword(wd) 79 | int wd; 80 | { 81 | emit(hibyte(wd)); 82 | emit(lobyte(wd)); 83 | } 84 | 85 | /* 86 | * emit --- emit a byte to code file 87 | */ 88 | emit(byte) 89 | { 90 | #ifdef DEBUG 91 | printf("%2x @ %4x\n",byte,Pc); 92 | #endif 93 | if(Pass==1){ 94 | Pc++; 95 | return(YES); 96 | } 97 | if(P_total < P_LIMIT) 98 | P_bytes[P_total++] = byte; 99 | E_bytes[E_total++] = byte; 100 | Pc++; 101 | if(E_total == E_LIMIT) 102 | f_record(); 103 | } 104 | 105 | /* 106 | * f_record --- flush record out to S19 and Bin files if neccesary 107 | */ 108 | f_record() 109 | { 110 | int i; 111 | int chksum; 112 | 113 | if(Pass == 1) 114 | return; 115 | if(E_total==0) 116 | { 117 | E_pc = Pc; 118 | return; 119 | } 120 | chksum = E_total+3; /* total bytes in this record */ 121 | chksum += lobyte(E_pc); 122 | chksum += E_pc>>8; 123 | if (Oflag) 124 | { 125 | fprintf(Objfil,"S1"); /* record header preamble */ 126 | hexout(E_total+3); /* byte count +3 */ 127 | hexout(E_pc>>8); /* high byte of PC */ 128 | hexout(lobyte(E_pc)); /* low byte of PC */ 129 | } 130 | for(i=0;i>4],hexstr[byte&017]); 157 | } 158 | 159 | binout(byte) 160 | int byte; 161 | { 162 | fprintf(Binfil,"%c",byte); 163 | } 164 | 165 | /* 166 | * print_line --- pretty print input line to List file 167 | */ 168 | print_line() 169 | { 170 | int i; 171 | 172 | if (Lflag==0) 173 | return; 174 | else 175 | { 176 | fprintf (Lstfil,"%04d ",Line_num); 177 | if(P_total || P_force) 178 | fprintf(Lstfil,"%04x",Old_pc); 179 | else 180 | fprintf(Lstfil," "); 181 | for(i=0;i= 'A' && c <= 'Z') 224 | return(c+040); 225 | return(c); 226 | } 227 | 228 | /* 229 | * lobyte --- return low byte of an int 230 | */ 231 | lobyte(i) 232 | int i; 233 | { 234 | return(i&0xFF); 235 | } 236 | /* 237 | * hibyte --- return high byte of an int 238 | */ 239 | hibyte(i) 240 | int i; 241 | { 242 | return((i>>8)&0xFF); 243 | } 244 | 245 | /* 246 | * head --- is str2 the head of str1? 247 | */ 248 | int head( char *str1, char *str2 ) 249 | { 250 | int l=strlen(str2); 251 | return !strncasecmp(str1, str2, l) && 252 | ( EOS==str1[l] || any(str1[l]," \t\n,+-];*")); 253 | } 254 | 255 | /* 256 | * alpha --- is character a legal letter 257 | */ 258 | alpha(c) 259 | char c; 260 | { 261 | if( c<= 'z' && c>= 'a' )return(YES); 262 | if( c<= 'Z' && c>= 'A' )return(YES); 263 | if( c== '_' )return(YES); 264 | if( c== '.' )return(YES); 265 | return(NO); 266 | } 267 | /* 268 | * alphan --- is character a legal letter or digit 269 | */ 270 | alphan(c) 271 | char c; 272 | { 273 | if( alpha(c) )return(YES); 274 | if( c<= '9' && c>= '0' )return(YES); 275 | if( c == '$' )return(YES); /* allow imbedded $ */ 276 | return(NO); 277 | } 278 | 279 | /* 280 | * white --- is character whitespace? 281 | */ 282 | white(c) 283 | char c; 284 | { 285 | return any(c," \n\t\r")? YES: NO ; 286 | } 287 | 288 | /* 289 | * alloc --- allocate memory 290 | */ 291 | char * 292 | alloc(nbytes) 293 | int nbytes; 294 | { 295 | char *malloc(); 296 | 297 | return(malloc(nbytes)); 298 | } 299 | -------------------------------------------------------------------------------- /09/assist09-6850.s19: -------------------------------------------------------------------------------- 1 | S123F000308D68BE1F101F8B979D3384318C35EF81C61634041F20E3A1ED816AE426F6C66E 2 | S123F0200DA6A0A7805A26F9318DF7D48E20FEACA12602ADA43584328D68168DC34F1F8B9F 3 | S123F0403F0820F9015802920290028E0270028A0045022BFFE3029002840296028A02931A 4 | S123F0600290039A02B702D202BF6892047D012DFCF40005000000000000000039019401A2 5 | S123F080B101CB01C30175017301C001790055017D025601D16A8D67F7170225EE6A335F8C 6 | S123F0A00DFB261117069B505A2B0A11A3A126F8EF6A16021E0FFB3706C10B1022020FEF2F 7 | S123F0C06A58338CB8ECC56ECB41535349535430390410DF976D61260DAD9D67F9AD9D67E3 8 | S123F0E0FB308CE53F039EF6270D6F026F03CC01A6A701E7846F013F061706462A0C50D788 9 | S123F100FA5A2B06A630A7B120F7AE6A9F93863E3F0133E4DF954F5FDD9BDD8FDD91C60280 10 | S123F1203407170454308D0581812E275A308D04E9812F27528120231434026C5F812F272B 11 | S123F1404F17040B27026A5E17042E20E8800DA75D9EC4E6802A109EEE5C27F710DE9530A8 12 | S123F1608D015A3F0220905AE15F24033A20E4315DA65F8002A75E5AA680A1A226EE6A5EFA 13 | S123F18026F53AEC1E308B6D5D32C4AD1E16FF7A6D5E2BC83088AEDC9B20ECFE0442054DFA 14 | S123F1A0044304170444049D0445059F044703D2044C04DD044D040D044E04FD044F050AAB 15 | S123F1C0045004AF04520284045304F2045404D6045604CF04570468FFA6803406C6103D63 16 | S123F1E08D043506840F8B90198940196E9D66EE8DE78DE5AF648620203DA6618134223924 17 | S123F200109EC2EEA6EF64AF7E272EAFA6202A8D5D8D5F24FA4D27F9817F27F5A7610D8F51 18 | S123F2202617810D2604860A8DC20DF4260BA661308C09810A270F8DB30C903B04308CFC64 19 | S123F240860D8DA8860A8DA4A680810426F88D1E8D061FA9E7E420E18D18240581182602F7 20 | S123F26053398D0A8D0C24FA811827F44F396E9D6678AD9D6662847F394F502D048D420D91 21 | S123F2808F26340D902B29306C9CF82523308CE93F02098E308D66013F058D172537068E9F 22 | S123F2A025339E91272F301F9F9127298DAA25251603F71701B9390F8F1702EB3B3F0720C0 23 | S123F2C004E68D65D81F9BA163272510DE97308CEC3F038DDE16FE218DE720F7DEF0A6C49A 24 | S123F2E0442402A6413986139EF0A7848615A784393447DEF08D1B81102712D6F2810D26F8 25 | S123F30002D6F34FE7E48C8D096AE42AFA35C717FF5CE6C4C50227F7A7413986116D6626C2 26 | S123F320014C3F010C8F3986143F014A3F010A8F8E61A8301F26FC39EE626D662754327DDD 27 | S123F3403F00815326FA3F0081392722813126F26FE48D21E7618D1DE7628D19A66231CB84 28 | S123F3608D13270C6D692B02E7A4E1A027F235924C27CD20F98D12C6103D8D0D3404ABE05F 29 | S123F3801F89AB62A7626A63393F001701D427F835F2DEF2AE643456CC0018D7F23F01C615 30 | S123F3A004DDF2EC68A362108300182502C6175CE7E4CB03E761308C333F035F30618D275C 31 | S123F3C08D258D23AE628D1F6AE426FAAF6253E76130618D14AE68AC6224C8308C113F03A0 32 | S123F3E0EC64DDF24F35D6EB8416FDED533104533930333030303046430D0A043F06C60635 33 | S123F4003F075A26FB5F1F9817FDDB3F073F075CC11025F23F06252F30643F05AE64C610F9 34 | S123F4203F045A26FB3F07AE64C610A6802B0481202402862E3F015A26F1AC622409AF640D 35 | S123F440A6654826CF20B53F06398D234C8D21395043FF1341000A42000B58FF0D59FF0F22 36 | S123F46055FF1153FF01434300094450000C004F30E8103432318CD8ECA04D2F043F0120C3 37 | S123F480F7862D3F0130E56DE426126D3F27033F058C3F04ECA05D26DF3F0635B28D4027E9 38 | S123F4A010810D271EE63F5A50583F075A26FB20E3A7E4DC9B6D3F2602A682ED84A6E48100 39 | S123F4C00D26D1308D638AC6153502A7805A26F910EE88ECC615A68234025A26F920BC4F79 40 | S123F4E08C8620978E6E9D640334148D5C2718918E27F89E9E814D27169E93815027109E73 41 | S123F500A08157270A35948D4427FC200AAE849F9B0D8E27F08D629E9B812B260E8D23344D 42 | S123F52002DC9B308B9F9B350220EC812D2707814027DA5F20CF8D0A3402DC9B40508200D4 43 | S123F54020E18D9D273216FC130F9B0F9C8D2A8D112625C6103D860458099C099B4A26F863 44 | S123F56020148130251281392F0A8141250A814622068007840F1A04393F00811827C73928 45 | S123F5808D013B3530341026191701B6AE6C5A2B16A630ACA126F7813F260297FB0C8F16C8 46 | S123F5A001061700BBED6C17019800FA5A2BC9A6B4A730863FA7B120F38DC8357FADF13FD6 47 | S123F5C00A20FC17009ADD9E9E9E17FC0C862D3F0117FF0B270A812C260E9F9E300120F1D5 48 | S123F5E0D69C8D47812C27E98127260C8D8B8127270C1F898D3520F4812026069F9E3F0769 49 | S123F60020C6810A2608860D3F019F9E200A815E260A301E9F9E3F068D0720AC812F27F601 50 | S123F620399E9E341030E43F0535909E9EE780E11F26039F9E393402863F3F0135828D200F 51 | S123F640DDA0398D1BC4F01F02302F25048D1130AB343010A3622302EDE4AD9D628435E0BE 52 | S123F66017FE7E2609812F2205810EDC9B3916FAEB8DED1F028DE96FE23426AD9D6265AD39 53 | S123F6809D62633401AD9D625F350126E135B28D010133F133D427038DC68C4F5F344E208D 54 | S123F6A0DA8DEFFF8DBADD913262EEF80ADF99DEF6CC0701ED423B8DA7DDF23927058DA099 55 | S123F6C0DDF839306E9FF8398D961F018D9230013430A3E4EDE430611DA1E426023F04EECF 56 | S123F6E0E4335FEF843F053F063596272317FDF1272C812D263F17FDE827030FFA398D40DF 57 | S123F7005A2B32ACA126F9AEA1AF3C5A2AF90AFA8D2E27E930A13F055A26F93F06398D2083 58 | S123F720C1082711A684E784E1842609A7845A2B07ACA126F916FA24AFA46F310CFA20D05B 59 | S123F7409E9B318D616CD6FA396FE25F308C3F3F00815B26068610A7E43F00810D270C6D58 60 | S123F760842BD2A18126F8EB1F20EE308C491F988460AAE4A7E4C49F6D8427B9E18126F83F 61 | S123F780E61FEAE4E7E430E43F043F06358441044205440648014801480148002C002D0917 62 | S123F7A02D0153705930555058102B072B015080430052005D00FF108411001288138914B0 63 | S123F7C0861585168B1780188119821A83828C838D039F006E9D60EE6E9D60EC6E9D60EA37 64 | S113F7E06E9D60E86E9D60E66E9D60E46E9D60E2D5 65 | S113F7F0F7D4F7D8F7DCF7E0F7E4F7E8F7ECF037FD 66 | S9030000FC 67 | -------------------------------------------------------------------------------- /09/cputest.s19: -------------------------------------------------------------------------------- 1 | S1232000200FA68081042705B7FCF520F5390100007F3305BD2295BD2DCEBD2E22BD2E41A3 2 | S1232020BD2E6BBD2E8BBD2EB5BD2EE0BD2F0CBD2F42BD2F75BD2F9CBD2FCABD3034BD3092 3 | S12320405EBD3088BD30B9BD30EABD3120BD3154BD3183BD31B1BD2404BD2443BD2692BD91 4 | S123206026CCBD2706BD27C8BD273CBD282ABD20B4BD2115BD292EBD2B22BD29BCBD2295ED 5 | S1232080BD290CBD2C02BD2153BD2255BD2486BD24E4BD253EBD2619BD259CBD2184BD21F4 6 | S12320A0A3BD21C5BD21FDBD2220BD2C27BD2CCFBD32F739CE210F8E20D8EC813D1FAB100D 7 | S12320C0A381102612201FB9C405E180102612168C210F1026FFE3390000000004808040BF 8 | S12320E0000001FF00FF01FF0100FF017F813FFF01817F3FFF01C04030000040C0300000FE 9 | S1232100FFFFFE01007F7F3F010001010001004D554C0D0A04CE214D8E2139E6801D1FAB03 10 | S123212010A381102611BF1FB9C40CE180102611B58C214D1026FFE339000000040100010B 11 | S1232140007F007F0080FF8008FFFFFF085345580D0A04CE217E8E216EA6804D1FA9C40ECF 12 | S1232160E180102611808C217E1026FFEC39000480080100FF087F008108C0084000545363 13 | S1232180540D0A04CE219E8E216EA6801FA9C40EE180102611508C217E1026FFED394C4454 14 | S12321A00D0A04CE21C08E216EA680B780001FA9C40EE1801026112E8C217E1026FFEA39E4 15 | S12321C053540D0A04CE21F78E21DFEC811FA9C40EE1801026110F8C21F71026FFED390008 16 | S12321E00004800008000100FFFF087FFF00800108C000084000004C44440D0A04CE221A40 17 | S12322008E21DFEC81FD80001FA9C40EE180102610D48C21F71026FFEA395354440D0A042B 18 | S1232220CE224F8E223D10AE8131A41FA9C404E180102610B18C224F1026FFEA3900000419 19 | S1232240000100FFFF007FFF008000008001004C45410D0A04CE228F8E2271A680A5801F05 20 | S1232260A9C40EE1801026107D8C228F1026FFEB39000004AA5504AAAA08555500FFFF0812 21 | S1232280FF8008818008FF7F00FF0100F00F044249540D0A04CE23FE8E22BEA6801FA9E400 22 | S12322A080EA801F9A191FA9A18010261038C40DE180102610308C23FE1026FFDE3900DE78 23 | S12322C000000401DE00010009DE0009000ADE0010000FDE00150010DE0010004ADE0050B6 24 | S12322E00079DE0079007ADE0080087FDE00850881DE00810899DE009908A0DE000005BFFE 25 | S1232300DE002501F0DE005001FFDE00650100DF01600101DF01610109DF0169010ADF0192 26 | S123232070010FDF01750110DF0170014ADF01B00979DF01D9097ADF01E0097FDF01E509B4 27 | S123234081DF01E10999DF01F909A0DF010005BFDF012501F0DF015001FFDF01650100FE05 28 | S123236020060001FE20070009FE200F000AFE2010000FFE20150010FE2016004AFE205061 29 | S12323800079FE207F007AFE2080087FFE20850881FE20870899FE209F08A0FE200601BFC9 30 | S12323A0FE202501F0FE205601FFFE20650100FF21660101FF21670109FF216F010AFF211A 31 | S12323C070010FFF21750110FF2176014AFF21B00979FF21DF097AFF21E0097FFF21E50988 32 | S12323E081FF21E70999FF21FF09A0FF210601BFFF212501F0FF215601FFFF21650144414A 33 | S1232400410D0A04CE243D8E2425A680401FA9A18010260ED1C40FE18010260EC98C243DC4 34 | S12324201026FFE63900000480800B01FF09FF01017F8109817F01C0400140C0094E45473D 35 | S12324400D0A04CE24808E2462A680431FA9A18010260E92C40FE18010260E8A8C24802657 36 | S1232460E83900FF09FF0005F00F010FF00955AA09AA550101FE09FE0101807F017F80090B 37 | S1232480434F4D0D0A04CE24DE8E24A5A680441FA9A18010260E4FC40FE18010260E478CE6 38 | S12324A024DE26E839000004FF7F017F3F013F1F011F0F010F0701070301030101010005D2 39 | S12324C0552A01AA5500804000100800C06000E07000F07800F87C00FC7E00FE7F004C53BF 40 | S12324E0520D0A04CE25388E24FFA680481FA9A18010260DF1C40FE1808C253826EC39009C 41 | S12325000004FFFE017FFE013F7E011F3E000F1E00070E0003060001020055AA00AA5400D1 42 | S1232520800001102001C08001E0C001F0E001F8F001FCF801FEFC014C534C0D0A04CE2560 43 | S1232540968E255DA680471FA9A18010260D97C40DE18010260D8F8C259626E8390000040B 44 | S1232560FFFF097F3F013F1F011F0F010F0701070301030101010005552A01AAD50880C08F 45 | S123258008100800C0E008E0F008F0F808F8FC08FCFE08FEFF084153520D0A04CE26138E0E 46 | S12325A025C3A6801FA9E480EA801F9A461FA9A18010260D31C40DE18010260D298C2613B4 47 | S12325C026E03900FE00000401FE0000050FFE00070110FE0008007FFE003F0180FE00400C 48 | S12325E000FEFE007F00FFFE007F0100FF01800801FF0180090FFF01870910FF0188087F0F 49 | S1232600FF01BF0980FF01C008FEFF01FF08FFFF01FF09524F520D0A04CE268C8E263CA676 50 | S1232620801FA9E480EA801F9A491FA9A18010260CB4C40DE1808C268C26E43900FE0000EE 51 | S12326400401FE0002000FFE001E0008FE0010007FFE00FE0880FE000005FEFE00FC09FF2A 52 | S1232660FE00FE0900FF01010001FF0103000FFF011F0008FF0111007FFF01FF0880FF01FF 53 | S12326800101FEFF01FD09FFFF01FF09524F4C0D0A04CE26C68E26B1A6804A1FA9A1801099 54 | S12326A0260C43C40EE18010260C3B8C26C626E83901000400FF08FFFE08807F027F7E0023 55 | S12326C0100F000F0E004445430D0A04CE27008E26EBA6804C1FA9A18010260C09C40EE1E6 56 | S12326E08010260C018C270026E839000100FEFF08FF00047F800A8081080F1000101100BE 57 | S1232700494E430D0A04CE27368E2721A6804F1FA9A18010260BCFC40FE1808C273626EC22 58 | S123272039010004000004FF00048000047F00041000040F0004434C520D0A04CE27C18EE2 59 | S1232740275FEC81E3811FAB10A38110260B971FB8840FA18010260B8D8C27C126E4390038 60 | S1232760000000000004000000010001004000400080000A0000800080000880008000003D 61 | S1232780000740008000C000087FFF7FFFFFFE0A7FFF8000FFFF087FFF000180000A800016 62 | S12327A000018001084000C0000000054000C001000101FFFFFFFFFFFE098001800000017F 63 | S12327C003414444440D0A04CE28248E27E8E680EB801FA8E18010260B0C842FA1801026C3 64 | S12327E00B048C282426E73900000004000101004040800A00808008808000074080C00801 65 | S12328007F7FFE2A7F80FF08807FFF087F01802A8001810840C0000540C10101FFFFFE2921 66 | S1232820818001034144440D0A04CE29068E2852A6801FA9E480EA801F9AA9801FA9A1801F 67 | S123284010260AA2C42FE18010260A9A8C290626DF3900FE0000000400FE0001010040FE2B 68 | S12328600040800A00FE0080800880FE0080000740FE0080C0087FFE007FFE2A7FFE0080D8 69 | S1232880FF0880FE007FFF087FFE0001802A80FE0001810840FE00C0000540FE00C10101F5 70 | S12328A0FFFE00FFFE2981FE0080010300FF0100010000FF0101020040FF0140810A00FFE0 71 | S12328C00180810880FF0180010340FF0180C1087FFF017FFF2A7FFF0180002580FF017F13 72 | S12328E000257FFF0101812A80FF0101820840FF01C0010140FF01C10201FFFF01FFFF294D 73 | S123290081FF018002034144430D0A04CE29288E294EE680E1801FA83001840FA1801026FD 74 | S123292009C48C29B626EB39434D500D0A04CE29B68E294EE680E0801FA8E180102609A691 75 | S1232940840FA1801026099E8C29B626E739000000040001FF09007F81090080800B00FF11 76 | S1232960010101000100017F82094041FF094080C00B40C0800B40C17F017F007F007F01A6 77 | S12329807E007F7E01007F7F00047F80FF0B7FFF800B80017F0280404002807F010280809D 78 | S12329A000048081FF0981800100FFFF0004FFFE0100FF00FF085355420D0A04CE2B1C8E56 79 | S12329C029E4A6801FA9E480EA801F9AA2801FA9A18010260910C40FE180102609088C2BE5 80 | S12329E01C26DF3900FE0000000400FE0001FF0900FE007F810900FE0080800B00FE00FF63 81 | S1232A00010101FE0000010001FE007F820940FE0041FF0940FE0080C00B40FE00C0800B0E 82 | S1232A2040FE00C17F017FFE00007F007FFE00017E007FFE007E01007FFE007F00047FFEA2 83 | S1232A400080FF0B7FFE00FF800B80FE00017F0280FE0040400280FE007F010280FE0080E3 84 | S1232A60000480FE0081FF0981FE00800100FFFE00FF0004FFFE00FE0100FFFE0000FF0847 85 | S1232A8000FF0100FF0900FF0101FE0900FF017F800900FF01807F0100FF01FF000501FF16 86 | S1232AA00100000401FF017F810940FF0141FE0940FF0180BF0B40FF01C07F0140FF01C170 87 | S1232AC07E017FFF01007E007FFF01017D007FFF017E00047FFF017FFF097FFF0180FE0B6A 88 | S1232AE07FFF01FF7F0180FF01017E0280FF01403F0280FF017F000680FF0180FF0980FF46 89 | S1232B000181FE0981FF01800004FFFF01FFFF09FFFF01FE0004FFFF0100FE085342430D32 90 | S1232B200A04CE2BFB8E2B45EC81A3811FAB10A381102607B11FB8840FA180102607A78C19 91 | S1232B402BFB26E4390000000000000400000001FFFF0900007FFF800109000080008000F4 92 | S1232B600B0000FFFF0001010001000000010000017FFF80020940004001FFFF09400080F2 93 | S1232B8000C0000B4000C00080000B4000C0017FFF017FFF00007FFF007FFF00017FFE0063 94 | S1232BA07FFF7FFE0001007FFF7FFF0000047FFF8000FFFF0B7FFFFFFF80000B8000000186 95 | S1232BC07FFF028000400040000280007FFF0001028000800000000480008001FFFF0980E2 96 | S1232BE0018000000100FFFFFFFF000004FFFFFFFE000100FFFF0000FFFF08535542440D14 97 | S1232C000A04CE2C208E2B45EC81A3811FAB30021FB8840FA180102606CC8C2BFB26E93970 98 | S1232C20434D50440D0A048E2CB9341010AE84ADA43510260830028C2CC926EE39CE2CC9D1 99 | S1232C401606A34F5F8E0000108E0000CE00001F8B1F8A398DEDCC56781F018C5678398D29 100 | S1232C60E28E12341F12108C1234398DD6108E55001F2311835500398DC9CEFEFF1F301014 101 | S1232C8083FEFF398DBD86551F89C155398DB4C6AA1F9B3408350281AA398DA78603340226 102 | S1232CA04F35081FBA340135028103398D958601340235011FA88101392C542C5F2C6B2C1D 103 | S1232CC0782C842C8D2C9A2CAC5446520D0A048E2DAB341010AE84ADA43510260830028CFC 104 | S1232CE02DBB26EE39CE2DBB1605FB17FF55CC56788EA55A1E018C567826041083A55A39CF 105 | S1232D0017FF408E1234108E08151E12108C123426ED8C08153917FF2A108E5500CE47116A 106 | S1232D201E231183550026D7108C47113917FF13CEFEFFCC99991E301083FEFF26C11183F0 107 | S1232D4099993917FEFD8655C6AA1E89C15526AF81AA3917FEEDC6AA864434024F35081E95 108 | S1232D609B3408350281AA2696C1443917FED4860334024F3508863034024F35011EBA346B 109 | S1232D800135023408350481031026FF72C1303917FEB08611C69934045F35011EA83401AA 110 | S1232DA0350481991026FF57C111392CEB2D002D162D2D2D432D532D6C2D904558470D0A03 111 | S1232DC00434108E7F804F6F804C26FB3590CE31DF8E80008DEB8655B78000A68481551024 112 | S1232DE02605038DDC8612B78001A6018112102604F48DCD8644B7807FA6887F814410267E 113 | S1232E0004E48DBD8634B77FFFA61F8134102604D58DAE86AAB77F80A6888081AA102604D0 114 | S1232E20C5398E8000CE31EA8D97CCA55AFD8000A68081A5102604AEA680815A102604A618 115 | S1232E40398E8000CE31F417FF77CCA55AFD8000CC789AFD8002EC811083A55A1026048643 116 | S1232E60EC811083789A1026047C398E8000CE31FF17FF4DCCA55AFD7FFEA682815A102660 117 | S1232E800464A68281A51026045C398E8000CE320917FF2DCCA55AFD7FFECC789AFD7FFCB4 118 | S1232EA0EC831083A55A1026043CEC831083789A1026043239CE32148E800017FF0386120B 119 | S1232EC0B780018601A68681121026041917FEF18644B7807F867FA6868144102604073927 120 | S1232EE0CE321E108E800017FED78634B77FFFC6FFA6A58134102603ED17FEC586AAB77F8C 121 | S1232F0080C680A6A581AA102603DB39CE32288E000017FEACCC1289FD8000CC8000EC8B06 122 | S1232F2010831289102603BE8E800017FE93CC2299FD8000CC0000EC8B10832299102603E4 123 | S1232F40A539CE32328E000017FE76CC1289FD8000EC89800010831289102603898E80006D 124 | S1232F6017FE5ECC2299FD8000EC8410832299102603733900CE323E17FE468613B72F74A7 125 | S1232F80A68CF181131026035D17FE358623B72F9BA68C0781231026034C3900CE324A1770 126 | S1232FA0FE1FCC9876FD200FEC8DF063108398761026033217FE0ACC5432FD3303EC8D03F2 127 | S1232FC042108354321026031D39CE32578E800017FDEECC5522FD80003194108C552210F4 128 | S1232FE026030317FDDBCC1234FD8001319801108C1234102602EF17FDC7CC4444FD807F24 129 | S123300031987F108C4444102602DB17FDB3CC3456FD7FFF3198FF108C3456102602C71791 130 | S1233020FD9FCCAAAAFD7F80319880108CAAAA102602B3398E8000CE326517FD84CCA55AA1 131 | S1233040FD8000CC5AA5FD80023191108CA55A102602933191108C5AA510260289398E8018 132 | S123306000CE327317FD5ACCA55AFD7FFECC789AFD7FFC3193108CA55A10260269319310FC 133 | S12330808C789A1026025F39CE32818E800017FD30CC1234FD800186013196108C1234101B 134 | S12330A026024317FD1BCC4444FD807F867F3196108C44441026022E39CE328E8E800017E0 135 | S12330C0FCFFCC3456FD7FFFC6FF3195108C34561026021217FCEACCAAAAFD7F80C6803195 136 | S12330E095108CAAAA102601FD39CE329B8E000017FCCECC1289FD8000CC8000319B108C38 137 | S12331001289102601E08E800017FCB5CC2299FD8000CC0000319B108C2299102601C739F9 138 | S1233120CE32A88E000017FC98CC1289FD800031998000108C1289102601AB8E800017FC42 139 | S123314080CC2299FD80003194108C229910260195390000CE32B717FC67CC1357FD3152DF 140 | S1233160319CEF108C13571026017B17FC53CC2345FD3181319D0009108C23451026016616 141 | S1233180390000CE32C717FC38CC9876FD200F319DEE7C108C98761026014B17FC23CC5420 142 | S12331A032FD3303319D015B108C54321026013639CE32D817FC0ACC9876FD200F319F20C9 143 | S12331C00F108C98761026011D17FBF5CC5432FD3303319F3303108C543210260108394C66 144 | S12331E04441206E382C580D0A044C4441202C582B0D0A044C4444202C582B2B0D0A044CF1 145 | S12332004441202C2D580D0A044C4444202C2D2D580D0A044C444120412C580D0A044C44EB 146 | S12332204120422C590D0A044C444420442C580D0A044C4444206E31362C580D0A044C4478 147 | S123324041206E382C50430D0A044C4444206E31362C50430D0A044C454158205B6E382C6F 148 | S1233260585D0D0A044C454158205B2C582B2B5D0D0A044C454158205B2C2D2D585D0D0A8C 149 | S1233280044C454158205B412C585D0D0A044C454158205B422C595D0D0A044C4541582016 150 | S12332A05B442C585D0D0A044C454158205B6E31362C585D0D0A044C454158205B6E382C82 151 | S12332C05043525D0D0A044C454158205B6E31362C5043525D0D0A044C454158205B616420 152 | S12332E064725D0D0A048601B733058E3306BD20021F31BD200239B6330526068E3314BD4C 153 | S12333002002390000004661696C656420546573743A20040D0A0D0A416C6C2054657374E4 154 | S1123320732073756363656465640D0A0D0A0495 155 | S9030000FC 156 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | 2 | GNU GENERAL PUBLIC LICENSE 3 | Version 1, February 1989 4 | 5 | Copyright (C) 1989 Free Software Foundation, Inc. 6 | 675 Mass Ave, Cambridge, MA 02139, USA 7 | Everyone is permitted to copy and distribute verbatim copies 8 | of this license document, but changing it is not allowed. 9 | 10 | Preamble 11 | 12 | The license agreements of most software companies try to keep users 13 | at the mercy of those companies. By contrast, our General Public 14 | License is intended to guarantee your freedom to share and change free 15 | software--to make sure the software is free for all its users. The 16 | General Public License applies to the Free Software Foundation's 17 | software and to any other program whose authors commit to using it. 18 | You can use it for your programs, too. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Specifically, the General Public License is designed to make 22 | sure that you have the freedom to give away or sell copies of free 23 | software, that you receive source code or can get it if you want it, 24 | that you can change the software or use pieces of it in new free 25 | programs; and that you know you can do these things. 26 | 27 | To protect your rights, we need to make restrictions that forbid 28 | anyone to deny you these rights or to ask you to surrender the rights. 29 | These restrictions translate to certain responsibilities for you if you 30 | distribute copies of the software, or if you modify it. 31 | 32 | For example, if you distribute copies of a such a program, whether 33 | gratis or for a fee, you must give the recipients all the rights that 34 | you have. You must make sure that they, too, receive or can get the 35 | source code. And you must tell them their rights. 36 | 37 | We protect your rights with two steps: (1) copyright the software, and 38 | (2) offer you this license which gives you legal permission to copy, 39 | distribute and/or modify the software. 40 | 41 | Also, for each author's protection and ours, we want to make certain 42 | that everyone understands that there is no warranty for this free 43 | software. If the software is modified by someone else and passed on, we 44 | want its recipients to know that what they have is not the original, so 45 | that any problems introduced by others will not reflect on the original 46 | authors' reputations. 47 | 48 | The precise terms and conditions for copying, distribution and 49 | modification follow. 50 | 51 | GNU GENERAL PUBLIC LICENSE 52 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 53 | 54 | 0. This License Agreement applies to any program or other work which 55 | contains a notice placed by the copyright holder saying it may be 56 | distributed under the terms of this General Public License. The 57 | "Program", below, refers to any such program or work, and a "work based 58 | on the Program" means either the Program or any work containing the 59 | Program or a portion of it, either verbatim or with modifications. Each 60 | licensee is addressed as "you". 61 | 62 | 1. You may copy and distribute verbatim copies of the Program's source 63 | code as you receive it, in any medium, provided that you conspicuously and 64 | appropriately publish on each copy an appropriate copyright notice and 65 | disclaimer of warranty; keep intact all the notices that refer to this 66 | General Public License and to the absence of any warranty; and give any 67 | other recipients of the Program a copy of this General Public License 68 | along with the Program. You may charge a fee for the physical act of 69 | transferring a copy. 70 | 71 | 2. You may modify your copy or copies of the Program or any portion of 72 | it, and copy and distribute such modifications under the terms of Paragraph 73 | 1 above, provided that you also do the following: 74 | 75 | a) cause the modified files to carry prominent notices stating that 76 | you changed the files and the date of any change; and 77 | 78 | b) cause the whole of any work that you distribute or publish, that 79 | in whole or in part contains the Program or any part thereof, either 80 | with or without modifications, to be licensed at no charge to all 81 | third parties under the terms of this General Public License (except 82 | that you may choose to grant warranty protection to some or all 83 | third parties, at your option). 84 | 85 | c) If the modified program normally reads commands interactively when 86 | run, you must cause it, when started running for such interactive use 87 | in the simplest and most usual way, to print or display an 88 | announcement including an appropriate copyright notice and a notice 89 | that there is no warranty (or else, saying that you provide a 90 | warranty) and that users may redistribute the program under these 91 | conditions, and telling the user how to view a copy of this General 92 | Public License. 93 | 94 | d) You may charge a fee for the physical act of transferring a 95 | copy, and you may at your option offer warranty protection in 96 | exchange for a fee. 97 | 98 | Mere aggregation of another independent work with the Program (or its 99 | derivative) on a volume of a storage or distribution medium does not bring 100 | the other work under the scope of these terms. 101 | 102 | 3. You may copy and distribute the Program (or a portion or derivative of 103 | it, under Paragraph 2) in object code or executable form under the terms of 104 | Paragraphs 1 and 2 above provided that you also do one of the following: 105 | 106 | a) accompany it with the complete corresponding machine-readable 107 | source code, which must be distributed under the terms of 108 | Paragraphs 1 and 2 above; or, 109 | 110 | b) accompany it with a written offer, valid for at least three 111 | years, to give any third party free (except for a nominal charge 112 | for the cost of distribution) a complete machine-readable copy of the 113 | corresponding source code, to be distributed under the terms of 114 | Paragraphs 1 and 2 above; or, 115 | 116 | c) accompany it with the information you received as to where the 117 | corresponding source code may be obtained. (This alternative is 118 | allowed only for noncommercial distribution and only if you 119 | received the program in object code or executable form alone.) 120 | 121 | Source code for a work means the preferred form of the work for making 122 | modifications to it. For an executable file, complete source code means 123 | all the source code for all modules it contains; but, as a special 124 | exception, it need not include source code for modules which are standard 125 | libraries that accompany the operating system on which the executable 126 | file runs, or for standard header files or definitions files that 127 | accompany that operating system. 128 | 129 | 4. You may not copy, modify, sublicense, distribute or transfer the 130 | Program except as expressly provided under this General Public License. 131 | Any attempt otherwise to copy, modify, sublicense, distribute or transfer 132 | the Program is void, and will automatically terminate your rights to use 133 | the Program under this License. However, parties who have received 134 | copies, or rights to use copies, from you under this General Public 135 | License will not have their licenses terminated so long as such parties 136 | remain in full compliance. 137 | 138 | 5. By copying, distributing or modifying the Program (or any work based 139 | on the Program) you indicate your acceptance of this license to do so, 140 | and all its terms and conditions. 141 | 142 | 6. Each time you redistribute the Program (or any work based on the 143 | Program), the recipient automatically receives a license from the original 144 | licensor to copy, distribute or modify the Program subject to these 145 | terms and conditions. You may not impose any further restrictions on the 146 | recipients' exercise of the rights granted herein. 147 | 148 | 7. The Free Software Foundation may publish revised and/or new versions 149 | of the General Public License from time to time. Such new versions will 150 | be similar in spirit to the present version, but may differ in detail to 151 | address new problems or concerns. 152 | 153 | Each version is given a distinguishing version number. If the Program 154 | specifies a version number of the license which applies to it and "any 155 | later version", you have the option of following the terms and conditions 156 | either of that version or of any later version published by the Free 157 | Software Foundation. If the Program does not specify a version number of 158 | the license, you may choose any version ever published by the Free Software 159 | Foundation. 160 | 161 | 8. If you wish to incorporate parts of the Program into other free 162 | programs whose distribution conditions are different, write to the author 163 | to ask for permission. For software which is copyrighted by the Free 164 | Software Foundation, write to the Free Software Foundation; we sometimes 165 | make exceptions for this. Our decision will be guided by the two goals 166 | of preserving the free status of all derivatives of our free software and 167 | of promoting the sharing and reuse of software generally. 168 | 169 | NO WARRANTY 170 | 171 | 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 172 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 173 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 174 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 175 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 176 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 177 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 178 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 179 | REPAIR OR CORRECTION. 180 | 181 | 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 182 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 183 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 184 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 185 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 186 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 187 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 188 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 189 | POSSIBILITY OF SUCH DAMAGES. 190 | 191 | END OF TERMS AND CONDITIONS 192 | 193 | Appendix: How to Apply These Terms to Your New Programs 194 | 195 | If you develop a new program, and you want it to be of the greatest 196 | possible use to humanity, the best way to achieve this is to make it 197 | free software which everyone can redistribute and change under these 198 | terms. 199 | 200 | To do so, attach the following notices to the program. It is safest to 201 | attach them to the start of each source file to most effectively convey 202 | the exclusion of warranty; and each file should have at least the 203 | "copyright" line and a pointer to where the full notice is found. 204 | 205 | 206 | Copyright (C) 19yy 207 | 208 | This program is free software; you can redistribute it and/or modify 209 | it under the terms of the GNU General Public License as published by 210 | the Free Software Foundation; either version 1, or (at your option) 211 | any later version. 212 | 213 | This program is distributed in the hope that it will be useful, 214 | but WITHOUT ANY WARRANTY; without even the implied warranty of 215 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 216 | GNU General Public License for more details. 217 | 218 | You should have received a copy of the GNU General Public License 219 | along with this program; if not, write to the Free Software 220 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 221 | 222 | Also add information on how to contact you by electronic and paper mail. 223 | 224 | If the program is interactive, make it output a short notice like this 225 | when it starts in an interactive mode: 226 | 227 | Gnomovision version 69, Copyright (C) 19xx name of author 228 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 229 | This is free software, and you are welcome to redistribute it 230 | under certain conditions; type `show c' for details. 231 | 232 | The hypothetical commands `show w' and `show c' should show the 233 | appropriate parts of the General Public License. Of course, the 234 | commands you use may be called something other than `show w' and `show 235 | c'; they could even be mouse-clicks or menu items--whatever suits your 236 | program. 237 | 238 | You should also get your employer (if you work as a programmer) or your 239 | school, if any, to sign a "copyright disclaimer" for the program, if 240 | necessary. Here a sample; alter the names: 241 | 242 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 243 | program `Gnomovision' (a program to direct compilers to make passes 244 | at assemblers) written by James Hacker. 245 | 246 | , 1 April 1989 247 | Ty Coon, President of Vice 248 | 249 | That's all there is to it! 250 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | DATADIR ?= /usr/local/share/exorsim/ 2 | BINDIR ?= /usr/local/bin/ 3 | MANDIR ?= /usr/local/man/man1/ 4 | 5 | CFLAGS = -g -Wall 6 | 7 | CC = gcc 8 | 9 | all : mdos exor exor09 unasm6800 edos lpf imdx 10 | 11 | unasm6800 : obj/unasm.o obj/utils.o obj/unasm6800.o 12 | $(CC) -o unasm6800 obj/unasm.o obj/utils.o obj/unasm6800.o 13 | 14 | .PHONY: exor 15 | exor : 16 | make -f Makefile.00 DATADIR=$(DATADIR) 17 | 18 | .PHONY: exor09 19 | exor09 : 20 | make -f Makefile.09 DATADIR=$(DATADIR) 21 | 22 | mdos : obj/mdos.o obj/utils.o 23 | $(CC) -o mdos obj/mdos.o obj/utils.o 24 | 25 | edos : obj/edos.o 26 | $(CC) -o edos obj/edos.o 27 | 28 | imdx : obj/imdx.o 29 | $(CC) -o imdx obj/imdx.o 30 | 31 | lpf : obj/lpf.o 32 | $(CC) -o lpf obj/lpf.o 33 | 34 | .PHONY: clean 35 | clean : 36 | rm -rf obj 37 | make -f Makefile.00 clean 38 | make -f Makefile.09 clean 39 | 40 | .PHONY: install 41 | install : mdos exor exor09 edos unasm6800 lpf imdx 42 | install -D unasm6800 $(BINDIR)unasm6800 43 | install -D lpf $(BINDIR)lpf 44 | install -D imdx $(BINDIR)imdx 45 | install -D exor $(BINDIR)exor 46 | install -D exor09 $(BINDIR)exor09 47 | install -D mdos $(BINDIR)mdos 48 | install -D edos $(BINDIR)edos 49 | install -D -m 644 facts $(DATADIR)facts 50 | install -D -m 644 facts09 $(DATADIR)facts09 51 | install -D -m 644 mdos.dsk $(DATADIR)mdos.dsk 52 | install -D -m 644 flex.dsk $(DATADIR)flex.dsk 53 | install -D -m 644 mdos09.dsk $(DATADIR)mdos09.dsk 54 | install -D -m 644 exbug.bin $(DATADIR)exbug.bin 55 | install -D -m 644 exbug09.bin $(DATADIR)exbug09.bin 56 | install -D -m 644 swtbug.bin $(DATADIR)swtbug.bin 57 | 58 | # include dependancy files if they exist 59 | -include obj/unasm.d obj/utils.d obj/unasm6800.d obj/mdos.d obj/edos.d obj/imdx.d obj/lpf.d 60 | 61 | # compile and generate dependency info 62 | obj/%.o: %.c 63 | @echo 64 | @mkdir -p obj/$(shell dirname $*) 65 | $(CC) -c $(CFLAGS) -MT $@ -MMD -MP -MF obj/$*.d $*.c -o obj/$*.o 66 | -------------------------------------------------------------------------------- /Makefile.00: -------------------------------------------------------------------------------- 1 | DATADIR ?= /usr/local/share/exorsim/ 2 | 3 | OBJ_DIR := obj00/ 4 | 5 | OBJS = utils.o exor.o sim6800.o asm6800.o unasm6800.o exorterm.o mon.o 6 | 7 | SUBDIR_OBJS := $(addprefix $(OBJ_DIR), $(OBJS)) 8 | 9 | CFLAGS = -DM6800 -g -Wall -DDATADIR=\"$(DATADIR)\" 10 | 11 | CC = gcc 12 | 13 | exor : $(SUBDIR_OBJS) 14 | $(CC) -o exor $(SUBDIR_OBJS) 15 | 16 | clean : 17 | rm -rf $(OBJ_DIR) 18 | 19 | # include dependancy files if they exist 20 | -include $(SUBDIR_OBJS:.o=.d) 21 | 22 | $(OBJ_DIR)%.o: %.c 23 | @echo 24 | @mkdir -p $(OBJ_DIR)$(shell dirname $*) 25 | $(CC) -c $(CFLAGS) -MT $@ -MMD -MP -MF $(OBJ_DIR)$*.d $*.c -o $(OBJ_DIR)$*.o 26 | -------------------------------------------------------------------------------- /Makefile.09: -------------------------------------------------------------------------------- 1 | DATADIR ?= /usr/local/share/exorsim/ 2 | 3 | OBJ_DIR := obj09/ 4 | 5 | OBJS = utils.o exor.o sim6809.o asm6809.o unasm6809.o exorterm.o mon.o 6 | 7 | SUBDIR_OBJS := $(addprefix $(OBJ_DIR), $(OBJS)) 8 | 9 | CFLAGS = -DM6809 -g -Wall -DDATADIR=\"$(DATADIR)\" 10 | 11 | CC = gcc 12 | 13 | exor09 : $(SUBDIR_OBJS) 14 | $(CC) -o exor09 $(SUBDIR_OBJS) 15 | 16 | clean : 17 | rm -rf $(OBJ_DIR) 18 | 19 | # include dependancy files if they exist 20 | -include $(SUBDIR_OBJS:.o=.d) 21 | 22 | $(OBJ_DIR)%.o: %.c 23 | @echo 24 | @mkdir -p $(OBJ_DIR)$(shell dirname $*) 25 | $(CC) -c $(CFLAGS) -MT $@ -MMD -MP -MF $(OBJ_DIR)$*.d $*.c -o $(OBJ_DIR)$*.o 26 | -------------------------------------------------------------------------------- /NOTES: -------------------------------------------------------------------------------- 1 | exbug-1.2.bin can be used, but the lowest level function to read a character 2 | from the UART (ACIA) is at a different address than it is for exbug.bin 3 | (which is exbug-1.1). 4 | 5 | So you must recompile exorsim to intercept this address instead. 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EXORsim - Motorola EXORciser Simulator 2 | 3 | ## Introduction 4 | 5 | EXORsim is a Linux/Cygwin program that simulates a Motorola EXORciser, which was 6 | a development system that [Motorola](http://en.wikipedia.org/wiki/Motorola) 7 | introduced in 1975 based on their 8-bit 8 | [6800](http://en.wikipedia.org/wiki/Motorola_6800) and 9 | [6809](https://en.wikipedia.org/wiki/Motorola_6809) microprocessors. They 10 | are analogous to Intel's [Intellec](https://en.wikipedia.org/wiki/Intellec) 11 | development system for their own microprocessors. 12 | 13 | ![http://computermuseum.informatik.uni-stuttgart.de/pics/exor/gesamt.jpg](http://computermuseum.informatik.uni-stuttgart.de/pics/exor/gesamt.jpg) 14 | 15 | Image from [Computermuseum der Stuttgarter Informatik](http://computermuseum.informatik.uni-stuttgart.de/dev/exor/). 16 | Some more pictures of this development system can be found at Pekka Tanskanen's website [here](http://www.exorciser.net/index_en.htm). 17 | 18 | The EXORciser was influential in the M6800 world: 19 | 20 | * The [Fairlight CMI](https://en.wikipedia.org/wiki/Fairlight_CMI) sampling synthesize was developed on it 21 | * See especially [Tony Furse's Qasar M8](https://www.outofphase.fr/en/qasar-en/) 22 | * The [First Digital Camera](https://thephotographeronline.com/current-issue/meet-the-inventor-of-the-first-digital-camera) was developed on it 23 | * The EXORciser was used by [Williams Electronics](https://en.wikipedia.org/wiki/WMS_Industries) to develop software for pinball machines in the 1980s, as well as the Defender video game. Here's [Steve Ritchie and Larry DeMar working on Black Knight](doc/williams.jpg) 24 | 25 | Documentation for the EXORciser can be found here: 26 | 27 | [http://www.bitsavers.org/components/motorola/6800/exorciser/](http://www.bitsavers.org/components/motorola/6800/exorciser/) 28 | 29 | Disk images for the EXORciser can be found here: 30 | 31 | [http://www.bitsavers.org/bits/Motorola/Exorcisor/](http://www.bitsavers.org/bits/Motorola/Exorcisor/) 32 | 33 | You need to use [ImageDisk](http://www.classiccmp.org/dunfield/img/index.htm) to extract the binary data from from the .IMD 34 | files (requires MS-DOS). 35 | 36 | imdu disk.imd disk.dsk /b 37 | 38 | Or you can use "imdx" provided in this repository: 39 | 40 | ./imdx disk.imd 41 | 42 | The EXORciser was designed primarily to help you write assembly language 43 | programs for Motorola's 8-bit microprocessors, including 6800, 6801, 6805 and 44 | 6809. But it also supported some high level language compilers including 45 | BASIC, FORTRAN, COBOL, [MPL](https://github.com/jhallen/exorsim/blob/master/mpl/readme.md) and PASCAL. 46 | 47 | The EXORciser could be used without any disk drives. In this case, you 48 | would use either a paper tape punch and reader, usually as part of an [ASR33 49 | Teletype](https://en.wikipedia.org/wiki/Teletype_Model_33), or cassette tape 50 | storage, for example as included with a [TI ASR 733](https://terminals-wiki.org/wiki/index.php/TI_Silent_700_Model_733). 51 | But it was much more pleasant if you did have floppy drives, such as the 52 | EXORdisk-I,-II, or -III. In this case, there were a number of available operating systems: 53 | 54 | * EDOS-I (primitive OS with no file names- files are refered to by number, for EXORdisk-I) 55 | * EDOS-II (primitive OS with 5 character file names, for EXORdisk-I) 56 | * MDOS (CP/M-like OS with 8 character file names with two character extensions, for EXORdisk-II/-III) 57 | * MDOS09 (same as MDOS, but for 6809-based EXORcisers) 58 | 59 | There was an all-in-one follow-on system called [EXORset](https://www.retrotechnology.com/restore/exorset.html) 60 | available in the early 1980s. This system had a built-in terminal, used 5 1/4" mini-floppies and 61 | ran "XDOS". XDOS is nearly identical to the 6809 version of MDOS, but with mini-floppy 62 | support. 63 | 64 | **New!** EXORsim can now simulate a 6809-based EXORciser as well as the 65 | original 6800-based one. It can run both MDOS and MDOS09. 66 | 67 | ## SWTPC 68 | 69 | EXORsim also simulates a [SWTPC 6800 Computer System](https://deramp.com/swtpc.html), which allows you to run 70 | the [TSC FLEX](http://en.wikipedia.org/wiki/FLEX_%28operating_system%29) operating system. 71 | 72 | SWTPC-6800-01) 73 | 74 | ## EXORsim 75 | 76 | EXORsim is a terminal program- it's invoked at the UNIX shell and runs in 77 | the user's ANSI terminal emulator (such as XTerm). This allows you to use 78 | terminal emulator features such as scroll-back. I find this to be more 79 | useful than some emulators which run under MS-Windows, but provide only a 80 | very rudimentary terimnal. 81 | 82 | EXORsim Simulates 6800 CPU and the following peripherals: 83 | 84 | * MC6850 "ACIA"-based serial port (UART) 85 | * EXORsim emulates an EXORterm 155 by converting its control sequences into ANSI ones 86 | * This allows the [EDITORM Resident Editor](https://github.com/jhallen/exorsim/blob/master/doc/mdos-intro.md#e-editorm-resident-editor) to operate in screen mode. 87 | * Line printer port 88 | * Output is appended to a file "listing.lp" 89 | * "listing.lp" can be converted to a .pdf file using the included "lpf" program 90 | * Floppy disk controller 91 | * EXORdisk-II floppy diskette controller emulated by intercepting calls to the controller ROM 92 | * SWTPC [MF68](https://deramp.com/swtpc.com/MF_68/MF_68_Index.htm) with DC_1 emulated by hardware emulation of the [FD1771](https://en.wikipedia.org/wiki/Western_Digital_FD1771) controller. 93 | 94 |

Example session

95 | 96 | Right now the exbug.bin (or swtbug.bin for SWTPC) files must be in the 97 | current directory. 98 | 99 | '=' is the MDOS command prompt. 100 | 101 |

105 | ~/exor-1.0$ ./exor
106 | Load facts file 'facts'
107 | 'exbug.bin' loaded.
108 | 'mdos.dsk' opened for drive 0 (double sided)
109 | 
110 | Hit Ctrl-C for simulator command line.  Starting simulation...
111 | 
112 | 
113 | MDOS  3.05
114 | =         
115 | 
116 | =DIR 
117 | DRIVE : 0   DISK I.D. : SYSTEM
118 | ECUSTOM .CF                   
119 | MDOSMODE.CF
120 | NEWS    .SA
121 | EDITINFO.SA
122 | TOTAL DIRECTORY ENTRIES SHOWN : 004/$04
123 | =                                      
124 | 
125 | =DIR;S                     Include hidden system files
126 | DRIVE : 0   DISK I.D. : SYSTEM
127 | BINEX   .CM                   
128 | LIST    .CM
129 | MDOSOV0 .SY
130 | DIR     .CM
131 | MERGE   .CM
132 | RLOAD   .CM
133 | 
134 | . . . etc . . .
135 | 
136 | TOTAL DIRECTORY ENTRIES SHOWN : 058/$3A
137 | =
138 | 
139 | =BASIC FRED                Try BASIC interpreter- it requires a filename
140 | 
141 | MDOS BASIC 2.01
142 | COPYRIGHT(C)- 1977
143 | 
144 | 
145 | 
146 | READY
147 | #PRINT "HELLO, WORLD!"
148 | HELLO, WORLD!
149 | 
150 | READY
151 | #EXIT
152 | SAVE(Y/N)
153 | N
154 | 
155 | =RASM
156 | MDOS MACROASSEMBLER  3.01
157 | COPYRIGHT BY MOTOROLA 1977
158 | 
159 | 
160 | 
161 | ** 02 NAME REQUIRED
162 | 
163 | =RASM09
164 | M6809 MACROASSEMBLER 02.00
165 | COPYRIGHT BY MOTOROLA 1978
166 | 
167 | 
168 | 
169 | ** 02 NAME REQUIRED
170 | 
171 | =ASM09
172 | 
173 | AUSTIN,TEXAS--MICROCOMPUTER CAPITAL OF THE WORLD!
174 | M6800-M6809 CROSS-ASSEMBLER 2.2
175 | MOTOROLA-AUSTIN INTERNAL USE ONLY
176 | COPYRIGHT MOTOROLA 1978
177 | 
178 | **UNIF. I/O ERROR-STATUS=00 AT 2971
179 | 
180 | =
181 | 
182 | 183 | You can also emulate a 6809-based EXORciser: 184 | 185 |

189 | 
190 | ~/exorsim$ ./exor09
191 | Load facts file 'facts09'
192 | 'exbug09.bin' loaded.
193 |   EXBUG09-2.1 detected
194 | 'mdos09.dsk' opened for drive 0 (double sided)
195 | 
196 | OSLOAD...
197 | 
198 | Hit Ctrl-C for simulator command line.  Starting simulation...
199 | 
200 | 
201 | MDOS09  3.04
202 | =DIR
203 | DRIVE : 0   DISK I.D. : TEST
204 | RASM09  .CM
205 | XASM    .CM
206 | PROMPROG.CM
207 | EDIT    .CM
208 | E       .CM
209 | NEWS    .SA
210 | TOTAL DIRECTORY ENTRIES SHOWN : 006/$06
211 | =
212 | 
213 | 
214 | 215 | 216 | Hit Ctrl-C once to access the simulator's debugger prompt. 217 | 218 | Hit Ctrl-C again to exit EXORsim, or use the 'c' command to continue 219 | simulating. 220 | 221 | See the [MDOS quick start](doc/mdos-intro.md) to see how to use MDOS editors 222 | and write simple assembly langauge programs. 223 | 224 | Also see [EXORsim usage guide](doc/usage.md) for more usage information. 225 | 226 | ## SWTPC FLEX 227 | 228 | To simulate SWTPC instead, run with the --swtpc option: 229 | 230 |

234 | ~/exor-1.0$ ./exor --swtpc
235 | Load facts file 'facts'
236 | 'swtbug.bin' loaded.
237 | 'flex.dsk' opened for drive 0 (tracks=80 sectors=72)
238 | 
239 | Hit Ctrl-C for simulator command line.  Starting simulation...
240 | 
241 | FLEX 2.0
242 | 
243 | DATE (MM,DD,YY)? 02,07,11
244 | 
245 | +++
246 | 
247 | 248 | 249 | You can get FLEX2 disk images here: 250 | 251 | [http://www.flexusergroup.com/flexusergroup/fugdflx2.htm](http://www.flexusergroup.com/flexusergroup/fugdflx2.htm) 252 | 253 | [https://deramp.com/downloads/swtpc/software/FLEX/FLEX%202.0%20and%203.0%20Disk%20Images/](https://deramp.com/downloads/swtpc/software/FLEX/FLEX%202.0%20and%203.0%20Disk%20Images/) 254 | 255 | 256 | # Build instructions 257 | 258 | 1. Make a clone of this repository 259 | 260 | 2. (Linux) 261 | 262 | sudo make install 263 | 264 | 2. (Cygwin) "run as administrator" the Cygwin terminal, then: 265 | 266 | make install 267 | 268 | This will install the binaries in /usr/local/bin and install the data files 269 | in /usr/local/share/exorsim. When you run exor or exor09, the default drive 0 270 | disk image is copied to $HOME/.exorsim. 271 | 272 | The search order for data files is: 273 | 274 | 1. Current directory 275 | 2. $HOME/.exorsim 276 | 3. /usr/local/share/exorsim 277 | 278 | # Utilities 279 | 280 | A number of utilities are built in addition to "exor": 281 | 282 | mdos This provides file access to MDOS diskette images 283 | 284 | edos This provides read-only file access to EDOS-II diskette images 285 | 286 | unasm This is a stand-alone 6800 disassember 287 | 288 | imdx Utility to extract disk images from .imd files 289 | (so that you don't have to run MS-DOS) 290 | 291 | lpf Convert ASCII line printer output (66 lines per page) to 292 | PostScript. Then use ps2pdf to generate a .PDF file. 293 | 294 | # Blank disks 295 | 296 | sblank.dsk Single sided blank disk with filesystem installed (DOSGEN ;U) 297 | 298 | dblank.dsk Double sided blank disk with filesystem installed (DOSGEN ;U) 299 | 300 | ### Links 301 | 302 | [MDOS quick start](doc/mdos-intro.md) 303 |
304 | [MDOS reference](doc/mdos-ref.md) 305 |
306 | [MDOS technical information](doc/mdos-tech.md) 307 |
308 | [EXORsim usage guide](doc/usage.md) 309 |
310 | [MPL language](mpl/readme.md) 311 |
312 | [EXORterm info](doc/exorterm.md) 313 |
314 | [Notes](doc/notes.md) 315 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | 2 | Exor: 3 | write man page 4 | 5 | maybe replace --exbug with something implying that it's the entire memory image 6 | 7 | assembler: 8 | non-motorola mode? (; comments, : after label, allow whitespace ?) 9 | Include 6809 assembler improvements for 6800? 10 | expression evaluator including Motorola operators 11 | 12 | exorterm update(): maybe call it periodically even if there is no input polling 13 | 14 | Generic simulator setup? Something like: 15 | device acia 0xfcf4 0xfcf5 16 | ram 0x0000 0xe7ff 17 | readonly 0xf000 0xfbff 18 | readonly 0xe800 0xebff 19 | cpu 6809 20 | load 0xf000 exor.bin 21 | load 0xe800 fdc.bin 22 | setword 0xFFFe 0xF000 23 | 24 | Step over function (we only have step into now) 25 | Break key 26 | More breakpoints 27 | 28 | Ctrl-C twice sends Ctrl-C to program? It exists now.. or some way to send Ctrl-C to program. 29 | 30 | 6800 simulator: add 6801, 6811, 6816 support 31 | 6809 simulator: add 6309 support 32 | 6809 version of flex, should be possible. There is already a flex09 emulator. 33 | 34 | Share symbols from external assembler for facts 35 | Some way to read assembly listing for symbols (improved facts file). 36 | 37 | Show top of stack command? 38 | 39 | User GNU readline or add history for monitor jgetline? We probably also want tab-completion 40 | 41 | Televideo emulation for Flex2? Maybe not necessary. 42 | 43 | Direct support of .imd files so that binary extract 44 | is not necessary? 45 | 46 | Mdos: 47 | 48 | Support writing binary files 49 | Add rename function 50 | Add format function to create a blank disk. 51 | Check for read/write errors to disk. 52 | Check disk size for reads/writes. 53 | Check MDOS file name is 8.2 54 | 55 | Add support for EXORset mini-floppies 56 | 57 | Direct support of .imd files? 58 | 59 | Unasm: 60 | 61 | Tracing to discover all valid code... 62 | 63 | HTDOCs: 64 | 65 | Finish MDOS tech page. 66 | Add inline links to MDOS info. Add links to MDOS info source. 67 | Mention Windows exor emulator. 68 | Add installation information 69 | 70 | Document what emulator actually emulates (hardware addresses, subroutine 71 | calls..) 72 | 73 | Document monitor ROMs. 74 | 75 | 76 | - - - 77 | Done: 78 | Create Linux version of ImageDisk imdu command. 79 | 80 | Exorterm emulation (if we can find docs for it..) 81 | 82 | MDOS extract all files 83 | 84 | Detect intercepted jumps for exbug-1.1 and exbug-1.2 by looking at code, otherwise fall back 85 | to ACIA polling. 86 | 87 | Backport instruction set fixes to 6800 88 | DAA 89 | NEG 90 | 91 | u with no args should continue unassembling from last address 92 | 93 | better 'm' command 94 | 95 | l command: 96 | Return to prompt when S9 received [fixed] 97 | Read S19 from file if filename given (we have this with input redirection) 98 | 99 | l command: file name argument instead of input redirect which is weird 100 | 101 | regs command must show 6809 regs 102 | 103 | Re-enable exorterm mode: I think it just needed flushes or update calls. 104 | 105 | 6809 version of disassembler 106 | 107 | 6809 version of assembler 108 | setdp directive 109 | parse_word should handle motorola identifiers 110 | complain if there is extra junk (space begins comment after operand) 111 | < and > to force index size and direct/extended 112 | 113 | Merge exor / exor09 114 | 115 | Default options and file locations in environment variables, so you don't need 116 | exbug.bin in current directory. 117 | [now we have environment variables for this] 118 | 119 | Switch disks 120 | [drive0..drive3 commands] 121 | 122 | "make install" (needs paths to binaries). 123 | 124 | -------------------------------------------------------------------------------- /asm6800.h: -------------------------------------------------------------------------------- 1 | unsigned short assemble(unsigned char *mem, unsigned short addr, char *buf); 2 | 3 | void show_syms(FILE *f); 4 | void clr_syms(void); 5 | char *find_label(unsigned short val); 6 | 7 | extern unsigned short pseudo_dp; 8 | -------------------------------------------------------------------------------- /assist.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhallen/exorsim/e44e17218a7ef00d7ff9a658461118db9b3b08ba/assist.bin -------------------------------------------------------------------------------- /cyfix: -------------------------------------------------------------------------------- 1 | for a in $* 2 | do 3 | NEWNAME=`echo $a | sed 's/.sa/.txt/'` 4 | echo Converting $a to $NEWNAME 5 | tr -d -c '[:print:]\r\n\t' <$a | fold -s -w 70 >$NEWNAME 6 | done 7 | -------------------------------------------------------------------------------- /dblank.dsk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhallen/exorsim/e44e17218a7ef00d7ff9a658461118db9b3b08ba/dblank.dsk -------------------------------------------------------------------------------- /doc/crteditor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhallen/exorsim/e44e17218a7ef00d7ff9a658461118db9b3b08ba/doc/crteditor.gif -------------------------------------------------------------------------------- /doc/exorterm.md: -------------------------------------------------------------------------------- 1 | 2 | # EXORterm 155 or EXORterm 200 quick reference 3 | 4 | Here is some information about Motorola's EXORterm 155 and EXORterm 200. 5 | 6 | Here is a picture of an EXORterm: [http://digitaltmuseum.no/011015371771/motorola-datamaskin-exorciser-exorterm-exordisk](http://digitaltmuseum.no/011015371771/motorola-datamaskin-exorciser-exorterm-exordisk) 7 | 8 | The EXORterm 155 is a CRT-based display console designed to work with the 9 | EXORciser: 10 | 11 | * 12 inch screen 12 | * 80 column x 24 line display 13 | * 128 character font 14 | * 96 ASCII characters 15 | * 24 lower case Greek characters 16 | * 2 uppercase Greek characers and 6 special characters 17 | * RS-232C and 20/60 mA current loop interface 18 | * Up to 9600 BAUD 19 | * Support for 193 and 202 modem controls (support for half duplex) 20 | 21 | The EXORterm 155 does not support the DEC VT100 / ANSI control sequences. 22 | Instead it has its own control language. It supports "page mode", which 23 | many terminals of its era had (inspired by IBM's 3270). 24 | 25 | The EXORterm 200 is just like the EXORterm 155 but it has a small EXORciser 26 | development system built in. It has a card cage in the back which accepts 27 | EXORciser 86-pin boards. 28 | 29 | ## Keys 30 | 31 | These keys are on the keyboard (in addition to the usual ASCII keys): 32 | 33 | Key | Code or Function 34 | ----|----- 35 | ALL CAPS (with light) | (Force all caps) 36 | AUTO LF (with light) | (Automatically line feed
after carriage return) 37 | ON LINE (with light) | (Switch between on line
and local modes) 38 | PAGE MODE (with light) | (Switch between page and
scroll modes) 39 | LF | 0x0A 40 | ESC | 0x1B 41 | BREAK | 300 ms "space" condition 42 | RETURN | 0x0D 43 | HOME (shift CLEAR) * | CLEAR=0xD8, HOME=0xC0. Allowed in scroll mode. 44 | PAGE SEND (shift LINE SEND) | Ignored in scroll mode.
Send Page or Line in
page or protected mode. 45 | INS CHAR * | 0xD0 46 | DEL CHAR * | 0xD1 47 | SET TABS * | 0xDC 48 | Back tab * | 0xDB 49 | Forward tab | 0xDA 50 | DEL LINE * | 0xD7 51 | INS LINE * | 0xD6 52 | PAGE ERASE (shift LINE ERASE) * | PAGE ERASE=0xD4, LINE ERASE=0xD5. Allowed in scroll mode. 53 | Left arrow | 0x08 54 | Right arrow | 0x0C 55 | Up arrow | 0x0B 56 | Down arrow | 0x0A 57 | F1 - F12 | 0xA0 - 0xAB 58 | Shift F1 - F12 | 0xB0 - 0xBB 59 | 60 | (*) I'm fairly sure that these keys never send codes to the application. 61 | They edit the terminal screen only (and then only in page or protected mode, 62 | except where noted). 63 | 64 | ## Definitions 65 | 66 | Page rollover: it means that when you try to move the cursor down when it's 67 | on the last line, it moves to the first line. Also, if you try to move the 68 | cursor up while it's on the first line, it moves to the last line. 69 | 70 | Line and page rollover: it means when you try to move the cursor right when 71 | it's on the last column, it moves to the first column of the next line. If 72 | the cursor was on the last line, it's moved to the first line. Also, if you 73 | try to move the cursor left while it's on the first column, it's moved to 74 | the last column of the previous line. If the cursor was on the first line, 75 | it's moved to the last line. 76 | 77 | Cursor position codes: 78 | 79 | line/column 0: space / 0x20 80 | line/column 1: ! / 0x21 81 | line/column 2: " / 0x22 82 | ... 83 | line/column 79: o / 0x6F 84 | 85 | Some commands require both a line and column number. For these commands the 86 | line number is provided first: 87 | 88 | _command_ _line_ _column_ 89 | 90 | Scroll mode: This is the normal mode of the terminal and it operates as you 91 | would expect: keyboard codes are sent directly to the application and the 92 | terminal scrolls the screen when it receives linefeed when the cursor is on 93 | the last line. There are very few screen editing commands available in this 94 | mode. There is no page or line rollover. 95 | 96 | Page mode: There is page and line rollover. There is no scrolling (linefeed 97 | acts as cursor down with rollover). The terminal has built-in editing so 98 | that the keyboard can be used to edit the contents of the screen. You hit 99 | the _page send_ or _line send_ keys to transmit the screen or line contents 100 | to the application (also the application can send commands for _page send_ 101 | and _line send_). Many editing commands become available. 102 | 103 | Protect mode: This is just like page mode, except that certain fields can be 104 | set up to be protected from editing. The cursor is not allowed to appear in 105 | protected fields (it jumps over them). FAC (field attribute codes / AKA 106 | "magic cookies") are used to delineate the protected fields. 107 | 108 | ## FACs / Field attribute codes / "Magic cookies" 109 | 110 | Screen locations can have magic cookies which set or reset display 111 | attributes. When a location has a magic cookie, it appears blank on the 112 | screen. If you overwrite the location with the magic cookie with a normal 113 | character, the attribute settings are deleted. On the other hand, the codes 114 | to set attributes do not quite act like characters: they do overwrite the 115 | character in the location (changing it to a space), but they do not cause 116 | the cursor to move. Also several attributes can be placed into the same 117 | character location. Once the attributes have been set, move off the 118 | location by issuing a cursor movement command, not by sending a space. 119 | 120 | Attributes do not cross lines: they are reset to their defaults after each 121 | line. 122 | 123 | 0xE0 or ESC ` set blink 124 | 0xE1 or ESC a reset blink 125 | 0xE2 or ESC b set inverse 126 | 0xE3 or ESC c reset inverse 127 | 0xE4 or ESC d set dim 128 | 0xE5 or ESC e reset dim 129 | 0xE6 or ESC f set underline 130 | 0xE7 or ESC g reset underline 131 | 0xE8 or ESC h set non-display 132 | 0xE9 or ESC i reset non-display 133 | 0xEA or ESC j set field protect 134 | 0xEB or ESC k reset field protect 135 | 136 | ## CRT Editor Mode 137 | 138 | This mode is for support of the EXORmacs M68000 CRT Editor, the M6800 139 | EXORciser resident editor does not need it. 140 | 141 | If the CRT editor mode is enabled, the CRT enters a pseudo half-duplex mode 142 | requiring no echo from the host, and performs certain text editing 143 | functions. Optionally, the terminal notifies the host system when the 144 | cursor has been moved off the current line. If the current line has 145 | changes, the new data is always transmitted as part of a message packet. 146 | 147 | All data and command message packets sent by the terminal cause the keyboard 148 | to be locked. The host needs to send an unlock command. BREAK key will 149 | also unlock. 150 | 151 | Key| Code| CRT Action |Message to host 152 | ---|----------------|----------------------------------|---------------- 153 | HOME| 0xC0| Normal| Yes 154 | Up| 0xC1| Normal| Yes 155 | Down| 0xC2| Normal| Yes 156 | Left| 0xC3| Cursor stays on line, no wrap| No 157 | Right| 0xC4| Cursor stays on line, no wrap| No 158 | Set scroll mode|0xC8| Ignored| 159 | Set page mode| 0xC7| Ignored| 160 | Tab| 0xDA| Cursor stays on line| No 161 | Back tab| 0xDB| Cursor stays on line| No 162 | Set tabs| 0xDC| Next char becomes tab char.| No 163 | ASCII CR| 0x0D| Current line sent if changed, CR-LF is performed.|Yes, with 0xDF term 164 | Insert char| 0xD0| Insert space in line| No 165 | Delete char| 0xD1| Delete in line| No 166 | Page erase| 0xD4| Ignored| No 167 | Line erase| 0xD5| Line blank, cursor at left edge|No 168 | Line insert| 0xD6| Normal| Yes (1) 169 | Line delete| 0xD7| Normal| Yes (1) 170 | Clear/Home| 0xD8| Only home function| Yes (1) 171 | Send page| 0xD9| Ignored| No 172 | Send line| 0xDF| Ignored| No 173 | Func keys| 0xA0 - 0xBF| No CRT action| Yes (1) 174 | Ctrl-W| 0x17| No CRT action| Yes (1) 175 | Delete last| 0x7F| move left and blank (backspace)|No 176 | 177 | (1) Sent only if in "return command mode" or if data has been changed on 178 | line 179 | 180 | (2) All other ASCII commands and escape sequences ignored 181 | 182 | (3) If data is being entered on the last line and operator enters a 183 | character into the last character position and hit RETURN or LF, all lines 184 | scrolled up, bottom line blanked, and message sent. The terminating char 185 | with be 0xD9. 186 | 187 | Enable CRT editor more: 0x8E followed by ASCII char for line repeat 188 | function. If no repeat function desired, use 0xFF. 189 | 190 | Disable CRT editor mode: 0x8F. Back to scroll mode. 191 | 192 | Return command mode: 0x90. Packet sent each time cursor moved from one line 193 | to another. 194 | 195 | Non-return command mode: 0x91. Packet sent only when cursor moves off a 196 | line that has been changed or when Return or LineFeed issued while cursor is 197 | on the last line of the display. 198 | 199 | Packet format: 200 | 201 | Offset| Code| Name 202 | --------|------|------ 203 | 0| 0xDD| Start of data 204 | 1| 0xFF| Filler byte 205 | 2| 0xFF| Change flag: FF for no change or number of lines changed. 206 | 3| | Terminating character: function which caused packet to be sent 207 | 4| | Cursor line 208 | 5| | Cursor column 209 | 6 - col. M| | characters from line which changed 210 | | 0xDE| End of data 211 | 212 | # Table of command codes 213 | 214 | Command codes for normal scroll / page / protect mode 215 | 216 | Function | Send | Receive 217 | --------|----------|-------- 218 | Disable keyboard | 0xD3 (or ESC S) | 219 | Enable keyboard | 0xD2 (or ESC R) | 220 | Set page mode | 0xC7 (or ESC G). Page mode: Ignored.
Scroll or Protect mode: Change to page mode and
move cursor to virtual home. | 221 | Set scroll mode | 0xC8 (or ESC H). Scroll mode: Ignored.
Page or Protect mode: Change to scroll mode and
move cursor to virtual home. | 222 | Set protect mode | 0xCD (or ESC M). Change to protect mode
and home cursor (find first unprotected
columnon first virtual line). | 223 | Set transparent mode | 0xEC (or ESC 1) | 224 | Reset transparent mode | 0xED (or ESC m) | 225 | Set video invert | 0xEE (or ESC n) | 226 | Reset video invert | 0xEF (or ESC o) | 227 | Set display special | 0xFC (or ESC :). Codes between 0x00
and 0x1F treated as greek characters. | 228 | Reset display special | 0xFD (or ESC }) | 229 | Reset terminal | 0xF1 (or ESC q). Clear screen, scroll mode,
home cursor. | 230 | Home | 0xC0 (or ESC @). Home cursor to virtual area.
In protect mode, find first unprotected column
of first virtual line. If none, cursor lands in
first column of first line. | 231 | Cursor up | 0xC1 (0x0B in scroll mode) or ESC A.
Cursor rolls over virtual area in protect or page mode. | 232 | Cursor down | 0xC2 (0x0A in scroll mode) or ESC B.
Cursor rolls over virtual area in protect or page mode.| 233 | Cursor left | 0xC3 (0x08 in scroll mode) or ESC C.
Cursor rolls over virtual area in protect or page mode. | 234 | Cursor right | 0xC4 (0x0C in scroll mode) or ESC D.
Cursor rolls over virtual area in protect or page mode. | 235 | Load cursor | 0xC5 (or ESC E) _line_ _col_ | 236 | Read cursor | 0xC6 (or ESC F) | 0xDD _line_ _col_ 0xDE 237 | Auto linefeed | 0xF7 | 238 | Forward tab | 0xDA (or ESC Z). Cursor moves to next
tab stop (with page rollover in Page mode). In protect
mode, moves to next unprotected field (with
rollover). | 239 | Back tab | 0xDB (or ESC [). Cursor moves to previous
tab stop (with page rollover in Page mode). In protect
mode, moves to start of previous field (with
rollover).| 240 | set tabs | 0xDC (or ESC \\) _stops_ 0x0A. _stops_
include spaces, tabs (0x09) or cancel (0x18) to clear
or set tabs stops at various positions.
0xDC 0x0A cancels all tabs.
0xDC 0x09 0x0A resets them to defaults.| 241 | Set top line of virtual area | 0xC9 (or ESC I) _line_. If cursor is
not in the virtual area, move cursor
right (with page rollover) until cursor is in the
new area. | 242 | Set bottom line of virtual area | 0xCA (or ESC J) _line_. If cursor is
not in the virtual area, move cursor
right (with page rollover) until cursor is in the
new area. | 243 | Set left column of virtual area | 0xCB (or ESC K) _col_. If cursor is
not in the virtual area, move cursor
right (with page rollover) until cursor is in the
new area. | 244 | Set right column of virtual area | 0xCC (or ESC L) _col_. If cursor is
not in the virtual area, move cursor
right (with page rollover) until cursor is in the
new area. | 245 | Delete character | 0xD1 (or ESC Q). Scroll mode: ignored.
Page mode: Delete character in virtual line.
Protect mode: Delete character in field. | 246 | Page erase | 0xD4 (or ESC T). Scroll and page mode: Erase
from cursor to end of virtual area. Protect
mode: Erase from cursor to end, but only in unprotected areas.| 247 | Line erase | 0xD5 (or ESC U). Scroll and page mode: Erase
from cursor to end of virtual line. Protect
mode: Same, but only in unprotected areas. | 248 | Line insert | 0xD6 (or ESC V). Scroll and protect mode: Ignored.
Page mode: insert blank line and move
cursor to left virtual edge. | 249 | Insert character | 0xD0 (or ESC P). Scroll mode: ignored.
Page: insert next character and move to
the right with rollover. Protect: insert next
character within unprotected field.| 250 | Line delete | 0xD7 (or ESC W). Scroll and protect mode: Ignored.
Page mode: delete line and move cursor
to left virtual edge.| 251 | Clear | 0xD8 (or ESC X). Scroll and page mode: Erase screen and
move cursor to virtual home.
Protect mode: erase all unprotected area, move cursor to
first unproteted column of first line (or home if none).| 252 | Write absolute | 0xCE (or ESC N) 0xDD _line_ _column_ _text_ 0xDE.
Writes to absolute screen location, not virtual. | 253 | Read absolute | 0xCF (or ESC 0) _start-line_ _start-column_ _end-line_ _end-column_ | 0xDD _data_ 0xDE (with 0xF9 at
the end of each line) 254 | Display status on | 0xF2 (or ESC r) | 255 | Display status off | 0xF3 (or ESC s) | 256 | Send line | 0xDF (or ESC \_). Scroll mode: ignored. Page mode:
entire virtual line sent. Protect
mode: unprotected fields in virtual line sent. |0xDD _data_ 0xDE (end of each protected field marked with 0xF9) 257 | Send page | 0xD9 (or ESC Y). Scroll mode: ignored. Page mode:
from virtual home to current cursor is sent. |0xDD _data 0xDE (0xF9 at end of each line) 258 | 259 | ## Various codes 260 | 261 | Function | Send | Receive 262 | --------|----------|-------- 263 | Start data | 0xDD (or ESC ]) | 264 | End data | 0xDE (or ESC ^) | 265 | End data indicator | 0xF9 (or ESC y) | 266 | Enable load | 0xFA (or ESC z) | 267 | Disable load | 0xFB (or ESC \{) | 268 | End of line FAC | 0xFE (or ESC ~) | 269 | Break | 0x8C | 270 | 271 | ## Notes 272 | 273 | The set scroll/page/protect commands reset the virtual window back to the 274 | size of the full screen. 275 | -------------------------------------------------------------------------------- /doc/mdos-tech.md: -------------------------------------------------------------------------------- 1 |

Filesystem

2 | 3 |

MDOS uses single sided or double sided 8-inch soft sectored single 4 | density diskettes with the IBM 3740 format: 77 cylinders of 26 sectors of 5 | 128 bytes. 2002 sectors for a single sided diskette and 4004 sectors for a 6 | double sided diskette.

7 | 8 |

Space is allocated in clusters. Each cluster has four sectors and is 512 9 | bytes.

10 | 11 |

Total clusters on a single sided diskette is 500, with two unused sectors 12 | left over at the end of the disk. Double-sided diskettes have exactly 1001 13 | clusters.

14 | 15 |

These sectors are reserved:

16 | 17 |
18 |
Sector 0
Diskette ID block 19 |
Sector 1
Cluster Allocation Table (or CAT) bitmap. 1 means 20 | allocated. Bit 7 of byte 0 is the first cluster. 21 |
Sector 2
Lock-out cluster allocation table 22 |
Sectors 3 - 22
Directory - 20 sectors 23 |
Sectors 23 - 24
Boot block and MDOS RIB 24 |
25 | 26 |

Each directory entry is 16 bytes, so there can be up to 160 files on a 27 | diskette. Each directory entry looks like this:

28 | 29 |
30 |
0 - 7
File name 31 |
8 - 9
Suffix 32 |
10 - 11
Sector number of first cluster 33 |
12 - 13
File attributes 34 |
14 - 15
Unused 35 |
36 | 37 |

Sectors within a file are addressed by LSN- Logical Sector Number. LSN 38 | $FFFF is the first sector of the first cluster. It contains the the file's 39 | RIB- Retrieval Information Block. The first data sector is LSN $0000.

40 | 41 |

Files are composed of up to 57 contiguous "extents", where each extent 42 | can have up to 32 clusters. This works out to a maximum file size of 912 KB 43 | (but the largest disk is 500.5 KB).

44 | 45 |

The RIB contains a list of SDWs- 16-bit words which give the starting 46 | cluster number and size of each extent. The RIB also contains the load 47 | address and starting execution address of binary files.

48 | -------------------------------------------------------------------------------- /doc/notes.md: -------------------------------------------------------------------------------- 1 | # Various notes 2 | 3 | ## Missing information 4 | 5 | We don't have RASM.CM for MDOS09. 6 | 7 | We don't have EDIT.CM for MDOS09: but now we have MEDIT! This is an EDIT 8 | clone by Dave Hatch, see MEDIT.SA. Rubout works correctly for this editor. 9 | 10 | We don't have the RLOAD object file format. This is not in the RLOAD manual 11 | nor in the recent assembler manual. I think it might be in an appendix of 12 | the older assembler manual. 13 | 14 | We don't have a bootable EDOS-II disk. We don't have a manual for it 15 | either but some of commands are shown in the EXORdisk-I brochure. 16 | 17 | We don't have a bootable EDOS disk. 18 | 19 | We have the PASCAL manual, but not the software. 20 | 21 | Done: 22 | 23 | We don't have the COBOL manual. We now have it! 24 | 25 | We don't have the FORTRAN manual. We now have it! 26 | 27 | ## CRT-mode patches 28 | 29 | ### MDOS09 30 | 31 | Unfortunately the version of MDOS09 we have (version 3.04) is designed for a 32 | teletype like ASR-33: when you hit Backspace (the key that sends 33 | 0x7F), it emits the character deleted. This is the best you can do on a 34 | teletype. 35 | 36 | There is a chain file that is supposed to patch MDOS to emit 0x08, 0x20, 37 | 0x08 instead for a CRT terminal (MDOSMODE.CF). At least this chain file is 38 | available on some of the 6800 versions of MDOS. Unfortunately, we don't 39 | have it for MDOS09. 40 | 41 | So here is my own patch for this. It's included in the mdos09.dsk image. 42 | (I searched for 0xC1 0x7F 0x26 0x1F in the entire disk image to find the 43 | code, but it's in one of the MDOS overlay files). 44 | 45 | Original: this is code that is checking what to do for each entered key. 46 | 47 | ~~~ 48 | 1946: C1 7F CMPB #$7f Check for Delete 49 | 1948: 26 1F BNE $1969 branch if not delete 50 | 51 | 194A: BD 1B8D JSR $1b8d Check if at start, load cursor ptr to b,a 52 | 194D: 27 DD BEQ $192c Loop, next char 53 | 54 | 194F: 4D TSTA Decrement b,a: backup cursor 55 | 1950: 26 01 BNE $1953 56 | 1952: 5A DECB 57 | 1953: 4A DECA 58 | 59 | 1954: AE 66 LDX 6,S Get pointer to struct 60 | 1956: E7 02 STB 2,X Save updated cursor 61 | 1958: A7 03 STA 3,X 62 | 63 | 195A: 7F 1BD9 CLR $1bd9 Overflowed line flag? 64 | 65 | 195D: 3F SWI B,A -> X 66 | 195E: 25 FCB $25 67 | 68 | 195F: E6 84 LDB ,X Get old character at cursor 69 | 1961: BD 1AFC JSR $1afc Echo deleted character b 70 | 1964: 24 C6 BCC $192c Print OK, loop, get next char 71 | 1966: 7E 1AC7 JMP $1ac7 not sure what this does 72 | 73 | 1969: C1 18 CMPB #$18 Check for Ctrl-X 74 | 196B: 26 06 BNE $1973 75 | ~~~ 76 | 77 | This is my replacement code: 78 | 79 | ~~~ 80 | % u 1946 81 | 1946: C1 7F CMPB #$7f 82 | 1948: 26 1F BNE $1969 83 | 84 | 194A: AE 66 LDX 6,S Get structure pointer 85 | 194C: EC 02 LDD 2,X Get cursor 86 | 194E: 10A3 04 CMPD 4,X At beginning? 87 | 1951: 27 D9 BEQ $192c branch if yes 88 | 1953: 83 0001 SUBD #$0001 Backup cursor 89 | 1956: ED 02 STD 2,X 90 | 1958: 8D 09 BSR $1963 Print 0x08 91 | 195A: C6 20 LDB #$20 Print 0x20 92 | 195C: 8D 07 BSR $1965 93 | 195E: C6 08 LDB #$08 Print 0x08 94 | 1960: 12 NOP 95 | 96 | $1961 might be an entry point, so preserve its behavior: 97 | 1961: 20 C1 BRA $1924 Jump to some other code that calls 1afc then 1ac7. 98 | 1963: C6 08 LDB #$08 99 | 1965: 7E 1AFC JMP $1afc 100 | 1968: 12 NOP 101 | 102 | 1969: C1 18 CMPB #$18 103 | 196B: 26 06 BNE $1973 104 | ~~~ 105 | 106 | ### E 107 | 108 | The 6800 and 6809 versions of E have the same problem. There is a chain 109 | file to patch it for CRT mode, but it's for E version 3.14, but we have 110 | version 3.12 so it does not work. 111 | 112 | Some other notes about 6800 E: 113 | 114 | $251E appears to be the start of the input buffer. 115 | 116 | E.CM is 20408 bytes- it loads from $2000 - $6fb7 and starts at $2b6d. 117 | There are two overlay areas: 118 | 119 | $637f - $6dae, 2608 bytes. 120 | 121 | $6daf - $6fb6, 520 bytes. 122 | 123 | The copyright notice is located at $638C. Unfortunately, this is in the 124 | overlay area, which is too bad because we need a place to fit our patch. 125 | 126 | For the 6800 version of E, $3483 is the location of the code that performs 127 | the backspace: 128 | 129 | ~~~ 130 | % u 3483 131 | 3483: DE F3 LDX $00F3 Has same pointer as cursor? 132 | 3485: 09 DEX 133 | 3486: DF F3 STX $00F3 134 | 3488: DE F1 LDX $00F1 Cursor pointer 135 | 348A: 09 DEX 136 | 348B: DF F1 STX $00F1 137 | 348D: E6 00 LDB $00,X Get character to delete 138 | 348F: BD 38 DF JSR $38DF Print character in B 139 | 3492: 7A 00 FF DEC $00FF Line length? 140 | 3495: 39 RTS 141 | ~~~ 142 | 143 | Notice that this code does not check for the beginning of the buffer before 144 | decrementing the pointers in $F1 and $F3. Sure enough, the code is buggy: 145 | if you hit Backspace 100 times you'll see junk echoing back (after echoing 146 | back a bunch of NULs which appear before the start of the buffer). 147 | 148 | Here is the patched version of 6800 E: 149 | 150 | ~~~ 151 | % u 3483 152 | 3483: 7E 2D 9A JMP $2D9A 153 | 154 | % u 2d9a 155 | 2D9A: DE F1 LDX $00F1 156 | 2D9C: 8C 25 1E CPX #$251E Don't backspace before start 157 | 2D9F: 27 16 BEQ $2DB7 158 | 2DA1: 09 DEX Update cursor 159 | 2DA2: DF F1 STX $00F1 160 | 2DA4: DE F3 LDX $00F3 161 | 2DA6: 09 DEX Update other pointer 162 | 2DA7: DF F3 STX $00F3 163 | 2DA9: 7A 00 FF DEC $00FF Decrement line length? 164 | 2DAC: 8D 04 BSR $2DB2 Emit 8 165 | 2DAE: C6 20 LDB #$20 Emit 20 166 | 2DB0: 8D 02 BSR $2DB4 167 | 2DB2: C6 08 LDB #$08 Emit 8 168 | 2DB4: 7E 38 DF JMP $38DF 169 | 2DB7: 39 RTS 170 | ~~~ 171 | 172 | The region 0x2d9a - 0x2db7 was all zeros to start with. There is some 173 | evidence that this area is safe to use because the existing ECUSTOM.CF used 174 | it. Even so it's risky since ECUSTOM.CF is for E version 3.14... 175 | 176 | For the 6809 version of E, $34A7 is the location of the code that performs 177 | the backspace: 178 | 179 | ~~~ 180 | % u 34a7 181 | 34A7: 9E F3 LDX $f3 Has same pointer as cursor? 182 | 34A9: 30 1F LEAX -1,X 183 | 34AB: 9F F3 STX $f3 184 | 34AD: 9E F1 LDX $f1 Cursor pointer 185 | 34AF: 30 1F LEAX -1,X 186 | 34B1: 9F F1 STX $f1 187 | 34B3: E6 84 LDB ,X Get character to delete 188 | 34B5: BD 3911 JSR $3911 Print character in B 189 | 34B8: 0A FF DEC $ff Line length? 190 | 34BA: 39 RTS 191 | ~~~ 192 | 193 | Here is the patched version of 6809 E: 194 | 195 | ~~~ 196 | % u 34a7 197 | 34A7: 7E 2DBE JMP $2dbe 198 | 199 | % u 2dbe 200 | 2DBE: 9E F1 LDX $f1 201 | 2DC0: 8C 251E CMPX #$251e 202 | 2DC3: 27 17 BEQ $2ddc 203 | 2DC5: 30 1F LEAX -1,X 204 | 2DC7: 9F F1 STX $f1 205 | 2DC9: 9E F3 LDX $f3 206 | 2DCB: 30 1F LEAX -1,X 207 | 2DCD: 9F F3 STX $f3 208 | 2DCF: 0A FF DEC $ff 209 | 2DD1: 8D 04 BSR $2dd7 210 | 2DD3: C6 20 LDB #$20 211 | 2DD5: 8D 02 BSR $2dd9 212 | 2DD7: C6 08 LDB #$08 213 | 2DD9: 7E 3911 JMP $3911 214 | 2DDC: 39 RTS 215 | ~~~ 216 | 217 | Again the area 0x2DBE - 0x2DDC was originally all zeros. 218 | -------------------------------------------------------------------------------- /doc/williams.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhallen/exorsim/e44e17218a7ef00d7ff9a658461118db9b3b08ba/doc/williams.jpg -------------------------------------------------------------------------------- /exbug-1.2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhallen/exorsim/e44e17218a7ef00d7ff9a658461118db9b3b08ba/exbug-1.2.bin -------------------------------------------------------------------------------- /exbug.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhallen/exorsim/e44e17218a7ef00d7ff9a658461118db9b3b08ba/exbug.bin -------------------------------------------------------------------------------- /exbug09.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhallen/exorsim/e44e17218a7ef00d7ff9a658461118db9b3b08ba/exbug09.bin -------------------------------------------------------------------------------- /exor.h: -------------------------------------------------------------------------------- 1 | extern FILE *mon_out; 2 | extern FILE *mon_in; 3 | 4 | extern unsigned char mem[65536]; 5 | extern int lower; 6 | extern int polling; 7 | 8 | void simulated(unsigned short addr); 9 | void parse_facts(FILE *f); 10 | 11 | int load_drive(int n); 12 | void set_drive(int n, const char *name); 13 | void close_drive(int n); 14 | void show_drive(int n); 15 | -------------------------------------------------------------------------------- /exorterm.h: -------------------------------------------------------------------------------- 1 | /* Initialize the EXORterm */ 2 | void izexorterm(); 3 | 4 | /* Handle a character sent to the terminal */ 5 | void term_out(int c); 6 | 7 | /* Read from terminal */ 8 | int term_in(); 9 | 10 | /* Poll for user input, return true if there is any */ 11 | int quick_term_poll(); /* Actual OS poll only occasionally */ 12 | int term_poll(); 13 | void update(); 14 | extern int exorterm; /* Set to enable EXORTerm emulation */ 15 | -------------------------------------------------------------------------------- /facts: -------------------------------------------------------------------------------- 1 | 2 | Facts start in column 1. If column one has a blank, then the line is 3 | a comment. 4 | 5 | Facts are in the following format: 6 | 7 | ffc0 fcc