ORG 30000

_MAIN
CALL SUB1 ;(Print faces)
CALL SUB2 ;(Print scenery)
CALL SUB3 ;(Print small text)
RET ;Return to BASIC


_SUBS

SUB1 ;Print face graphics.

LD HL, FACEUDGS ;Get location of UDG data.
LD (UDGPOINTER), HL ;Set UDG SYSVAR pointer.
LD A, 2 ;Set output channel 2 (upper screen).
CALL OUTCHAN ;Activate output channel.
LD DE, STR1 ;Start of string.
LD BC, STR1END-STR1 ;Length of string.
CALL PRINTSTRING ;Print string.
RET ;Return from SUB1.

SUB2 ;Print scenery graphics.

LD HL, SCENERYUDGS ;Ger location of UDG data.
LD (UDGPOINTER), HL ;Set UDG SYSVAR pointer.
LD A, 2 ;Set output channel 2 (upper screen).
CALL OUTCHAN ;Activate output channel.
LD DE, STR2 ;Start of string.
LD BC, STR2END-STR2 ;Length of string.
CALL PRINTSTRING ;String printing routine.
RET ;Return from SUB2.

SUB3 ;Print small text graphics.

LD HL, SMALLTEXTUDGS ;Get location of UDG data.
LD (UDGPOINTER), HL ;Set UDG SYSVAR pointer.
LD A, 2 ;Set output channel 2 (upper screen).
CALL OUTCHAN ;Activate output channel.
LD DE, STR3 ;Start of string.
LD BC, STR3END-STR3 ;Length of string.
CALL PRINTSTRING ;String printing routine.
RET ;Return from SUB3.

_SYSVARS

UDGPOINTER EQU 23675 ;UDG pointer.


_ROM

BORDER EQU 8859 ;Set border color.
CLS EQU 3503 ;Clear screen using attributes in ATTR-P (23693)
OUTCHAN EQU 5633 ;Activate output channel.
PRINTNUMSMALL EQU 6683 ;Print number in BC (9999 max).
PRINTNUMBIG1 EQU 11563 ;(1 of 2) to print number in BC (65535 max).
PRINTNUMBIG2 EQU 11747 ;(2 of 2) to print number in BC (65535 max).
PRINTSTRING EQU 8252 ;Print string (DE start, BC length).


_VALUES

;Store values into memory here.


_STRINGS

STR1 ;Face graphics string.

DEFB _AT,7,11,ink,red,paper,blk,flash,off,bright,on,ua ; Happy.
DEFB _AT,7,13,ink,cyn,paper,blu,flash,off,bright,off,ub ; Sad.
DEFB _AT,7,15,ink,yel,paper,mag,flash,on,bright,on,uc ; Surprised.

STR1END EQU $ ;Marker for end of string data.

STR2 ;Scenery graphics string.

DEFB _AT,9,11,ink,grn,paper,blk,flash,off,bright,on,ua ; Tree.
DEFB _AT,9,13,ink,red,paper,blk,flash,off,bright,on,ub ; Church.
DEFB _AT,9,15,ink,mag,paper,blk,flash,off,bright,off,uc ; Factory.

STR2END EQU $ ;Marker for end of string data.

STR3 ;Small text graphics string.

DEFB _AT,13,10,ink,cyn,paper,blk,flash,off,bright,on,ua,ub,uc ;"HE","AL","TH".
DEFB _AT,13,14,ink,grn,paper,blk,flash,off,bright,on,"100" ; Health value.

STR3END EQU $ ;End of string marker


_CODES EQU $

cr equ 13 ;carriage return.
ink equ 16 ;INK control code.
paper equ 17 ;PAPER control code.
flash equ 18 ;FLASH control code.
bright equ 19 ;BRIGHT control code.
inverse equ 20 ;INVERSE control code.
off equ 0 ;OFF control code.
on equ 1 ;ON control code.
_at equ 22 ;AT control code.
_tab equ 23 ;TAB
blk equ 0 ;Blk.
blu equ 1 ;Blue.
red equ 2 ;Red.
mag equ 3 ;Magenta.
grn equ 4 ;Green.
cyn equ 5 ;Cyan.
yel equ 6 ;Yellow.
wht equ 7 ;White.
ua equ 144 ;UDG "A".
ub equ 145 ;UDG "B".
uc equ 146 ;UDG "C".
ud equ 147 ;UDG "D".
ue equ 148 ;UDG "E".
uf equ 149 ;UDG "F".
ug equ 150 ;UDG "G".
uh equ 151 ;UDG "H".
ui equ 152 ;UDG "I".
uj equ 153 ;UDG "J".
uk equ 154 ;UDG "K".
ul equ 155 ;UDG "L".
um equ 156 ;UDG "M".
un equ 157 ;UDG "N".
uo equ 158 ;UDG "O".
up equ 159 ;UDG "P".
uq equ 160 ;UDG "Q".
ur equ 161 ;UDG "R".
us equ 162 ;UDG "S".
ut equ 163 ;UDG "Y".
uu equ 164 ;UDG "U".




_UDGS ;********************************* UDGS ********************************

FACEUDGS ;Face UDGs.
; Happy(A)
DEFB % 00111100
DEFB % 01111110
DEFB % 10011001
DEFB % 11100111
DEFB % 10100101
DEFB % 10011001
DEFB % 01000010
DEFB % 00111100

; Sad(B)
DEFB % 00111100
DEFB % 01111110
DEFB % 10111101
DEFB % 11100111
DEFB % 11111111
DEFB % 11000011
DEFB % 01011010
DEFB % 00111100

; Surprised(B)
DEFB % 00111100
DEFB % 01111110
DEFB % 11011011
DEFB % 10011001
DEFB % 11111111
DEFB % 11100111
DEFB % 01100110
DEFB % 00111100


SCENERYUDGS ;Scenery UDGs.
; Tree(A)
DEFB % 01010001
DEFB % 10101010
DEFB % 01101101
DEFB % 11011011
DEFB % 00011110
DEFB % 00011000
DEFB % 00011000
DEFB % 00011000


; Church(B)
DEFB % 00100000
DEFB % 01110000
DEFB % 00100000
DEFB % 00100000
DEFB % 01111000
DEFB % 11111111
DEFB % 11010101
DEFB % 11011111

; Factory(C)
DEFB % 00010000
DEFB % 01000000
DEFB % 01000000
DEFB % 01000000
DEFB % 01111100
DEFB % 01010110
DEFB % 01101010
DEFB % 00000000


SMALLTEXTUDGS ;Small text UDGs.
; "HE"(A)
DEFB % 00000000
DEFB % 00000000
DEFB % 10101110
DEFB % 10101000
DEFB % 11101100
DEFB % 10101000
DEFB % 10101110
DEFB % 00000000

; "AL"(B)
DEFB % 00000000
DEFB % 00000000
DEFB % 11101001
DEFB % 10101000
DEFB % 11101000
DEFB % 10101000
DEFB % 10101110
DEFB % 00000000

; "TH"(C)
DEFB % 00000000
DEFB % 00000000
DEFB % 11010100
DEFB % 10010101
DEFB % 10011100
DEFB % 10010101
DEFB % 10010100
DEFB % 00000000