M100 TS-DOS ROM Compression

From Bitchin100 DocGarden
Jump to navigationJump to search

TS-DOS Model 100/102 ROM Compression Routines

This code, as you can see, has not been disassembled yet.

; =========================================================================================
; Compress / Decompress a file a .DO file
; =========================================================================================
5000H  CALL 5008H
5003H  RET

5004H  CALL 500FH
5007H  RET

5008H  XRA A
5009H  STA F69EH
500CH  JMP 5018H


; =========================================================================================
; Perform compression / decompression
; =========================================================================================
500FH  (3EH) MVI A,0CH
5011H  (32H) STA F69EH
5014H  (E7H) RST 4          ; Send character in A to screen/printer
5015H  (CDH) CALL 5347H
5018H  (22H) SHLD F69BH
501BH  (21H) LXI H,534BH
501EH  (11H) LXI D,F685H    ; Keyboard buffer
5021H  (01H) LXI B,0015H
5024H  (CDH) CALL 5318H
5027H  (3EH) MVI A,50H
5029H  (32H) STA F69DH
502CH  (AFH) XRA A
502DH  (32H) STA F69FH
5030H  (CDH) CALL 533BH
5033H  (2AH) LHLD F69BH
5036H  (CDH) CALL 5333H
5039H  (EBH) XCHG
503AH  (D5H) PUSH D
503BH  (CDH) CALL 52ABH
503EH  (00H) NOP
503FH  (2EH) MVI L,7EH
5041H  (C2H) JNZ 5046H
5044H  (2EH) MVI L,80H
5046H  (01H) LXI B,0000H
5049H  (1AH) LDAX D
504AH  (BDH) CMP L
504BH  (DAH) JC 504FH
504EH  (03H) INX B
504FH  (13H) INX D
5050H  (FEH) CPI 1AH
5052H  (C2H) JNZ 5049H
5055H  (E1H) POP H
5056H  (3AH) LDA F69EH
5059H  (D6H) SUI 0CH
505BH  (C2H) JNZ 5060H      ; Generate IE error
505EH  (47H) MOV B,A
505FH  (4FH) MOV C,A
5060H  (CDH) CALL 533FH
5063H  (D8H) RC
5064H  (2BH) DCX H
5065H  (E5H) PUSH H
5066H  (CDH) CALL 52A5H
5069H  (C2H) JNZ 5098H
506CH  (CDH) CALL 52ABH
506FH  (DCH) CC 5307H
5072H  (C3H) JMP 521AH

5075H  (CDH) CALL 5323H
5078H  (DAH) JC 5075H
507BH  (CDH) CALL 5337H
507EH  (C9H) RET

507FH  (4FH) MOV C,A
5080H  (FEH) CPI 3AH
5082H  (D0H) RNC
5083H  (FEH) CPI 20H
5085H  (37H) STC
5086H  (C8H) RZ
5087H  (FEH) CPI 2FH
5089H  (C8H) RZ
508AH  (3FH) CMC
508BH  (C9H) RET

508CH  (D6H) SUI 2FH
508EH  (D0H) RNC
508FH  (3EH) MVI A,0BH
5091H  (C9H) RET

5092H  (FEH) CPI 3AH
5094H  (C0H) RNZ
5095H  (3EH) MVI A,20H
5097H  (C9H) RET

5098H  (D5H) PUSH D
5099H  (00H) NOP
509AH  (00H) NOP
509BH  (01H) LXI B,0000H
509EH  (C5H) PUSH B
509FH  (E1H) POP H
50A0H  (03H) INX B
50A1H  (13H) INX D
50A2H  (1AH) LDAX D
50A3H  (FEH) CPI 5BH
50A5H  (D2H) JNC 50A0H
50A8H  (FEH) CPI 1AH
50AAH  (CAH) JZ 50B7H
50ADH  (FEH) CPI 41H
50AFH  (DAH) JC 50A1H
50B2H  (00H) NOP
50B3H  (23H) INX H
50B4H  (C3H) JMP 50A1H

50B7H  (C5H) PUSH B
50B8H  (D1H) POP D
50B9H  (DFH) RST 3          ; Compare DE and HL
50BAH  (D1H) POP D
50BBH  (DAH) JC 50C6H
50BEH  (CDH) CALL 5307H
50C1H  (3EH) MVI A,43H
50C3H  (32H) STA F69DH
50C6H  (AFH) XRA A
50C7H  (32H) STA F69FH
50CAH  (CDH) CALL 520AH
50CDH  (CDH) CALL 518AH
50D0H  (D2H) JNC 515EH
50D3H  (CDH) CALL 507FH
50D6H  (00H) NOP
50D7H  (D2H) JNC 5117H
50DAH  (13H) INX D
50DBH  (1AH) LDAX D
50DCH  (CDH) CALL 5080H
50DFH  (1BH) DCX D
50E0H  (47H) MOV B,A
50E1H  (79H) MOV A,C
50E2H  (D2H) JNC 5117H
50E5H  (C2H) JNZ 50EEH
50E8H  (B8H) CMP B
50E9H  (CAH) JZ 5136H
50ECH  (00H) NOP
50EDH  (00H) NOP
50EEH  (13H) INX D
50EFH  (21H) LXI H,F69FH
50F2H  (00H) NOP
50F3H  (7EH) MOV A,M
50F4H  (B7H) ORA A
50F5H  (C2H) JNZ 50FFH
50F8H  (3EH) MVI A,7EH
50FAH  (77H) MOV M,A
50FBH  (E1H) POP H
50FCH  (77H) MOV M,A
50FDH  (23H) INX H
50FEH  (E5H) PUSH H
50FFH  (79H) MOV A,C
5100H  (CDH) CALL 508CH
5103H  (00H) NOP
5104H  (4FH) MOV C,A
5105H  (78H) MOV A,B
5106H  (CDH) CALL 508CH
5109H  (C6H) ADI 0BH
510BH  (0DH) DCR C
510CH  (C2H) JNZ 5109H
510FH  (C6H) ADI 7AH
5111H  (E1H) POP H
5112H  (77H) MOV M,A
5113H  (E5H) PUSH H
5114H  (C3H) JMP 50CAH

5117H  (E1H) POP H
5118H  (FEH) CPI 0DH
511AH  (C2H) JNZ 512AH
511DH  (13H) INX D
511EH  (1AH) LDAX D
511FH  (FEH) CPI 0AH
5121H  (1BH) DCX D
5122H  (3EH) MVI A,0DH
5124H  (C2H) JNZ 512AH
5127H  (13H) INX D
5128H  (3EH) MVI A,80H
512AH  (77H) MOV M,A
512BH  (E5H) PUSH H
512CH  (3AH) LDA F69FH
512FH  (B7H) ORA A
5130H  (C2H) JNZ 50C6H
5133H  (00H) NOP
5134H  (00H) NOP
5135H  (7EH) MOV A,M
5136H  (21H) LXI H,F684H
5139H  (06H) MVI B,07H
513BH  (05H) DCR B
513CH  (CAH) JZ 50CAH
513FH  (23H) INX H
5140H  (BEH) CMP M
5141H  (C2H) JNZ 513BH
5144H  (0EH) MVI C,15H
5146H  (CDH) CALL 518AH
5149H  (D2H) JNC 515EH
514CH  (21H) LXI H,F685H    ; Keyboard buffer
514FH  (BEH) CMP M
5150H  (CAH) JZ 517BH
5153H  (0DH) DCR C
5154H  (CCH) CZ 520AH
5157H  (CAH) JZ 5184H
515AH  (23H) INX H
515BH  (C3H) JMP 514FH

515EH  (32H) STA F69AH
5161H  (AFH) XRA A
5162H  (32H) STA F69FH
5165H  (78H) MOV A,B
5166H  (FEH) CPI 07H
5168H  (D2H) JNC 516EH
516BH  (CDH) CALL 520AH
516EH  (E1H) POP H
516FH  (36H) MVI M,FFH
5171H  (E5H) PUSH H
5172H  (3AH) LDA F69AH
5175H  (CDH) CALL 5195H
5178H  (C3H) JMP 50CAH

517BH  (79H) MOV A,C
517CH  (C6H) ADI 15H
517EH  (05H) DCR B
517FH  (C2H) JNZ 517CH
5182H  (C6H) ADI 6BH
5184H  (E1H) POP H
5185H  (77H) MOV M,A
5186H  (E5H) PUSH H
5187H  (C3H) JMP 50CAH

518AH  (13H) INX D
518BH  (1AH) LDAX D
518CH  (FEH) CPI 1AH
518EH  (CAH) JZ 52BAH
5191H  (FEH) CPI 7EH
5193H  (C9H) RET

5194H  (7EH) MOV A,M
5195H  (4FH) MOV C,A
5196H  (3AH) LDA F69EH
5199H  (B7H) ORA A
519AH  (79H) MOV A,C
519BH  (C1H) POP B
519CH  (E1H) POP H
519DH  (23H) INX H
519EH  (C2H) JNZ 51A2H
51A1H  (77H) MOV M,A
51A2H  (E5H) PUSH H
51A3H  (C5H) PUSH B
51A4H  (C8H) RZ
51A5H  (E7H) RST 4          ; Send character in A to screen/printer
51A6H  (D5H) PUSH D
51A7H  (6FH) MOV L,A
51A8H  (3AH) LDA F63AH      ; Cursor column (1-40)
51ABH  (2FH) CMA
51ACH  (C6H) ADI 2CH
51AEH  (67H) MOV H,A
51AFH  (7DH) MOV A,L
51B0H  (CDH) CALL 51D7H
51B3H  (00H) NOP
51B4H  (00H) NOP
51B5H  (3FH) CMC
51B6H  (CAH) JZ 51C4H
51B9H  (D2H) JNC 51C7H      ; Print current STAT settings
51BCH  (13H) INX D
51BDH  (1AH) LDAX D
51BEH  (CDH) CALL 51D7H
51C1H  (C3H) JMP 51B6H

51C4H  (CDH) CALL 532FH
51C7H  (CDH) CALL 5075H
51CAH  (00H) NOP
51CBH  (D1H) POP D
51CCH  (C8H) RZ
51CDH  (FEH) CPI 20H
51CFH  (DAH) JC 52BAH
51D2H  (CCH) CZ 5327H
51D5H  (00H) NOP
51D6H  (C9H) RET

51D7H  (25H) DCR H
51D8H  (C8H) RZ
51D9H  (FEH) CPI 21H
51DBH  (3FH) CMC
51DCH  (D0H) RNC
51DDH  (FEH) CPI FEH
51DFH  (3DH) DCR A
51E0H  (D0H) RNC
51E1H  (D6H) SUI 7FH
51E3H  (CAH) JZ 5200H
51E6H  (D8H) RC
51E7H  (25H) DCR H
51E8H  (00H) NOP
51E9H  (C8H) RZ
51EAH  (F5H) PUSH PSW
51EBH  (3AH) LDA F69FH
51EEH  (B7H) ORA A
51EFH  (01H) LXI B,050BH
51F2H  (C2H) JNZ 51F8H
51F5H  (01H) LXI B,0015H
51F8H  (F1H) POP PSW
51F9H  (90H) SUB B
51FAH  (90H) SUB B
51FBH  (00H) NOP
51FCH  (D8H) RC
51FDH  (3CH) INR A
51FEH  (FEH) CPI 6AH
5200H  (3DH) DCR A
5201H  (D0H) RNC
5202H  (80H) ADD B
5203H  (91H) SUB C
5204H  (D8H) RC
5205H  (C2H) JNZ 5203H
5208H  (3CH) INR A
5209H  (C9H) RET

520AH  (C1H) POP B
520BH  (E1H) POP H
520CH  (23H) INX H
520DH  (E5H) PUSH H
520EH  (C5H) PUSH B
520FH  (C9H) RET

5210H  (AFH) XRA A
5211H  (32H) STA F69FH
5214H  (CDH) CALL 518AH
5217H  (C3H) JMP 522FH      ; TELCOM CALL instruction routine

521AH  (CDH) CALL 52ABH
521DH  (C2H) JNZ 5210H
5220H  (CDH) CALL 518AH
5223H  (DAH) JC 522FH       ; TELCOM CALL instruction routine
5226H  (C2H) JNZ 5239H
5229H  (32H) STA F69FH
522CH  (C3H) JMP 521AH

522FH  (CDH) CALL 5195H
5232H  (AFH) XRA A
5233H  (32H) STA F69FH
5236H  (C3H) JMP 521AH

5239H  (FEH) CPI 80H
523BH  (C2H) JNZ 5248H
523EH  (3EH) MVI A,0DH
5240H  (CDH) CALL 5195H
5243H  (3EH) MVI A,0AH
5245H  (C3H) JMP 522FH      ; TELCOM CALL instruction routine

5248H  (FEH) CPI FEH
524AH  (CAH) JZ 5281H
524DH  (D2H) JNC 5210H
5250H  (4FH) MOV C,A
5251H  (3AH) LDA F69FH
5254H  (B7H) ORA A
5255H  (79H) MOV A,C
5256H  (CAH) JZ 5281H
5259H  (D6H) SUI 86H
525BH  (DAH) JC 521AH
525EH  (01H) LXI B,0000H
5261H  (0CH) INR C
5262H  (D6H) SUI 0BH
5264H  (D2H) JNC 5261H
5267H  (C6H) ADI 3BH
5269H  (CDH) CALL 5092H
526CH  (32H) STA F69AH
526FH  (79H) MOV A,C
5270H  (C6H) ADI 2FH
5272H  (CDH) CALL 5092H
5275H  (CDH) CALL 5195H
5278H  (3AH) LDA F69AH
527BH  (CDH) CALL 5195H
527EH  (C3H) JMP 521AH

5281H  (D6H) SUI 81H
5283H  (21H) LXI H,F68BH
5286H  (2BH) DCX H
5287H  (D6H) SUI 15H
5289H  (D2H) JNC 5286H
528CH  (C6H) ADI 16H
528EH  (32H) STA F69AH
5291H  (CDH) CALL 5194H
5294H  (3AH) LDA F69AH
5297H  (21H) LXI H,F69AH
529AH  (2BH) DCX H
529BH  (3DH) DCR A
529CH  (C2H) JNZ 529AH
529FH  (CDH) CALL 5194H
52A2H  (C3H) JMP 521AH

52A5H  (3AH) LDA F69EH
52A8H  (FEH) CPI 0CH
52AAH  (C8H) RZ
52ABH  (2AH) LHLD F69BH
52AEH  (01H) LXI B,000AH
52B1H  (09H) DAD B
52B2H  (7EH) MOV A,M
52B3H  (FEH) CPI 50H
52B5H  (C8H) RZ
52B6H  (FEH) CPI 43H
52B8H  (37H) STC
52B9H  (C9H) RET

52BAH  (32H) STA F69AH
52BDH  (C5H) PUSH B
52BEH  (CDH) CALL 52A5H
52C1H  (C1H) POP B
52C2H  (D1H) POP D
52C3H  (E1H) POP H
52C4H  (FEH) CPI 0CH
52C6H  (C2H) JNZ 52D6H
52C9H  (3AH) LDA F69AH
52CCH  (FEH) CPI 1AH
52CEH  (CCH) CZ 5327H
52D1H  (CDH) CALL 532BH
52D4H  (BFH) CMP A
52D5H  (C9H) RET

52D6H  (D6H) SUI 43H
52D8H  (CAH) JZ 52E6H
52DBH  (D6H) SUI 0FH
52DDH  (CAH) JZ 52E6H
52E0H  (78H) MOV A,B
52E1H  (FEH) CPI 07H
52E3H  (D2H) JNC 52E7H
52E6H  (23H) INX H
52E7H  (E5H) PUSH H
52E8H  (2BH) DCX H
52E9H  (01H) LXI B,FFFFH
52ECH  (3EH) MVI A,1AH
52EEH  (03H) INX B
52EFH  (23H) INX H
52F0H  (BEH) CMP M
52F1H  (C2H) JNZ 52EEH
52F4H  (E1H) POP H
52F5H  (CDH) CALL 5343H
52F8H  (CDH) CALL 52ABH
52FBH  (CAH) JZ 5304H
52FEH  (3AH) LDA F69DH
5301H  (77H) MOV M,A
5302H  (BFH) CMP A
5303H  (C9H) RET

5304H  (36H) MVI M,4FH
5306H  (C9H) RET

5307H  (21H) LXI H,F686H
530AH  (3EH) MVI A,14H
530CH  (F5H) PUSH PSW
530DH  (7EH) MOV A,M
530EH  (E6H) ANI DFH
5310H  (77H) MOV M,A
5311H  (F1H) POP PSW
5312H  (3DH) DCR A
5313H  (C8H) RZ
5314H  (23H) INX H
5315H  (C3H) JMP 530CH

5318H  (7EH) MOV A,M
5319H  (12H) STAX D
531AH  (23H) INX H
531BH  (13H) INX D
531CH  (0BH) DCX B
531DH  (78H) MOV A,B
531EH  (B1H) ORA C
531FH  (C2H) JNZ 5318H
5322H  (C9H) RET

5323H  (CFH) RST 1          ; Call main ROM at address in following 2 bytes
5324H  DW    7283H
5326H  (C9H) RET

5327H  (CFH) RST 1          ; Call main ROM at address in following 2 bytes
5328H  DW    12CBH
532AH  (C9H) RET

532BH  (CFH) RST 1          ; Call main ROM at address in following 2 bytes
532CH  DW    4231H
532EH  (C9H) RET

532FH  (CFH) RST 1          ; Call main ROM at address in following 2 bytes
5330H  DW    4222H
5332H  (C9H) RET

5333H  (CFH) RST 1          ; Call main ROM at address in following 2 bytes
5334H  DW    5AE3H
5336H  (C9H) RET

5337H  (CFH) RST 1          ; Call main ROM at address in following 2 bytes
5338H  DW    7242H
533AH  (C9H) RET

533BH  (CFH) RST 1          ; Call main ROM at address in following 2 bytes
533CH  DW    2146H
533EH  (C9H) RET

533FH  (CFH) RST 1          ; Call main ROM at address in following 2 bytes
5340H  DW    6B6DH)
5342H  (C9H) RET

5343H  (CFH) RST 1          ; Call main ROM at address in following 2 bytes
5344H  DW    6B9FH
5346H  (C9H) RET

5347H  (CFH) RST 1          ; Call main ROM at address in following 2 bytes
5348H  DW    4244H
534AH  (C9H) RET

; =========================================================================================
; Keystoke buffer contents (for performing compression?)
; =========================================================================================
534BH  DB    "etaoinrshdlfcmugypwb"

Navigate to: