From 97efeaf44dff16762a559fce6edd005c955c8d32 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Fri, 15 Sep 2017 20:04:56 -0700 Subject: [PATCH] STF: Glyph widths --- desk.acc/a2d.inc | 7 +++++ desk.acc/show_text_file.s | 55 +++++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/desk.acc/a2d.inc b/desk.acc/a2d.inc index 47fd881..cb70505 100644 --- a/desk.acc/a2d.inc +++ b/desk.acc/a2d.inc @@ -59,6 +59,8 @@ A2D_QUERY_SCREEN := $03 ; Get screen state ;; .byte vthick vertical pen thickness ;; .byte 0,$7F,0,$88 ??? (note: one byte shorter than SET_STATE) + ;; $8800 is possibly font (glyph metrics starts thereabouts) + A2D_SET_STATE := $04 ; Set full drawing state ;; (input length 36 bytes) ;; .word left pixels from screen edge @@ -441,3 +443,8 @@ end: ;; .byte ?? ;; .byte ?? ;; .byte len, name (length-prefixed, spaces before/after; 17 byte buffer) + + + font_size_count := $8801 ; num glyphs + 1 (for height) ?? + font_height := $8802 + font_width_table := $8803 ; width in pixels, indexed by ASCII code diff --git a/desk.acc/show_text_file.s b/desk.acc/show_text_file.s index 66de55e..3296a6b 100644 --- a/desk.acc/show_text_file.s +++ b/desk.acc/show_text_file.s @@ -464,15 +464,16 @@ end: rts .endproc + font_width_backup := $1100 + .proc open_file_and_init_window lda #0 sta fixed_mode_flag - ;; copy bytes (length at $8801) from $8802 to $10FF ??? - ;; length is $7f in tests - ldx $8801 + ;; make backup of font width table; overwritten if fixed + ldx font_size_count sta RAMWRTOFF -loop: lda $8802,x +loop: lda font_width_table - 1,x sta call_jt15+2,x dex bne loop @@ -661,7 +662,7 @@ end: rts beq end lda L0949 bne end - jsr L0E1D + jsr clear_window end: rts .endproc @@ -960,11 +961,12 @@ end: rts jmp input_loop .endproc - ;; called on scroll -L0E1D: A2D_CALL A2D_SET_PATTERN, white_pattern +.proc clear_window + A2D_CALL A2D_SET_PATTERN, white_pattern A2D_CALL A2D_FILL_RECT, window_params::box::hoffset A2D_CALL A2D_SET_PATTERN, black_pattern rts +.endproc ;;; ================================================== ;;; Content Rendering @@ -972,7 +974,7 @@ L0E1D: A2D_CALL A2D_SET_PATTERN, white_pattern .proc draw_content lda #0 sta L0949 - jsr L1129 + jsr overwrite_font_width_table jsr set_file_mark lda #default_buffer? @@ -1318,14 +1322,13 @@ loop: clc rts .endproc -;;; if fixed mode, do a main->aux copy of a code block ??? -.proc L1109 +.proc restore_font_table lda fixed_mode_flag ; if not fixed (i.e. proportional) beq done ; then exit - start := $1100 - end := $117E - dest := $8803 + start := font_width_backup + end := font_width_backup + $7E + dest := font_width_table lda #