From f653649bce7ea3ac26771451bc910eaa1a1e1d1a Mon Sep 17 00:00:00 2001 From: Ross Wilson Date: Sat, 12 Mar 2016 11:04:48 +0700 Subject: [PATCH] Replace old c8lds blockloader with ambidextrous --- pyasm/pyasm | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-) diff --git a/pyasm/pyasm b/pyasm/pyasm index aca097a..fdd6ffc 100755 --- a/pyasm/pyasm +++ b/pyasm/pyasm @@ -221,7 +221,7 @@ OpcodeData = { # The papertape/teletype loader code (c8lds form) ###### -BlockLoader_C8LDS = [ +X_BlockLoader_C8LDS = [ # code address assembler source code # ------- ------- ------------------------------------------------------------------------ # ; Imlac Papertape Program Block Loader @@ -419,6 +419,108 @@ BlockLoader_LC16SD = [ # END ; ] + +BlockLoader_C8LDS = [ + # 0001: ; 'c8lds' blockloader disassembled from chars.ptp. + # 0002: ; + # 0003: ; this loader is smart - it looks at the ROM code + # 0004: ; and decides if it should use PTR or TTY. + # 0005: + #03700 0006: ORG 03700 ; + # 0007: + #03677 0008: cksum equ 03677 ; store checksum just below start address + # 0009: +0001032, #03700 0010: start RCF ; 03700 0001032 +0013740, #03701 0011: JMP patch ; 03701 0013740 ; patch loadeer to use PTR or TTY +0023677, #03702 0012: rdblok DAC cksum ; 03702 0023677 ; AC is zero at this point +0037760, #03703 0013: skpzer JMS rdbyte ; 03703 0037760 ; wait for non-zero byte +0102001, #03704 0014: ASN ; 03704 0102001 +0013703, #03705 0015: JMP skpzer ; 03705 0013703 +0100006, #03706 0016: CIA ; 03706 0100006 +0023777, #03707 0017: DAC wrdcnt ; 03707 0023777 ; save word count (or load address?) +0037750, #03710 0018: JMS rdword ; 03710 0037750 ; get load address +0023776, #03711 0019: DAC ldaddr ; 03711 0023776 +0077730, #03712 0020: SAM eolval ; 03712 0077730 +0013715, #03713 0021: JMP rddata ; 03713 0013715 +0000000, #03714 0022: HLT ; 03714 0000000 +0037750, #03715 0023: rddata JMS rdword ; 03715 0037750 +0123776, #03716 0024: DAC *ldaddr ; 03716 0123776 +0037731, #03717 0025: JMS updcks ; 03717 0037731 +0033776, #03720 0026: ISZ ldaddr ; 03720 0033776 +0033777, #03721 0027: ISZ wrdcnt ; 03721 0033777 +0013715, #03722 0028: JMP rddata ; 03722 0013715 +0037750, #03723 0029: JMS rdword ; 03723 0037750 +0073677, #03724 0030: SUB cksum ; 03724 0073677 +0102001, #03725 0031: ASN ; 03725 0102001 +0013746, #03726 0032: JMP nxtblk ; 03726 0013746 +0000000, #03727 0033: HLT ; 03727 0000000 + # 0034: +0177777, #03730 0035: eolval DATA 0177777 ; 03730 0177777 ;' end-of-load' load address value + # 0036: + # 0037: ;------------------------ + # 0038: ; Update checksum. New word in AC. + # 0039: ; On exit, AC is updated checksum. + # 0040: ;------------------------ +0000000, #03731 0041: updcks DATA 0 ; 03731 0017720 +0100010, #03732 0042: CLL ; 03732 0100010 +0067677, #03733 0043: ADD cksum ; 03733 0067677 +0002004, #03734 0044: LSZ ; 03734 0002004 +0100004, #03735 0045: IAC ; 03735 0100004 +0023677, #03736 0046: DAC cksum ; 03736 0023677 +0113731, #03737 0047: JMP *updcks ; 03737 0113731 + # 0048: + # 0049: ;------------------------ + # 0050: ; Patch loader to use TTY or PTR. + # 0051: ;------------------------ +0001061, #03740 0052: patch HON ; 03740 0001061 +0063774, #03741 0053: LAC pattty ; 03741 0063774 +0023761, #03742 0054: DAC usetty ; 03742 0023761 +0005032, #03743 0055: LAW 01032 ; 03743 0005032 ; load RCF instruction +0177775, #03744 0056: SAM *romflg ; 03744 0177775 ; skip if ROM is TTY (RCF @044) +0023761, #03745 0057: DAC usetty ; 03745 0023761 ; patch this code to use PTR +0100011, #03746 0058: nxtblk CAL ; 03746 0100011 +0013702, #03747 0059: JMP rdblok ; 03747 0013702 + # 0060: + # 0061: ;------------------------ + # 0062: ; Read a word from the input device. + # 0063: ;------------------------ +0000000, #03750 0064: rdword DATA 0 ; 03750 0017711 +0100011, #03751 0065: CAL ; 03751 0100011 +0037760, #03752 0066: JMS rdbyte ; 03752 0037760 +0003003, #03753 0067: RAL 3 ; 03753 0003003 +0003003, #03754 0068: RAL 3 ; 03754 0003003 +0003002, #03755 0069: RAL 2 ; 03755 0003002 +0037760, #03756 0070: JMS rdbyte ; 03756 0037760 +0113750, #03757 0071: JMP *rdword ; 03757 0113750 + # 0072: + # 0073: ;------------------------ + # 0074: ; Read a byte. Patched to use TTY or PTR. + # 0075: ;------------------------ +0000000, #03760 0076: rdbyte DATA 0 ; 03760 0017757 +0001032, #03761 0077: usetty RCF ; 03761 0001032 +0102400, #03762 0078: HSN ; 03762 0102400 +0013762, #03763 0079: JMP .-1 ; 03763 0013762 +0002400, #03764 0080: HSF ; 03764 0002400 +0013764, #03765 0081: JMP .-1 ; 03765 0013764 +0001051, #03766 0082: HRB ; 03766 0001051 +0113760, #03767 0083: JMP *rdbyte ; 03767 0113760 + # 0084: +0002040, #03770 0085: rdtty RSF ; 03770 0002040 +0013770, #03771 0086: JMP .-1 ; 03771 0013770 +0001033, #03772 0087: RRC ; 03772 0001033 +0113760, #03773 0088: JMP *rdbyte ; 03773 0113760 + # 0089: +0013770, #03774 0090: pattty JMP rdtty ; 03774 0013770 +0000044, #03775 0091: romflg DATA 000044 ; 03775 0000044 +0000000, #03776 0092: ldaddr DATA 000000 ; 03776 0000000 +0000000, #03777 0093: wrdcnt DATA 000000 ; 03777 0000000 + # 0094: + # 0095: END ; + ] + + + + def usage(msg=None): """Print usage and optional error message."""