build 6-and-2 on-the-fly

This commit is contained in:
Peter Ferrie 2019-04-18 14:43:43 -07:00
parent af64599488
commit 6c8ecc6498
2 changed files with 52 additions and 42 deletions

View File

@ -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

View File

@ -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