DisketteBootDisassemblyGEP2

 count : 2048
First pass
Second pass
		     *
		     .  Temporary File Table
		     .
		     TFT      EQU      4		start of Temporary File Table in low memory
		     LF0      EQU      0<4		logical file zero
		     LF1      EQU      1<4		logical file zero
		     LF2      EQU      2<4		logical file zero
		     LF3      EQU      3<4		logical file zero
		     PFN      EQU      0		(1) physical file number
		     PDN      EQU      1		(1) physical drive number and protection
		     LRN      EQU      2		(2) next LRN to be dealt with
		     BLRN     EQU      4		(2) first LRN within current segment
		     CSD      EQU      6		(2) current segment descriptor
		     RIBCYL   EQU      8		(1) PDA (MSB) of RIB
		     RIBSEC   EQU      9		(1) PDA (LSB) of RIB
		     MAXLRN   EQU      10		(2) largest LRN referenced
		     LRNLIM   EQU      12		(2) reserved field (initially zero)
		     BUFADR   EQU      14		(1) current controller buffer address
		     XXXXXX   EQU      15		(1) current controller buffer address
		     .
		     DOSPTR   EQU      026		next character to read from disk buffer


         LOC 000000
000000  020                   BETA    
000001  056  000              LH        000			store a RETURN at location zero
000003  365                   LLH     
000004  006  007              LA        007
000006  370                   LMA     
		     .
000007  106  113 002          CALL      JP_BR 
000012  030                   ALPHA   
000013  036  003              LD        003
000015  066  050              LL        050
000017  056  000              LH        000
000021  307          JP_B     LAM     
000022  253                   XRD     
000023  330                   LDA     
000024  106  011 002          CALL      INCHL 
000027  074  003              CP        003
000031  110  021 000          JFZ       JP_B  
000034  303                   LAD     
000035  260                   ORA     
000036  153                   EX_CLICK
000037  150  050 000          JTZ       BOOT$EP 
000042  151          BEEPHLT  EX_BEEP          cnt = 2		BEEP, then halt
000043  377                   HALT    				 do not proceed
000044  104  042 000          JMP       BEEPHLT	 		 just stay beeping and stop again if they press RUN
		     .
000047  135                   EX_COM3 
		     *
		     .  BOOT$  --  Reboot the Operating System
		     .
000050  030          BOOT$EP  ALPHA            cnt = 3	use main register set
000051  006  000              LA        000	DOS is physical file PFN zero
000053  320                   LCA 		 on physical drive zero
		     *
		     .   RUNX$  --  Load and run a file by PFN (Physical File Number)
		     .      On entry,  A = Physical File Number
		     .                 C = Physical Drive Number     
		     .  
000054  106  064 000 RUNX$EP  CALL      LOADX$EP	load the file specified  
000057  070                   PUSH    			 
000060  003                   RFC     
000061  104  050 000          JMP       BOOT$EP		try the boot again
		     *
		     .  LOADX$  --  Load a file by PFN (Physical File Number)
		     .     On entry, A = Physical File Number (PFN)
		     .		     C = Physical Drive Number
		     .     On exit, CARRY FALSE:
		     .		     HL = entry point of loaded program
		     .  
000064  066  004     LOADX$EP LL        004         cnt = 2
000066  056  000              LH        000
000070  370                   LMA     
000071  315                   LBH     
000072  066  005              LL        005
000074  372                   LMC     
		     .
000075  044  017              ND        017
000077  004  021              AD        021
000101  330                   LDA     
000102  046  014              LE        014
000104  106  151 001          CALL      DR$0  
000107  006  002              LA        002
000111  140  073 001          JTC       SR_P  
000114  066  004              LL        004
000116  307                   LAM     
000117  044  360              ND        360
000121  106  077 001          CALL      SR_Q  
000124  043                   RTC     
000125  066  014              LL        014
000127  373                   LMD     
000130  304                   LAE     
000131  044  300              ND        300
000133  066  015              LL        015
000135  370                   LMA     
000136  250                   XRA     
000137  066  006              LL        006
000141  370                   LMA     
000142  066  007              LL        007
000144  370                   LMA     
000145  006  004              LA        004
000147  066  022              LL        022
000151  370                   LMA     
000152  066  015     JP_H     LL        015
000154  347                   LEM     
000155  066  014              LL        014
000157  337                   LDM     
000160  106  151 001          CALL      DR$0  
000163  006  003              LA        003
000165  140  073 001          JTC       SR_P  
000170  066  022              LL        022
000172  307                   LAM     
000173  106  077 001          CALL      SR_Q  
000176  006  005              LA        005
000200  043                   RTC     
000201  066  024              LL        024
000203  373                   LMD     
000204  304                   LAE     
000205  044  037              ND        037
000207  004  001              AD        001
000211  360                   LLA     
000212  200                   ADA     
000213  206                   ADL     
000214  066  023              LL        023
000216  370                   LMA     
000217  304                   LAE     
000220  044  300              ND        300
000222  066  025              LL        025
000224  370                   LMA     
000225  066  025     JP_I     LL        025
000227  347                   LEM     
000230  066  024              LL        024
000232  337                   LDM     
000233  106  151 001          CALL      DR$0  
000236  006  004              LA        004
000240  140  073 001          JTC       SR_P  
000243  066  026              LL        026
000245  375                   LMH     
000246  106  121 001          CALL      GETNCH0  
000251  066  004              LL        004
000253  257                   XRM     
000254  340                   LEA     
000255  106  121 001          CALL      GETNCH0  
000260  066  006              LL        006
000262  257                   XRM     
000263  264                   ORE     
000264  340                   LEA     
000265  106  121 001          CALL      GETNCH0  
000270  066  007              LL        007
000272  257                   XRM     
000273  264                   ORE     
000274  110  313 000          JFZ       SR_K  
000277  106  121 001 JP_J     CALL      GETNCH0  
000302  260                   ORA     
000303  150  317 000          JTZ       JP_L  
000306  074  377              CP        377
000310  150  001 001          JTZ       JP_N  
000313  006  203     SR_K     LA        203         cnt = 2
000315  200                   ADA     
000316  007                   RETURN  
		     .
000317  106  121 001 JP_L     CALL      GETNCH0  
000322  360                   LLA     
000323  106  121 001          CALL      GETNCH0  
000326  350                   LHA     
000327  106  121 001          CALL      GETNCH0  
000332  256                   XRL     
000333  340                   LEA     
000334  106  121 001          CALL      GETNCH0  
000337  255                   XRH     
000340  244                   NDE     
000341  074  377              CP        377
000343  110  313 000          JFZ       SR_K  
000346  106  121 001          CALL      GETNCH0  
000351  260                   ORA     
000352  053                   RTZ     
000353  320                   LCA     
000354  106  121 001 JP_M     CALL      GETNCH0  
000357  370                   LMA     
000360  006  001              LA        001
000362  206                   ADL     
000363  360                   LLA     
000364  142  116 001          CTC       JP_R  
000367  006  377              LA        377
000371  202                   ADC     
000372  320                   LCA     
000373  110  354 000          JFZ       JP_M  
000376  104  277 000          JMP       JP_J 
		     . 
000401  066  025     JP_N     LL        025
000403  056  000              LH        000
000405  307                   LAM     
000406  004  001              AD        001
000410  370                   LMA     
000411  044  003              ND        003
000413  074  003              CP        003
000415  140  032 001          JTC       JP_O  
000420  257                   XRM     
000421  004  100              AD        100
000423  370                   LMA     
000424  066  024              LL        024
000426  307                   LAM     
000427  014  000              AC        000
000431  370                   LMA     
000432  066  006     JP_O     LL        006
000434  307                   LAM     
000435  004  001              AD        001
000437  370                   LMA     
000440  066  007              LL        007
000442  307                   LAM     
000443  014  000              AC        000
000445  370                   LMA     
000446  066  023              LL        023
000450  307                   LAM     
000451  024  001              SU        001
000453  370                   LMA     
000454  110  225 000          JFZ       JP_I  
000457  066  022              LL        022
000461  307                   LAM     
000462  004  002              AD        002
000464  370                   LMA     
000465  100  152 000          JFC       JP_H  
000470  006  005              LA        005
000472  007                   RETURN  
		     .
000473  053          SR_P     RTZ              cnt = 3
000474  006  001              LA        001
000476  007                   RETURN  
		     .
000477  066  026     SR_Q     LL        026         cnt = 2
000501  370                   LMA     
000502  106  121 001          CALL      GETNCH0  
000505  330                   LDA     
000506  106  121 001          CALL      GETNCH0  
000511  340                   LEA     
000512  006  001              LA        001
000514  203                   ADD     
000515  007                   RETURN  
		     .
000516  215          JP_R     ACH     
000517  350                   LHA     
000520  007                   RETURN  
		     *
		     .  GETNCH  --  Get the next disk buffer byte
	 	     .     Gets the character from the disk buffer 
		     .     On entry, DOSPTR = disk buffer pointer (0-255)
		     .     On return, A = character from disk buffer
		     .                (DOSPTR) = (DOSPTR) + 1
		     .		      B,C,D,E,H,L all unchanged
		     .
000521  070          GETNCH0     PUSH             cnt = 13	save the caller's HL pair
000522  006  074              LA        074	address the disk controller
000524  040                   DI      		 disable interrupts while we do this
000525  121                   EX_ADR  
000526  066  026              LL        DOSPTR	pick up DOSPTR
000530  056  000              LH        000	 MSB of DOSPTR
000532  307                   LAM     		pick up DOSPTR 
000533  137                   EX_COM4 		select that character of disk buffer
000534  004  001              AD        001	bump to the next buffer location for next time
000536  370                   LMA     		 and update that incremented DOSPTR
000537  125                   EX_DATA 		switch to data mode
000540  050                   EI      		 reinable interrupts after we...
000541  101                   INPUT   		  get the desired byte from the buffer
000542  060                   POP     		restore the caller's HL pair
000543  007                   RETURN  		 and return to caller
		     *
		     .  DW$  --  Write a disk sector
		     .     On entry, B = 16 times buffer number
		     .		     D = physical disk address (MSB)
		     .		     E = physical disk address (LSB)
		     .		     TFT+PDN (at loc 5) = logical drive number
		     .     On exit,  B,D,E,TFT & PDN all unchanged
		     .		     CARRY FALSE if write was successful
		     .		     CARRY TRUE and ZERO FALSE if drive offline
		     .		     CARRY TRUE and ZERO TRUE if parity fault
		     .
000544  026  007     DW$0     LC        007	we're going to do a write
000546  104  153 001          JMP       DR$1  
		     *
		     .  DR$  --  Read a disk sector
		     .     On entry, B = 16 times buffer number
		     .		     D = physical disk address (MSB)
		     .		     E = physical disk address (LSB)
		     .		     TFT+PDN (at loc 5) = logical drive number
		     .     On exit,  B,D,E,TFT & PDN all unchanged
		     .		     CARRY FALSE if read was successful
		     .		     CARRY TRUE and ZERO FALSE if drive offline
		     .		     CARRY TRUE and ZERO TRUE if parity fault
		     .
000551  026  005     DR$0     LC        005         cnt = 4	we're going to do a read
000553  006  074     DR$1     LA        074		address the disk controller
000555  040                   DI      			 disable interrupts while addressed
000556  121                   EX_ADR  
000557  300                   NOP     
000560  066  005              LL        TFT+PDN		get logical drive number
000562  056  000              LH        000		 MSB of memory location
000564  307                   LAM     			  get logical drive number
000565  044  003              ND        003		can be only 0-3 here
000567  066  373              LL        373		initialize a retry count
000571  050          JP_W     EI      
000572  131                   EX_COM1 
000573  106  274 001 JP_X     CALL      DSKWAT0 	wait for drive to be ready and online
000576  043                   RTC     			 return if it went offline
000577  304                   LAE     
000600  106  324 001          CALL      JP_BC 
000603  106  274 001 JP_Y     CALL      DSKWAT0  	wait for drive to be ready and online
000606  043                   RTC     			 return if it went offline
000607  044  010              ND        010
000611  150  227 001          JTZ       SR_Z  
000614  050                   EI      
000615  302                   LAC			check if we're reading or writing     
000616  074  007              CP        007		 is it a write?
000620  110  227 001          JFZ       SR_Z  		  jump if not
000623  151                   EX_BEEP 			we did a read and got a fault
000624  104  203 001          JMP       JP_Y 
		     . 
000627  050          SR_Z     EI               cnt = 2
000630  006  001              LA        001		increment the retry count
000632  206                   ADL     			 which is stored in L
000633  360                   LLA     			  save it back in L
000634  043                   RTC     			if overflows return CARRY TRUE ZERO TRUE (ints enabled)
000635  006  074              LA        074		re-address the disk controller
000637  040                   DI      			 with interrupts disabled
000640  121                   EX_ADR  
000641  301                   LAB     			get buffer number * 16
000642  002                   SLC     
000643  002                   SLC     			 make it * 64 in A (high order 2 bits
000644  044  300              ND        300		  clear other stuff just in case
000646  064  011              OR        011
000650  131                   EX_COM1 			select that disk controller buffer
000651  302                   LAC     			based on read or write command
000652  131                   EX_COM1 			 issue the read or write command requested
000653  106  274 001          CALL      DSKWAT0  	wait for drive to be ready and online
000656  043                   RTC     			return if it went offline
000657  006  010              LA        010
000661  110  171 001          JFZ       JP_W  
000664  101                   INPUT   
000665  050                   EI      
000666  044  220              ND        220
000670  053                   RTZ     
000671  104  173 001          JMP       JP_X 
		     *
		     .  DSKWAT  --  Wait for Disk Ready
		     .     This routine waits for disk ready, controller ready, no disk I/O transfer
		     .   in progress, and drive online to all be true.  If the drive is not online,
		     .   returns with carry true,zero flag false, and interrupts enabled.  If the drive
		     .   is OK and ready, routine exits with interrupts disabled.
		     .     On entry, drive checked is the selected drive
		     .     On exit,  B,C,D,E,H,L all unchanged
		     .		     CARRY TRUE and ZERO FALSE if drive offline (interrupts enabled)
		     .		     CARRY FALSE if drive is ready (interrupts disabled)
		     . 
000674  006  074     DSKWAT0  LA        074         cnt = 4	address the disk controller
000676  040                   DI      			disable interrupts during the operation
000677  121                   EX_ADR  
000700  050          DSKWAT1  EI      
000701  101                   INPUT   			get the status byte
000702  054  005              XR        005
000704  012                   SRC     
000705  043                   RTC     
000706  044  003              ND        003
000710  006  074              LA        074		re-address the disk controller
000712  040                   DI      			 with interrupts disabled
000713  121                   EX_ADR  
000714  101                   INPUT   			fetch the status byte again
000715  110  300 001          JFZ       DSKWAT1 	status was set by ND above (carry clear too)
000720  044  200              ND        200		 make sure carry and zero set appropriately
000722  101                   INPUT   			 return the current status byte
000723  007                   RETURN  			  and return to caller
		     .
000724  002          JP_BC    SLC     
000725  002                   SLC     
000726  044  003              ND        003
000730  070                   PUSH    
000731  360                   LLA     
000732  200                   ADA     
000733  206                   ADL     
000734  204                   ADE     
000735  044  017              ND        017
000737  360                   LLA     
000740  006  003              LA        003
000742  243                   NDD     
000743  206                   ADL     
000744  004  357              AD        SECTMAP		use that to index into sector mapping table
000746  360                   LLA     
000747  056  001              LH        001		 MSB of sector mapping table address
000751  307                   LAM     			get the remapped sector number
000752  060                   POP     			restore caller's HL pair
000753  135                   EX_COM3 			select the remapped sector number
000754  303                   LAD     			get the cylinder/track number
000755  133                   EX_COM2 			 and select that too
000756  007                   RETURN  			  then return to caller
		     *
		     .  Sector mapping table
		     .    This table is used to help implement the sector skewing/radius spiraling.
		     .
000757  000          SECTMAP  HALT    
000760  005                   ---     
000761  012                   SRC     
000762  002                   SLC     
000763  007                   RETURN  
000764  014  004              AC        004
000766  011                   ---     
000767  001                   HALT    
000770  006  013              LA        013
000772  003                   RFC     
000773  010                   SYNC    
000774  000                   HALT    
000775  005                   ---     
000776  012                   SRC     
000777  000                   HALT   
001000  104  050 000 BOOT$    JMP       BOOT$EP		reboot the operating system  
001003  104  054 000 RUNX$    JMP       RUNX$EP		load and run a file by PFN physical file number
001006  104  064 000 LOADX$   JMP       LOADX$EP 	load a file by PFN physical file number
		     *
		     .  INCHL  --  Increment HL pair
		     .     On return, A = H
		     .                CARRY TRUE: if H increment overflowed
		     .
001011  006  001     INCHL    LA        001         cnt = 10
001013  206                   ADL     
001014  360                   LLA     
001015  006  000              LA        000
001017  215                   ACH     
001020  350                   LHA     
001021  007                   RETURN  
		     *
		     .  DECHL  --  Decrement HL pair
		     .
001022  006  377     DECHL    LA        377         cnt = 2
001024  206                   ADL     
001025  360                   LLA     
001026  006  377              LA        377
001030  215                   ACH     
001031  350                   LHA     
001032  007                   RETURN  

001033  104  301 002 CS$      JMP       CS$EP 		CS$ - Change Process State
001036  104  272 002 TP$      JMP       TP$EP 		TP$ - Terminate Foreground Process
001041  104  323 002 SETI$    JMP       SETI$EP 
001044  104  317 002 CLRI$    JMP       JP_CB 		CLRI$ - Clear Interrupt Process
001047  104  121 001 GETNCH   JMP       GETNCH0  	GETNCH - Get the next disk buffer byte
001052  104  151 001 DR$      JMP       DR$0  
001055  104  144 001 DW$      JMP       DW$0  
001060  104  274 001 DSKWAT   JMP       DSKWAT0       cnt = 6
001063  104  063 002 PREP$    JMP       PREP$ 
001066  104  066 002 OPEN$    JMP       OPEN$ 
001071  104  071 002 LOAD$    JMP       LOAD$ 
001074  104  074 002 RUN$     JMP       RUN$ 
001077  104  077 002 CLOSE$   JMP       CLOSE$ 
001102  104  102 002 CHOP$    JMP       CHOP$ 
001105  104  105 002 PROTE$   JMP       PROTE$ 
001110  104  110 002 POSIT$   JMP       POSIT$ 
00READ$  066  250    JP_BR    LL        250
001115  056  003              LH        003
001117  307                   LAM     
001120  074  026              CP        026
001122  013                   RFZ     
001123  006  341              LA        341		address the CRT/keyboard
001125  121                   EX_ADR  
001126  101                   INPUT   
001127  044  010              ND        010		is the DISPLAY key depressed?
001131  053                   RTZ     			 just return, if not
001132  066  047              LL        047		pick up the XOR value to check against
001134  056  000              LH        000		 MSB of the address
001136  337                   LDM     			 get that into D
001137  066  050              LL        050		start computing XOR starting at the next byte
001141  056  000              LH        000		 MSB of the address
001143  307          JP_BS    LAM     			pick up a byte
001144  253                   XRD     			 XOR the byte with the XOR we've got so far
001145  330                   LDA     			 save it back in D
001146  106  011 002          CALL      INCHL 		bump to next address
001151  074  010              CP        010		 check if H is past last address to check
001153  110  143 002          JFZ       JP_BS 		 if not, keep computing the XOR of the ROM code
001156  303                   LAD     			then get the XOR we've got so far
001157  260                   ORA     			 make sure it's zero
001160  110  042 000          JFZ       BEEPHLT		 if not, halt beeping
001163  153                   EX_CLICK			  if it's good.. just click once
001164  030                   ALPHA   			  set ALPHA register set
001165  104  026 005          JMP       JP_DO 		   and continue booting
001170  104  170 002 WAIT$    JMP       WAIT$ 
001173  104  173 002 JP_BU    JMP       JP_BU 
001176  104  176 002 JP_BV    JMP       JP_BV 
		     *
		     .  Timer interrupt routine
		     .     This routine will be given control every millisecond, once set up
		     .
001201  040          MSTI     DI      
001202  020                   BETA    
001203  106  233 002 MSTI0    CALL      NOOPRTN 		interrupt routine 1 (every millisecond)
001206  106  233 002 MSTI1    CALL      NOOPRTN 		interrupt routine 2 (every millisecond)
001211  106  233 002 MSTI2    CALL      NOOPRTN 		interrupt routine 3 (every millisecond)
001214  106  233 002 MSTI3    CALL      NOOPRTN 		interrupt routine 4 (every millisecond)
001217  066  366              LL        INTNO		pick up next interrupt routine number to dispatch
001221  056  002              LH        002		 MSB of INTNO
001223  307                   LAM     			  get interrupt routine number to dispatch
001224  004  006              AD        006		  bump to next one (each CALL/JMP is 6 bytes total)
001226  370                   LMA     			   and save for next time
001227  004  226              AD        MSTI4-6		prepare to vector to next routine dispatcher
001231  360                   LLA     
001232  070                   PUSH    
001233  007          NOOPRTN  RETURN           cnt = 8	 vector to next routine dispatcher
.
001234  106  233 002 MSTI4    CALL      NOOPRTN 	interrupt routine 5 (every 4 milliseconds)
001237  104  267 002          JMP       MSTIX 		 then return from millisecond interrupt
001242  106  233 002 MSTI5    CALL      NOOPRTN 	interrupt routine 6 (every 4 milliseconds)
001245  104  267 002          JMP       MSTIX 		 then return from millisecond interrupt
001250  106  233 002 MSTI6    CALL      NOOPRTN 	interrupt routine 7 (every 4 milliseconds)
001253  104  267 002          JMP       MSTIX 		 then return from millisecond
001256  106  233 002 MSTI7    CALL      NOOPRTN 	interrupt routine 8 (every 4 milliseconds)
001261  250                   XRA     			clear next interrupt routine number
001262  066  366              LL        INTNO		store that in 4ms interrupt routine number for next time
001264  056  002              LH        002		 MSB of INTNO
001266  370                   LMA     			  so next time we'll schedule the next one of 4
001267  030          MSTIX    ALPHA            cnt = 3	reset regs to Alpha regs & flags
001270  050                   EI      			 re-enable interrupts
001271  007                   RETURN  			  and return from timer interrupt
		     *
		     .  TP$ -- Terminate a Foreground Process
.		     .     Terminate the active millisecond interrupt routine so it won't be called next time.
		     .
001272  046  233     TP$EP    LE        NOOPRTN		set DE = address of NOOPRTN (just returns)
001274  036  002              LD        002		 MSB of routine address
001276  104  304 002          JMP       CS$EP1 
		     *
		     .  CS$ -- Change State of a Foreground Process
		     .    Change the next entry point for the active millisecond interrupt routine to the
		     .   instruction following the call
		     .
001301  060          CS$EP    POP 			set DE to the address after call to CS$    
001302  335                   LDH     
001303  346                   LEL     
001304  060          CS$EP1   POP     			set HL to the address after call to interrupt routine 
001305  070                   PUSH    
001306  106  022 002          CALL      DECHL 		set HL to MSB of address in call to interrupt routine
001311  373                   LMD     			 store new routine entry address MSB
001312  106  022 002          CALL      DECHL 		set HL to LSB of address in call to interrupt routine
001315  374                   LME     			 store new routine entry address LSB
001316  007                   RETURN  
		     *
		     .  CLRI$  --  Clear interrupt routine addess into vector
		     .    On entry, C = which array entry to clear (0,1,2,3,4,5,6,7)
	      	     .
001317  046  233     CLRI$EP  LE        NOOPRTN		set DE = address of NOOPRTN (just returns)
001321  036  002              LD        002		 MSB of routine address
		     *
		     .  SETI$  --  Save interrupt routine addess into vector
		     .    On entry, DE = address to be saved
		     .              C = which array entry to save (0,1,2,3,4,5,6,7)
	      	     .
001323  302          SETI$EP  LAC     			get array entry to save
001324  044  007              ND        007		 make sure it's 0-7
001326  004  367              AD        ADRVEC0		index into ADRVEC list of addresses
001330  360                   LLA     
001331  056  002              LH        002		 MSB of ADRVEC
001333  367                   LLM     
001334  056  002              LH        002		MSB of ADRVEC (was already set)
001336  040                   DI      			disable interrupts
001337  374                   LME 			store the DE address there (LSB, MSB)    
001340  106  011 002          CALL      INCHL 		 (storing into a CALL instruction address field)
001343  373                   LMD     
		     .
		     .  Next set up to run the MSTI interrupt dispatcher routine every millisecond
		     .
001344  305                   LAH     			save MSB of MSTI routine address in A
001345  066  002              LL        002		store A as MSB of jump-address-to-be
001347  056  000              LH        000		MSB for location zero in memory
001351  370                   LMA     			 save MSB of MSTI routine address into JMP instruction
001352  006  201              LA        MSTI		store 
001354  066  001              LL        001
001356  370                   LMA     			 save LSB of MSTI routine address into JMP instruction
001357  006  104              LA        104		store a JMP instruction opcode
001361  066  000              LL        000		 at hard location zero
001363  370                   LMA     
001364  050                   EI      			re-enable interrupts
001365  007                   RETURN  			 and return
		     .
001366  000          INTNO    DB	0		next 4ms interrupt routine number 
.
001367  204          ADRVEC0  DB	MSTI0+1		array of eight interrupt routine addresses (LSBs only)
001370  207                   DB	MSTI1+1		 these are pointers to where we'll store the entry
001371  212                   DB	MSTI2+1		 points of each of our 8 millisecond interrupt
001372  215                   DB	MSTI3+1		 user service routines
001373  235                   DB        MSTI4+1		the second four only get control every 4th millisecond
001374  243                   DB	MSTI5+1          in rotation
001375  251                   DB	MSTI6+1     
001376  257                   DB	MSTI7+1
001377  001                   HALT    
		     *
		     .  READ_KBD -- Get keyboard character
		     .     Turn on the cursor, and wait for a character to be typed
		     .    On exit, A = character typed on keyboard
		     .
001400  006  341     READ_KBD LA        341         cnt = 2	address CRT/keyboard
001402  121                   EX_ADR  
001403  006  020              LA        020
001405  131                   EX_COM1 				turn on the cursor
001406  101                   INPUT   				get status
001407  044  002              ND        002			does keyboard have a character for us?
001411  150  000 003          JTZ       SR_CD 			 wait if not
001414  250                   XRA     				otherwise
001415  131                   EX_COM1 				 turn off the cursor
001416  125                   EX_DATA 				get the keyboard character
001417  101                   INPUT   
001420  007                   RETURN  				 and return
		     *
		     .  DSPOD  --  Display Octal Digit
		     .     On entry,  A = digit to display (low order 3 bits)
		     .                E = CRT column to display octal digit, minus 1
		     .     On exit,   E = incremented to reflect column was displayed in
		     .
001421  044  007     DSPOD    ND        007         cnt = 3	get just low order 3 bits
001423  004  060              AD        "0"		convert to octal digit
001425  310                   LBA     			save that in B for now
		     *
		     .  DSPCH  --  Display Character
		     .     On entry,  B = character to display
		     .                E = CRT column to display character, minus 1
		     .     On exit,   E = incremented to reflect column was displayed in
		     .
001426  106  345 004 SR_CF    CALL      CRTWW          cnt = 5	wait for CRT to be write-ready
001431  006  001              LA        001		bump column to next column for next time
001433  204                   ADE     
001434  340                   LEA     			 save back in E
001435  133                   EX_COM2 			position to that column of display line
001436  301                   LAB     			get the character to display there
001437  127                   EX_WRITE			display the character there
001440  007                   RETURN  			 and return
		     *
001441  046  104     SR_CG    LE        104         cnt = 3
001443  026  040              LC        040
001445  106  311 004          CALL      SR_DI 
001450  106  000 003 SR_CH    CALL      READ_KBD      cnt = 2
001453  320                   LCA     
001454  074  064              CP        064
001456  100  050 003          JFC       SR_CH 
001461  024  060              SU        060
001463  140  050 003          JTC       SR_CH 
001466  066  005              LL        005
001470  056  000              LH        000
001472  370                   LMA     
001473  106  317 004          CALL      SR_DJ 
001476  006  074              LA        074
001500  121                   EX_ADR  
001501  307                   LAM     
001502  131                   EX_COM1 
001503  101                   INPUT   
001504  106  362 004          CALL      JP_DL 
001507  106  060 002 JP_CI    CALL      DSKWAT
001512  140  041 003          JTC       SR_CG 
001515  026  061              LC        061
001517  106  307 004          CALL      SR_DH 
001522  026  000              LC        000		set millisecond timer interrupt zero		
001524  046  357              LE        357		 to routine here 02357
001526  036  004              LD        004
001530  106  041 002          CALL      SETI$ 
001533  106  060 002          CALL      DSKWAT
001536  140  041 003          JTC       SR_CG 
001541  006  004              LA        004
001543  131                   EX_COM1 
001544  016  004              LB        004
001546  026  001              LC        001
001550  301          JP_CJ    LAB     
001551  024  001              SU        001
001553  310                   LBA     
001554  140  250 003          JTC       JP_CN 
001557  012                   SRC     
001560  012                   SRC     
001561  064  011              OR        011
001563  131                   EX_COM1 
001564  250                   XRA     
001565  330                   LDA     
001566  137                   EX_COM4 
001567  302          SR_CK    LAC              cnt = 2
001570  127                   EX_WRITE
001571  006  001              LA        001
001573  203                   ADD     
001574  330                   LDA     
001575  110  167 003          JFZ       SR_CK 
001600  040          JP_CL    DI      
001601  125                   EX_DATA 
001602  101                   INPUT   
001603  272                   CPC     
001604  112  227 003          CFZ       JP_CM 
001607  006  001              LA        001
001611  203                   ADD     
001612  330                   LDA     
001613  110  200 003          JFZ       JP_CL 
001616  302                   LAC     
001617  002                   SLC     
001620  140  150 003          JTC       JP_CJ 
001623  320                   LCA     
001624  104  167 003          JMP       SR_CK 
001627  301          JP_CM    LAB     
001630  064  060              OR        060
001632  320                   LCA     
001633  046  102              LE        102
001635  106  311 004          CALL      SR_DI 
001640  006  074              LA        074
001642  121                   EX_ADR  
001643  006  004              LA        004
001645  131                   EX_COM1 
001646  125                   EX_DATA 
001647  007                   RETURN 
		     . 
001650  026  062     JP_CN    LC        062
001652  106  307 004          CALL      SR_DH 
001655  106  060 002 JP_CO    CALL      DSKWAT
001660  006  010              LA        010
001662  131                   EX_COM1 
001663  106  060 002          CALL      DSKWAT
001666  140  255 003          JTC       JP_CO 
001671  026  063              LC        063
001673  106  307 004          CALL      SR_DH 
001676  106  035 004 JP_CP    CALL      JP_CX 
001701  140  276 003          JTC       JP_CP 
001704  026  064              LC        064
001706  106  307 004          CALL      SR_DH 
001711  036  000     JP_CQ    LD        000
001713  106  060 002 JP_CR    CALL      DSKWAT
001716  140  347 003          JTC       JP_CT 
001721  153                   EX_CLICK
001722  006  001              LA        001
001724  203                   ADD     
001725  330                   LDA     
001726  074  115              CP        115
001730  150  337 003          JTZ       JP_CS 
001733  133                   EX_COM2 
001734  104  313 003          JMP       JP_CR 
		     .
001737  250          JP_CS    XRA     
001740  133                   EX_COM2 
001741  106  060 002          CALL      DSKWAT
001744  100  355 003          JFC       JP_CU 
001747  006  010     JP_CT    LA        010
001751  131                   EX_COM1 
001752  104  311 003          JMP       JP_CQ 
		     .
001755  026  065     JP_CU    LC        065
001757  106  307 004          CALL      SR_DH 
001762  016  020              LB        020
001764  036  000              LD        000
001766  106  041 004 JP_CV    CALL      JP_CY 
001771  142  017 004          CTC       JP_CW 
001774  153                   EX_CLICK
001775  006  001              LA        001
001777  203                   ADD     
002000  330                   LDA     
002001  074  115              CP        115
002003  110  366 003          JFZ       JP_CV 
002006  046  040              LE        040
002010  324                   LCE     
002011  106  311 004          CALL      SR_DI 
002014  104  107 003          JMP       JP_CI 
		     .
002017  046  074     JP_CW    LE        074
002021  323                   LCD     
002022  016  105              LB        105
002024  040                   DI      
002025  106  367 004          CALL      JP_DM 
002030  046  000              LE        000
002032  016  020              LB        020
002034  007                   RETURN  
		     .
002035  016  020     JP_CX    LB        020
002037  036  000              LD        000
002041  006  014     JP_CY    LA        014
002043  066  113              LL        113
002045  056  004              LH        004
002047  370                   LMA     
002050  056  004     JP_CZ    LH        004
002052  004  076              AD        076
002054  360                   LLA     
002055  347                   LEM     
002056  106  052 002          CALL      DR$  
002061  043                   RTC     
002062  066  113              LL        113
002064  056  004              LH        004
002066  307                   LAM     
002067  024  001              SU        001
002071  370                   LMA     
002072  110  050 004          JFZ       JP_CZ 
002075  007                   RETURN  
002076  012                   SRC     
002077  007                   RETURN  
002100  004  001              AD        001
002102  013                   RFZ     
002103  010                   SYNC    
002104  005                   ---     
002105  002                   SLC     
002106  014  011              AC        011
002110  006  003              LA        003
002112  000                   HALT    
002113  000                   HALT    
002114  020          JP_DA    BETA    
002115  026  000              LC        000
002117  030                   ALPHA   
002120  026  000              LC        000
002122  066  000     JP_DB    LL        000
002124  056  010              LH        010
002126  070                   PUSH    
002127  305          JP_DC    LAH     
002130  206                   ADL     
002131  202                   ADC     
002132  002                   SLC     
002133  002                   SLC     
002134  370                   LMA     
002135  106  011 002          CALL      INCHL 
002140  044  077              ND        077
002142  110  127 004          JFZ       JP_DC 
002145  060                   POP     
002146  305          JP_DD    LAH     
002147  206                   ADL     
002150  202                   ADC     
002151  002                   SLC     
002152  002                   SLC     
002153  277                   CPM     
002154  112  234 004          CFZ       JP_DG 
002157  106  345 004 JP_DE    CALL      CRTWW 		wait for CRT to be write-ready
002162  044  006              ND        006
002164  110  157 004          JFZ       JP_DE 
002167  106  011 002          CALL      INCHL 
002172  044  077              ND        077
002174  110  146 004          JFZ       JP_DD 
002177  302                   LAC     
002200  004  001              AD        001
002202  320                   LCA     
002203  106  212 004          CALL      JP_DF 
002206  153                   EX_CLICK
002207  104  122 004          JMP       JP_DB 
		     .
002212  046  115     JP_DF    LE        115
002214  324                   LCE     
002215  106  317 004          CALL      SR_DJ 
002220  020                   BETA    
002221  046  005              LE        005
002223  006  001              LA        001
002225  202                   ADC     
002226  320                   LCA     
002227  106  377 004          CALL      SR_DN 
002232  030                   ALPHA   
002233  007                   RETURN  
		     .
002234  332          JP_DG    LDC     
002235  006  060              LA        060
002237  245                   NDH     
002240  012                   SRC     
002241  012                   SRC     
002242  012                   SRC     
002243  012                   SRC     
002244  004  061              AD        061
002246  320                   LCA     
002247  046  103              LE        103
002251  106  311 004          CALL      SR_DI 
002254  046  040              LE        040
002256  016  114              LB        114
002260  106  026 003          CALL      SR_CF 
002263  016  040              LB        040
002265  106  026 003          CALL      SR_CF 
002270  325                   LCH     
002271  106  377 004          CALL      SR_DN 
002274  016  040              LB        040
002276  106  026 003          CALL      SR_CF 
002301  326                   LCL     
002302  106  377 004          CALL      SR_DN 
002305  323                   LCD     
002306  007                   RETURN  
		     *		     
		     .
002307  046  124     SR_DH    LE        "T"         cnt = 5
		     *		     
		     .   Scroll the display, and display two characters to the CRT display bottom row
		     .   On entry, E = character to be displayed leftmost column
		     .		   C = character to be displayed (third place, position 2)
		     .   On exit,  characters displayed as requested
		     .             CRT is addressed
		     .		   INTERRUPTS DISABLED
		     .
002311  106  345 004 SR_DI    CALL      CRTWW          cnt = 4	wait for CRT to be write-ready
002314  006  010              LA        010		scroll the CRT up one line
002316  131                   EX_COM1 
002317  106  345 004 SR_DJ    CALL      CRTWW          cnt = 2	wait for CRT to be write-ready
002322  250                   XRA     
002323  133                   EX_COM2 			position to leftmost character of the line
002324  006  013              LA        013
002326  135                   EX_COM3 			position to bottommost line of CRT display
002327  106  345 004          CALL      CRTWW 		wait for CRT to be write-ready
002332  304                   LAE     			get the character to be displayed
002333  127                   EX_WRITE			 display that character on the screen (leftmost byte)
002334  106  345 004          CALL      CRTWW 		wait for CRT to be write-ready
002337  006  002              LA        002		then position to third character (position 2)
002341  133                   EX_COM2 
002342  302                   LAC     			 display that character onto the screen
002343  127                   EX_WRITE
002344  007                   RETURN  
		     *
		     .  CRTWW  --  CRT Write Ready Wait
		     .     Address CRT, wait until it's ready to accept a character
		     .	   On return, CRT can be written
		     .                CRT/keyboard is addressed
		     .		      INTERRUPTS DISABLED!
		     .
002345  006  341     CRTWW    LA        341         cnt = 8	address the CRT/keyboard
002347  040                   DI 			disable interrupts     
002350  121                   EX_ADR  			address the CRT/keyboard
002351  101                   INPUT   			check the status
002352  012                   SRC     			 is it ready to write?
002353  100  345 004          JFC       CRTWW 		 if not, keep waiting until it is (ints disabled!)
002356  007                   RETURN  			then return (ready to write to display)
		     *
		     .     This is a millisecond interrupt routine (0)
		     .
002357  101                   INPUT   
002360  272                   CPC     
002361  053                   RTZ     
002362  320          JP_DL    LCA     
002363  046  040              LE        040
002365  016  123              LB        123
002367  106  026 003 JP_DM    CALL      SR_CF 
002372  016  040              LB        040
002374  106  026 003          CALL      SR_CF 
		     .
		     .  Display the C value in octal to the display
		     .
002377  302          SR_DN    LAC              cnt = 3	get byte to display
002400  002                   SLC     			get high order 2 bits at low end of A
002401  002                   SLC     
002402  044  003              ND        003		extract just low order 2 bits
002404  106  021 003          CALL      DSPOD  		display those as octal digit
002407  302                   LAC     			get the byte to display again
002410  012                   SRC     			shift 3 bits to the right
002411  012                   SRC     
002412  012                   SRC     
002413  106  021 003          CALL      DSPOD  		display middle octal digit of C value
002416  302                   LAC     			get byte to display again
002417  106  021 003          CALL      DSPOD  		display low order octal digit of C value
002422  006  074              LA        074
002424  121                   EX_ADR  
002425  007                   RETURN  
		     .
002426  070          JP_DO    PUSH    
002427  364                   LLE     
002430  353                   LHD     
002431  070                   PUSH    
002432  362                   LLC     
002433  351                   LHB     
002434  070                   PUSH    
002435  350                   LHA     
002436  006  000              LA        000
002440  310                   LBA     
002441  320                   LCA     
002442  100  047 005          JFC       JP_DP 
002445  006  200              LA        200
002447  120  054 005 JP_DP    JFS       JP_DQ 
002452  016  100              LB        100
002454  150  071 005 JP_DQ    JTZ       SR_DS 
002457  160  064 005          JTS       JP_DR 
002462  026  002              LC        002
002464  170  071 005 JP_DR    JTP       SR_DS 
002467  064  001              OR        001
002471  261          SR_DS    ORB              cnt = 2
002472  262                   ORC     
002473  360                   LLA     
002474  070                   PUSH    
002475  006  341              LA        341		address the CRT/keyboard
002477  121                   EX_ADR  
002500  066  243              LL        243
002502  056  007              LH        007
002504  307                   LAM     
002505  044  177     JP_DT    ND        177
002507  150  132 005          JTZ       JP_DV 
002512  137                   EX_COM4 
002513  106  011 002          CALL      INCHL 
002516  307          JP_DU    LAM     
002517  260                   ORA     
002520  160  105 005          JTS       JP_DT 
002523  127                   EX_WRITE
002524  106  011 002          CALL      INCHL 
002527  104  116 005          JMP       JP_DU 

002532  131          JP_DV    EX_COM1 
002533  066  243              LL        243
002535  370                   LMA     
002536  046  244              LE        244
002540  060          JP_DW    POP     
002541  306                   LAL     
002542  315                   LBH     
002543  364                   LLE     
002544  056  007              LH        007
002546  370                   LMA     
002547  006  001              LA        001
002551  206                   ADL     
002552  360                   LLA     
002553  371                   LMB     
002554  006  001              LA        001
002556  206                   ADL     
002557  340                   LEA     
002560  074  314              CP        314
002562  110  140 005          JFZ       JP_DW 
002565  066  370     JP_DX    LL        370
002567  056  007              LH        007
002571  327                   LCM     
002572  066  371              LL        371
002574  317                   LBM     
002575  362                   LLC     
002576  351                   LHB     
002577  070                   PUSH    
002600  302                   LAC     
002601  002                   SLC     
002602  320                   LCA     
002603  301                   LAB     
002604  210                   ACA     
002605  310                   LBA     
002606  066  005              LL        005
002610  046  010              LE        010
002612  036  112              LD        112
002614  106  225 006          CALL      SR_EE 
002617  060                   POP     
002620  070                   PUSH    
002621  327                   LCM     
002622  106  011 002          CALL      INCHL 
002625  317                   LBM     
002626  302                   LAC     
002627  002                   SLC     
002630  320                   LCA     
002631  301                   LAB     
002632  210                   ACA     
002633  310                   LBA     
002634  066  005              LL        005
002636  046  012              LE        012
002640  106  225 006          CALL      SR_EE 
002643  060                   POP     
002644  046  011              LE        011
002646  106  275 006          CALL      CRTPOS
002651  006  040              LA        040
002653  127                   EX_WRITE
002654  101                   INPUT   
002655  101                   INPUT   
002656  307                   LAM     
002657  127                   EX_WRITE
002660  012                   SRC     
002661  320                   LCA     
002662  044  177              ND        177
002664  310                   LBA     
002665  066  003              LL        003
002667  106  233 006          CALL      JP_EF 
002672  106  300 005          CALL      DEBUG 
002675  104  165 005          JMP       JP_DX 
		     .
		     .  Get debug command
		     .
002700  046  013     DEBUG    LE        013         cnt = 3	displaying on bottom line
002702  036  106              LD        106		column 72 decimal
002704  026  000              LC        000		initially clear BC pair
002706  312                   LBC     
002707  106  275 006          CALL      CRTPOS		address & position on display
002712  006  222              LA        222		turn on cursor, erase to end of line
002714  131                   EX_COM1 
		     .
		     .  Get the first/next debug character entered at the keyboard
		     .
002715  101          DEBUG1   INPUT            cnt = 2	get CRT status again
002716  044  002              ND        002		 is there a keyboard character ready for us?
002720  150  315 005          JTZ       DEBUG1 		if not, keep waiting until there is
002723  101                   INPUT   			then check status again
002724  044  014              ND        014		are both KEYBOARD/DISPLAY keys pressed?
002726  074  014              CP        014
002730  150  006 007          JTZ       JP_EP		 if so, go process that 
002733  006  200     JP_EA    LA        200
002735  131                   EX_COM1 
002736  125                   EX_DATA 
002737  101                   INPUT   
002740  056  007              LH        007
002742  074  015              CP        015		is it a RETURN character?
002744  150  347 006          JTZ       JP_EL 
002747  074  030              CP        030		is it a CANCEL character>
002751  150  300 005          JTZ       DEBUG 
002754  074  056              CP        "."		is it a period (.) character?
002756  150  021 007          JTZ       JP_EQ 
002761  074  155              CP        "m"		is it an "m" character?
002763  150  365 006          JTZ       SR_EO 
002766  074  151              CP        "i"		is it an "i" character?
002770  150  027 007          JTZ       SR_ER 
002773  074  144              CP        "d"		is it a "d" character?
002775  150  305 006          JTZ       DEB_DEC 
003000  074  143              CP        "c"		is it a "c" character?
003002  150  054 007          JTZ       JP_ET 
003005  074  152              CP        "j"		is it a "j" character?
003007  150  063 007          JTZ       JP_EU 
003012  074  154              CP        "l"		is it an "l" character?
003014  150  326 006          JTZ       JP_EK 
003017  074  163              CP        "s"		is it an "s" character?
003021  150  036 007          JTZ       JP_ES 
003024  074  141              CP        "a"		is it an "a" character?
003026  150  153 007          JTZ       JP_EX 
003031  074  157              CP        "o"		is it an "o" character?
003033  150  041 003          JTZ       SR_CG 
003036  074  164              CP        "t"		is it a "t" character?
003040  150  114 004          JTZ       JP_DA 
003043  074  146              CP        "f"		is it an "f" character?
003045  150  200 007          JTZ       JP_FB 
003050  074  173              CP        "{"		is it an "{" character?
003052  100  065 006          JFC       JP_EB 
003055  074  166              CP        "v"		is it a "v" character?
003057  150  205 007          JTZ       JP_FC 
003062  100  207 007          JFC       JP_FD 
003065  106  155 006 JP_EB    CALL      DEBREG  
003070  150  173 007          JTZ       JP_FA 
003073  350                   LHA     
003074  024  060              SU        060
003076  160  151 006          JTS       SR_EC 
003101  074  010              CP        010
003103  120  151 006          JFS       SR_EC 
003106  360                   LLA     
003107  301                   LAB     
003110  200                   ADA     
003111  200                   ADA     
003112  200                   ADA     
003113  310                   LBA     
003114  302                   LAC     
003115  002                   SLC     
003116  002                   SLC     
003117  002                   SLC     
003120  320                   LCA     
003121  044  007              ND        007
003123  261                   ORB     
003124  310                   LBA     
003125  302                   LAC     
003126  044  370              ND        370
003130  266                   ORL     
003131  320                   LCA     
003132  106  275 006          CALL      CRTPOS
003135  305                   LAH     
003136  127                   EX_WRITE
003137  006  220              LA        220		turn cursor on
003141  131                   EX_COM1 
003142  006  001              LA        001
003144  203                   ADD     			position to next column
003145  330                   LDA     
003146  104  315 005          JMP       DEBUG1 		let them enter another character there
		     .
		     .  when we get here, didn't recognize the command... go let them try again
		     .
003151  151          SR_EC    EX_BEEP          cnt = 3	beep,
003152  104  300 005          JMP       DEBUG 		 then go get another character from keyboard
		     *
		     .  DEBREG  --  Check if they entered register name or flags
		     .     This routine checks if the character entered was a register name or flags
		     .     On entry, A is the character that was entered...
		     .     On exit,  ZERO TRUE:  was a valid register name/flags code
		     .				 L is the LSB of the saved register value location
		     .
003155  066  245     DEBREG   LL        SAVEDA
003157  074  101              CP        "A"		is it an "A" character?
003161  053                   RTZ     
003162  066  247              LL        SAVEDB
003164  074  102              CP        "B"		is it a "B" character?
003166  053                   RTZ     
003167  066  246              LL        SAVEDC
003171  074  103              CP        "C"		is it a "C" character?
003173  053                   RTZ     
003174  066  251              LL        SAVEDD
003176  074  104              CP        "D"		is it a "D" character?
003200  053                   RTZ     
003201  066  250              LL        SAVEDE
003203  074  105              CP        "E"		is it an "E" character?
003205  053                   RTZ     
003206  066  253              LL        SAVEDH
003210  074  110              CP        "H"		is it an "H" character?
003212  053                   RTZ     
003213  066  252              LL        SAVEDL
003215  074  114              CP        "L"		is it an "L" character?
003217  053                   RTZ     
003220  066  244              LL        SAVEDFL
003222  074  106              CP        "F"		is it an "F" character?  (Flags)
003224  007                   RETURN  
		     .
003225  106  275 006 SR_EE    CALL      CRTPOS         cnt = 2
003230  006  200              LA        200
003232  131                   EX_COM1 
003233  006  040     JP_EF    LA        040
003235  127                   EX_WRITE
003236  301          JP_EG    LAB     
003237  002                   SLC     
003240  002                   SLC     
003241  002                   SLC     
003242  310                   LBA     
003243  044  007              ND        007
003245  004  060              AD        060
003247  127                   EX_WRITE
003250  301                   LAB     
003251  044  370              ND        370
003253  310                   LBA     
003254  302                   LAC     
003255  002                   SLC     
003256  002                   SLC     
003257  002                   SLC     
003260  320                   LCA     
003261  044  007              ND        007
003263  261                   ORB     
003264  310                   LBA     
003265  306                   LAL     
003266  024  001              SU        001
003270  360                   LLA     
003271  110  236 006          JFZ       JP_EG 
003274  007                   RETURN  
		     *
		     .  CRTPOS  -- Set position on CRT display
		     .     Set CRT display position
		     .     On entry, D = column to display to (0-79)
		     .               E = row to display to (0-11)
		     .	   On exit,  display is addressed, cursor positioned, ready to write there
		     .		     INTERRUPTS DISABLED
		     .
003275  106  345 004 CRTPOS   CALL      CRTWW          cnt = 4	wait for CRT to be write-ready
003300  303                   LAD     
003301  133                   EX_COM2 			set column position as requested
003302  304                   LAE     
003303  135                   EX_COM3 			set row position as requested
003304  007                   RETURN  			 then return
		     *
		     .  Decrement the address saved in MEMPTR 
		     .
003305  036  377     DEB_DEC  LD        377		set DE to -1
003307  343                   LED   
		     .
		     .  can also add one if enter here with DE = 0001
		     .  
003310  066  370     JP_EJ    LL        MEMPTR					
003312  056  007              LH        007		high order byte of MEMPTR address
003314  307                   LAM     			pick up byte at MEMPTR
003315  204                   ADE     			 add/subtract one
003316  370                   LMA     			 and save back at MEMPTR
003317  066  371              LL        MEMPTR+1	pick up byte at MEMPTR+1
003321  307                   LAM     			 
003322  213                   ACD     			 add/subtract one (with carry/borrow)
003323  104  357 006          JMP       JP_EN		  make sure it's legal and save back at MEMPTR+1 
		     *
		     .  Get the memory address saved in MEMPTR into HL  (H already set right)
		     .
003326  066  370     JP_EK    LL        MEMPTR
003330  307                   LAM     
003331  066  371              LL        MEMPTR+1
003333  357                   LHM     
003334  360                   LLA     			HL now contains address from MEMPTR
		     .  pick up the two-byte address from there into BC
003335  327                   LCM     
003336  106  011 002          CALL      INCHL 
003341  317                   LBM 
		     .  Next save the BC address to MEMPTR1
003342  056  007              LH        007
003344  104  353 006          JMP       SR_EM 
		     .
003347  303          JP_EL    LAD     
003350  074  106              CP        106
003352  053                   RTZ 
		     .
003353  066  370     SR_EM    LL        MEMPTR1         cnt = 3
003355  372                   LMC       		save the LSB from C there
003356  301                   LAB     			get the MSB
		     .  Save the A byte at MEMPTR1+1 as a valid memory MSB
003357  044  077     JP_EN    ND        077		make sure it's legal 14-bit memory address
003361  066  371              LL        MEMPTR1+1	
003363  370                   LMA     			save the legal memory address MSB there
003364  007                   RETURN
		     . 
		     .     Save the bytes in BC at the memory address pointed to by MEMPTR1
003365  066  370     SR_EO    LL        MEMPTR1         cnt = 2
003367  307                   LAM     
003370  066  371              LL        MEMPTR1+1
003372  357                   LHM     
003373  360                   LLA     
003374  372                   LMC     
		     .      ...and the byte in B to the following location
003375  106  011 002          CALL      INCHL 
003400  301                   LAB     
003401  260                   ORA     
003402  053                   RTZ     			unless it's zero, don't save those
003403  371                   LMB     			save the high-order byte from B
003404  153                   EX_CLICK			click before returning
003405  007                   RETURN  			 then return (HL points at last byte maybe saved)
		     .					ZERO TRUE:  B byte was zero, not saved
		     .
003406  303          JP_EP    LAD     
003407  074  106              CP        106
003411  110  333 005          JFZ       JP_EA 
003414  125                   EX_DATA 
003415  101                   INPUT   
003416  320                   LCA     
003417  056  007              LH        007
003421  106  365 006 JP_EQ    CALL      SR_EO 		save the BC pair at address pointed to by MEMPTR1
003424  112  027 007          CFZ       SR_ER 
003427  046  001     SR_ER    LE        001         cnt = 2
003431  036  000              LD        000
003433  104  310 006          JMP       JP_EJ		increment MEMPTR1 and return
		     . 		
003436  302          JP_ES    LAC     
003437  074  014              CP        014
003441  100  151 006          JFC       SR_EC 
003444  200                   ADA     
003445  004  254              AD        254
003447  320                   LCA     
003450  315                   LBH     
003451  104  353 006          JMP       SR_EM 
003454  060          JP_ET    POP     
003455  066  026              LL        026
003457  056  005              LH        005
003461  070                   PUSH    
003462  070                   PUSH    
003463  060          JP_EU    POP     
		     .
003464  056  007              LH        007		set H to MSB of MEMPTR1 location
003466  303                   LAD     
003467  074  106              CP        106
003471  150  102 007          JTZ       JP_EW 
		     .
003474  066  370              LL        MEMPTR1		store BC at MEMPTR1
003476  372                   LMC     
003477  066  371              LL        MEMPTR1+1
003501  371                   LMB     
003502  066  370     JP_EW    LL        MEMPTR1		pick up MEMPTR1 value into HL
003504  307                   LAM     
003505  066  371              LL        MEMPTR1+1
003507  357                   LHM     
003510  360                   LLA     
003511  070                   PUSH    			save that address onto the stack
003512  066  253              LL        SAVEDH		pick up SAVEDH value into HL
003514  056  007              LH        007		 address MSB to saved registers area
003516  307                   LAM     
003517  066  252              LL        SAVEDL   
003521  367                   LLM     
003522  350                   LHA     
003523  070                   PUSH    			save that HL address onto the stack too
003524  066  244              LL        SAVEDFL
003526  056  007              LH        007
003530  307                   LAM     			pick up and restore saved flags
003531  200                   ADA     			 restore flags
003532  066  245              LL        SAVEDA		pick up saved A
003534  307                   LAM     
003535  066  247              LL        SAVEDB		pick up saved B
003537  317                   LBM     
003540  066  246              LL        SAVEDC		pick up saved C
003542  327                   LCM     
003543  066  251              LL        SAVEDD		pick up saved D
003545  337                   LDM     
003546  066  250              LL        SAVEDE		pick up saved E
003550  347                   LEM     
003551  060                   POP     			restore saved HL value
003552  007                   RETURN  
		     .
003553  303          JP_EX    LAD     
003554  074  106              CP        106
003556  066  372              LL        372
003560  150  164 007          JTZ       JP_EY 
003563  372                   LMC     
003564  307          JP_EY    LAM     
003565  121                   EX_ADR  
003566  300                   NOP     
003567  101          JP_EZ    INPUT   
003570  066  374              LL        374
003572  370                   LMA     
003573  326          JP_FA    LCL     
003574  315                   LBH     
003575  104  353 006          JMP       SR_EM 
003600  006  125     JP_FB    LA        125
003602  104  214 007          JMP       JP_FE
		     . 
003605  006  173     JP_FC    LA        173
003607  024  167     JP_FD    SU        167
003611  002                   SLC     
003612  004  127              AD        127
003614  066  237     JP_FE    LL        237		overwrite the HALT instruction below
003616  370                   LMA     			 with the instruction ? in A
003617  303                   LAD     
003620  074  106              CP        106
003622  150  230 007          JTZ       JP_FF 
003625  066  373              LL        373
003627  372                   LMC     
003630  066  372     JP_FF    LL        372
003632  307                   LAM     
003633  121                   EX_ADR  
003634  066  373              LL        373
003636  307                   LAM     
003637  000                   HALT   			overwritten just above! 
003640  104  167 007          JMP       JP_EZ 

003643  260                   ORA     

003644  076          SAVEDFL  ---     			saved flags
003645  105          SAVEDA   ---     			saved A
003646  111          SAVEDC   ---     
003647  121          SAVEDB   EX_ADR  
003650  076          SAVEDE   ---     
003651  021          SAVEDD   ---     
		     .
003652  041          SAVEDL     ---     
003653  177                   EX_TSTOP
003654  001                   HALT    
003655  001                   HALT    
003656  043                   RTC     
003657  105                   ---     
003660  105                   ---     
003661  111                   ---     
003662  061                   ---     
003663  102  101 111          CFC       JP_A  
003666  125                   EX_DATA 
003667  042                   ---     
003670  014  024              AC        024
003672  044  177              ND        177
003674  004  162              AD        162
003676  121                   EX_ADR  
003677  121                   EX_ADR  
003700  121                   EX_ADR  
003701  116                   ---     
003702  036  051              LD        051
003704  111                   ---     
003705  111                   ---     
003706  106  100 107          CALL      JP_EV 
003711  110  120 140          JFZ       JP_A  
003714  314                   LBE     
003715  177                   EX_TSTOP
003716  001                   HALT    
003717  001                   HALT    
003720  001                   HALT    
003721  001                   HALT    
003722  177                   EX_TSTOP
003723  040                   DI      
003724  030                   ALPHA   
003725  040                   DI      
003726  177                   EX_TSTOP
003727  323                   LCD     
003730  061                   ---     
003731  111                   ---     
003732  111                   ---     
003733  111                   ---     
003734  106  100 100          CALL      JP_G  
003737  177                   EX_TSTOP
003740  100  100 302          JFC       JP_BN 
003743  177                   EX_TSTOP
003744  111                   ---     
003745  111                   ---     
003746  111                   ---     
003747  066  076              LL        076
003751  101                   INPUT   
003752  101                   INPUT   
003753  101                   INPUT   
003754  042                   ---     
003755  177                   EX_TSTOP
003756  101                   INPUT   
003757  101                   INPUT   
003760  042                   ---     
003761  034  177              SB        177
003763  111                   ---     
003764  111                   ---     
003765  111                   ---     
003766  101                   INPUT   
003767  240                   NDA
		     .
003770  000          MEMPTR1  DB	0,0    
003772  000                   HALT    
003773  000                   HALT    
003774  000                   HALT    
003775  200                   ADA     
003776  300                   NOP     
003777  300                   NOP