PROGRAM LINES: ==============
10 init (9000) 20 main menu (9400), branching 30 (IF SCREEN NEEDS CLEARED) set editor mode, clear screen (1550), maze border (1000) 35 (IF MAZE NEEDS REDISPLAYED) read map (1700), display title, display map # (1800) and free mem (1820), display maze (1400) 40 (IF ONLY SUMMARY LINE WAS CHANGED) display controls, editor menu (9650), erase summary line (9550), branching 90 (START MAP EDITING) set changes to 0 100 (CONTINUE MAP EDITING) put cursor down (1200), reset keyboard 105 display editor summary, go to main loop (385) 150 game mode; restore player stats; clear screen, draw maze border 160 game screen (9700); draw player
Main loop: 200 key commands 280 saving player location, exit to main menu (20) 300 typing into map 380 space key 385 set move mode then back to main loop 400 moving/drawing 420 delete special 450 (game mode) bump! 460 (game mode) specials 500 moving left (map goes right) 550 moving right (map goes left) 600 moving up (map goes down) 650 moving down (map goes up) 700 exiting map-drawing (need: SA) - inner use: A$ - call: 1350, 1095 750 browse map (need: NM, ID) - manage: N - inner use: I, J (cursor coords), A$ - call: 1090, 1800, 1200 800 draw specials - inner use: A (1 = going up, -1 = going down), B (1 = goal, 0 = stairs) - call: 1780, 1090 850 stairs up / goal (up) (A=1) 880 move map to reserve, load destination map, check if blocked, load current map (for colors), recall map from reserve 900 if up, then 905, if down, create top of stairs, then 915 905 create bottom of stairs or goal, then 910 or 920 910 create top of stairs (need: A (1 = don't)) 915 create bottom of stairs, then store (940) 920 create top of goal (need: A (1 = don't)) 930 update NM, then... 940 store map, then back to editor 950 stairs down (A=-1), check if bottommost level 970 volume 980 set player starting pos
Subroutines: 1000 SUB: draw maze border (need: XS, YS, W, H) = temp fix: uses only black color - inner use: I 1050 wait I seconds (need: I) 1090 SUB: wait for a key 1095 SUB: without text - set: A$ 1100 create filled M$, put spc to pos Z, create C$() if not exists (need: W$, M, Z, E$) 1110 SUB: create 255-chars M$ (need: W$) - set: M$ - inner use: I 1200 SUB: move cursor to position (need: I, J) - set: CH, CL 1250 1300 message to top of maze display (need: A$) 1320 SUB: clear message from top of maze - need: YS 1350 SUB: remove cursor from screen (need: C) 1400 draw maze (need: XS, YS, M$, Z, HP, M, W, S, XE, YE, X, Y, P$) - inner use: I, J 1450 draw maze ANYWHERE on/off-screen (need: A, B (coord)) - inner use: I 1500 SUB: set screen colors and current ink (need: DATA pointer) - set: C$() - inner use: I, J 1550 SUB: clear screen, set ink (need: C$(1)) 1600 SUB: print A$ centered; extra line feed (need: A$) 1650 1700 SUB: read map, alternatively create a new one (need: N, NM, P) - set: M$, W$, E$ - inner use: I, A$, DATA pointer - call: 1100, 1500 1750 SUB: move map (M$, W$, E$) to reserve (MZ$, WZ$, EZ$) 1760 SUB: recall map (M$, W$, E$) from reserve (MZ$, WZ$, EZ$), delete reserve 1780 SUB: check current map pos for special chars (need: M$, Z) - set: A$ (current pos char) 1790 SUB: check if A$ is a special char (need: A$) - set: I (1 = blocked) 1800 SUB: display map number (need: N) 1820 SUB: display free memory (in maps) (need: FNME(0)) 1850 1900 SUB: poke J instances of RETURN to key buffer (need: J) - inner use: I 1950 2000 filter A$ (need: A$) - spc, shift-spc remains, double quotes filtered out - inner use: A (ASC code of A$) 2050
3000 store map (need: CO, M$, M (0 means no map matrix storing), C$(), SP$ (optional commands before relaunching)) - inner use: A$, I (first DATA line #), J, DATA pointer - max. random text: 24 chars - call: 1350, 1900 >3010 without top message 3065 set line 9100 >3070 (optional commands):GOSUB 9000:GOTO CO
4000 set up dimensions 4100 set up specials (need: SU$, SD$, GU$) >4105 skip clear screen, title, maze border and maze - set: DATA pointer - inner use: J, IS, I2, B$, A$, B (specials type) - call: 9600, 1400, 9550, 9200, 1095, 2000 4290 SUB: SP$ creator 4300 delete topmost map 4400 map appearance - inner use: B (board #, 1-4, in 2 bg=ink always...), I$(3-4) 4400 check if an already stored map 4410 generate color tables >4440 redraw texts >4480 display wall and floor char >4490 display instructions 4500 reset ink changes 4505 fields branching 4550 fields controls 4620 store/back to menu 4650 change chars 4800 randomly delete walls (need: M, M$, W$, E$) - set: SA - inner use: I, J - call: 9550, 1400, 1095 4900 edit texts 5000 edit line - set: IM - manage: SA, I$(), IS, L - inner use: I, J, DATA pointer, B$ (current text), B (current text length), U (SA reserve) - call: 1550, 9550, 9220 5060 SUB: change all spaces to cursor right chars in B$ - inner use: I 5100 SUB: create DATA line bundle from 2 adjacent I$() - need: I (first I$() index), J (base DATA line number), I$()
5200 SUB: edit B$ in line J from pos 1 to pos D (need: B$, J, ES$, D) clears line after editing >5205 loop start with updating cursor pos >5210 loop start with getkey only - manage: B$, SA - inner use: I (cursor x pos), A$, B (text length), D$ (original text) - call: 1200, 1350, 2000 (A) 5300
6000 save game - inner use: U (device #) - call: 1095, 1550
8000 game end
9000 SUB: constants and variables init - set: (all 'const' and 'begin' class) - inner use: I, DATA pointer 9170 SUB: calculate XS, YS
9200 SUB: menu init and choose (need: DATA pointer, J (fullscreen), IS (initially selected item), C$()) >9220 menu display 9230 choose - set: D$, IM, I$() - manage: IS - inner use: A (current item is active (0,1)), A$, I - call: 9300 9300 display menu item (need: A (active?), I (item #), I$(), J (fullscreen), C$())
9350 menu background effects (need: BG) - inner use: B (screen poke) - set: IS, A$
9400 SUB: main menu (remembers last selected item) - used by: main control (20) - inner use: DATA pointer, J - manage: IS, I0 - call: 9200 9450 SUB: tag 9500 SUB: display read text (need: DATA pointer) - inner use: A$ - call: 1500, 1600 9550 erase summary line (need: ES$) 9610 sub-editor screen - set: DATA pointer - inner use: I - call: 1600 9650 editor menu (remembers last selected item) - set: DATA pointer - inner use: J - call: 9200 9700 SUB: game screen - call: 1700, 1400, 1320 9750 SUB: change B$ to D$ in M$ (need: M$, D$, B$, C$()) - inner use: I - manage: M$ - set: J (changed map) - call: 1400, 1095 9770 SUB: get
9800 intro - set: N - inner use: A, B - call: 1700, 1450 Subroutine: 9990 delete line #I to the top and bottom; make line 12 solid
Data: 10000 title colors, text 10010 title menu text 10020 editor colors, text 10030 editor menu text (max. 18 chars) 10040 game mode colors, text 10050 specials menu text 10100 random text for "dangerous" actions, max. 24 chars
20000 maps (max 76 chars per DATA line) starting DATA line = 19995 + N*5 each new block of 76 bytes of map get +8 bytes (255=76+76+76+27) max map mem = 255 chars map data + 8 bytes * 5 DATA lines + 23 bytes parameters = 318 bytes per map
VARIABLES: ==========
const C cursor poke address (65292) const C$ ink color chars const ES$ ESC char const G$ common game key commands string (left-right-up-down-spc-esc-,-.) const K keyboard buffer size address (239) const K$ common key commands string (left-right-up-down-spc-esc-del-enter-home) const QU$ double quote char
A,B,D,I,J short-term (loop) variables menu- BG background effects (0,1) begin BP bottom-right maze corner poke address editr CH cursor address high editr CL cursor address low editr CO continue at which line after storing map begin DE number of demo map begin FNME() free memory in maps begin H maze screen height (5-7-9-11-13-15) begin HH half of maze screen height-1 (7) begin HM half of maze minus half line offset (HH*W-O = 111) begin HP half of maze plus half line offset (HH*W+O = 127) begin I0 main menu selected item begin I1 editor menu selected item edit- I2 specials menu selected item menu- ID selected dir on menu item (-1,0,1) menu- IM menu items max menu- IS number of menu item selected (0:esc, 1-...) begin L lines spacing in menus (1 in text editor, 2 elsewhere) begin L0 link poke data (2030) begin L1 link poke data (2031) begin L2 link poke data (2032) begin M maze string length (255) menu- MO current mode (0:edit, 1:play) begin N number of current maze map (1-nnn) begin NM number of stored maze maps (0-nnn) begin O XS->X offset (8) begin P number of map pieces in DATAs (1-4) begin PN Player saved map # (1-nnn) begin PZ Player saved pos in maze string (1-255) begin S stop pos in maze string (240) editr SA changes were made to the actual map/menu (0,1) begin TP top-left maze corner poke address play- U previous player pos (see Z) / SA reserve (5000) begin V sound volume (0-8) begin W maze screen width (5-7-9-11-13-15-17) begin X player screen x coord (10) begin XE maze screen right side x coord (XS+W-1 = 18) begin XS maze screen left side x coord (8-7-6-5-4-3-2) begin Y player screen y coord (12) begin YE maze screen right side y coord (=YS+H-1 = 19) begin YS maze screen left side y coord (10-9-8-7-6-5) begin Z current pos in maze string (1-255, def:1)
A$,B$ short-term string variables begin BT$ set current screen pos as window bottom, go to top and set window top menu- C$(0,1) de/selected item color; 1: also wall color editr D$ current drawing char editr EZ$ empty char reserve menu- I$(1-14) menu item names, short-term string array start M$ current maze (length: 255) editr MZ$ maze reserve (length: 255) spec- SP$ special parameters for after map storing editr WZ$ wall char reserve
Characters (6): begin E$ current (map) empty char begin GU$ goal (up) char begin P$ player char begin SD$ stairs down char begin SU$ stairs up char begin W$ current (map) wall char
SCREEN LINES DATA: ==================
111111111122222 0123456789012345678901234
654321076543210765432107 \_2030/\_2031_/\_2032_/\_2033 .....xxxxxxxxxxxxxx..... H=15 3 255 240 ......xxxxxxxxxxxx...... H=13 1 255 224 .......xxxxxxxxxx....... H=11 0 255 192 ........xxxxxxxx........ H=9 0 127 128 .........xxxxxx......... H=7 0 63 0 ..........xxxx.......... H=5 0 30 0
111111111122222 0123456789012345678901234 aaaAaaaAaaaA BbbbBbbbBbbb ...AaAaAaAaA BbBbBbBbB... ........AAAA BBBB........
|