4000           DATA >AA01,>0000,>4010,>0000,>4016,>0000,>406C,>0000,>0000
4012           DATA >40F4,>0000,>4020,>416E,>0552,>5332,>3332,>402C,>416E
4024           DATA >0752,>5332,>3332,>2F31,>4038,>4174,>0752,>5332,>3332
4036           DATA >2F32,>4040,>415E,>0350,>494F,>404A,>415E,>0550,>494F
4048           DATA >2F31,>4054,>4164,>0550,>494F,>2F32,>4060,>4180,>0752
405A           DATA >5332,>3332,>2F33,>0000,>417A,>0752,>5332,>3332,>2F34
406C           DATA >0000,>40D2,>0000,>0800,>0303,>4543,>4512,>4352,>4518
407E           DATA >4C46,>451E,>4E55,>4524,>4441,>4570,>4241,>4536,>5041
4090           DATA >4540,>5457,>4596,>4348,>452A,>0000,>0028,>40B6,>0030
40A2           DATA >40C4,>0000,>006E,>012C,>0258,>04B0,>0960,>12C0,>2580
40B4           DATA >0000,>8563,>8482,>8209,>015B,>8082,>8041,>002B,>85AA
40C6           DATA >849C,>8271,>01A1,>809C,>804E,>8027

4000 AA             BYTE >AA		Identification
4001 01             BYTE 1		Version number
4002 00             BYTE 0		Number of programs
4003 00             BYTE 0		Reserved
4004 4010           DATA >4010		Power up routine
4006 0000           DATA 0		User program header
4008 4016           DATA >4016		DSR Header
400A 0000           DATA 0		Subroutine link header
400C 406C           DATA >406C          Address of interrupt link
400E 0000           DATA 0		Address of BASIC subroutine libraries

4010 0000           DATA 0		Power up routines
4012 40F4           DATA >40F4

4014 0000           DATA 0

4016 4020           DATA >4020          DEVICE NAME TABLES LIST
     416E           DATA >416E
     05             BYTE 5
     5253323332     TEXT 'RS232'
4020 402C           DATA >402C
     416E           DATA >416E
     07             BYTE 7
     52533233322F31 TEXT 'RS232/1'
402C 4038           DATA >4038
     4174           DATA >4174
     07             BYTE 7
     52533233322F32 TEXT 'RS232/2'
4038 4040           DATA >4040
     415E           DATA >415E
     03             BYTE 3
     50495F         TEXT 'PIO'
4040 404A           DATA >404A
     415E           DATA >415E
     05             BYTE 5
     50494F2F31     TEXT 'PIO/1'
404A 4054           DATA >4054
     4164           DATA >4164
     05             BYTE 5
     50494F2F32     TEXT 'PIO/2'
4054 4060           DATA >4060
     4180           DATA >4180
     07             BYTE 7
     52533233322F33 TEXT 'RS232/3'
4060 0000           DATA 0
     417A           DATA >417A
     07             BYTE 7
     52533233322F34 TEXT 'RS232/4'

406C 0000           DATA 0
     40D2           DATA >40D2          INTERRUPT ROUTINE ADDRESS
     0000           DATA 0
     0800           DATA >0800
     0303           DATA >0303

4076 4543           DATA 'EC'		These options can be used with
     4512           DATA >4512		any I/O op code except LOAD and SAVE
     4352           DATA 'CR'
     4518           DATA >4518
     4C46           DATA 'LF'
     451E           DATA >451E
     4E55           DATA 'NU'
     4524           DATA >4524
     4441           DATA 'DA'
     4570           DATA >4570
408A 4241           DATA 'BA'		These option can be used with any
     4536           DATA >4536		I/O op code
     5041           DATA 'PA'
     4540           DATA >4540
     5457           DATA 'TW'
     4596           DATA >4596
     4348           DATA 'CH'
     452A           DATA >452A
     0000           DATA 0

* Possible clock speeds and corresponding baud rate table

409C 0028           DATA >0028		2.5 Mhz
     40B6           DATA >40B6
     0030           DATA >0030		3.0 Mhz
     40C4           DATA >40C4
     0000           DATA 0

40A6 006E           DATA 110
     012C           DATA 300
     0258           DATA 600
     04B0           DATA 1200
     0960           DATA 2400
     12C0           DATA 4800
     2580           DATA 9600
     0000           DATA 0

* 2.5 MHz Baud rate table

40B6 8563           DATA >8563		110
     8482           DATA >8482		300
     8209           DATA >8209		600
     015B           DATA >015B		1200
     8082           DATA >8082		2400
     8041           DATA >8041		4800
     002B           DATA >002B		9600

* 3.0 MHz Baud rate table

40C4 85AA           DATA >85AA		110
     949C           DATA >949C		300
     8271           DATA >8271		600
     01A1           DATA >01A1		1200
     809C           DATA >809C		2400
     804E           DATA >804E		4800
     8027           DATA >8027		9600

*************************************************************************
*									*
*  Interrupt routine							*
*									*
*     This routine gets called if the 9902 chip has interrupts enabled	*
*  and the chip sends an interrupt signal.  It checks to see if a byte	*
*  of information has been received by either 9902.  If so, it stores	*
*  it in a buffer in VDP RAM.  If not it resets both 9902s.		*
*									*
*************************************************************************

40D2 02A4           STWP R4
40D4 1D07           SBO  7		Turn on LED
40D6 C14B           MOV  R11,R5
40D8 C18C           MOV  R12,R6
40DA 022C 0040      AI   R12,>0040
40DE 1F10           TB   16		Receiver interrupt?
40E0 1316           JEQ  >410E
40E2 1F1F           TB   31		Interrupt?
40E4 1306           JEQ  >40F2
40E6 022C 0040      AI   R12,>0040
40EA 1F10           TB   16		Receiver interrupt?
40EC 1310           JEQ  >410E
40EE 1F1F           TB   31		Interrupt?
40F0 1632           JNE  >4156		*BUG* should be JNE  >4158
40F2 C306           MOV  R6,R12
40F4 C18C           MOV  R12,R6		Power up routine
40F6 1D07           SBO  7		Turn on LED
40F8 1D02           SBO  2
40FA 1E01           SBZ  1
40FC 022C 0040      AI   R12,>0040
4100 1D1F           SBO  31		Reset 9902 chip on port 1
4102 022C 0040      AI   R12,>0040
4106 1D1F           SBO  31		Reset 9902 chip on port 2
4108 C306           MOV  R6,R12
410A 1E07           SBZ  7		Turn off LED
410C 045B           RT

410E 06A0 4874      BL   @>4874		Make sure data is there
4112 1621           JNE  >4156
4114 D064 FF24      MOVB @>FF24(R4),R1
4118 B060 45F9      AB   @>45F9,R1	Add 1 to R1
411C 9901 FF22      CB   R1,@>FF22(R4)
4120 1201           JLE  >4124
4122 04C1           CLR  R1
4124 9901 FF23      CB   R1,@>FF23(R4)
4128 1306           JEQ  >4136
412A 3607           STCR R7,8		Read data byte
412C 1F09           TB   9		Receive error?
412E 1607           JNE  >413E
4130 0207 FF00      LI   R7,>FF00	If error, store a >FF
4134 1004           JMP  >413E
4136 0207 FE00      LI   R7,>FE00	Buffer overflow, store a >FE
413A D064 FF24      MOVB @>FF24(R4),R1
413E D901 FF24      MOVB R1,@>FF24(R4)
4142 0981           SRL  R1,8
4144 A064 FF20      A    @>FF20(R4),R1
4148 0241 3FFF      ANDI R1,>3FFF
414C 06A0 484E      BL   @>484E
4150 4000           DATA >4000
4152 DBC7 FFFE      MOVB R7,@>FFFE(R15)		Store in VDP buffer
4156 1D12           SBO  18		Set Receive Interrupt Enable
4158 C306           MOV  R6,R12
415A 1E07           SBZ  7		Turn off LED
415C 0455           B    *R5

*************************************************************************
*									*
*  PIO and PIO/1 DSR Routine						*
*									*
*************************************************************************

415E 0206 0001      LI   R6,>0001
4162 1002           JMP  >4168

*************************************************************************
*									*
*  PIO/2 DSR Routine							*
*									*
*************************************************************************

4164 0206 0002      LI   R6,>0002
4168 0703           SETO R3
416A 04C2           CLR  R2
416C 1011           JMP  >4190

*************************************************************************
*									*
*  RS232 and RS232/1 DSR Routine					*
*									*
*************************************************************************

416E 0206 0001      LI   R6,>0001
4172 1008           JMP  >4184

*************************************************************************
*									*
*  RS232/2 DSR Routine							*
*									*
*************************************************************************

4174 0206 0001      LI   R6,>0001
4178 1008           JMP  >418A

*************************************************************************
*									*
*  RS232/4 DSR Routine							*
*									*
*************************************************************************

417A 0206 0002      LI   R6,>0002
417E 1005           JMP  >418A

*************************************************************************
*									*
*  RS232/3 DSR Routine							*
*									*
*************************************************************************

4180 0206 0002      LI   R6,>0002	R6 = RS232 card #
4184 0202 0040      LI   R2,>0040	R2 = CRU offset
4188 1002           JMP  >418E
418A 0202 0080      LI   R2,>0080

418E 04C3           CLR  R3
4190 02A4           STWP R4
4192 C90B FF84      MOV  R11,@>FF84(R4)
4196 8181           C    R1,R6
4198 1302           JEQ  >419E
419A 0460 4480      B    @>4480		Wrong card, quit
419E C184           MOV  R4,R6
41A0 0226 FF78      AI   R6,>FF78
41A4 0205 0006      LI   R5,6
41A8 04F6           CLR  *R6+
41AA 0605           DEC  R5
41AC 16FD           JNE  >41A8
41AE 1D07           SBO  7		Turn on LED
41B0 A302           A    R2,R12
41B2 06A0 4842      BL   @>4842		Set VDP read address to PAB
41B6 0000           DATA 0
41B8 0205 000A      LI   R5,>000A
41BC C184           MOV  R4,R6
41BE 0226 FF6A      AI   R6,>FF6A
41C2 DDAF FBFE      MOVB @>FBFE(R15),*R6+	COPY PAB TO >834A (10 bytes)
41C6 0605           DEC  R5
41C8 16FC           JNE  >41C2
41CA 5920 460B FF6B SZCB @>460B,@>FF6B(R4)	Set error code to >00
41D0 9920 40B3 FF6A CB   @>40B3,@>FF6A(R4)
41D6 1606           JNE  >41E4
41D8 F920 4132 FF7D SOCB @>4132,@>FF7D(R4)
41DE 5920 40B3 FF6A SZCB @>40B3,@>FF6A(R4)
41E4 9824 FF6A 41A7 CB   @>FF6A(R4),@>41A7	Check I/O op code
41EA 1202           JLE  >41F0
41EC 0460 4450      B    @>4450			If op code > 6, error
41F0 06A0 4490      BL   @>4490			Parse the string
41F4 D164 FF6A      MOVB @>FF6A(R4),R5		Put I/O op code in R5
41F8 0985           SRL  R5,8
41FA 0A15           SLA  R5,1
41FC C165 4202      MOV  @>4202(R5),R5		Get address from jump table
4200 0455           B    *R5

* I/O op code jump table

4202 4210           DATA >4210		I/O op code 0 - OPEN
4204 4464           DATA >4464		I/O op code 1 - CLOSE
4206 4236           DATA >4236		I/O op code 2 - READ
4208 42FA           DATA >42FA		I/O op code 3 - WRITE
420A 4450           DATA >4450		I/O op code 4 - Illegal
420C 4338           DATA >4338		I/O op code 5 - LOAD
420E 43D2           DATA >43D2		I/O op code 6 - SAVE

*************************************************************************
*									*
*  I/O op code 0 - OPEN							*
*									*
*************************************************************************

4210 D0A4 FF6E      MOVB @>FF6E(R4),R2		R2 = record length
4214 1609           JNE  >4228
4216 06A0 4842      BL   @>4842			If record length is 0,
421A 4004           DATA >4004			set it to the default 80
421C 0202 5000      LI   R2,>5000
4220 D902 FF6E      MOVB R2,@>FF6E(R4)
4224 DBC2 FFFE      MOVB R2,@>FFFE(R15)
4228 D064 FF6B      MOVB @>FF6B(R4),R1
422C 2060 43CA      COC  @>43CA,1		Sequential?
4230 1663           JNE  >42F8
4232 0460 444A      B    @>444A			Error #2

*************************************************************************
*									*
*  I/O op code 2 - READ							*
*									*
*************************************************************************

4236 0743           ABS  R3
4238 5920 4132 FF6F SZCB @>4132,@>FF6F(R4)
423E D1E4 FF6E      MOVB @>FF6E(R4),R7
4242 C264 FF6C      MOV  @>FF6C(R4),R9
4246 06A0 4740      BL   @>4740
424A 1607           JNE  >425A
424C 06A0 463A      BL   @>463A
4250 9187           CB   R7,R6
4252 1402           JHE  >4258
4254 0460 4456      B    @>4456
4258 C1C6           MOV  R6,R7
425A 0987           SRL  R7,8
425C 1348           JEQ  >42EE
425E 06A0 463A      BL   @>463A
4262 06A0 4740      BL   @>4740
4266 133A           JEQ  >42DC
4268 D064 FF78      MOVB @>FF78(R4),R1
426C 1307           JEQ  >427C
426E 06A0 474A      BL   @>474A
4272 1334           JEQ  >42DC
4274 0286 0D00      CI   R6,>0D00
4278 1631           JNE  >42DC
427A 1039           JMP  >42EE
427C 0286 0D00      CI   R6,>0D00
4280 1325           JEQ  >42CC
4282 0286 7F00      CI   R6,>7F00
4286 1312           JEQ  >42AC
4288 0286 1200      CI   R6,>1200
428C 1625           JNE  >42D8
428E C064 FF6C      MOV  @>FF6C(R4),R1
4292 06A0 4850      BL   @>4850
4296 06A0 46EE      BL   @>46EE
429A C089           MOV  R9,R2
429C 60A4 FF6C      S    @>FF6C(R4),R2
42A0 1003           JMP  >42A8
42A2 06A0 47DE      BL   @>47DE
42A6 0602           DEC  R2
42A8 16FC           JNE  >42A2
42AA 10D9           JMP  >425E
42AC 8264 FF6C      C    @>FF6C(R4),R9
42B0 13D6           JEQ  >425E
42B2 0587           INC  R7
42B4 0609           DEC  R9
42B6 C049           MOV  R9,R1
42B8 06A0 4850      BL   @>4850
42BC 06A0 47DE      BL   @>47DE
42C0 0286 0D00      CI   R6,>0D00
42C4 16CC           JNE  >425E
42C6 06A0 4700      BL   @>4700
42CA 10C9           JMP  >425E
42CC 06A0 474A      BL   @>474A
42D0 1303           JEQ  >42D8
42D2 06A0 46EE      BL   @>46EE
42D6 100B           JMP  >42EE
42D8 06A0 47E6      BL   @>47E6
42DC C049           MOV  R9,R1
42DE 06A0 484E      BL   @>484E
42E2 4000           DATA >4000
42E4 DBC6 FFFE      MOVB R6,@>FFFE(R15)
42E8 0589           INC  R9
42EA 0607           DEC  R7
42EC 16B8           JNE  >425E
42EE 6264 FF6C      S    @>FF6C(R4),R9
42F2 0A89           SLA  R9,8
42F4 D909 FF6F      MOVB R9,@>FF6F(R4)
42F8 101D           JMP  >4334
42FA C0C3           MOV  R3,R3

*************************************************************************
*									*
*  I/O op code 3 - WRITE						*
*									*
*************************************************************************

42FC 1301           JEQ  >4300
42FE 0703           SETO R3
4300 C064 FF6C      MOV  @>FF6C(R4),R1
4304 06A0 4850      BL   @>4850
4308 D1E4 FF6F      MOVB @>FF6F(R4),R7
430C 06A0 4740      BL   @>4740
4310 1603           JNE  >4318
4312 C187           MOV  R7,R6
4314 06A0 47E6      BL   @>47E6
4318 0987           SRL  R7,8
431A 1304           JEQ  >4324
431C 06A0 47DE      BL   @>47DE
4320 0607           DEC  R7
4322 16FC           JNE  >431C
4324 06A0 4740      BL   @>4740
4328 1305           JEQ  >4334
432A 06A0 474A      BL   @>474A
432E 1302           JEQ  >4334
4330 06A0 46EE      BL   @>46EE
4334 0460 4464      B    @>4464

*************************************************************************
*									*
*  I/O op code 4 - LOAD							*
*									*
*************************************************************************

4338 C024 FF70      MOV  @>FF70(R4),R0
433C 06A0 47E4      BL   @>47E4
4340 1600           NOP
4342 0205 0007      LI   R5,>0007
4346 0201 C01C      LI   R1,>C01C
434A 06A0 4870      BL   @>4870
434E 1307           JEQ  >435E
4350 0601           DEC  R1
4352 16FB           JNE  >434A
4354 06A0 4880      BL   @>4880
4358 0605           DEC  R5
435A 16F5           JNE  >4346
435C 10EF           JMP  >433C
435E 0709           SETO R9
4360 06A0 45C6      BL   @>45C6
4364 C1C6           MOV  R6,R7
4366 06A0 45C6      BL   @>45C6
436A 0986           SRL  R6,8
436C E1C6           SOC  R6,R7
436E 06A0 45A0      BL   @>45A0
4372 06A0 46B4      BL   @>46B4
4376 8248           C    R8,R9
4378 1304           JEQ  >4382
437A 06A0 47E4      BL   @>47E4
437E 1500           NOP
4380 10EE           JMP  >435E
4382 81C0           C    R0,R7
4384 1A68           JL   >4456
4386 06A0 47E4      BL   @>47E4
438A 0600           DEC  R0
438C 06A0 4686      BL   @>4686
4390 0709           SETO R9
4392 C04A           MOV  R10,R1
4394 06A0 484E      BL   @>484E
4398 4000           DATA >4000
439A 06A0 45C6      BL   @>45C6
439E DBC6 FFFE      MOVB R6,@>FFFE(R15)
43A2 0607           DEC  R7
43A4 16FA           JNE  >439A
43A6 06A0 45A0      BL   @>45A0
43AA C0C3           MOV  R3,R3
43AC 1302           JEQ  >43B2
43AE 06A0 48A2      BL   @>48A2		Slight delay
43B2 8209           C    R9,R8
43B4 1306           JEQ  >43C2
43B6 C1E4 FF80      MOV  @>FF80(R4),R7
43BA 06A0 47E4      BL   @>47E4
43BE 1500           NOP
43C0 10E7           JMP  >4390
43C2 06A0 47E4      BL   @>47E4
43C6 0600           DEC  R0
43C8 022A 0100      AI   R10,>0100
43CC C1E4 FF7E      MOV  @>FF7E(R4),R7
43D0 10DD           JMP  >438C

*************************************************************************
*									*
*  I/O op code 5 - SAVE							*
*									*
*************************************************************************

43D2 C04A           MOV  R10,R1
43D4 06A0 4850      BL   @>4850
43D8 06A0 463A      BL   @>463A
43DC 0286 1600      CI   R6,>1600
43E0 16FB           JNE  >43D8
43E2 0709           SETO R9
43E4 C0C3           MOV  R3,R3
43E6 1302           JEQ  >43EC
43E8 06A0 48A2      BL   @>48A2		Slight delay
43EC C1A4 FF70      MOV  @>FF70(R4),R6
43F0 06A0 45D0      BL   @>45D0
43F4 06C6           SWPB R6
43F6 06A0 45D0      BL   @>45D0
43FA 06A0 45B4      BL   @>45B4
43FE 06A0 463A      BL   @>463A
4402 0286 0600      CI   R6,>0600
4406 16ED           JNE  >43E2
4408 C1E4 FF70      MOV  @>FF70(R4),R7
440C 06A0 4686      BL   @>4686
4410 0709           SETO R9
4412 C04A           MOV  R10,R1
4414 06A0 4850      BL   @>4850
4418 D1AF FBFE      MOVB @>FBFE(R15),R6
441C 06A0 45D0      BL   @>45D0
4420 0607           DEC  R7
4422 16FA           JNE  >4418
4424 06A0 45B4      BL   @>45B4
4428 06A0 463A      BL   @>463A
442C 0286 0600      CI   R6,>0600
4430 1307           JEQ  >4440
4432 C0C3           MOV  R3,R3
4434 1302           JEQ  >443A
4436 06A0 48A2      BL   @>48A2		Slight delay
443A C1E4 FF80      MOV  @>FF80(R4),R7
443E 10E8           JMP  >4410
4440 022A 0100      AI   R10,>0100
4444 C1E4 FF7E      MOV  @>FF7E(R4),R7
4448 10E1           JMP  >440C

* Error reporting routines

444A 0201 4000      LI   R1,>4000		I/O error code 2
444E 1008           JMP  >4460

4450 0201 6000      LI   R1,>6000		I/O error code 3
4454 1005           JMP  >4460			Illegal I/O op code

4456 0201 8000      LI   R1,>8000		I/O error code 4
445A 1002           JMP  >4460

445C 0201 C000      LI   R1,>C000		I/O error code 6

4460 F901 FF6B      SOCB R1,@>FF6B(R4)

*************************************************************************
*									*
*  I/O op code 1 - CLOSE						*
*									*
*************************************************************************

4464 06A0 4842      BL   @>4842
4468 4001           DATA >4001
446A DBE4 FF6B FFFE MOVB @>FF6B(R4),@>FFFE(R15)
4470 06A0 4842      BL   @>4842
4474 4005           DATA >4005
4476 DBE4 FF6F FFFE MOVB @>FF6F(R4),@>FFFE(R15)
447C 05E4 FF84      INCT @>FF84(R4)
4480 024C FF00      ANDI R12,>FF00
4484 C2E4 FF84      MOV  @>FF84(R4),R11
4488 1D02           SBO  2
448A 1E01           SBZ  1
448C 1E07           SBZ  7		Turn off LED
448E 045B           RT

*************************************************************************
*									*
*  This is the highly sophisticated parser.  Its job is to determine	*
*  what options have been specified.  For example .BA=300, .PA=E etc.	*
*									*
*************************************************************************

4490 C90B FF86      MOV  R11,@>FF86(R4)
4494 06A0 4730      BL   @>4730		Check for LOAD or SAVE operation
4498 1305           JEQ  >44A4
449A 0208 4076      LI   R8,>4076	Select option table
449E 0201 B200      LI   R1,>B200
44A2 1004           JMP  >44AC
44A4 0208 408A      LI   R8,>408A	Select more limited option table
44A8 0201 8300      LI   R1,>8300
44AC 0205 012C      LI   R5,>012C
44B0 C244           MOV  R4,R9
44B2 0229 FFFA      AI   R9,>FFFA
44B6 D641           MOVB R1,*R9
44B8 06A0 45F4      BL   @>45F4
44BC D024 FF73      MOVB @>FF73(R4),R0	Length of device name + options
44C0 0980           SRL  R0,8
44C2 6024 FF74      S    @>FF74(R4),R0	Subtract device name length
44C6 1217           JLE  >44F6
44C8 C064 FF76      MOV  @>FF76(R4),R1	R1 points to device name in VDP ram
44CC 06A0 4850      BL   @>4850		Set VDP read address to R1
44D0 0706           SETO R6
44D2 C000           MOV  R0,R0
44D4 1310           JEQ  >44F6
44D6 06A0 4798      BL   @>4798		Locates next '.' in options string
44DA 2E00           DATA >2E00		ASCII '.'
44DC 130C           JEQ  >44F6		If not found, we are done parsing
44DE C1C8           MOV  R8,R7		Store pointer to options table in R7
44E0 0986           SRL  R6,8
44E2 D1AF FBFE      MOVB @>FBFE(R15),R6	   Get first 2 characters of option
44E6 0600           DEC  R0
44E8 06C6           SWPB R6
44EA C077           MOV  *R7+,R1	Check for valid option
44EC 1311           JEQ  >4510		If invalid, error code #2
44EE C0B7           MOV  *R7+,R2
44F0 8181           C    R1,R6		If this the option?
44F2 16FB           JNE  >44EA		If not, try next one
44F4 0452           B    *R2		Otherwise, jump to the routine

44F6 D064 FF6A      MOVB @>FF6A(R4),R1	Get I/O op code
44FA 1307           JEQ  >450A		jump if it equals OPEN
44FC 06A0 4730      BL   @>4730		check for SAVE or LOAD
4500 1606           JNE  >450E
4502 06A0 46B2      BL   @>46B2		Display "255" at top of screen
4506 C2A4 FF6C      MOV  @>FF6C(R4),R10
450A 06A0 4822      BL   @>4822
450E 1066           JMP  >45DC
4510 109C           JMP  >444A

4512 0201 FF78      LI   R1,>FF78	EC - Echo
4516 100B           JMP  >452E
4518 0201 FF79      LI   R1,>FF79	CR
451C 1008           JMP  >452E
451E 0201 FF7A      LI   R1,>FF7A	LF
4522 1005           JMP  >452E
4524 0201 FF7C      LI   R1,>FF7C	NU
4528 1002           JMP  >452E
452A 0201 FF7B      LI   R1,>FF7B	CH
452E A044           A    R4,R1
4530 F460 4132      SOCB @>4132,*R1
4534 1034           JMP  >459E

*  BA - Baud rate selection

4536 C0C3           MOV  R3,R3
4538 1632           JNE  >459E
453A 06A0 45E2      BL   @>45E2
453E 102F           JMP  >459E

*  PA - Parity selection

4540 C0C3           MOV  R3,R3
4542 162D           JNE  >459E
4544 06A0 4798      BL   @>4798		Located next '=' in options string
4548 3D00           DATA >3D00		'='
454A 13E2           JEQ  >4510		I/O error #2
454C 5660 40A1      SZCB @>40A1,*R9
4550 0986           SRL  R6,8
4552 0286 004E      CI   R6,>004E
4556 1323           JEQ  >459E
4558 0286 0045      CI   R6,>0045
455C 1306           JEQ  >456A
455E 0286 004F      CI   R6,>004F
4562 16D6           JNE  >4510		I/O error #2
4564 F660 40A1      SOCB @>40A1,*R9
4568 101A           JMP  >459E
456A F660 422C      SOCB @>422C,*R9
456E 1017           JMP  >459E

*  DA - number of data bits

4570 C0C3           MOV  R3,R3
4572 1615           JNE  >459E
4574 06A0 4798      BL   @>4798		Locates next '=' in options string
4578 3D00           DATA >3D00		'='
457A 13CA           JEQ  >4510		I/O error #2
457C 06A0 4754      BL   @>4754
4580 F660 4074      SOCB @>4074,*R9
4584 0225 FFF9      AI   R5,>FFF9
4588 1303           JEQ  >4590
458A 0605           DEC  R5
458C 16C1           JNE  >4510		I/O error #2
458E 1002           JMP  >4594
4590 5660 45F9      SZCB @>45F9,*R9
4594 1004           JMP  >459E

* TW - Two stop bits

4596 5660 42DC      SZCB @>42DC,*R9
459A F660 4004      SOCB @>4004,*R9
459E 1099           JMP  >44D2
45A0 C90B FF86      MOV  R11,@>FF86(R4)
45A4 06A0 463A      BL   @>463A
45A8 C206           MOV  R6,R8
45AA 06A0 463A      BL   @>463A
45AE 06C6           SWPB R6
45B0 E206           SOC  R6,R8
45B2 1014           JMP  >45DC
45B4 C90B FF86      MOV  R11,@>FF86(R4)
45B8 C189           MOV  R9,R6
45BA 06A0 47E6      BL   @>47E6
45BE 06C6           SWPB R6
45C0 06A0 47E6      BL   @>47E6
45C4 100B           JMP  >45DC
45C6 C90B FF86      MOV  R11,@>FF86(R4)
45CA 06A0 463A      BL   @>463A
45CE 1004           JMP  >45D8
45D0 C90B FF86      MOV  R11,@>FF86(R4)
45D4 06A0 47E6      BL   @>47E6
45D8 06A0 47C0      BL   @>47C0
45DC C2E4 FF86      MOV  @>FF86(R4),R11
45E0 045B           RT

45E2 C90B FF88      MOV  R11,@>FF88(R4)
45E6 06A0 4798      BL   @>4798		Locates next '=' in options string
45EA 3D00           DATA >3D00		ASCII '='
45EC 1391           JEQ  >4510		I/O error #2
45EE 06A0 4754      BL   @>4754
45F2 1002           JMP  >45F8
45F4 C90B FF88      MOV  R11,@>FF88(R4)
45F8 0201 40A6      LI   R1,>40A6
45FC 04C2           CLR  R2
45FE C2F1           MOV  *R1+,R11
4600 1387           JEQ  >4510		I/O error #2
4602 82C5           C    R5,R11
4604 1302           JEQ  >460A
4606 05C2           INCT R2
4608 10FA           JMP  >45FE
460A D2E0 000C      MOVB @>000C,R11		Check clock speed
460E 098B           SRL  R11,8
4610 0201 409C      LI   R1,>409C
4614 C171           MOV  *R1+,R5
4616 1327           JEQ  >4666		Jump if clock speed is invalid
4618 82C5           C    R5,R11
461A 1302           JEQ  >4620
461C 05C1           INCT R1
461E 10FA           JMP  >4614
4620 A091           A    *R1,R2
4622 C052           MOV  *R2,R1
4624 1505           JGT  >4630
4626 F660 4072      SOCB @>4072,*R9
462A 0241 7FFF      ANDI R1,>7FFF
462E 1002           JMP  >4634
4630 5660 4072      SZCB @>4072,*R9
4634 C901 FFFE      MOV  R1,@>FFFE(R4)
4638 1023           JMP  >4680
463A C90B FF88      MOV  R11,@>FF88(R4)
463E 06A0 4870      BL   @>4870
4642 1303           JEQ  >464A
4644 06A0 4880      BL   @>4880
4648 10FA           JMP  >463E
464A C0C3           MOV  R3,R3
464C 160E           JNE  >466A
464E 04C6           CLR  R6
4650 3606           STCR R6,8
4652 1E12           SBZ  18
4654 1F0B           TB   11
4656 1307           JEQ  >4666
4658 1F0C           TB   12
465A 1305           JEQ  >4666
465C D2E4 FF7B      MOVB @>FF7B(R4),R11
4660 130F           JEQ  >4680
4662 1F0A           TB   10
4664 160D           JNE  >4680
4666 0460 445C      B    @>445C
466A 1D01           SBO  1
466C 1E02           SBZ  2
466E 1F02           TB   2
4670 1603           JNE  >4678
4672 06A0 4880      BL   @>4880
4676 10FB           JMP  >466E
4678 04C6           CLR  R6
467A D1A0 5000      MOVB @>5000,R6
467E 1D02           SBO  2
4680 C2E4 FF88      MOV  @>FF88(R4),R11
4684 045B           RT

4686 C90B FF88      MOV  R11,@>FF88(R4)
468A D1C7           MOVB R7,R7
468C 1309           JEQ  >46A0
468E 06A0 46B4      BL   @>46B4
4692 0227 FF00      AI   R7,>FF00
4696 C907 FF7E      MOV  R7,@>FF7E(R4)
469A 0207 0100      LI   R7,>0100
469E 1006           JMP  >46AC
46A0 C1C7           MOV  R7,R7
46A2 1602           JNE  >46A8
46A4 0460 4464      B    @>4464
46A8 04E4 FF7E      CLR  @>FF7E(R4)
46AC C907 FF80      MOV  R7,@>FF80(R4)
46B0 10E7           JMP  >4680
46B2 0707           SETO R7			R7 = -1
46B4 C90B FF8A      MOV  R11,@>FF8A(R4)		Save return address
46B8 04C1           CLR  R1			R1 = 0
46BA 06A0 484E      BL   @>484E			Set VDP write address to R0
46BE 4000           DATA >4000
46C0 06A0 485A      BL   @>485A			Display 14 spaces on screen

* I don't understand what they are doing here.  It just displays
* "255" at the top of the screen.

46C4 C087           MOV  R7,R2
46C6 0982           SRL  R2,8
46C8 0206 0064      LI   R6,>0064		100 decimal
46CC 04C1           CLR  R1
46CE 3C46           DIV  R6,1			255/100
46D0 0221 0030      AI   R1,>0030		'0'
46D4 0A81           SLA  R1,8
46D6 B064 FF72      AB   @>FF72(R4),R1		Add screen offset character
46DA DBC1 FFFE      MOVB R1,@>FFFE(R15)		and display on screen
46DE 04C5           CLR  R5
46E0 3D60 4796      DIV  @>4796,5		divide r5|r6 by 10
46E4 C185           MOV  R5,R6
46E6 16F2           JNE  >46CC
46E8 06A0 485A      BL   @>485A			display 14 more blanks
46EC 101E           JMP  >472A

46EE C90B FF8A      MOV  R11,@>FF8A(R4)
46F2 D2E4 FF79      MOVB @>FF79(R4),R11
46F6 1619           JNE  >472A
46F8 06A0 47E4      BL   @>47E4
46FC 0D00           SRC  R0,0
46FE 1002           JMP  >4704
4700 C90B FF8A      MOV  R11,@>FF8A(R4)
4704 D064 FF7C      MOVB @>FF7C(R4),R1
4708 1307           JEQ  >4718
470A 0205 0006      LI   R5,>0006
470E 06A0 47E4      BL   @>47E4
4712 0000           DATA 0
4714 0605           DEC  R5
4716 16FB           JNE  >470E
4718 D064 FF79      MOVB @>FF79(R4),R1
471C 1606           JNE  >472A
471E D064 FF7A      MOVB @>FF7A(R4),R1
4722 1603           JNE  >472A
4724 06A0 47E4      BL   @>47E4
4728 0A00           SLA  R0,0
472A C2E4 FF8A      MOV  @>FF8A(R4),R11		Restore return address
472E 045B           RT

*************************************************************************
*									*
*  This simple little procedure seems to set the Equal status bit if	*
*  the I/O op code is 5 or 6 (SAVE or LOAD)				*
*									*
*************************************************************************

4730 D064 FF6A      MOVB @>FF6A(R4),R1		I/O op code
4734 0981           SRL  R1,8			Move to lower byte
4736 0221 FFFB      AI   R1,>FFFB		Subtract 5
473A 1301           JEQ  >473E
473C 0601           DEC  R1
473E 045B           RT

4740 D064 FF6B      MOVB @>FF6B(R4),R1		See if we have a certain error
4744 2060 4072      COC  @>4072,1		(>0800)
4748 045B           RT

474A D064 FF6B      MOVB @>FF6B(R4),R1
474E 0241 1000      ANDI R1,>1000
4752 045B           RT

4754 C90B FF8A      MOV  R11,@>FF8A(R4)
4758 04C1           CLR  R1
475A 04CB           CLR  R11
475C 1003           JMP  >4764
475E D1AF FBFE      MOVB @>FBFE(R15),R6
4762 0600           DEC  R0
4764 C1C6           MOV  R6,R7
4766 0987           SRL  R7,8
4768 0227 FFD0      AI   R7,>FFD0
476C 110C           JLT  >4786
476E 0287 0009      CI   R7,>0009
4772 1B09           JH   >4786
4774 058B           INC  R11
4776 3860 4796      MPY  @>4796,1
477A C041           MOV  R1,R1
477C 1606           JNE  >478A
477E A087           A    R7,R2
4780 C042           MOV  R2,R1
4782 C000           MOV  R0,R0
4784 16EC           JNE  >475E
4786 C2CB           MOV  R11,R11
4788 1602           JNE  >478E
478A 0460 444A      B    @>444A
478E C141           MOV  R1,R5
4790 C2E4 FF8A      MOV  @>FF8A(R4),R11
4794 045B           RT

4796 000A           DATA 10

4798 C17B           MOV  *R11+,R5
479A 9185           CB   R5,R6
479C 1307           JEQ  >47AC
479E D1AF FBFE      MOVB @>FBFE(R15),R6
47A2 0600           DEC  R0
47A4 9185           CB   R5,R6
47A6 1302           JEQ  >47AC
47A8 C000           MOV  R0,R0
47AA 16F9           JNE  >479E
47AC C000           MOV  R0,R0
47AE 1307           JEQ  >47BE
47B0 04C6           CLR  R6
47B2 D1AF FBFE      MOVB @>FBFE(R15),R6
47B6 0600           DEC  R0
47B8 0286 2000      CI   R6,>2000
47BC 13F7           JEQ  >47AC
47BE 045B           RT

47C0 C046           MOV  R6,R1
47C2 0241 FF00      ANDI R1,>FF00
47C6 2A41           XOR  R1,9
47C8 C049           MOV  R9,R1
47CA 0941           SRL  R1,4
47CC 2849           XOR  R9,1
47CE 0241 FF00      ANDI R1,>FF00
47D2 0941           SRL  R1,4
47D4 2A41           XOR  R1,9
47D6 0B71           SRC  R1,7
47D8 2A41           XOR  R1,9
47DA 06C9           SWPB R9
47DC 045B           RT

47DE D1AF FBFE      MOVB @>FBFE(R15),R6
47E2 1001           JMP  >47E6
47E4 C1BB           MOV  *R11+,R6
47E6 C90B FF8C      MOV  R11,@>FF8C(R4)
47EA C0C3           MOV  R3,R3
47EC 160D           JNE  >4808
47EE 1D10           SBO  16
47F0 1F1B           TB   27
47F2 1602           JNE  >47F8
47F4 1F16           TB   22
47F6 1303           JEQ  >47FE
47F8 06A0 4880      BL   @>4880
47FC 10F6           JMP  >47EA
47FE 3206           LDCR R6,8
4800 1E10           SBZ  16
4802 C2E4 FF8C      MOV  @>FF8C(R4),R11
4806 045B           RT

4808 1E01           SBZ  1
480A 1F02           TB   2
480C 13F5           JEQ  >47F8
480E D806 5000      MOVB R6,@>5000
4812 1E02           SBZ  2
4814 1F02           TB   2
4816 1303           JEQ  >481E
4818 06A0 4880      BL   @>4880
481C 10FB           JMP  >4814
481E 1D02           SBO  2
4820 10F0           JMP  >4802
4822 C0C3           MOV  R3,R3
4824 1303           JEQ  >482C
4826 1D02           SBO  2
4828 1E01           SBZ  1
482A 045B           RT

482C 1D1F           SBO  31
482E 3224 FFFA      LDCR @>FFFA(R4),8
4832 1E0D           SBZ  13
4834 3324 FFFE      LDCR @>FFFE(R4),12
4838 D064 FF7D      MOVB @>FF7D(R4),R1
483C 1301           JEQ  >4840
483E 1D12           SBO  18
4840 045B           RT

4842 C064 FF76      MOV  @>FF76(R4),R1
4846 6064 FF74      S    @>FF74(R4),R1
484A 0221 FFF6      AI   R1,>FFF6
484E A07B           A    *R11+,R1
4850 D7E4 0003      MOVB @>0003(R4),*R15
4854 1000           NOP
4856 D7C1           MOVB R1,*R15
4858 045B           RT

485A 0201 2020      LI   R1,>2020
485E B064 FF72      AB   @>FF72(R4),R1
4862 0202 000E      LI   R2,>000E
4866 DBC1 FFFE      MOVB R1,@>FFFE(R15)
486A 0602           DEC  R2
486C 16FC           JNE  >4866
486E 045B           RT

4870 C0C3           MOV  R3,R3
4872 1604           JNE  >487C
4874 1F1B           TB   27	Data set ready?
4876 1601           JNE  >487A
4878 1F15           TB   21	Receive Buffer register loaded?
487A 045B           RT
487C 1F02           TB   2	
487E 045B           RT

4880 C04C           MOV  R12,R1
4882 020C 0024      LI   R12,>0024
4886 30E0 4073      LDCR @>4073,3
488A 1FF5           TB   -11
488C 1304           JEQ  >4896
488E 30E0 4074      LDCR @>4074,3
4892 1FF5           TB   -11
4894 1602           JNE  >489A
4896 C301           MOV  R1,R12
4898 045B           RT

489A C301           MOV  R1,R12
489C 0460 445C      B    @>445C		I/O error code 6

48A0 ABCD           DATA >ABCD		????
48A2 0B80           SRC  R0,8		This must be some sort of a delay
48A4 0B80           SRC  R0,8		routine
48A6 0B80           SRC  R0,8
48A8 0B80           SRC  R0,8
48AA 0B80           SRC  R0,8
48AC 0B80           SRC  R0,8
48AE 045B           RT
