0001 *********************************************************************** 0002 * CML Demo Program 28 May 1997 Michael Burke 0003 * VT100/ANSI Escape Code Demonstration 0004 * 0005 * This program demonstrates how to use the various VT100/ANSI escape 0006 * code sequences. 0007 * 0008 *********************************************************************** 0009 0010 *********************************************************************** 0011 * Initialization routine - jumps straight to the 0012 * beginning of code, with the data inbetween 0013 * Input: None 0014 * Output: All 0015 * Modifies: Just about everything 0016 *********************************************************************** 0017 c000 ORG $C000 0018 c000 7e c5 42 [ 3 ] JMP START 0019 0020 *********************************************************************** 0021 * Data Segment - EQU's, constants and variables here 0022 * Input: None 0023 * Output: None 0024 *********************************************************************** 0025 0026 * Equates ("Magic Numbers" and BUFFALO routines) 0027 ffc4 OUTCRLF EQU $FFC4 ; prints a LF and a CR 0028 ffac INPUT EQU $FFAC ; Input without polling 0029 ffb8 OUTA EQU $FFB8 ; Output ASCII character in ACCA 0030 ffa0 UPCASE EQU $FFA0 ; Lower -> upper case conversion 0031 ffaf OUTPUT EQU $FFAF ; outputs a single character -> SCI 0032 0033 * Put a stack in our program (mostly for BUFFALO/interrupt calls) 0034 * (Note: This stack is probably WAY too large for our needs, as 0035 * nested calls which fill the stack are mostly absent. However, 0036 * since our data immediately follows the stack, an overflow could 0037 * be very messy...) 0038 c003 STACK RMB $100 ; 256 byte stack 0039 c102 INITSP EQU *-1 ; Stack pointer initializer 0040 0041 * VT100/ANSI Escape codes (Generic) 0042 * These escape codes do not have specific {NUM} or position 0043 * variables inside them; those are included in the next section 0044 * (program specific). 0045 * [NOTE: Most of these codes are not used in this demonstration; 0046 * they are included to avoid duplication of effort.] 0047 c103 1b RESET FCB $1B ; Resets all terminal settings to default 0048 c104 63 FCB $63 0049 c105 04 FCB $04 0050 c106 1b ELINEW FCB $1B ; Enables wrapping text to the next line 0051 c107 5b FCB $5B ; if text is no longer than the display 0052 c108 37 FCB $37 ; area. 0053 c109 68 FCB $68 0054 c10a 04 FCB $04 0055 c10b 1b DLINEW FCB $1B ; Disables wrapping text; text will be 0056 c10c 5b FCB $5B ; clipped if longer than display area. 0057 c10d 37 FCB $37 0058 c10e 6c FCB $6C 0059 c10f 04 FCB $04 0060 0061 c110 1b CURHOME FCB $1B ; Moves the cursor to the home position 0062 c111 5b FCB $5B 0063 c112 48 FCB $48 0064 c113 04 FCB $04 0065 c114 1b CURUP FCB $1B ; Moves the cursor up one row. 0066 c115 5b FCB $5B 0067 c116 41 FCB $41 0068 c117 04 FCB $04 0069 c118 1b CURDOWN FCB $1B ; Moves the cursor down one row. 0070 c119 5b FCB $5B 0071 c11a 42 FCB $42 0072 c11b 04 FCB $04 0073 c11c 1b CURLEFT FCB $1B ; Moves the cursor left one column. 0074 c11d 5b FCB $5B 0075 c11e 44 FCB $44 0076 c11f 04 FCB $04 0077 c120 1b CURIGHT FCB $1B ; Moves the cursor right one column. 0078 c121 5b FCB $5B 0079 c122 43 FCB $43 0080 c123 04 FCB $04 0081 c124 1b CURSAVE FCB $1B ; Saves the current cursor position. 0082 c125 5b FCB $5B 0083 c126 73 FCB $73 0084 c127 04 FCB $04 0085 c128 1b CURREST FCB $1B ; Restores the previously saved position. 0086 c129 5b FCB $5B 0087 c12a 75 FCB $75 0088 c12b 04 FCB $04 0089 0090 c12c 1b CLREOL FCB $1B ; Erases from the current cursor position 0091 c12d 5b FCB $5B ; to the end of the row. 0092 c12e 4b FCB $4B 0093 c12f 04 FCB $04 0094 c130 1b CLRSOL FCB $1B ; Erases from the current cursor position 0095 c131 5b FCB $5B ; to the beginning of the row. 0096 c132 31 FCB $31 0097 c133 4b FCB $4B 0098 c134 04 FCB $04 0099 c135 1b CLRLINE FCB $1B ; Erases the row the cursor is in. 0100 c136 5b FCB $5B 0101 c137 32 FCB $32 0102 c138 4b FCB $4B 0103 c139 04 FCB $04 0104 c13a 1b CLRDOWN FCB $1B ; Erases from the current cursor position 0105 c13b 5b FCB $5B ; to the bottom of the screen. 0106 c13c 4a FCB $4A 0107 c13d 04 FCB $04 0108 c13e 1b CLRUP FCB $1B ; Erases from the current cursor position 0109 c13f 5b FCB $5B ; to the top of the screen. 0110 c140 31 FCB $31 0111 c141 4a FCB $4A 0112 c142 04 FCB $04 0113 c143 1b CLRALL FCB $1B ; Erases the entire screen and places the 0114 c144 5b FCB $5B ; cursor in the home position. 0115 c145 32 FCB $32 0116 c146 4a FCB $4A 0117 c147 04 FCB $04 0118 0119 c148 1b SCROLLA FCB $1B ; Set the whole screen as 'scrollable'. 0120 c149 5b FCB $5B 0121 c14a 72 FCB $72 0122 c14b 04 FCB $04 0123 c14c 1b SCROLLD FCB $1B ; Scroll one line down. 0124 c14d 44 FCB $44 0125 c14e 04 FCB $04 0126 c14f 1b SCROLLU FCB $1B ; Scroll one line up. 0127 c150 4d FCB $4D 0128 c151 04 FCB $04 0129 0130 * VT100/ANSI Escape codes (Program specific) 0131 * (These codes contain code specific to this program) 0132 c152 1b WHITE FCB $1B ; Make the cursor white 0133 c153 5b FCB $5B 0134 c154 33 FCB $33 0135 c155 37 FCB $37 0136 c156 6d FCB $6D 0137 c157 04 FCB $04 0138 c158 1b RED FCB $1B ; Make the cursor red 0139 c159 5b FCB $5B 0140 c15a 33 FCB $33 0141 c15b 31 FCB $31 0142 c15c 6d FCB $6D 0143 c15d 04 FCB $04 0144 c15e 1b GREEN FCB $1B ; Make the cursor green 0145 c15f 5b FCB $5B 0146 c160 33 FCB $33 0147 c161 32 FCB $32 0148 c162 6d FCB $6D 0149 c163 04 FCB $04 0150 0151 c164 1b RSTCUR FCB $1B ; Resets the cursor attributes 0152 c165 5b FCB $5B 0153 c166 30 FCB $30 0154 c167 6d FCB $6D 0155 c168 04 FCB $04 0156 c169 1b BLNKCUR FCB $1B ; Blink the cursor 0157 c16a 5b FCB $5B 0158 c16b 35 FCB $35 0159 c16c 6d FCB $6D 0160 c16d 04 FCB $04 0161 c16e 1b BRTCUR FCB $1B ; Bright cursor 0162 c16f 5b FCB $5B 0163 c170 31 FCB $31 0164 c171 6d FCB $6D 0165 c172 04 FCB $04 0166 0167 c173 1b CURCNTR FCB $1B ; Center the cursor on the screen 0168 c174 5b FCB $5B 0169 c175 31 FCB $31 0170 c176 32 FCB $32 0171 c177 3b FCB $3B 0172 c178 34 FCB $34 0173 c179 30 FCB $30 0174 c17a 48 FCB $48 0175 c17b 04 FCB $04 0176 c17c 1b PAKCNTR FCB $1B ; Center the words "Press any key to continue" 0177 c17d 5b FCB $5B ; at the bottom of the screen 0178 c17e 32 FCB $32 0179 c17f 33 FCB $33 0180 c180 3b FCB $3B 0181 c181 32 FCB $32 0182 c182 37 FCB $37 0183 c183 48 FCB $48 0184 c184 04 FCB $04 0185 0186 * Program text; predefined text for the demo 0187 c185 43 4d 4c 20 44 65 HEADR1 FCC `CML Demonstration: VT100/ANSI Escape Sequences v1.0 6 June 1997` 6d 6f 6e 73 74 72 61 74 69 6f 6e 3a 20 20 56 54 31 30 30 2f 41 4e 53 49 20 45 73 63 61 70 65 20 53 65 71 75 65 6e 63 65 73 20 20 76 31 2e 30 20 20 20 20 20 20 20 20 20 20 20 0188 c1d2 04 FCB $04 0189 c1d3 3d 2d 3d 2d 3d 2d HEADR2 FCC `=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=` 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 3d 2d 0190 c220 04 FCB $04 0191 c221 20 20 54 6f 20 6d INST1 FCC ` To move the cursor, use the I J K L keys as shown below. moves the` 6f 76 65 20 74 68 65 20 63 75 72 73 6f 72 2c 20 75 73 65 20 74 68 65 20 49 20 4a 20 4b 20 4c 20 6b 65 79 73 20 61 73 20 73 68 6f 77 6e 20 62 65 6c 6f 77 2e 20 20 3c 49 3e 20 0192 c26a 04 FCB $04 0193 c26b 20 20 63 75 72 73 INST2 FCC ` cursor up, moves the cursor left, moves the cursor right, and ` 6f 72 20 75 70 2c 20 3c 4a 3e 20 6d 6f 76 65 73 20 74 68 65 20 63 75 72 73 6f 72 20 6c 65 66 74 2c 20 3c 4c 3e 20 6d 6f 76 65 73 20 74 68 65 20 63 75 72 73 6f 72 20 72 69 67 0194 c2b6 04 FCB $04 0195 c2b7 20 20 6d 6f 76 65 INST3 FCC ` moves the cursor down.` 73 20 74 68 65 20 63 75 72 73 6f 72 20 64 6f 77 6e 2e 0196 c2cf 04 FCB $04 0197 c2d0 20 20 20 20 20 20 INST4 FCC ` ^` 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 0198 c30f 04 FCB $04 0199 c310 20 20 50 72 65 73 INST5 FCC ` Press to make the cursor WHITE. |` 73 20 3c 57 3e 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 63 75 72 73 6f 72 20 57 48 49 54 45 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0200 c34f 04 FCB $04 0201 c350 20 20 50 72 65 73 INST6 FCC ` Press to make the cursor RED. ` 73 20 3c 52 3e 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 63 75 72 73 6f 72 20 52 45 44 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 49 3e 0202 c390 04 FCB $04 0203 c391 20 20 50 72 65 73 INST7 FCC ` Press to make the cursor GREEN. <- ->` 73 20 3c 47 3e 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 63 75 72 73 6f 72 20 47 52 45 45 4e 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 2d 20 3c 4a 3e 20 20 20 20 0204 c3d8 04 FCB $04 0205 c3d9 20 20 20 20 20 20 INST8 FCC ` ` 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 4b 3e 0206 c419 04 FCB $04 0207 c41a 20 20 50 72 65 73 INST9 FCC ` Press to HOME the cursor (in the center). |` 73 20 3c 48 3e 20 74 6f 20 48 4f 4d 45 20 74 68 65 20 63 75 72 73 6f 72 20 28 69 6e 20 74 68 65 20 63 65 6e 74 65 72 29 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0208 c459 04 FCB $04 0209 c45a 20 20 50 72 65 73 INSTA FCC ` Press to CLEAR the screen. V` 73 20 3c 43 3e 20 74 6f 20 43 4c 45 41 52 20 74 68 65 20 73 63 72 65 65 6e 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0210 c499 04 FCB $04 0211 c49a 20 20 50 72 65 73 INSTB FCC ` Press <[> to pick up the "pen", and` 73 20 3c 5b 3e 20 74 6f 20 70 69 63 6b 20 75 70 20 74 68 65 20 22 70 65 6e 22 2c 20 61 6e 64 0212 c4bf 04 FCB $04 0213 c4c0 20 20 50 72 65 73 INSTC FCC ` Press <]> to put the "pen" down.` 73 20 3c 5d 3e 20 74 6f 20 70 75 74 20 74 68 65 20 22 70 65 6e 22 20 64 6f 77 6e 2e 0214 c4e2 04 FCB $04 0215 c4e3 20 20 50 72 65 73 INSTD FCC ` Press to QUIT this demonstration.` 73 20 3c 51 3e 20 74 6f 20 51 55 49 54 20 74 68 69 73 20 64 65 6d 6f 6e 73 74 72 61 74 69 6f 6e 2e 0216 c50a 04 FCB $04 0217 c50b 50 72 65 73 73 20 PAKTC FCC `Press any key to continue...` 61 6e 79 20 6b 65 79 20 74 6f 20 63 6f 6e 74 69 6e 75 65 2e 2e 2e 0218 c527 04 FCB $04 0219 c528 20 20 57 72 69 74 END1 FCC ` Written : 6 June 1997.` 74 65 6e 20 3a 20 36 20 4a 75 6e 65 20 31 39 39 37 2e 0220 c540 04 FCB $04 0221 0222 * Save the state of the cursor 0223 c541 00 CURSTA FCB $00 ; Cursor state: $00 if up, $01 if down 0224 0225 *********************************************************************** 0226 * START Start of the program 0227 * Input: None 0228 * Output: VT100/ANSI Demo 0229 * Modifies: Just about everything 0230 *********************************************************************** 0231 c542 8e c1 02 [ 3 ] START LDS #INITSP ; Initializes the stack 0232 c545 cc 00 00 [ 3 ] LDAD #$00 ; If you dont put initial values into the 0233 c548 ce 00 00 [ 3 ] LDX #$0000 ; registers, you can get unexpected results 0234 c54b 18 ce 00 00 [ 4 ] LDY #$0000 ; if you try to push them onto the stack. 0235 c54f 0e [ 2 ] CLI ; Enable interrupts globally 0236 0237 c550 bd c5 7b [ 6 ] JSR RSCREEN ; Clear the screen 0238 c553 bd c5 8c [ 6 ] JSR PRNTHDR ; Print the header 0239 c556 bd ff c4 [ 6 ] JSR OUTCRLF 0240 c559 bd c5 df [ 6 ] JSR PRNTINS ; Print instructions 0241 c55c bd c6 59 [ 6 ] JSR PRNTKEY ; Press any key to continue 0242 c55f bd c5 7b [ 6 ] JSR RSCREEN 0243 c562 bd c6 8e [ 6 ] JSR CENTER ; Center the cursor 0244 c565 bd c6 99 [ 6 ] LOOP JSR GETKEY ; Gets key (returns in B) 0245 c568 bd c6 a3 [ 6 ] JSR DRAW ; Use the keypress (returns 00 in B if quit) 0246 c56b 5d [ 2 ] TSTB 0247 c56c 26 f7 [ 3 ] BNE LOOP ; End if 00, otherwise LOOP 0248 c56e bd c5 7b [ 6 ] JSR RSCREEN 0249 c571 bd c5 8c [ 6 ] JSR PRNTHDR 0250 c574 bd ff c4 [ 6 ] JSR OUTCRLF 0251 c577 bd c5 af [ 6 ] JSR ENDSCRN ; Print an ending screen 0252 c57a 3f [14 ] SWI ; Return control to the simulator or BUFFALO 0253 0254 *********************************************************************** 0255 * RSCREEN Reset the screen 0256 * Input: None 0257 * Output: Clears the screen, and returns to the home position 0258 * Modifies: Nothing 0259 *********************************************************************** 0260 c57b 36 [ 3 ] RSCREEN PSHA ; Push registers so they are returned as they 0261 c57c 3c [ 4 ] PSHX ; were received. 0262 c57d ce c1 10 [ 3 ] LDX #CURHOME 0263 c580 bd c7 64 [ 6 ] JSR STRGOUT 0264 c583 ce c1 43 [ 3 ] LDX #CLRALL 0265 c586 bd c7 64 [ 6 ] JSR STRGOUT ; Clear the screen 0266 c589 38 [ 5 ] PULX ; Restore the original register values 0267 c58a 32 [ 4 ] PULA 0268 c58b 39 [ 5 ] RTS ; Go home. 0269 0270 *********************************************************************** 0271 * PRNTHDR Prints the two line program title bar 0272 * Input: None 0273 * Output: 2 Lines of text, starting wherever the cursor is. 0274 * Modifies: Nothing 0275 *********************************************************************** 0276 c58c 36 [ 3 ] PRNTHDR PSHA ; Push registers so they are returned as they 0277 c58d 3c [ 4 ] PSHX ; were received. 0278 c58e ce c1 5e [ 3 ] LDX #GREEN 0279 c591 bd c7 64 [ 6 ] JSR STRGOUT 0280 c594 ce c1 85 [ 3 ] LDX #HEADR1 0281 c597 bd c7 64 [ 6 ] JSR STRGOUT ; Print the header 0282 c59a bd ff c4 [ 6 ] JSR OUTCRLF 0283 c59d ce c1 d3 [ 3 ] LDX #HEADR2 0284 c5a0 bd c7 64 [ 6 ] JSR STRGOUT 0285 c5a3 bd ff c4 [ 6 ] JSR OUTCRLF 0286 c5a6 ce c1 52 [ 3 ] LDX #WHITE 0287 c5a9 bd c7 64 [ 6 ] JSR STRGOUT 0288 c5ac 38 [ 5 ] PULX ; Restore the original register values 0289 c5ad 32 [ 4 ] PULA 0290 c5ae 39 [ 5 ] RTS ; Go home. 0291 0292 *********************************************************************** 0293 * ENDSCRN Output the quit screen 0294 * Input: None 0295 * Output: Some text 0296 * Modifies: Nothing 0297 *********************************************************************** 0298 c5af 36 [ 3 ] ENDSCRN PSHA ; Push registers so they are returned as they 0299 c5b0 3c [ 4 ] PSHX ; were received. 0300 c5b1 ce c5 28 [ 3 ] LDX #END1 0301 c5b4 bd c7 64 [ 6 ] JSR STRGOUT ; Print the header 0302 c5b7 bd ff c4 [ 6 ] JSR OUTCRLF 0303 c5ba bd ff c4 [ 6 ] JSR OUTCRLF 0304 c5bd 38 [ 5 ] PULX ; Restore the original register values 0305 c5be 32 [ 4 ] PULA 0306 c5bf 39 [ 5 ] RTS ; Go home. 0307 0308 *********************************************************************** 0309 * DELAY Delays A/10'ths of a second 0310 * Input: Register A 0311 * Output: Register A/10 seconds of delay 0312 * Modifies: Nothing 0313 *********************************************************************** 0314 c5c0 36 [ 3 ] DELAY PSHA ; Push registers so they are returned as they 0315 c5c1 37 [ 3 ] PSHB ; were received. 0316 c5c2 3c [ 4 ] PSHX 0317 c5c3 18 3c [ 5 ] PSHY 0318 c5c5 81 00 [ 2 ] DELLP1 CMPA #$00 0319 c5c7 27 10 [ 3 ] BEQ DELDNE 0320 c5c9 4a [ 2 ] DECA 0321 c5ca 18 ce 00 00 [ 4 ] LDY #$0000 0322 c5ce 02 [41 ] DELLP2 IDIV 0323 c5cf 18 08 [ 4 ] INY 0324 c5d1 18 8c 0a 00 [ 5 ] CPY #$0A00 0325 c5d5 24 ee [ 3 ] BHS DELLP1 0326 c5d7 20 f5 [ 3 ] BRA DELLP2 0327 c5d9 18 38 [ 6 ] DELDNE PULY ; Restore the original register values. 0328 c5db 38 [ 5 ] PULX 0329 c5dc 33 [ 4 ] PULB 0330 c5dd 32 [ 4 ] PULA 0331 c5de 39 [ 5 ] RTS ; Go home. 0332 0333 *********************************************************************** 0334 * PRNTHDR Prints the instructions 0335 * Input: None 0336 * Output: Text 0337 * Modifies: Nothing 0338 *********************************************************************** 0339 c5df 36 [ 3 ] PRNTINS PSHA ; Push registers so they are returned as they 0340 c5e0 3c [ 4 ] PSHX ; were received. 0341 c5e1 ce c2 21 [ 3 ] LDX #INST1 0342 c5e4 bd c7 64 [ 6 ] JSR STRGOUT ; Print the instructions (long...) 0343 c5e7 bd ff c4 [ 6 ] JSR OUTCRLF 0344 c5ea ce c2 6b [ 3 ] LDX #INST2 0345 c5ed bd c7 64 [ 6 ] JSR STRGOUT 0346 c5f0 bd ff c4 [ 6 ] JSR OUTCRLF 0347 c5f3 ce c2 b7 [ 3 ] LDX #INST3 0348 c5f6 bd c7 64 [ 6 ] JSR STRGOUT 0349 c5f9 bd ff c4 [ 6 ] JSR OUTCRLF 0350 c5fc ce c2 d0 [ 3 ] LDX #INST4 0351 c5ff bd c7 64 [ 6 ] JSR STRGOUT 0352 c602 bd ff c4 [ 6 ] JSR OUTCRLF 0353 c605 ce c3 10 [ 3 ] LDX #INST5 0354 c608 bd c7 64 [ 6 ] JSR STRGOUT 0355 c60b bd ff c4 [ 6 ] JSR OUTCRLF 0356 c60e ce c3 50 [ 3 ] LDX #INST6 0357 c611 bd c7 64 [ 6 ] JSR STRGOUT 0358 c614 bd ff c4 [ 6 ] JSR OUTCRLF 0359 c617 ce c3 91 [ 3 ] LDX #INST7 0360 c61a bd c7 64 [ 6 ] JSR STRGOUT 0361 c61d bd ff c4 [ 6 ] JSR OUTCRLF 0362 c620 ce c3 d9 [ 3 ] LDX #INST8 0363 c623 bd c7 64 [ 6 ] JSR STRGOUT 0364 c626 bd ff c4 [ 6 ] JSR OUTCRLF 0365 c629 ce c4 1a [ 3 ] LDX #INST9 0366 c62c bd c7 64 [ 6 ] JSR STRGOUT 0367 c62f bd ff c4 [ 6 ] JSR OUTCRLF 0368 c632 ce c4 5a [ 3 ] LDX #INSTA 0369 c635 bd c7 64 [ 6 ] JSR STRGOUT 0370 c638 bd ff c4 [ 6 ] JSR OUTCRLF 0371 c63b ce c4 9a [ 3 ] LDX #INSTB 0372 c63e bd c7 64 [ 6 ] JSR STRGOUT 0373 c641 bd ff c4 [ 6 ] JSR OUTCRLF 0374 c644 ce c4 c0 [ 3 ] LDX #INSTC 0375 c647 bd c7 64 [ 6 ] JSR STRGOUT 0376 c64a bd ff c4 [ 6 ] JSR OUTCRLF 0377 c64d ce c4 e3 [ 3 ] LDX #INSTD 0378 c650 bd c7 64 [ 6 ] JSR STRGOUT 0379 c653 bd ff c4 [ 6 ] JSR OUTCRLF 0380 c656 38 [ 5 ] PULX ; Restore the original register values 0381 c657 32 [ 4 ] PULA 0382 c658 39 [ 5 ] RTS ; Go home. 0383 0384 *********************************************************************** 0385 * PRNTKEY "Press any key to continue..." 0386 * Input: None 0387 * Output: One ine of text starting at (23,27) 0388 * Modifies: Nothing 0389 *********************************************************************** 0390 c659 36 [ 3 ] PRNTKEY PSHA ; Push registers so they are returned as they 0391 c65a 3c [ 4 ] PSHX ; were received. 0392 c65b ce c1 58 [ 3 ] LDX #RED ; Red text 0393 c65e bd c7 64 [ 6 ] JSR STRGOUT 0394 c661 ce c1 69 [ 3 ] LDX #BLNKCUR ; Blinking 0395 c664 bd c7 64 [ 6 ] JSR STRGOUT 0396 c667 ce c1 6e [ 3 ] LDX #BRTCUR 0397 c66a bd c7 64 [ 6 ] JSR STRGOUT 0398 c66d ce c1 7c [ 3 ] LDX #PAKCNTR ; Place the cursor where we need it (23,27) 0399 c670 bd c7 64 [ 6 ] JSR STRGOUT 0400 c673 ce c5 0b [ 3 ] LDX #PAKTC ; Text 0401 c676 bd c7 64 [ 6 ] JSR STRGOUT 0402 c679 bd ff ac [ 6 ] PKLOOP JSR INPUT ; Wait for a keypress 0403 c67c 4d [ 2 ] TSTA 0404 c67d 27 fa [ 3 ] BEQ PKLOOP 0405 c67f ce c1 64 [ 3 ] LDX #RSTCUR ; Reset cursor attributes 0406 c682 bd c7 64 [ 6 ] JSR STRGOUT 0407 c685 ce c1 52 [ 3 ] LDX #WHITE 0408 c688 bd c7 64 [ 6 ] JSR STRGOUT 0409 c68b 38 [ 5 ] PULX ; Restore the original register values 0410 c68c 32 [ 4 ] PULA 0411 c68d 39 [ 5 ] RTS ; Go home. 0412 0413 *********************************************************************** 0414 * CENTER Centers the cursor 0415 * Input: None 0416 * Output: Centered cursor 0417 * Modifies: Nothing 0418 *********************************************************************** 0419 c68e 36 [ 3 ] CENTER PSHA ; Push registers so they are returned as they 0420 c68f 3c [ 4 ] PSHX ; were received. 0421 c690 ce c1 73 [ 3 ] LDX #CURCNTR 0422 c693 bd c7 64 [ 6 ] JSR STRGOUT 0423 c696 38 [ 5 ] PULX ; Restore the original register values 0424 c697 32 [ 4 ] PULA 0425 c698 39 [ 5 ] RTS ; Go home. 0426 0427 *********************************************************************** 0428 * GETKEY Gets a keypress 0429 * Input: None 0430 * Output: The ASCII value of the key in REG B 0431 * Modifies: Reg B 0432 *********************************************************************** 0433 c699 36 [ 3 ] GETKEY PSHA ; Store unmodified registers 0434 c69a bd ff ac [ 6 ] GETLOOP JSR INPUT 0435 c69d 4d [ 2 ] TSTA 0436 c69e 27 fa [ 3 ] BEQ GETLOOP 0437 c6a0 16 [ 2 ] TAB 0438 c6a1 32 [ 4 ] PULA ; Restore original values. 0439 c6a2 39 [ 5 ] RTS ; Go home. 0440 0441 *********************************************************************** 0442 * DRAW Draws according to Reg B 0443 * Input: Reg B 0444 * Output: Draws something on the screen 0445 * Modifies: Reg B 0446 *********************************************************************** 0447 c6a3 36 [ 3 ] DRAW PSHA ; Store unmodified registers 0448 c6a4 3c [ 4 ] PSHX 0449 c6a5 17 [ 2 ] TBA 0450 c6a6 bd ff a0 [ 6 ] JSR UPCASE 0451 c6a9 16 [ 2 ] TAB 0452 c6aa c1 49 [ 2 ] CMPB #$49 ; Is it up? 0453 c6ac 27 57 [ 3 ] BEQ DUP 0454 c6ae c1 4a [ 2 ] CMPB #$4A ; Is it left? 0455 c6b0 27 63 [ 3 ] BEQ DLEFT 0456 c6b2 c1 4c [ 2 ] CMPB #$4C ; Is it right? 0457 c6b4 27 67 [ 3 ] BEQ DRIGHT 0458 c6b6 c1 4b [ 2 ] CMPB #$4B ; Is it down? 0459 c6b8 27 53 [ 3 ] BEQ DDOWN 0460 c6ba c1 57 [ 2 ] CMPB #$57 ; White? 0461 c6bc 27 67 [ 3 ] BEQ DWHITE 0462 c6be c1 52 [ 2 ] CMPB #$52 ; Red? 0463 c6c0 27 6b [ 3 ] BEQ DRED 0464 c6c2 c1 47 [ 2 ] CMPB #$47 ; Green? 0465 c6c4 27 6f [ 3 ] BEQ DGREEN 0466 c6c6 c1 48 [ 2 ] CMPB #$48 ; Home? 0467 c6c8 27 73 [ 3 ] BEQ DHOME 0468 c6ca c1 43 [ 2 ] CMPB #$43 ; Clear screen? 0469 c6cc 27 77 [ 3 ] BEQ DCLR 0470 c6ce c1 5b [ 2 ] CMPB #$5B ; Pick up the pen? 0471 c6d0 26 07 [ 3 ] BNE D1 0472 c6d2 86 00 [ 2 ] LDAA #$00 0473 c6d4 b7 c5 41 [ 4 ] STAA CURSTA 0474 c6d7 20 11 [ 3 ] BRA DRET 0475 c6d9 c1 5d [ 2 ] D1 CMPB #$5D ; Put the pen down? 0476 c6db 26 07 [ 3 ] BNE D2 0477 c6dd 86 01 [ 2 ] LDAA #$01 0478 c6df b7 c5 41 [ 4 ] STAA CURSTA 0479 c6e2 20 06 [ 3 ] BRA DRET 0480 c6e4 c1 51 [ 2 ] D2 CMPB #$51 ; Quit? 0481 c6e6 27 71 [ 3 ] BEQ DQUIT 0482 c6e8 20 73 [ 3 ] BRA DERROR 0483 c6ea b6 c5 41 [ 4 ] DRET LDAA CURSTA ; Is the pen up or down? 0484 c6ed 81 00 [ 2 ] CMPA #$00 0485 c6ef 27 11 [ 3 ] BEQ DRET2 ; If CURSTA=00, up so therefore don't draw. 0486 c6f1 ce c1 24 [ 3 ] LDX #CURSAVE 0487 c6f4 bd c7 64 [ 6 ] JSR STRGOUT 0488 c6f7 86 23 [ 2 ] LDAA #$23 ; # Pound sign 0489 c6f9 bd ff b8 [ 6 ] JSR OUTA 0490 c6fc ce c1 28 [ 3 ] LDX #CURREST 0491 c6ff bd c7 64 [ 6 ] JSR STRGOUT 0492 c702 38 [ 5 ] DRET2 PULX ; Return here when done above 0493 c703 32 [ 4 ] PULA ; Restore values in pushed registers. 0494 c704 39 [ 5 ] RTS ; Go home. 0495 0496 *********************************************************************** 0497 * DUP Draw UP 0498 * Input: None 0499 * Output: One charater drawn up 0500 * Modifies: REG X 0501 *********************************************************************** 0502 c705 ce c1 14 [ 3 ] DUP LDX #CURUP 0503 c708 bd c7 64 [ 6 ] JSR STRGOUT 0504 c70b 20 dd [ 3 ] BRA DRET 0505 0506 *********************************************************************** 0507 * DDOWN Draw DOWN 0508 * Input: None 0509 * Output: One charater drawn down 0510 * Modifies: REG X 0511 *********************************************************************** 0512 c70d ce c1 18 [ 3 ] DDOWN LDX #CURDOWN 0513 c710 bd c7 64 [ 6 ] JSR STRGOUT 0514 c713 20 d5 [ 3 ] BRA DRET 0515 0516 *********************************************************************** 0517 * DLEFT Draw LEFT 0518 * Input: None 0519 * Output: One charater drawn left 0520 * Modifies: REG X 0521 *********************************************************************** 0522 c715 ce c1 1c [ 3 ] DLEFT LDX #CURLEFT 0523 c718 bd c7 64 [ 6 ] JSR STRGOUT 0524 c71b 20 cd [ 3 ] BRA DRET 0525 0526 *********************************************************************** 0527 * DRIGHT Draw RIGHT 0528 * Input: None 0529 * Output: One charater drawn right 0530 * Modifies: REG X 0531 *********************************************************************** 0532 c71d ce c1 20 [ 3 ] DRIGHT LDX #CURIGHT 0533 c720 bd c7 64 [ 6 ] JSR STRGOUT 0534 c723 20 c5 [ 3 ] BRA DRET 0535 0536 *********************************************************************** 0537 * DWHITE Change color to white 0538 * Input: None 0539 * Output: One character drawn white 0540 * Modifies: REG X 0541 *********************************************************************** 0542 c725 ce c1 52 [ 3 ] DWHITE LDX #WHITE 0543 c728 bd c7 64 [ 6 ] JSR STRGOUT 0544 c72b 20 bd [ 3 ] BRA DRET 0545 0546 *********************************************************************** 0547 * DRED Change color to red 0548 * Input: None 0549 * Output: One charater drawn red 0550 * Modifies: REG X 0551 *********************************************************************** 0552 c72d ce c1 58 [ 3 ] DRED LDX #RED 0553 c730 bd c7 64 [ 6 ] JSR STRGOUT 0554 c733 20 b5 [ 3 ] BRA DRET 0555 0556 *********************************************************************** 0557 * DGREEN Change color to green 0558 * Input: None 0559 * Output: One charater drawn green 0560 * Modifies: REG X 0561 *********************************************************************** 0562 c735 ce c1 5e [ 3 ] DGREEN LDX #GREEN 0563 c738 bd c7 64 [ 6 ] JSR STRGOUT 0564 c73b 20 ad [ 3 ] BRA DRET 0565 0566 *********************************************************************** 0567 * DHOME Home the cursor 0568 * Input: None 0569 * Output: One charater drawn in the center 0570 * Modifies: REG X 0571 *********************************************************************** 0572 c73d ce c1 73 [ 3 ] DHOME LDX #CURCNTR 0573 c740 bd c7 64 [ 6 ] JSR STRGOUT 0574 c743 20 a5 [ 3 ] BRA DRET 0575 0576 *********************************************************************** 0577 * DCLR Clear the screen 0578 * Input: None 0579 * Output: One charater drawn 0580 * Modifies: REG X 0581 *********************************************************************** 0582 c745 ce c1 24 [ 3 ] DCLR LDX #CURSAVE 0583 c748 bd c7 64 [ 6 ] JSR STRGOUT 0584 c74b ce c1 43 [ 3 ] LDX #CLRALL 0585 c74e bd c7 64 [ 6 ] JSR STRGOUT 0586 c751 ce c1 28 [ 3 ] LDX #CURREST 0587 c754 bd c7 64 [ 6 ] JSR STRGOUT 0588 c757 20 91 [ 3 ] BRA DRET 0589 0590 *********************************************************************** 0591 * DQUIT Quit drawing 0592 * Input: None 0593 * Output: Quit drawing 0594 * Modifies: ACCB 0595 *********************************************************************** 0596 c759 c6 00 [ 2 ] DQUIT LDAB #$00 ; Load ACCB with the 'quit' sequence 0597 c75b 20 a5 [ 3 ] BRA DRET2 0598 0599 *********************************************************************** 0600 * DERROR An error 0601 * Input: None 0602 * Output: Beep 0603 * Modifies: ACCA 0604 *********************************************************************** 0605 c75d 86 07 [ 2 ] DERROR LDAA #$07 ; A beep 0606 c75f bd ff b8 [ 6 ] JSR OUTA 0607 c762 20 9e [ 3 ] BRA DRET2 0608 0609 *********************************************************************** 0610 * STRGOUT String output - outputs a string with no leading 0611 * or trailing CRLF's... similar to the BUFFALO OUTSTRG 0612 * (This one does not wait on CTRL-W however) 0613 * Input: Register X points to the text location - terminate 0614 * with a $04 0615 * Output: Text 0616 * Modifies: Nothing 0617 *********************************************************************** 0618 c764 36 [ 3 ] STRGOUT PSHA 0619 c765 a6 00 [ 4 ] STRGOT1 LDAA 0,X 0620 c767 81 04 [ 2 ] CMPA #$04 0621 c769 27 06 [ 3 ] BEQ STRGOT3 0622 c76b bd ff af [ 6 ] JSR OUTPUT 0623 c76e 08 [ 3 ] INX 0624 c76f 20 f4 [ 3 ] BRA STRGOT1 0625 c771 32 [ 4 ] STRGOT3 PULA 0626 c772 39 [ 5 ] RTS 0627 BLNKCUR c169 BRTCUR c16e CENTER c68e CLRALL c143 CLRDOWN c13a CLREOL c12c CLRLINE c135 CLRSOL c130 CLRUP c13e CURCNTR c173 CURDOWN c118 CURHOME c110 CURIGHT c120 CURLEFT c11c CURREST c128 CURSAVE c124 CURSTA c541 CURUP c114 D1 c6d9 D2 c6e4 DCLR c745 DDOWN c70d DELAY c5c0 DELDNE c5d9 DELLP1 c5c5 DELLP2 c5ce DERROR c75d DGREEN c735 DHOME c73d DLEFT c715 DLINEW c10b DQUIT c759 DRAW c6a3 DRED c72d DRET c6ea DRET2 c702 DRIGHT c71d DUP c705 DWHITE c725 ELINEW c106 END1 c528 ENDSCRN c5af GETKEY c699 GETLOOP c69a GREEN c15e HEADR1 c185 HEADR2 c1d3 INITSP c102 INPUT ffac INST1 c221 INST2 c26b INST3 c2b7 INST4 c2d0 INST5 c310 INST6 c350 INST7 c391 INST8 c3d9 INST9 c41a INSTA c45a INSTB c49a INSTC c4c0 INSTD c4e3 LOOP c565 OUTA ffb8 OUTCRLF ffc4 OUTPUT ffaf PAKCNTR c17c PAKTC c50b PKLOOP c679 PRNTHDR c58c PRNTINS c5df PRNTKEY c659 RED c158 RESET c103 RSCREEN c57b RSTCUR c164 SCROLLA c148 SCROLLD c14c SCROLLU c14f STACK c003 START c542 STRGOT1 c765 STRGOT3 c771 STRGOUT c764 UPCASE ffa0 WHITE c152