class ZXUtils::BigFontHires
BigFontHires
¶ ↑
See also: BigFont
.
Public Instance Methods
print_char_hires()
click to toggle source
ZX Spectrum's ROM compatible CHAN output routine, for hi-res mode.
The a
register should have the output character code loaded.
# File lib/zxutils/bigfont.rb, line 494 ns :print_char_hires do # The routine may modify the registers AF, AF', BC, DE, HL, IX. We should only preserve an alternative set # which is a regular set for the system. Modifying IY is not a good idea without disabling interrupts first. with_saved :exx, bc, de, hl, merge: true do ld de, [cursor] ld hl, flags bit 0, [hl] jp NZ, at_control cp 0x20 # control code ? jp C, control_char ex af, af # save code ld a, d cp 192 # out of screen ? jp NC, rom.error_5 push de # save coordinates # calculate screen address in HL ytoscr d, col:e, t:c ld c, 8 # 8 character lines exx # save screen address and height ex af, af # restore code cp 0x80 # ASCII ? jr C, ascii_code sub 0x90 # block graphic character ? jr NC, udg_code ld b, a call rom.po_gr_1 # creates a block character in MEM-0 ld hl, vars.membot jr output_char udg_code ld hl, [vars.udg] jr code2address ascii_code ld hl, [vars.chars] code2address char_ptr_from_code hl, a, tt:de # hl' = screen address, c' = 8, hl = char address output_char enlarge_char8_16(compact:true, assume_chars_aligned:false, hires: :odd) pop de # restore coordinates inc e check_col ld a, e cp 0x20 jr C, exit_save next_line ld e, 0 ld a, 16 add d ld d, a exit_save ld [cursor], de end # with_saved ret control_char cp ?\r.ord # ENTER jr NZ, skip_eol ld e, 0x20 jr check_col skip_eol cp 0x16 # AT (y, x) jr NZ, skip_at ld [hl], 0x03 # flags = AT_ROW jr exit_save skip_at cp 0x17 # TAB (x) jr NZ, exit_save ld [hl], 0x01 # flags = AT_COL jr exit_save # ignore anything else at_control bit 1, [hl] jr Z, at_col_ctrl ld [hl], 0x01 # flags = AT_COL ld d, a # set row jr exit_save at_col_ctrl ld [hl], 0x00 # flags = NONE ld e, a # set col jr check_col cursor words 1 flags bytes 1 end