diff --git a/desk.acc/Makefile b/desk.acc/Makefile index 17471a7..7aba714 100644 --- a/desk.acc/Makefile +++ b/desk.acc/Makefile @@ -9,7 +9,7 @@ TARGETS = show_text_file.F1 show_dhr_file.F1 show_hgr_file.F1 .PHONY: clean all all: $(TARGETS) -HEADERS = $(wildcard ../*.h) +HEADERS = $(wildcard ../*.inc) $(wildcard *.inc) clean: rm -f *.o diff --git a/desk.acc/hgr_to_dhr.inc b/desk.acc/hgr_to_dhr.inc new file mode 100644 index 0000000..a9bdf4a --- /dev/null +++ b/desk.acc/hgr_to_dhr.inc @@ -0,0 +1,70 @@ + +;;; HGR to DHR - Aux Mem Bytes +hgr_to_dhr_aux: + .byte $00, $01, $06, $07, $18, $19, $1e, $1f + .byte $60, $61, $66, $67, $78, $79, $7e, $7f + .byte $00, $01, $06, $07, $18, $19, $1e, $1f + .byte $60, $61, $66, $67, $78, $79, $7e, $7f + .byte $00, $01, $06, $07, $18, $19, $1e, $1f + .byte $60, $61, $66, $67, $78, $79, $7e, $7f + .byte $00, $01, $06, $07, $18, $19, $1e, $1f + .byte $60, $61, $66, $67, $78, $79, $7e, $7f + .byte $00, $01, $06, $07, $18, $19, $1e, $1f + .byte $60, $61, $66, $67, $78, $79, $7e, $7f + .byte $00, $01, $06, $07, $18, $19, $1e, $1f + .byte $60, $61, $66, $67, $78, $79, $7e, $7f + .byte $00, $01, $06, $07, $18, $19, $1e, $1f + .byte $60, $61, $66, $67, $78, $79, $7e, $7f + .byte $00, $01, $06, $07, $18, $19, $1e, $1f + .byte $60, $61, $66, $67, $78, $79, $7e, $7f + .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f + .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f + .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f + .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f + .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f + .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f + .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f + .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f + .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f + .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f + .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f + .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f + .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f + .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f + .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f + .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f + +;;; HGR to DHR - Main Mem Bytes +hgr_to_dhr_main: + .byte $00, $80, $00, $80, $00, $80, $00, $80 + .byte $00, $80, $00, $80, $00, $80, $00, $80 + .byte $03, $83, $03, $83, $03, $83, $03, $83 + .byte $03, $83, $03, $83, $03, $83, $03, $83 + .byte $0c, $8c, $0c, $8c, $0c, $8c, $0c, $8c + .byte $0c, $8c, $0c, $8c, $0c, $8c, $0c, $8c + .byte $0f, $8f, $0f, $8f, $0f, $8f, $0f, $8f + .byte $0f, $8f, $0f, $8f, $0f, $8f, $0f, $8f + .byte $30, $b0, $30, $b0, $30, $b0, $30, $b0 + .byte $30, $b0, $30, $b0, $30, $b0, $30, $b0 + .byte $33, $b3, $33, $b3, $33, $b3, $33, $b3 + .byte $33, $b3, $33, $b3, $33, $b3, $33, $b3 + .byte $3c, $bc, $3c, $bc, $3c, $bc, $3c, $bc + .byte $3c, $bc, $3c, $bc, $3c, $bc, $3c, $bc + .byte $3f, $bf, $3f, $bf, $3f, $bf, $3f, $bf + .byte $3f, $bf, $3f, $bf, $3f, $bf, $3f, $bf + .byte $00, $00, $00, $00, $00, $00, $00, $00 + .byte $01, $01, $01, $01, $01, $01, $01, $01 + .byte $06, $06, $06, $06, $06, $06, $06, $06 + .byte $07, $07, $07, $07, $07, $07, $07, $07 + .byte $18, $18, $18, $18, $18, $18, $18, $18 + .byte $19, $19, $19, $19, $19, $19, $19, $19 + .byte $1e, $1e, $1e, $1e, $1e, $1e, $1e, $1e + .byte $1f, $1f, $1f, $1f, $1f, $1f, $1f, $1f + .byte $60, $60, $60, $60, $60, $60, $60, $60 + .byte $61, $61, $61, $61, $61, $61, $61, $61 + .byte $66, $66, $66, $66, $66, $66, $66, $66 + .byte $67, $67, $67, $67, $67, $67, $67, $67 + .byte $78, $78, $78, $78, $78, $78, $78, $78 + .byte $79, $79, $79, $79, $79, $79, $79, $79 + .byte $7e, $7e, $7e, $7e, $7e, $7e, $7e, $7e + .byte $7f, $7f, $7f, $7f, $7f, $7f, $7f, $7f diff --git a/desk.acc/hires_table.inc b/desk.acc/hires_table.inc new file mode 100644 index 0000000..ac00a7f --- /dev/null +++ b/desk.acc/hires_table.inc @@ -0,0 +1,51 @@ +hires_table_lo: + .byte $00,$00,$00,$00,$00,$00,$00,$00 + .byte $80,$80,$80,$80,$80,$80,$80,$80 + .byte $00,$00,$00,$00,$00,$00,$00,$00 + .byte $80,$80,$80,$80,$80,$80,$80,$80 + .byte $00,$00,$00,$00,$00,$00,$00,$00 + .byte $80,$80,$80,$80,$80,$80,$80,$80 + .byte $00,$00,$00,$00,$00,$00,$00,$00 + .byte $80,$80,$80,$80,$80,$80,$80,$80 + .byte $28,$28,$28,$28,$28,$28,$28,$28 + .byte $a8,$a8,$a8,$a8,$a8,$a8,$a8,$a8 + .byte $28,$28,$28,$28,$28,$28,$28,$28 + .byte $a8,$a8,$a8,$a8,$a8,$a8,$a8,$a8 + .byte $28,$28,$28,$28,$28,$28,$28,$28 + .byte $a8,$a8,$a8,$a8,$a8,$a8,$a8,$a8 + .byte $28,$28,$28,$28,$28,$28,$28,$28 + .byte $a8,$a8,$a8,$a8,$a8,$a8,$a8,$a8 + .byte $50,$50,$50,$50,$50,$50,$50,$50 + .byte $d0,$d0,$d0,$d0,$d0,$d0,$d0,$d0 + .byte $50,$50,$50,$50,$50,$50,$50,$50 + .byte $d0,$d0,$d0,$d0,$d0,$d0,$d0,$d0 + .byte $50,$50,$50,$50,$50,$50,$50,$50 + .byte $d0,$d0,$d0,$d0,$d0,$d0,$d0,$d0 + .byte $50,$50,$50,$50,$50,$50,$50,$50 + .byte $d0,$d0,$d0,$d0,$d0,$d0,$d0,$d0 + +hires_table_hi: + .byte $20,$24,$28,$2c,$30,$34,$38,$3c + .byte $20,$24,$28,$2c,$30,$34,$38,$3c + .byte $21,$25,$29,$2d,$31,$35,$39,$3d + .byte $21,$25,$29,$2d,$31,$35,$39,$3d + .byte $22,$26,$2a,$2e,$32,$36,$3a,$3e + .byte $22,$26,$2a,$2e,$32,$36,$3a,$3e + .byte $23,$27,$2b,$2f,$33,$37,$3b,$3f + .byte $23,$27,$2b,$2f,$33,$37,$3b,$3f + .byte $20,$24,$28,$2c,$30,$34,$38,$3c + .byte $20,$24,$28,$2c,$30,$34,$38,$3c + .byte $21,$25,$29,$2d,$31,$35,$39,$3d + .byte $21,$25,$29,$2d,$31,$35,$39,$3d + .byte $22,$26,$2a,$2e,$32,$36,$3a,$3e + .byte $22,$26,$2a,$2e,$32,$36,$3a,$3e + .byte $23,$27,$2b,$2f,$33,$37,$3b,$3f + .byte $23,$27,$2b,$2f,$33,$37,$3b,$3f + .byte $20,$24,$28,$2c,$30,$34,$38,$3c + .byte $20,$24,$28,$2c,$30,$34,$38,$3c + .byte $21,$25,$29,$2d,$31,$35,$39,$3d + .byte $21,$25,$29,$2d,$31,$35,$39,$3d + .byte $22,$26,$2a,$2e,$32,$36,$3a,$3e + .byte $22,$26,$2a,$2e,$32,$36,$3a,$3e + .byte $23,$27,$2b,$2f,$33,$37,$3b,$3f + .byte $23,$27,$2b,$2f,$33,$37,$3b,$3f diff --git a/desk.acc/show_hgr_file.s b/desk.acc/show_hgr_file.s index a2e2d8e..4ff4867 100644 --- a/desk.acc/show_hgr_file.s +++ b/desk.acc/show_hgr_file.s @@ -405,26 +405,46 @@ rloop: pha lda hires_table_hi,x sta ptr+1 - ldy #0 ; col - sty spill ; spill-over -cloop: lda (ptr),y ; between pairs + ldy #cols-1 ; col + + lda #0 + sta spill ; spill-over + +cloop: lda (ptr),y tax + + bmi hibitset + + ;; complex case - need to spill in bit from prev col and store + + lda hgr_to_dhr_aux,x + sta PAGE2ON + sta (ptr),y + lda hgr_to_dhr_main,x + ora spill ; apply previous spill bit (to bit 6) + sta PAGE2OFF + sta (ptr),y + + ror ; move high bit to bit 6 + and #(1 << 6) + sta spill + + jmp next + +hibitset: + ;; simple case - no bit spillage lda hgr_to_dhr_aux,x - ora spill sta PAGE2ON sta (ptr),y lda hgr_to_dhr_main,x sta PAGE2OFF sta (ptr),y - rol a ; shift high bit - lda #0 ; to low bit - rol a - sta spill ; and save - - iny - cpy #cols - bne cloop + lda #0 ; no spill bit + sta spill +next: + dey + bpl cloop pla inc @@ -541,126 +561,5 @@ cloop: lda (src),y rts .endproc - - -hires_table_lo: - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $80,$80,$80,$80,$80,$80,$80,$80 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $80,$80,$80,$80,$80,$80,$80,$80 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $80,$80,$80,$80,$80,$80,$80,$80 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $80,$80,$80,$80,$80,$80,$80,$80 - .byte $28,$28,$28,$28,$28,$28,$28,$28 - .byte $a8,$a8,$a8,$a8,$a8,$a8,$a8,$a8 - .byte $28,$28,$28,$28,$28,$28,$28,$28 - .byte $a8,$a8,$a8,$a8,$a8,$a8,$a8,$a8 - .byte $28,$28,$28,$28,$28,$28,$28,$28 - .byte $a8,$a8,$a8,$a8,$a8,$a8,$a8,$a8 - .byte $28,$28,$28,$28,$28,$28,$28,$28 - .byte $a8,$a8,$a8,$a8,$a8,$a8,$a8,$a8 - .byte $50,$50,$50,$50,$50,$50,$50,$50 - .byte $d0,$d0,$d0,$d0,$d0,$d0,$d0,$d0 - .byte $50,$50,$50,$50,$50,$50,$50,$50 - .byte $d0,$d0,$d0,$d0,$d0,$d0,$d0,$d0 - .byte $50,$50,$50,$50,$50,$50,$50,$50 - .byte $d0,$d0,$d0,$d0,$d0,$d0,$d0,$d0 - .byte $50,$50,$50,$50,$50,$50,$50,$50 - .byte $d0,$d0,$d0,$d0,$d0,$d0,$d0,$d0 - -hires_table_hi: - .byte $20,$24,$28,$2c,$30,$34,$38,$3c - .byte $20,$24,$28,$2c,$30,$34,$38,$3c - .byte $21,$25,$29,$2d,$31,$35,$39,$3d - .byte $21,$25,$29,$2d,$31,$35,$39,$3d - .byte $22,$26,$2a,$2e,$32,$36,$3a,$3e - .byte $22,$26,$2a,$2e,$32,$36,$3a,$3e - .byte $23,$27,$2b,$2f,$33,$37,$3b,$3f - .byte $23,$27,$2b,$2f,$33,$37,$3b,$3f - .byte $20,$24,$28,$2c,$30,$34,$38,$3c - .byte $20,$24,$28,$2c,$30,$34,$38,$3c - .byte $21,$25,$29,$2d,$31,$35,$39,$3d - .byte $21,$25,$29,$2d,$31,$35,$39,$3d - .byte $22,$26,$2a,$2e,$32,$36,$3a,$3e - .byte $22,$26,$2a,$2e,$32,$36,$3a,$3e - .byte $23,$27,$2b,$2f,$33,$37,$3b,$3f - .byte $23,$27,$2b,$2f,$33,$37,$3b,$3f - .byte $20,$24,$28,$2c,$30,$34,$38,$3c - .byte $20,$24,$28,$2c,$30,$34,$38,$3c - .byte $21,$25,$29,$2d,$31,$35,$39,$3d - .byte $21,$25,$29,$2d,$31,$35,$39,$3d - .byte $22,$26,$2a,$2e,$32,$36,$3a,$3e - .byte $22,$26,$2a,$2e,$32,$36,$3a,$3e - .byte $23,$27,$2b,$2f,$33,$37,$3b,$3f - .byte $23,$27,$2b,$2f,$33,$37,$3b,$3f - -;;; HGR to DHR - Aux Mem Bytes -hgr_to_dhr_aux: - .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f - .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f - .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f - .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f - .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f - .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f - .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f - .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f - .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f - .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f - .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f - .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f - .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f - .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f - .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f - .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - .byte $00, $06, $18, $1e, $60, $66, $78, $7e - -;;; HGR to DHR - Main Mem Bytes -hgr_to_dhr_main: - .byte $00, $00, $00, $00, $00, $00, $00, $00 - .byte $01, $01, $01, $01, $01, $01, $01, $01 - .byte $06, $06, $06, $06, $06, $06, $06, $06 - .byte $07, $07, $07, $07, $07, $07, $07, $07 - .byte $18, $18, $18, $18, $18, $18, $18, $18 - .byte $19, $19, $19, $19, $19, $19, $19, $19 - .byte $1e, $1e, $1e, $1e, $1e, $1e, $1e, $1e - .byte $1f, $1f, $1f, $1f, $1f, $1f, $1f, $1f - .byte $60, $60, $60, $60, $60, $60, $60, $60 - .byte $61, $61, $61, $61, $61, $61, $61, $61 - .byte $66, $66, $66, $66, $66, $66, $66, $66 - .byte $67, $67, $67, $67, $67, $67, $67, $67 - .byte $78, $78, $78, $78, $78, $78, $78, $78 - .byte $79, $79, $79, $79, $79, $79, $79, $79 - .byte $7e, $7e, $7e, $7e, $7e, $7e, $7e, $7e - .byte $7f, $7f, $7f, $7f, $7f, $7f, $7f, $7f - .byte $00, $00, $00, $00, $00, $00, $00, $00 - .byte $03, $03, $03, $03, $03, $03, $03, $03 - .byte $0c, $0c, $0c, $0c, $0c, $0c, $0c, $0c - .byte $0f, $0f, $0f, $0f, $0f, $0f, $0f, $0f - .byte $30, $30, $30, $30, $30, $30, $30, $30 - .byte $33, $33, $33, $33, $33, $33, $33, $33 - .byte $3c, $3c, $3c, $3c, $3c, $3c, $3c, $3c - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $c0, $c0, $c0, $c0, $c0, $c0, $c0, $c0 - .byte $c3, $c3, $c3, $c3, $c3, $c3, $c3, $c3 - .byte $cc, $cc, $cc, $cc, $cc, $cc, $cc, $cc - .byte $cf, $cf, $cf, $cf, $cf, $cf, $cf, $cf - .byte $f0, $f0, $f0, $f0, $f0, $f0, $f0, $f0 - .byte $f3, $f3, $f3, $f3, $f3, $f3, $f3, $f3 - .byte $fc, $fc, $fc, $fc, $fc, $fc, $fc, $fc - .byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff + .include "hires_table.inc" + .include "hgr_to_dhr.inc"