-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_01_udc.bas
190 lines (190 loc) · 7.11 KB
/
demo_01_udc.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
10 REM ******************************
20 REM * AGON LIGHT 2 *
30 REM * DEMO 01 *
40 REM * BBC BASIC MODE 8 *
50 REM * USER DEFINED CHARS *
60 REM * BY STEVE LOVEJOY *
70 REM ******************************
80 :
90 REM MAIN SETUP.
95 CLEAR : REM CLEAR MEMORY
100 PROC_LOAD_VARS : REM CALL LOAD_VARS.
110 PROC_LOAD_CHARS : REM CALL LOAD_CHARS.
120 PROC_INIT_SCREEN : REM CALL INITSCREEN.
130 PROC_MAINLOOP : REM CALL MAIN LOOP.
140 VDU 30 : REM MOVES CURSOR HOME (TOP LEFT) | 0,0).
250 END : REM END MAIN SETUP.
260 :
1000 DEF PROC_MAINLOOP : REM ** MAIN LOOP **
1010 CLS : REM CLEAR THE SCREEN.
1020 NX = 14 : REM SET X.
1030 NY = 2 : REM SET Y AT THE TOP OF THE SCREEN, BELOW HUD BORDER.
1040 :
1050 FOR J=1 TO 62 : REM LOOP FOR COLOUR CHANGE.
1060 CLS : REM CLEAR THE SCREEN BETWEEN EACH COLOUR CHANGE.
1070 COLOUR J : REM ASSIGN COLOUR OF J.
1080 PROC_DRAW_HUD : REM DRAW THE HUD (BORDER).
1090 IF NY <=23 THEN NY = NY+1 : REM INCREMENT THE Y POSITION EACH COLOUR LOOP.
1100 IF NY >23 THEN NY = 2 : REM RESET Y AFTER IT MOVES OFF THE SCREEN.
1110 PROC_DRAW_AGON(NX,NY) : REM THIS ALLOWS YOU TO MOVE THE AGON TEXT WITH CODE.
1120 PROC_DRAW_LIGHT(NX+2,NY+2) : REM THIS ALLOWS YOU TO MOVE THE LIGHT TEXT WITH CODE.
1130 ANYKEY%=INKEY(20) : REM USE INKEY FOR DELAY, PRESS ANY KEY TO SPEED IT UP.
1140 NEXT J : REM LOOP J.
1150 :
2000 ENDPROC : REM END MAIN_LOOP.
2010 :
5500 DEF PROC_INIT_SCREEN : REM ** INIT_SCREEN **
5510 :
5520 MODE mode% : REM SETS SCREEN MODE FROM VARS.
5530 CLS : REM CLEAR TEXT SCREEN.
5540 CLG : REM CLEAR GRAPHICS SCREEN.
5550 PROC_HIDE_CURSOR : REM CALL HIDE_CURSOR.
5560 ENDPROC : REM END INIT_SCREEN
5570 :
5580 DEF PROC_HIDE_CURSOR : REM ** HIDE_CURSOR **
5590 VDU 23,1,0;0;0;0;
5600 ENDPROC
5610 :
5620 DEF PROC_SHOW_CURSOR : REM ** SHOW_CURSOR **
5630 VDU 23,1,1;0;0;0;
5640 ENDPROC
5650 :
7710 DEF PROC_LOAD_CHARS : REM ** LOAD_CHARS TO MEMORY **
7720 REM ASSIGN A to CHRS.
7730 VDU 23,201,0,0,0,0,1,1,7,7
7740 VDU 23,202,30,30,126,126,254,254,254,254
7750 VDU 23,203,31,31,126,126,120,120,0,0
7760 VDU 23,204,158,158,30,30,30,30,6,6
7770 REM ASSIGN G to CHARS.
7780 VDU 23,205,127,127,127,112,112,112,112,112
7790 VDU 23,206,254,254,254,0,0,6,6,30
7800 VDU 23,207,112,112,112,127,127,127,0,0
7810 VDU 23,208,30,30,30,254,254,254,24,24
7820 REM ASSIGN O to CHARS.
7830 VDU 23,209,127,127,127,112,112,112,112,112
7840 VDU 23,210,254,254,254,14,14,14,14,14
7850 VDU 23,211,112,112,112,127,127,127,0,0
7860 VDU 23,212,14,14,14,254,254,254,0,0
7870 REM ASSIGN N to CHARS.
7880 VDU 23,213,96,120,120,126,126,127,127,127
7890 VDU 23,214,14,14,14,14,14,142,142,254
7900 VDU 23,215,127,113,113,112,112,112,0,0
7910 VDU 23,216,254,254,254,126,126,30,30,6
7920 :
7930 REM ASSIGN L to CHRS.
7940 VDU 23,217,120,120,120,120,120,120,120,120
7950 VDU 23,218,0,0,0,0,0,0,0,0
7960 VDU 23,219,120,120,120,127,127,127,0,0
7970 VDU 23,220,0,0,0,254,254,254,0,0
7980 REM ASSIGN I to CHARS.
8000 VDU 23,221,127,127,127,3,3,3,3,3
8010 VDU 23,222,254,254,254,192,192,192,192,192
8020 VDU 23,223,3,3,3,127,127,127,0,0
8030 VDU 23,224,192,192,192,254,254,254,0,0
8040 REM ASSIGN H to CHARS.
8050 VDU 23,225,120,120,120,120,120,120,127,127
8060 VDU 23,226,6,6,30,30,30,30,254,254
8070 VDU 23,227,127,127,120,120,120,120,96,96
8080 VDU 23,228,254,254,30,30,30,30,0,0
8090 REM ASSIGN T to CHARS.
8100 VDU 23,229,127,127,127,3,3,3,3,3
8110 VDU 23,230,254,254,254,192,192,192,192,192
8120 VDU 23,231,3,3,3,3,3,3,0,0
8130 VDU 23,232,192,192,192,192,192,192,192,192
8140 :
8190 REM HUD CHARS.
8200 VDU 23,237,255,255,192,192,192,192,192,192 : REM TOP LEFT CORNER.
8210 VDU 23,238,255,255,3,3,3,3,3,3 : REM TOP RIGHT CORNER.
8220 VDU 23,239,192,192,192,192,192,192,255,255 : REM BOT LEFT CORNER.
8230 VDU 23,240,3,3,3,3,3,3,255,255 : REM BOT RIGHT CORNER.
8240 VDU 23,241,255,255,0,0,0,0,0,0 : REM TOP STRAIGHT.
8250 VDU 23,242,0,0,0,0,0,0,255,255 : REM BOT STRAIGHT.
8260 VDU 23,243,192,192,192,192,192,192,192,192 : REM LEFT STRAIGHT.
8270 VDU 23,244,3,3,3,3,3,3,3,3 : REM RIGHT STRAIGHT.
8280 :
8290 ENDPROC : REM END LOAD_CHARS.
8300 :
8400 DEF PROC_LOAD_VARS : REM **** LOAD_VARS *****
8410 REM GIVE COLOURS A NAME.
8411 COLBLACK% = 0
8412 COLRED% = 1
8413 COLGREEN% = 2
8414 COLYELLOW% = 3
8415 COLBLUE% = 4
8416 COLMAGENTA% = 5
8417 COLCYAN% = 6
8418 COLWHITE% = 7
8419 COLINTRED% = 9
8420 COLINTGREEN% = 10
8421 COLINTYELLOW% = 11
8422 COLINTBLUE% = 12
8423 COLINTMAGENTA% = 13
8424 COLINTCYAN% = 14
8425 COLINTWHITE% = 15
8450 mode% = 8 : REM SET MODE HERE.
8460 RT% = 31 : REM SET RIGHT TEXT.
8470 LT% = 2 : REM SET LEFT TEXT.
8480 T1X = 0 : REM TITLE TEXT AGON X.
8490 T1Y = 0 : REM TITLE TEXT AGON Y.
8500 T2X = 0 : REM TITLE TEXT LIGHT X.
8510 T2Y = 0 : REM TITLE TEXT LIGHT Y.
8600 :
8700 ENDPROC : REM END LOAD_VARS.
8800 :
9000 DEF PROC_DRAW_AGON(T1X,T1Y) : REM ** DRAW_AGON **
9010 :
9020 REM FROM CUSTOM CHARS DEFINED PREVIOUSLY DISPLAYED AS (2x2) CHARS.
9030 REM AGON.
9060 PRINT TAB(T1X,T1Y);CHR$(201);CHR$(202)
9070 PRINT TAB(T1X,T1Y+1);CHR$(203);CHR$(204)
9080 REM DISPLAY G (2x2) CHARS.
9090 PRINT TAB(T1X+2,T1Y);CHR$(205);CHR$(206)
9100 PRINT TAB(T1X+2,T1Y+1);CHR$(207);CHR$(208)
9110 REM DISPLAY O (2x2) CHARS.
9120 PRINT TAB(T1X+4,T1Y);CHR$(209);CHR$(210)
9130 PRINT TAB(T1X+4,T1Y+1);CHR$(211);CHR$(212)
9140 REM DISPLAY N (2x2) CHARS.
9150 PRINT TAB(T1X+6,T1Y);CHR$(213);CHR$(214)
9160 PRINT TAB(T1X+6,T1Y+1);CHR$(215);CHR$(216)
9170 ENDPROC : REM END DRAW_AGON.
9180 :
9300 DEF PROC_DRAW_LIGHT(T2X,T2Y) : REM ** DRAW_LIGHT **
9310 :
9320 REM FROM CUSTOM CHARS DEFINED PREVIOUSLY.
9330 REM LIGHT.
9340 REM DISPLAY L (2x2) CHARS.
9360 PRINT TAB(T2X,T2Y);CHR$(217);CHR$(218)
9370 PRINT TAB(T2X,T2Y+1);CHR$(219);CHR$(220)
9380 REM DISPLAY I (2x2) CHARS.
9390 PRINT TAB(T2X+2,T2Y);CHR$(221);CHR$(222)
9400 PRINT TAB(T2X+2,T2Y+1);CHR$(223);CHR$(224)
9410 REM DISPLAY G (2x2) CHARS.
9420 PRINT TAB(T2X+4,T2Y);CHR$(205);CHR$(206)
9430 PRINT TAB(T2X+4,T2Y+1);CHR$(207);CHR$(208)
9440 REM DISPLAY H (2x2) CHARS.
9450 PRINT TAB(T2X+6,T2Y);CHR$(225);CHR$(226)
9460 PRINT TAB(T2X+6,T2Y+1);CHR$(227);CHR$(228)
9470 REM DISPLAY T (2x2) CHARS.
9480 PRINT TAB(T2X+8,T2Y);CHR$(229);CHR$(230)
9490 PRINT TAB(T2X+8,T2Y+1);CHR$(231);CHR$(232)
9500 ENDPROC : REM END DRAW_AGON.
9510 :
9600 DEF PROC_DRAW_HUD : REM ** DRAW_HUD **
9610 :
9620 PRINT TAB(0,0);CHR$(237) : REM TL CORNER.
9630 FOR TB = 1 TO 38 : REM TOP BORDER.
9640 PRINT TAB(TB,0)CHR$(241)
9650 NEXT TB
9660 PRINT TAB(39,0)CHR$(238) : REM TR CORNER.
9670 FOR LB = 1 TO 27 : REM LEFT BORDER.
9680 PRINT TAB(0,LB)CHR$(243)
9690 NEXT LB
9700 FOR RB = 1 TO 27 : REM RIGHT BORDER.
9710 PRINT TAB(39,RB)CHR$(244)
9720 NEXT RB
9730 PRINT TAB(0,27);CHR$(239) : REM BL CORNER.
9740 FOR BB = 1 TO 38 : REM BOTTOM BORDER.
9750 PRINT TAB(BB,27)CHR$(242)
9760 NEXT BB
9770 PRINT TAB(39,27);CHR$(240) : REM BR CORNER.
10000 ENDPROC : REM END DRAW_HUD.