Prev: 742B Up: Map Next: 746F
7436: Print the article for a word
Decides on and prints the article that goes in front of the word in DE, according to the flags in the top of D.
Names (bit 7 of D set) get no article. They do set the 'capitalise' flag $B5F5 so the name starts with a capital letter; the one exception is YOU, which is left alone.
Other words use bits 4-6 of D as an index (0-3) into a table of articles: AC21 (THE, A, AN, SOME) normally, or AC29 (THE, THE, THE, SOME) when a definite article is wanted ($B5F2 or 70D6 set). So each noun in the dictionary references carries its own article: 'a sword', 'an elvish sword', 'some wine'.
Input
DE Word reference
7436 BIT 7,D A name (bit 7 of D)?
7438 JR Z,$744C No: an ordinary noun
743A LD A,E Is it YOU ($07AC)?
743B LD HL,$07AC
743E CP L
743F JR NZ,$7446
7441 LD A,D
7442 AND $0F
7444 CP H
7445 RET Z YOU gets neither an article nor a capital
7446 LD A,$01 Other names get a capital letter...
7448 LD ($B5F5),A ...and no article
744B RET
744C LD HL,$AC21 HL = THE, A, AN, SOME
744F LD A,($B5F2) Is a definite article wanted?
7452 LD E,A
7453 LD A,($70D6)
7456 OR E
7457 JR Z,$745C No
7459 LD HL,$AC29 Yes: HL = THE, THE, THE, SOME
745C LD A,D The word's flag bits 4-6 choose one of the four
745D RRCA
745E RRCA
745F RRCA
7460 AND $1E
7462 PUSH DE
7463 LD E,A
7464 LD D,$00
7466 ADD HL,DE
7467 LD E,(HL) DE = the article
7468 INC HL
7469 LD D,(HL)
746A CALL $74B8 Print it
746D POP DE
746E RET
Prev: 742B Up: Map Next: 746F