blob: c482768e14625efbea71e72646dd7edcd4d9ffdf [file] [log] [blame]
kthacker62e146c2006-04-17 15:11:35 +00001;; Hires:
2;;
3;; Mode 0, 40 columns. Each character is 4 pixels wide and 8 pixels tall.
4;; Each character is two bytes wide and 8 lines tall.
5;;
6;; The graphics for each character is a bitmap defined using
7;; pen 0 and pen 15.
8;;
9;; The bitmap is processed at runtime to convert the font to the
10;; appropiate pixel colours.
11 .area _CODE
12;; This table converts between pen index (0-15) and pixel bitmap.
13.pen_table
14defb #00 ;; pen 0 (%00000000)
15defb #c0 ;; pen 1 (%11000000)
16defb #0c ;; pen 2 (%00001100)
17defb #cc ;; pen 3 (%11001100)
18defb #30 ;; pen 4 (%00110000)
19defb #f0 ;; pen 5 (%11110000)
20defb #3c ;; pen 6 (%00111100)
21defb #fc ;; pen 7 (%11111100)
22defb #03 ;; pen 8 (%00000011)
23defb #c3 ;; pen 9 (%11000011)
24defb #0f ;; pen 10 (%00001111)
25defb #cf ;; pen 11 (%11001111)
26defb #33 ;; pen 12 (%00110011)
27defb #f3 ;; pen 13 (%11110011)
28defb #3f ;; pen 14 (%00111111)
29defb #ff ;; pen 15 (%11111111)
30
31;; A = pen
32.get_pen_mask
33ld hl,pen_table
34add a,l
35ld l,a
36ld a,h
37adc a,0
38ld h,a
39ld a,(hl)
40ret
41
42.set_pen
43call get_pen_mask
44ld (pen_mask+1),a
45ld (pen_mask2+1),a
46ret
47
48.set_paper
49call get_pen_mask
50ld (paper_mask+1),a
51ld (paper_mask2+1),a
52ret
53
54;; enter:
55;; HL = current memory address
56;; exit:
57;; HL = memory address of byte immediatly below
58;; AF corrupt.
59.scr_next_line
60ld a,h
61add a,8
62ld h,a
63ret nc
64ld a,l
65add a,&50
66ld l,a
67ld a,h
68adc a,&c0
69ld h,a
70ret
71
72;; enter:
73;; HL = screen address
74;; DE = character pixel graphics
75;; exit:
76;; AF, BC, HL, DE corrupt
77.plot_char
78ld b,8
79.pc1
80ld a,(de) ;; convert 'on' pixels
81.pen_mask and 1
82ld c,a
83ld a,(de)
84cpl
85.paper_mask and 1
86or c
87ld (hl),a
88inc l
89ld a,(de)
90.pen_mask2 and 1
91ld c,a
92ld a,(de)
93cpl
94.paper_mask2 and 1
95or c
96ld (hl),a
97dec l
98call scr_next_line
99djnz pc1
100ret
101