From 6c8ecc649887156a68fd28e9d89a692c5db4e10a Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Thu, 18 Apr 2019 14:43:43 -0700 Subject: [PATCH] build 6-and-2 on-the-fly --- src/patchers/nibtable.a | 24 ++++++-------- src/patchers/rdos13.a | 70 +++++++++++++++++++++++++---------------- 2 files changed, 52 insertions(+), 42 deletions(-) diff --git a/src/patchers/nibtable.a b/src/patchers/nibtable.a index 606c996..5a55e73 100755 --- a/src/patchers/nibtable.a +++ b/src/patchers/nibtable.a @@ -6,19 +6,6 @@ ;------------------------------- !zone { _nibtable - jmp .checkread - -.writedata - !byte $96,$97,$9A,$9B,$9D,$9E,$9F,$A6 - !byte $A7,$AB,$AC,$AD,$AE,$AF,$B2,$B3 - !byte $B4,$B5,$B6,$B7,$B9,$BA,$BB,$BC - !byte $BD,$BE,$BF,$CB,$CD,$CE,$CF,$D3 - !byte $D6,$D7,$D9,$DA,$DB,$DC,$DD,$DE - !byte $DF,$E5,$E6,$E7,$E9,$EA,$EB,$EC - !byte $ED,$EE,$EF,$F2,$F3,$F4,$F5,$F6 - !byte $F7,$F9,$FA,$FB,$FC,$FD,$FE,$FF - -.checkread bit gMode ; nothing to do here in verify-only mode bpl .exit lda gIsRWTS ; if DOS 3.3 RWTS @@ -74,11 +61,18 @@ _nibtable bne .common .fixwrite + lda #$16 + sta modsrc + lda #$20 + ldx #$00 + tay + jsr build6and2 ; to $2000 + lda #$40 sta .loopcheck+1 lda #$29 - ldx #<.writedata - ldy #>.writedata + ldx #$00 + ldy #$20 .common sta nibdestindex diff --git a/src/patchers/rdos13.a b/src/patchers/rdos13.a index 8f043f8..4c379e1 100644 --- a/src/patchers/rdos13.a +++ b/src/patchers/rdos13.a @@ -65,33 +65,12 @@ lda #s_rwtswrite jsr PrintByID - -;build 6-and-2 denibbilisation table for reading - - ldx #$16 - ldy #0 --- stx $48 - txa - asl - bit $48 - beq + - ora $48 - eor #$ff - and #$7e -- bcs + - lsr - bne - - tya - sta (BASEPAGE * $100) + $6B9 - $16, x - -;and 6-and-2 nibbilisation table for writing - - txa - ora #$80 - sta (BASEPAGE * $100) + $B70, y - iny -+ inx - bpl -- + lda #<((BASEPAGE * $100) + $6B9 - $16) + sta modsrc + lda #>((BASEPAGE * $100) + $6B9 - $16) + ldx #<((BASEPAGE * $100) + $B70) + ldy #>((BASEPAGE * $100) + $B70) + jsr build6and2 ;replace 6-and-2 encoder routine ;and introduce DOS-order lookup @@ -118,6 +97,43 @@ jmp .exit +;build 6-and-2 denibbilisation table for reading + +build6and2 + sta modsrc+1 + stx moddest + sty moddest+1 + ldx #$16 + ldy #0 +-- stx $48 + txa + asl + bit $48 + beq + + ora $48 + eor #$ff + and #$7e +- bcs + + lsr + bne - + tya + pha + txa + tay + pla + sta (modsrc), y + tay + +;and 6-and-2 nibbilisation table for writing + + txa + ora #$80 + sta (moddest), y + iny ++ inx + bpl -- + rts + .writemod !byte $A2,$00 ;LDX #$00 !byte $A0,$02 ;LDY #$00