From e4a67924e3413d620668176bde9c4476b31190e9 Mon Sep 17 00:00:00 2001 From: Rob McMullen Date: Mon, 23 Jul 2018 12:39:56 -0700 Subject: [PATCH] Added sample tests for publishing --- transposed_font_comparison/HELLO | Bin 0 -> 256 bytes transposed_font_comparison/Makefile | 52 + transposed_font_comparison/driver.s | 107 + transposed_font_comparison/fatfont128.dat | Bin 0 -> 1024 bytes .../test1a--no_optimization.s | 63 + .../test1b--incrementing_font_pointers.s | 66 + .../test1c--assembly_lines_ch31.s | 66 + .../test1d--self_modifying_code.s | 61 + .../test2--compiled_font.s | 6828 +++++++++++++++++ .../test3--transposed_font.s | 605 ++ 10 files changed, 7848 insertions(+) create mode 100644 transposed_font_comparison/HELLO create mode 100644 transposed_font_comparison/Makefile create mode 100644 transposed_font_comparison/driver.s create mode 100644 transposed_font_comparison/fatfont128.dat create mode 100644 transposed_font_comparison/test1a--no_optimization.s create mode 100644 transposed_font_comparison/test1b--incrementing_font_pointers.s create mode 100644 transposed_font_comparison/test1c--assembly_lines_ch31.s create mode 100644 transposed_font_comparison/test1d--self_modifying_code.s create mode 100644 transposed_font_comparison/test2--compiled_font.s create mode 100644 transposed_font_comparison/test3--transposed_font.s diff --git a/transposed_font_comparison/HELLO b/transposed_font_comparison/HELLO new file mode 100644 index 0000000000000000000000000000000000000000..295b4320ce14d558d204959f59c951450d066342 GIT binary patch literal 256 zcmWG%P~qTW*rgQWuMiaKr{JjI;_BS vs-W)d=;NbcWME=ppsvIa#v#YB>$!%BrjC-cV~C@Vzq=9x0|N&T4*>uGjvf>8 literal 0 HcmV?d00001 diff --git a/transposed_font_comparison/Makefile b/transposed_font_comparison/Makefile new file mode 100644 index 0000000..dc15b01 --- /dev/null +++ b/transposed_font_comparison/Makefile @@ -0,0 +1,52 @@ +# Currently valid assemblers: mac65 and cc65 +ASSEMBLER = "mac65" + +TARGETS = TEST1A.BIN TEST1B.BIN TEST1C.BIN TEST1D.BIN TEST2.BIN test3--transposed_font.s TEST3.BIN + +all: $(TARGETS) + +asmgen_font_compare.dsk: + atrcopy asmsgen_font_compare.dsk create dos33.dsk -f + atrcopy asmsgen_font_compare.dsk add HELLO -t A -f + +TEST1A.BIN: driver.s test1a--no_optimization.s + rm -f $@ + cat $^ > temp.s + atrcopy . assemble -f -d fatfont128.dat@0x6000 -s temp.s -r 0x5000 -o $@ + atrcopy asmsgen_font_compare.dsk add $@ -f + +TEST1B.BIN: driver.s test1b--incrementing_font_pointers.s + rm -f $@ + cat $^ > temp.s + atrcopy . assemble -f -d fatfont128.dat@0x6000 -s temp.s -r 0x5000 -o $@ + atrcopy asmsgen_font_compare.dsk add $@ -f + +TEST1C.BIN: driver.s test1c--assembly_lines_ch31.s + rm -f $@ + cat $^ > temp.s + atrcopy . assemble -f -d fatfont128.dat@0x6000 -s temp.s -r 0x5000 -o $@ + atrcopy asmsgen_font_compare.dsk add $@ -f + +TEST1D.BIN: driver.s test1d--self_modifying_code.s + rm -f $@ + cat $^ > temp.s + atrcopy . assemble -f -d fatfont128.dat@0x6000 -s temp.s -r 0x5000 -o $@ + atrcopy asmsgen_font_compare.dsk add $@ -f + +TEST2.BIN: driver.s test2--compiled_font.s + rm -f $@ + cat $^ > temp.s + atrcopy . assemble -f -s temp.s -r 0x5000 -o $@ + atrcopy asmsgen_font_compare.dsk add $@ -f + +test3--transposed_font.s: + python ../asmgen.py -a $(ASSEMBLER) -f fatfont128.dat > test3--transposed_font.s + +TEST3.BIN: driver.s test3--transposed_font.s + rm -f $@ + cat $^ > temp.s + atrcopy . assemble -f -s temp.s -r 0x5000 -o $@ + atrcopy asmsgen_font_compare.dsk add $@ -f + +clean: + rm -f asmsgen_font_compare.dsk $(TARGETS) temp.s temp.s.lst temp.s.err diff --git a/transposed_font_comparison/driver.s b/transposed_font_comparison/driver.s new file mode 100644 index 0000000..60df2e9 --- /dev/null +++ b/transposed_font_comparison/driver.s @@ -0,0 +1,107 @@ + *= $0006 + +FIRST_CHAR_OF_SCREEN .ds 1 +FIRST_CHAR_OF_LINE .ds 1 +CURRENT_CHAR .ds 1 +FRAME_COUNT .ds 1 + + *= $00eb +hgr_ptr .ds 2 +font_ptr .ds 2 + + *= $00fa +scratch_0 .ds 1 +scratch_x .ds 1 +scratch_y .ds 1 + + + *= $5000 + +start_set + jsr set_hires + jsr clrscr + jsr driver + jsr set_text + rts + brk + +driver + lda #$00 + sta FIRST_CHAR_OF_SCREEN + lda #64 + sta FRAME_COUNT +page_loop + jsr page + dec FRAME_COUNT + bne page_loop + rts + +; os memory map +KEYBOARD = $c000 +KBDSTROBE = $c010 +CLRTEXT = $c050 +SETTEXT = $c051 +CLRMIXED = $c052 +SETMIXED = $c053 +TXTPAGE1 = $c054 +TXTPAGE2 = $c055 +CLRHIRES = $c056 +SETHIRES = $c057 + + +set_hires bit CLRTEXT ; start with HGR page 1, full screen + bit CLRMIXED + bit TXTPAGE1 + bit SETHIRES + rts + +set_text bit SETTEXT + bit CLRMIXED + bit TXTPAGE1 + bit CLRHIRES + rts + +; clear hires page 1 only +clrscr lda #$20 + sta clrscr_smc+2 + lda #0 + ldy #0 +clrscr_smc sta $ff00,y + iny + bne clrscr_smc + inc clrscr_smc+2 + ldx clrscr_smc+2 + cpx #$40 + bcc clrscr_smc + rts + + *= $5074 + +page + inc FIRST_CHAR_OF_SCREEN + lda FIRST_CHAR_OF_SCREEN + sta FIRST_CHAR_OF_LINE + + ldy #$00 +line_loop + ldx #$00 + lda FIRST_CHAR_OF_LINE + sta CURRENT_CHAR +char_loop + lda CURRENT_CHAR + jsr font_test + inc CURRENT_CHAR + inx + cpx #40 + bcc char_loop + + inc FIRST_CHAR_OF_LINE + iny + cpy #24 + bcc line_loop + + rts + + + +font_test diff --git a/transposed_font_comparison/fatfont128.dat b/transposed_font_comparison/fatfont128.dat new file mode 100644 index 0000000000000000000000000000000000000000..c90aaf3f0a0d611e7cb82ae8d6e4efc23fd4701a GIT binary patch literal 1024 zcmZuwON!e-5cMJA-7wzIb~ZVPeH()d8d_O2twlBhi|WN>mB1iqkOea8Q_Oyj;2TWd ztCqoplt10C-m9zpuXi9!^{hKk(aa<+t0)8^-l;sG`H6@^}35@(}#* z^=Y*S|M6IT$0MA$8h+q+yUOo&l{bv*=~P9hQ|0g2ys}yY6THXq*GSjz)jn3cT)N=r zS$yl;`TQ;+{0P)deT=c6q=|js$40tXQYs3*lwb;o8t+7wg?cm8`Me>raiS&XOnqz_ zLi|12IV=PG({;>c7^D=Jh!rRGr3_s_0qB(&r|G5d#XhLPx-8RAHWrb&hmPGj?d>;@=9GPcuuHyy#igY z;yCc_Q(CMyw5q~s-R;fRp*5=jM^$Fc%=Gv*1C4$HvGz9aKEajd-TE0rtT# m{;+Ts<^fVW8IOdv0O{2?UVCeb9YpP>PNVoz=dFK<&E_xQLgIe_ literal 0 HcmV?d00001 diff --git a/transposed_font_comparison/test1a--no_optimization.s b/transposed_font_comparison/test1a--no_optimization.s new file mode 100644 index 0000000..1cdd2de --- /dev/null +++ b/transposed_font_comparison/test1a--no_optimization.s @@ -0,0 +1,63 @@ + +FATFONT = $6000 + +; A = character, X = column, Y = row; A is clobbered, X&Y are not + + stx SCRATCH_X + sty SCRATCH_Y + + ; find address of glyph + sta font_ptr + lda #0 + sta font_ptr + 1 + asl font_ptr ; multiply by 8 + rol font_ptr + 1 + asl font_ptr + rol font_ptr + 1 + asl font_ptr + rol font_ptr + 1 + + clc ; add font table address to get pointer inside font table + lda #fatfont + adc font_ptr+1 + sta font_ptr+1 + + lda hgrtextrow_l,y ; load address of first line of hgr text + sta hgr_ptr + lda hgrtextrow_h,y + sta hgr_ptr+1 + + ldx #0 +slowfont_loop + txa + tay + lda (font_ptr),y + ldy SCRATCH_X ; col goes in y + sta (hgr_ptr),y + clc + lda #4 + adc hgr_ptr+1 + sta hgr_ptr+1 + inx + cpx #8 + bcc slowfont_loop + +done + ldx SCRATCH_X + ldy SCRATCH_Y + rts + + + + +hgrtextrow_l + .byte $00,$80,$00,$80,$00,$80,$00,$80 + .byte $28,$A8,$28,$A8,$28,$A8,$28,$A8 + .byte $50,$D0,$50,$D0,$50,$D0,$50,$D0 +hgrtextrow_h + .byte $20,$20,$21,$21,$22,$22,$23,$23 + .byte $20,$20,$21,$21,$22,$22,$23,$23 + .byte $20,$20,$21,$21,$22,$22,$23,$23 diff --git a/transposed_font_comparison/test1b--incrementing_font_pointers.s b/transposed_font_comparison/test1b--incrementing_font_pointers.s new file mode 100644 index 0000000..0c48229 --- /dev/null +++ b/transposed_font_comparison/test1b--incrementing_font_pointers.s @@ -0,0 +1,66 @@ + +FATFONT = $6000 + +; A = character, X = column, Y = row; A is clobbered, X&Y are not + + stx SCRATCH_X + sty SCRATCH_Y + + ; find address of glyph + sta font_ptr + lda #0 + sta font_ptr + 1 + asl font_ptr ; multiply by 8 + rol font_ptr + 1 + asl font_ptr + rol font_ptr + 1 + asl font_ptr + rol font_ptr + 1 + + clc ; add font table address to get pointer inside font table + lda #fatfont + adc font_ptr+1 + sta font_ptr+1 + + lda hgrtextrow_l,y ; load address of first line of hgr text + sta hgr_ptr + lda hgrtextrow_h,y + sta hgr_ptr+1 + + ldx #0 +slowfont_loop + ldy #0 + lda (font_ptr),y + ldy SCRATCH_X ; col goes in y + sta (hgr_ptr),y + clc + lda #4 + adc hgr_ptr+1 + sta hgr_ptr+1 + clc + inc font_ptr + bcc ?1 + inc font_ptr+1 +?1 inx + cpx #8 + bcc slowfont_loop + +done + ldx SCRATCH_X + ldy SCRATCH_Y + rts + + + + +hgrtextrow_l + .byte $00,$80,$00,$80,$00,$80,$00,$80 + .byte $28,$A8,$28,$A8,$28,$A8,$28,$A8 + .byte $50,$D0,$50,$D0,$50,$D0,$50,$D0 +hgrtextrow_h + .byte $20,$20,$21,$21,$22,$22,$23,$23 + .byte $20,$20,$21,$21,$22,$22,$23,$23 + .byte $20,$20,$21,$21,$22,$22,$23,$23 diff --git a/transposed_font_comparison/test1c--assembly_lines_ch31.s b/transposed_font_comparison/test1c--assembly_lines_ch31.s new file mode 100644 index 0000000..e497eb0 --- /dev/null +++ b/transposed_font_comparison/test1c--assembly_lines_ch31.s @@ -0,0 +1,66 @@ + +FATFONT = $6000 + +; A = character, X = column, Y = row; A is clobbered, X&Y are not + + stx SCRATCH_X + sty SCRATCH_Y + + ; find address of glyph + sta font_ptr + lda #0 + sta font_ptr + 1 + asl font_ptr ; multiply by 8 + rol font_ptr + 1 + asl font_ptr + rol font_ptr + 1 + asl font_ptr + rol font_ptr + 1 + + clc ; add font table address to get pointer inside font table + lda #fatfont + adc font_ptr+1 + sta font_ptr+1 + + clc + lda hgrtextrow_l,y ; load address of first line of hgr text + adc SCRATCH_X + sta hgr_ptr + lda hgrtextrow_h,y + adc #0 + sta hgr_ptr+1 + + ldy #0 +slowfont_loop + lda (font_ptr),y + sta (hgr_ptr),y + clc + lda hgr_ptr + adc #$ff + sta hgr_ptr + lda #3 + adc hgr_ptr+1 + sta hgr_ptr+1 + iny + cpy #8 + bcc slowfont_loop + +done + ldx SCRATCH_X + ldy SCRATCH_Y + rts + + + + +hgrtextrow_l + .byte $00,$80,$00,$80,$00,$80,$00,$80 + .byte $28,$A8,$28,$A8,$28,$A8,$28,$A8 + .byte $50,$D0,$50,$D0,$50,$D0,$50,$D0 +hgrtextrow_h + .byte $20,$20,$21,$21,$22,$22,$23,$23 + .byte $20,$20,$21,$21,$22,$22,$23,$23 + .byte $20,$20,$21,$21,$22,$22,$23,$23 diff --git a/transposed_font_comparison/test1d--self_modifying_code.s b/transposed_font_comparison/test1d--self_modifying_code.s new file mode 100644 index 0000000..0982e64 --- /dev/null +++ b/transposed_font_comparison/test1d--self_modifying_code.s @@ -0,0 +1,61 @@ + +FATFONT = $6000 + +; A = character, X = column, Y = row; A is clobbered, X&Y are not + + stx SCRATCH_X + sty SCRATCH_Y + + ; find address of glyph + sta font_ptr + lda #0 + sta font_ptr + 1 + asl font_ptr ; multiply by 8 + rol font_ptr + 1 + asl font_ptr + rol font_ptr + 1 + asl font_ptr + rol font_ptr + 1 + + clc ; add font table address to get pointer inside font table + lda #fatfont + adc font_ptr+1 + sta slowfont_loop_smc+2 + + lda hgrtextrow_l,y ; load address of first line of hgr text + sta hgr_ptr + lda hgrtextrow_h,y + sta hgr_ptr+1 + + ldx #0 + ldy SCRATCH_X ; col goes in y +slowfont_loop +slowfont_loop_smc + lda $ffff,x + sta (hgr_ptr),y + clc + lda #4 + adc hgr_ptr+1 + sta hgr_ptr+1 + inx + cpx #8 + bcc slowfont_loop + + ldx SCRATCH_X + ldy SCRATCH_Y + rts + + + + +hgrtextrow_l + .byte $00,$80,$00,$80,$00,$80,$00,$80 + .byte $28,$A8,$28,$A8,$28,$A8,$28,$A8 + .byte $50,$D0,$50,$D0,$50,$D0,$50,$D0 +hgrtextrow_h + .byte $20,$20,$21,$21,$22,$22,$23,$23 + .byte $20,$20,$21,$21,$22,$22,$23,$23 + .byte $20,$20,$21,$21,$22,$22,$23,$23 diff --git a/transposed_font_comparison/test2--compiled_font.s b/transposed_font_comparison/test2--compiled_font.s new file mode 100644 index 0000000..6a24c82 --- /dev/null +++ b/transposed_font_comparison/test2--compiled_font.s @@ -0,0 +1,6828 @@ +; AUTOGENERATED FILE; DO NOT EDIT! +; +; This file was generated by asmgen.py, a 6502 code generator sponsored by +; the Player/Missile Podcast. (The sprite compiler is based on HiSprite by +; Quinn Dunki). +; +; The code produced by asmgen is licensed under the Creative Commons +; Attribution 4.0 International (CC BY 4.0), so you are free to use the code in +; this file for any purpose. (The code generator itself is licensed under the +; GPLv3.) + +COMPILEDFONT_H1 ; A = character, X = column, Y = row; A is clobbered, X&Y are not + sty scratch_0 + tay + lda COMPILEDFONT_H1_JMP_HI,y + sta COMPILEDFONT_H1_JMP+2 + lda COMPILEDFONT_H1_JMP_LO,y + sta COMPILEDFONT_H1_JMP+1 + ldy scratch_0 + lda hgrtextrow_l,y + sta hgr_ptr + lda hgrtextrow_h,y + sta hgr_ptr+1 + txa + tay +COMPILEDFONT_H1_JMP + jmp $ffff + + +COMPILEDFONT_H1_JMP_HI + .byte >COMPILEDFONT_H1_0 + .byte >COMPILEDFONT_H1_1 + .byte >COMPILEDFONT_H1_2 + .byte >COMPILEDFONT_H1_3 + .byte >COMPILEDFONT_H1_4 + .byte >COMPILEDFONT_H1_5 + .byte >COMPILEDFONT_H1_6 + .byte >COMPILEDFONT_H1_7 + .byte >COMPILEDFONT_H1_8 + .byte >COMPILEDFONT_H1_9 + .byte >COMPILEDFONT_H1_10 + .byte >COMPILEDFONT_H1_11 + .byte >COMPILEDFONT_H1_12 + .byte >COMPILEDFONT_H1_13 + .byte >COMPILEDFONT_H1_14 + .byte >COMPILEDFONT_H1_15 + .byte >COMPILEDFONT_H1_16 + .byte >COMPILEDFONT_H1_17 + .byte >COMPILEDFONT_H1_18 + .byte >COMPILEDFONT_H1_19 + .byte >COMPILEDFONT_H1_20 + .byte >COMPILEDFONT_H1_21 + .byte >COMPILEDFONT_H1_22 + .byte >COMPILEDFONT_H1_23 + .byte >COMPILEDFONT_H1_24 + .byte >COMPILEDFONT_H1_25 + .byte >COMPILEDFONT_H1_26 + .byte >COMPILEDFONT_H1_27 + .byte >COMPILEDFONT_H1_28 + .byte >COMPILEDFONT_H1_29 + .byte >COMPILEDFONT_H1_30 + .byte >COMPILEDFONT_H1_31 + .byte >COMPILEDFONT_H1_32 + .byte >COMPILEDFONT_H1_33 + .byte >COMPILEDFONT_H1_34 + .byte >COMPILEDFONT_H1_35 + .byte >COMPILEDFONT_H1_36 + .byte >COMPILEDFONT_H1_37 + .byte >COMPILEDFONT_H1_38 + .byte >COMPILEDFONT_H1_39 + .byte >COMPILEDFONT_H1_40 + .byte >COMPILEDFONT_H1_41 + .byte >COMPILEDFONT_H1_42 + .byte >COMPILEDFONT_H1_43 + .byte >COMPILEDFONT_H1_44 + .byte >COMPILEDFONT_H1_45 + .byte >COMPILEDFONT_H1_46 + .byte >COMPILEDFONT_H1_47 + .byte >COMPILEDFONT_H1_48 + .byte >COMPILEDFONT_H1_49 + .byte >COMPILEDFONT_H1_50 + .byte >COMPILEDFONT_H1_51 + .byte >COMPILEDFONT_H1_52 + .byte >COMPILEDFONT_H1_53 + .byte >COMPILEDFONT_H1_54 + .byte >COMPILEDFONT_H1_55 + .byte >COMPILEDFONT_H1_56 + .byte >COMPILEDFONT_H1_57 + .byte >COMPILEDFONT_H1_58 + .byte >COMPILEDFONT_H1_59 + .byte >COMPILEDFONT_H1_60 + .byte >COMPILEDFONT_H1_61 + .byte >COMPILEDFONT_H1_62 + .byte >COMPILEDFONT_H1_63 + .byte >COMPILEDFONT_H1_64 + .byte >COMPILEDFONT_H1_65 + .byte >COMPILEDFONT_H1_66 + .byte >COMPILEDFONT_H1_67 + .byte >COMPILEDFONT_H1_68 + .byte >COMPILEDFONT_H1_69 + .byte >COMPILEDFONT_H1_70 + .byte >COMPILEDFONT_H1_71 + .byte >COMPILEDFONT_H1_72 + .byte >COMPILEDFONT_H1_73 + .byte >COMPILEDFONT_H1_74 + .byte >COMPILEDFONT_H1_75 + .byte >COMPILEDFONT_H1_76 + .byte >COMPILEDFONT_H1_77 + .byte >COMPILEDFONT_H1_78 + .byte >COMPILEDFONT_H1_79 + .byte >COMPILEDFONT_H1_80 + .byte >COMPILEDFONT_H1_81 + .byte >COMPILEDFONT_H1_82 + .byte >COMPILEDFONT_H1_83 + .byte >COMPILEDFONT_H1_84 + .byte >COMPILEDFONT_H1_85 + .byte >COMPILEDFONT_H1_86 + .byte >COMPILEDFONT_H1_87 + .byte >COMPILEDFONT_H1_88 + .byte >COMPILEDFONT_H1_89 + .byte >COMPILEDFONT_H1_90 + .byte >COMPILEDFONT_H1_91 + .byte >COMPILEDFONT_H1_92 + .byte >COMPILEDFONT_H1_93 + .byte >COMPILEDFONT_H1_94 + .byte >COMPILEDFONT_H1_95 + .byte >COMPILEDFONT_H1_96 + .byte >COMPILEDFONT_H1_97 + .byte >COMPILEDFONT_H1_98 + .byte >COMPILEDFONT_H1_99 + .byte >COMPILEDFONT_H1_100 + .byte >COMPILEDFONT_H1_101 + .byte >COMPILEDFONT_H1_102 + .byte >COMPILEDFONT_H1_103 + .byte >COMPILEDFONT_H1_104 + .byte >COMPILEDFONT_H1_105 + .byte >COMPILEDFONT_H1_106 + .byte >COMPILEDFONT_H1_107 + .byte >COMPILEDFONT_H1_108 + .byte >COMPILEDFONT_H1_109 + .byte >COMPILEDFONT_H1_110 + .byte >COMPILEDFONT_H1_111 + .byte >COMPILEDFONT_H1_112 + .byte >COMPILEDFONT_H1_113 + .byte >COMPILEDFONT_H1_114 + .byte >COMPILEDFONT_H1_115 + .byte >COMPILEDFONT_H1_116 + .byte >COMPILEDFONT_H1_117 + .byte >COMPILEDFONT_H1_118 + .byte >COMPILEDFONT_H1_119 + .byte >COMPILEDFONT_H1_120 + .byte >COMPILEDFONT_H1_121 + .byte >COMPILEDFONT_H1_122 + .byte >COMPILEDFONT_H1_123 + .byte >COMPILEDFONT_H1_124 + .byte >COMPILEDFONT_H1_125 + .byte >COMPILEDFONT_H1_126 + .byte >COMPILEDFONT_H1_127 +COMPILEDFONT_H1_JMP_LO + .byte FASTFONT_H1_0 + .byte >FASTFONT_H1_1 + .byte >FASTFONT_H1_2 + .byte >FASTFONT_H1_3 + .byte >FASTFONT_H1_4 + .byte >FASTFONT_H1_5 + .byte >FASTFONT_H1_6 + .byte >FASTFONT_H1_7 + .byte >FASTFONT_H1_8 + .byte >FASTFONT_H1_9 + .byte >FASTFONT_H1_10 + .byte >FASTFONT_H1_11 + .byte >FASTFONT_H1_12 + .byte >FASTFONT_H1_13 + .byte >FASTFONT_H1_14 + .byte >FASTFONT_H1_15 + .byte >FASTFONT_H1_16 + .byte >FASTFONT_H1_17 + .byte >FASTFONT_H1_18 + .byte >FASTFONT_H1_19 + .byte >FASTFONT_H1_20 + .byte >FASTFONT_H1_21 + .byte >FASTFONT_H1_22 + .byte >FASTFONT_H1_23 +FASTFONT_H1_JMP_LO + .byte