1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;; 6x8 font printing engine
3 ;; the font was stolen from the
4 ;; BYTEX font editor, (c) BYTEX Group
5 ;; all dumb code is mine.
6 ;; all smart code is taken from
7 ;; the font editor & slighly tweaked.
9 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12 incbin "main_font6x8.fnt"
14 emit6_line_count equ 24 ;; was 22
15 emit6_line_width equ 42
17 $FORTH_CONST (E6FONTADDR) font6x8_addr
18 font6x8_addr: defw font6x8_data
20 $FORTH_CONST (E6CURXY) emit6y
21 $FORTH_CONST (E6CURX) emit6x
22 $FORTH_CONST (E6CURY) emit6y
23 $FORTH_CONST (E6WASSCROLL) emit6wasscrl
24 $FORTH_CONST CONWIDTH emit6_line_width
34 emit6_allowattr: defb 1
36 $FORTH_CONST EMIT-ATTRS? 1
38 $FORTH_CODE_WORD TATTRS
45 jr z,fword_tattrz_zero
48 ld (emit6_allowattr),a
50 $FORTH_END_CODE_WORD TATTRS
52 $FORTH_CODE_WORD TATTRS?
55 ld a,(emit6_allowattr)
59 $FORTH_END_CODE_WORD TATTRS?
63 call #0DFE ;; CL-SC-ALL
64 ; set attribute for the lower part
65 ld hl,scrattr8x8(0,23)
66 ld de,scrattr8x8(1,23)
74 $FORTH_CONST EMIT-ATTRS? 0
75 emit6_do_scroll_subr equ #0DFE ;; CL-SC-ALL
77 $FORTH_CODE_WORD TATTRS
83 $FORTH_END_CODE_WORD TATTRS
85 $FORTH_CODE_WORD TATTRS?
90 $FORTH_END_CODE_WORD TATTRS?
99 ;; check for the new line
103 jr c,emit6i_0 ;; no new line
112 jr c,emit6i_1 ;; no scroll
115 ld (hl),emit6_line_count-1
118 call emit6_do_scroll_subr
128 ;; draw6InvMask: char inverse mask (norm: #00; inv: #FC)
129 ;; draw6CharMask: screen AND mask (norm: #03; over: #FF)
130 ;; draw6PutALU0: OR(#B2)/XOR(#AA) -- curr. XOR
131 ;; draw6PutALU1: OR(#B3)/XOR(#AB) -- curr. XOR
142 ;; calc screen address
177 ld (emit6_scraddr),hl
182 ld (Draw6Shift),a ; [#00] [#00]
188 draw6InvMask: equ $+1
193 draw6CharMask: equ $+2
228 and #1F ;; char byte is zero?
251 ld a,(emit6_allowattr)
256 emit6_scraddr equ $-2
257 ; conver to attribute
280 ;; end of internal EmitChar
285 ;; check for the new line
299 ld (hl),emit6_line_count-1
302 jp #0DFE ;; CL-SC-ALL
303 ;; end of internal CR proc
306 ;; draw one char, advance pos, scroll if necessary
307 $FORTH_CODE_WORD XEMIT
316 $FORTH_END_CODE_WORD XEMIT
335 $FORTH_END_CODE_WORD CLS
338 ;; backspace (back one char)
339 $FORTH_CODE_WORD EMITBS
346 jp z,i_next ;; can't move above the top
349 jr z,bs6_0 ;; up one line
354 ld h,emit6_line_width-1
358 $FORTH_END_CODE_WORD EMITBS
361 ;; draw one char, advance pos, scroll if necessary
369 ;; #13 -- cr (no line feed)
370 $FORTH_CODE_WORD EMIT
406 $FORTH_END_CODE_WORD EMIT
418 $FORTH_END_CODE_WORD CR
422 $FORTH_CODE_WORD VSCROLL
426 call emit6_do_scroll_subr
429 $FORTH_END_CODE_WORD VSCROLL
432 ;; vertical tab (#10)
433 $FORTH_CODE_WORD VTAB
441 $FORTH_END_CODE_WORD VTAB
443 ;; horizontal tab (#9)
444 $FORTH_CODE_WORD HTAB
452 jr c,htab6_0 ;; no new line
457 jr c,htab6_q ;; there were spaces, so tab is complete %-)
477 $FORTH_END_CODE_WORD HTAB
480 $FORTH_CODE_WORD WHEREX
488 $FORTH_END_CODE_WORD WHEREX
490 $FORTH_CODE_WORD WHEREY
495 $FORTH_END_CODE_WORD WHEREY
497 $FORTH_CODE_WORD GOTOXY
505 $FORTH_END_CODE_WORD GOTOXY
508 $FORTH_CODE_WORD TOVER
533 $FORTH_END_CODE_WORD TOVER
535 $FORTH_CODE_WORD TOVER?
545 $FORTH_END_CODE_WORD TOVER?
547 $FORTH_CODE_WORD TINV
558 $FORTH_END_CODE_WORD TINV
560 $FORTH_CODE_WORD TINV?
571 $FORTH_END_CODE_WORD TINV?
574 $FORTH_CODE_WORD SPACE
579 $FORTH_END_CODE_WORD SPACE
581 $FORTH_CODE_WORD EMITCR
587 $FORTH_END_CODE_WORD EMITCR
589 $FORTH_CODE_WORD SPACES
609 $FORTH_END_CODE_WORD SPACES
615 dup 0 > 0BRANCH type1
630 dup 0 > 0BRANCH xtype1
640 $FORTH_END_WORD XTYPE
644 $FORTH_CONST SV-ATTR_P emit6_attrp
647 $FORTH_CODE_WORD PAPER
663 $FORTH_END_CODE_WORD PAPER
678 $FORTH_END_CODE_WORD INK
680 $FORTH_CODE_WORD FLASH
686 jr z,fword_flash_zero
695 $FORTH_END_CODE_WORD FLASH
697 $FORTH_CODE_WORD BRIGHT
703 jr z,fword_bright_zero
712 $FORTH_END_CODE_WORD BRIGHT
718 $FORTH_CODE_WORD XEMIT8
726 jr c,fword_xemit8_xok
733 jr c,fword_xemit8_yok
737 call emit6_do_scroll_subr
767 ; DE: screen$ address
778 jr nz,fword_xemit8_loop
781 ; conver to attribute
792 $FORTH_END_CODE_WORD XEMIT8
794 $FORTH_CODE_WORD EMIT8
818 call emit6_do_scroll_subr
821 $FORTH_END_CODE_WORD EMIT8
829 $FORTH_END_CODE_WORD CR8
831 $FORTH_CODE_WORD SPACE8
837 $FORTH_END_CODE_WORD SPACE8
842 DUP 1- 0< 0BRANCH fword_spaces8_ok
848 (LOOP) fword_spaces8_loop
850 $FORTH_END_WORD SPACES8
855 dup 0 > 0BRANCH fword_type8_1
865 $FORTH_END_WORD TYPE8
870 dup 0 > 0BRANCH fword_xtype8_1
874 (LOOP) fword_xtype8_0
875 BRANCH fword_xtype8_2
880 $FORTH_END_WORD XTYPE8
890 $FORTH_END_CODE_WORD AT8
896 (KEY-SHOW-CURSOR) 0C!
898 SWAP (KEY-SHOW-CURSOR) C!
902 $FORTH_WORD (.8") ;;"
905 R> COUNT 2DUP TYPE8 + >R ;S
906 $FORTH_END_WORD (.8") ;;"
908 $FORTH_WORD .8" IMM ;;"
911 LIT 34 STATE @ 0BRANCH fword_qs8_0
918 $FORTH_END_WORD .8" ;;"
923 >R SWAP OVER DABS <# #S SIGN #> R> OVER - SPACES8 TYPE8 ;S