; ; DEC4 BBBBBBBBBBBBBBB ; ; First check if any other reception ; is completed by the arrival of this header. LDY thisma LDXAY magptr ; Is there anything coming in on this magazine? INX BEQ Newhea ; Tere wasn't. - So skip the next section... INX INX ; ctrlbl,X now points to ; first digit of page no. ; (skipping 2 byte pointer & mag.no.) LDYIM 1 checkp LDAAX ctrlbl ANDIM &0F CMPAY thisma ; +1,+2,+3,+4,+5,+6 BNE diffpa INX INY CPYIM 7 BNE checkp LDAAX ctrlbl-inuse+incons ; X pointing to inuse (I hope) ROLA BPL diffpa JMP nextro ; Duplicated header. (Curse you Antie Beeb) ************** diffpa ; NEW HEADER !!! ; --- Means terminate last page on this channel LDY thisma LDXAY magptr ; X is now index to controlblock of prev.pageon this mag. LDAIM &FF STAAY magptr ; Clear magptr(thisma) INX BEQ Newhea ; Zapped underfoot!!! DEX ; LDAAX ctrlbl+inuse ROLA BPL Newhea ; Fix for spurious reception as control block is upda00... LDAAX ctrlbl+incons ROLA BPL Newhea ; Changed underfoot... LDAAX ctrlbl+incons ANDIM TIM01 ; now consistent STAAX ctrlbl+incons ; LDAAX ctrlbl+full ORAIM flagbi ; now full STAAX ctrlbl+full ; LDAAX ctrlbl+upda00 ORAIM flagbi ; now upda00 STAAX ctrlbl+upda00 ; ... and go on to deal with new header in its own right. ; LDAAX ctrlbl+crcok ANDIM TIM01 ; CRC pending STAAX ctrlbl+crcok ; LDAAX ctrlbl+crcpre ANDIM TIM01 ; CRC pending STAAX ctrlbl+crcpre ; ; Newhea ; ; Now loop through all active ; control blocks to see if the header ; matches any of them. ; *** NOTE CBtot=(255 DIV CBlen) - 1 LDXIM ((-CBlen) :AND: &FF) ; Will index the first CB after being incremented STX CurCB CBloop LDA CurCB CMPIM (CBlen*(nopage-1)) ; Should be CBtot BNE morero JMP nextro morero CLC ADCIM CBlen TAX STA CurCB ; Go on to next CB LDAAX ctrlbl+inuse CMPIM &40 BNE CBloop ; Block not in use => try next block ; LDAAX ctrlbl+incons ROLA BPL notrec LdaAX ctrlbl+2 AndIM 7 Tay LdaAY magptr CmpIM &FF Bne CBloop JSR zapf00 ; ! Not receiv on this block... Jmp CBloop notrec LDAAX ctrlbl+hold ROLA BMI CBloop ; ! Not held by user... LDAAX ctrlbl+full ROLA BPL testpa ; <<<===prime candidate for a new page ; ! Full... BIT thishe BVS testpa ; BIT 6 is update. ; ! Accept update page when full LDAAX ctrlbl+crcok ROLA STA intzp0 ; ! Page is OK already, so reject incoming page LDAAX ctrlbl+crcpre ROLA EOR intzp0 BPL CBloop ; ! CRC being calculated => reject ; ! (CRC genuinely absent would have meant CRCOK was true) ; Otherwise, CRC present, but wrong. => RETRY testpa ; check full page no., ; (Allow wild cards) LDYIM 0 INX INX ; Skip data pointer (but not mag. no.) testlo LDAAX ctrlbl BMI wildca ANDIM &0F CMPAY thisma BNE CBloop BEQ NotWil wildca LDAAY thisma CMPIM 10 BCS CBloop ; reject page nos >9 NotWil INX INY CPYIM 7 BNE testlo ; Accept the header ; ; Set INCONSISTENT in the CB. ; Plug in the wild-carded digits. ; Store the header line as data in line 0. ; JMP nextro ; ; ; fill in wild-card digits from page received LDX CurCB LDYIM 0 wildfi LDAAX ctrlbl+2 ; 2 <= skips page pointer. BPL nochan ANDIM &F0 ; Retain flag bits, loose prev. page nos. ORAAY thisma STAAX ctrlbl+2 ; slot in page no. nochan INX INY CPYIM 7 BNE wildfi ; Put a pointer to the active CB in MAGPTRS. LDA CurCB LDY thisma STAAY magptr ; set INCONSISTENT LDX CurCB LDAAX ctrlbl+incons ORAIM flagbi STAAX ctrlbl+incons ; ; store header line - set up data for ; norrow ('normal row') ; LDX CurCB LDAAX ctrlbl+full ROLA BPL cleard BIT thishe BMI cleard ; erase? BVS noclea ; update? cleard LDX CurCB JSR erasep noclea LDA rowcnt STA rowreg LDYIM 3 head14 LDA datare DEY BNE head14 ; exits with Y=0 LDX CurCB LDAAX ctrlbl STA intzp0 LDAAX ctrlbl+1 STA intzp1 LDAIM 26 ; #25 ; SHOULD THIS BE 26??? - i think so. ;reset next free row on first header. INY ; LDY IM 1 - assumes Y=0 STAIY intzp0 LDAIM 0 JMP norrow ; That section was also cribbed from ARG ; - Aborts reception on all mags in the event of an error ; in the hammin coding such that the current context is lost zapmag ; Close down reception ; on all magazines on ; fatal error in MRAG, ; or on overrun. LDYIM 7 zap1 LDXAY magptr INX BEQ nextza DEX JSR Zap ; (X,Y) nextza DEY BPL zap1 RTS ; ; Zap ; full,upda00,incons=0 ; offset from ctrlbl by X ; preservesAY X LDAIM &FF STAAY magptr zapf00 LDAAX ctrlbl+incons ANDIM TIM01 STAAX ctrlbl+incons zapful ; LDAAX ctrlbl+full ANDIM TIM01 STAAX ctrlbl+full ; zapup LDAAX ctrlbl+upda00 ANDIM TIM01 STAAX ctrlbl+upda00 RTS ; ; ; Decodes a hammin coded byte in X ; returning a nibble in A, or &FF if a fatal error occured. ; Meanwhile, is upda00 as a count of bytes tested ; and is a count of errors (fatal or correctable) ; these are used by the tune facility to determine the success ; or failure of the reception. ; hammin ; **** MUST preserve Y LDAAX hamtab ANDIM &8F ; One bit error - clear flag bits RTS ; ******** INT.RT VERSION. ******** ; DOES COUNT OF ERRORS hamm00 INC ARGtst LDAAX hamtab STA intzp0 BIT intzp0 BMI hamfai BVC hamok ANDIM &0F hamfai INC ARGerr hamok TAX RTS ; ; ; clears the row bytes of a page to &FF to indicate ; lines not transmitted. On entry, X points to the controlblock ; for the page in question. is used (2 bytes), but ; interrs are turned off so that it can safely be used from ; DEC3 for clearing pages when they are re-select. ; ; erasep ; CAN ONLY BE CALLED IN INT ROUTINE = USES INTZP0 LDAAX ctrlbl STA intzp0 LDAAX ctrlbl+1 STA intzp1 TXA PHA LDXIM 26 ; 24\No. of text rows-1 (other rows counted differently) LDYIM 0 LDAIY intzp0 ; MAX rows CMPIM 26 BCS bigenu TAX ; MAX rows less than 26, so use smaller value.... bigenu LDYIM 2 erase1 LDA intzp0 CLC ADCIM 48 STA intzp0 BCC ernocy INC intzp1 ernocy LDAIM &FF STAIY intzp0 ; Offset 2 to skip free row pointer TYA ; For re-stacking if branch performed DEX BNE erase1 PLA TAX RTS ; LNK DEC5