mirror of
https://github.com/mi57730/a2d.git
synced 2024-11-29 07:49:20 +00:00
STF: Glyph widths
This commit is contained in:
parent
3b22aa7dbd
commit
97efeaf44d
@ -59,6 +59,8 @@ A2D_QUERY_SCREEN := $03 ; Get screen state
|
|||||||
;; .byte vthick vertical pen thickness
|
;; .byte vthick vertical pen thickness
|
||||||
;; .byte 0,$7F,0,$88 ??? (note: one byte shorter than SET_STATE)
|
;; .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
|
A2D_SET_STATE := $04 ; Set full drawing state
|
||||||
;; (input length 36 bytes)
|
;; (input length 36 bytes)
|
||||||
;; .word left pixels from screen edge
|
;; .word left pixels from screen edge
|
||||||
@ -441,3 +443,8 @@ end:
|
|||||||
;; .byte ??
|
;; .byte ??
|
||||||
;; .byte ??
|
;; .byte ??
|
||||||
;; .byte len, name (length-prefixed, spaces before/after; 17 byte buffer)
|
;; .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
|
||||||
|
@ -464,15 +464,16 @@ end: rts
|
|||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
font_width_backup := $1100
|
||||||
|
|
||||||
.proc open_file_and_init_window
|
.proc open_file_and_init_window
|
||||||
lda #0
|
lda #0
|
||||||
sta fixed_mode_flag
|
sta fixed_mode_flag
|
||||||
|
|
||||||
;; copy bytes (length at $8801) from $8802 to $10FF ???
|
;; make backup of font width table; overwritten if fixed
|
||||||
;; length is $7f in tests
|
ldx font_size_count
|
||||||
ldx $8801
|
|
||||||
sta RAMWRTOFF
|
sta RAMWRTOFF
|
||||||
loop: lda $8802,x
|
loop: lda font_width_table - 1,x
|
||||||
sta call_jt15+2,x
|
sta call_jt15+2,x
|
||||||
dex
|
dex
|
||||||
bne loop
|
bne loop
|
||||||
@ -661,7 +662,7 @@ end: rts
|
|||||||
beq end
|
beq end
|
||||||
lda L0949
|
lda L0949
|
||||||
bne end
|
bne end
|
||||||
jsr L0E1D
|
jsr clear_window
|
||||||
end: rts
|
end: rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
@ -960,11 +961,12 @@ end: rts
|
|||||||
jmp input_loop
|
jmp input_loop
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;; called on scroll
|
.proc clear_window
|
||||||
L0E1D: A2D_CALL A2D_SET_PATTERN, white_pattern
|
A2D_CALL A2D_SET_PATTERN, white_pattern
|
||||||
A2D_CALL A2D_FILL_RECT, window_params::box::hoffset
|
A2D_CALL A2D_FILL_RECT, window_params::box::hoffset
|
||||||
A2D_CALL A2D_SET_PATTERN, black_pattern
|
A2D_CALL A2D_SET_PATTERN, black_pattern
|
||||||
rts
|
rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
;;; Content Rendering
|
;;; Content Rendering
|
||||||
@ -972,7 +974,7 @@ L0E1D: A2D_CALL A2D_SET_PATTERN, white_pattern
|
|||||||
.proc draw_content
|
.proc draw_content
|
||||||
lda #0
|
lda #0
|
||||||
sta L0949
|
sta L0949
|
||||||
jsr L1129
|
jsr overwrite_font_width_table
|
||||||
jsr set_file_mark
|
jsr set_file_mark
|
||||||
lda #<default_buffer
|
lda #<default_buffer
|
||||||
sta read_params::buffer
|
sta read_params::buffer
|
||||||
@ -997,7 +999,7 @@ L0E68: lda L096D
|
|||||||
lda L096C
|
lda L096C
|
||||||
cmp L096A
|
cmp L096A
|
||||||
bne L0E7E
|
bne L0E7E
|
||||||
jsr L0E1D
|
jsr clear_window
|
||||||
inc L0948
|
inc L0948
|
||||||
L0E7E: A2D_CALL A2D_SET_POS, line_pos
|
L0E7E: A2D_CALL A2D_SET_POS, line_pos
|
||||||
sec
|
sec
|
||||||
@ -1035,7 +1037,7 @@ L0E7E: A2D_CALL A2D_SET_POS, line_pos
|
|||||||
inc L096D
|
inc L096D
|
||||||
: jmp L0E68
|
: jmp L0E68
|
||||||
|
|
||||||
L0ED7: jsr L1109
|
L0ED7: jsr restore_font_table
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
@ -1067,7 +1069,7 @@ L0F10: lda L0945
|
|||||||
bne L0F22
|
bne L0F22
|
||||||
lda L0947
|
lda L0947
|
||||||
beq L0F1F
|
beq L0F1F
|
||||||
jsr L0FF6
|
jsr draw_text_line
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -1091,7 +1093,7 @@ L0F22: ldy text_string::len
|
|||||||
jmp L0F9E
|
jmp L0F9E
|
||||||
|
|
||||||
L0F48: tay
|
L0F48: tay
|
||||||
lda $8803,y
|
lda font_width_table,y
|
||||||
clc
|
clc
|
||||||
adc L0F9C
|
adc L0F9C
|
||||||
sta L0F9C
|
sta L0F9C
|
||||||
@ -1115,7 +1117,7 @@ L0F6E: lda #0
|
|||||||
lda L0946
|
lda L0946
|
||||||
sta L0945
|
sta L0945
|
||||||
: inc text_string::len
|
: inc text_string::len
|
||||||
L0F86: jsr L0FF6
|
L0F86: jsr draw_text_line
|
||||||
ldy text_string::len
|
ldy text_string::len
|
||||||
lda ($06),y
|
lda ($06),y
|
||||||
cmp #$09 ; tab character?
|
cmp #$09 ; tab character?
|
||||||
@ -1170,14 +1172,16 @@ times70:.word 70
|
|||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;;; Draws a line of content
|
;;; Draws a line of content
|
||||||
L0FF6: lda L0948
|
.proc draw_text_line
|
||||||
beq L100B
|
lda L0948
|
||||||
|
beq end
|
||||||
lda text_string::len
|
lda text_string::len
|
||||||
beq L100B
|
beq end
|
||||||
A2D_CALL A2D_DRAW_TEXT, text_string
|
A2D_CALL A2D_DRAW_TEXT, text_string
|
||||||
lda #1
|
lda #1
|
||||||
sta L0949
|
sta L0949
|
||||||
L100B: rts
|
end: rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
L100C: lda text_string::addr+1
|
L100C: lda text_string::addr+1
|
||||||
cmp #$12 ; #>default_buffer?
|
cmp #$12 ; #>default_buffer?
|
||||||
@ -1318,14 +1322,13 @@ loop: clc
|
|||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;;; if fixed mode, do a main->aux copy of a code block ???
|
.proc restore_font_table
|
||||||
.proc L1109
|
|
||||||
lda fixed_mode_flag ; if not fixed (i.e. proportional)
|
lda fixed_mode_flag ; if not fixed (i.e. proportional)
|
||||||
beq done ; then exit
|
beq done ; then exit
|
||||||
|
|
||||||
start := $1100
|
start := font_width_backup
|
||||||
end := $117E
|
end := font_width_backup + $7E
|
||||||
dest := $8803
|
dest := font_width_table
|
||||||
|
|
||||||
lda #<start
|
lda #<start
|
||||||
sta STARTLO
|
sta STARTLO
|
||||||
@ -1344,12 +1347,12 @@ loop: clc
|
|||||||
done: rts
|
done: rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc L1129 ; ???
|
.proc overwrite_font_width_table
|
||||||
lda fixed_mode_flag ; if not fixed (i.e. proportional)
|
lda fixed_mode_flag ; if not fixed (i.e. proportional)
|
||||||
beq end ; then exit
|
beq end ; then exit
|
||||||
ldx $8801
|
ldx font_size_count
|
||||||
lda #7 ; 7 pixels/character
|
lda #7 ; 7 pixels/character
|
||||||
loop: sta $8802,x
|
loop: sta font_width_table - 1,x
|
||||||
dex
|
dex
|
||||||
bne loop
|
bne loop
|
||||||
end: rts
|
end: rts
|
||||||
@ -1370,7 +1373,7 @@ end: rts
|
|||||||
lda fixed_mode_flag
|
lda fixed_mode_flag
|
||||||
beq set_flag
|
beq set_flag
|
||||||
dec fixed_mode_flag ; clear flag (mode = proportional)
|
dec fixed_mode_flag ; clear flag (mode = proportional)
|
||||||
jsr L1109
|
jsr restore_font_table
|
||||||
jmp redraw
|
jmp redraw
|
||||||
|
|
||||||
set_flag:
|
set_flag:
|
||||||
|
Loading…
Reference in New Issue
Block a user