0001 ;;; 0002 ;;; MC3 line editor v1.2 for MCFS2 0003 ;;; By: Daniel Tufvesson 2017-2022 0004 ;;; 0005 c009 mon_pdata equ $c009 ; print text string @ x ended by $04 0006 c021 mon_pcrlf equ $c021 ; print crlf 0007 0008 d003 sys_return equ $d003 ; MCFS2 return 0009 d006 sys_call equ $d006 ; MCFS2 system call 0010 0011 7fe5 consvec equ $7fe5 ; console status vector 0012 7fe8 conovec equ $7fe8 ; console output vector 0013 7feb conivec equ $7feb ; console input vector 0014 0015 ;;; 0016 ;;; Program start 0017 ;;; 0018 a100 org $a100 0019 ;;; Clear memory 0020 a100 3c pshx 0021 a101 bd a3 d7 jsr mem_clear 0022 a104 38 pulx 0023 ;;; Load file to edit 0024 ;;; Save filename (first argument) 0025 a105 bd a4 c6 jsr str_skp_next 0026 a108 6d 00 tst ,x 0027 a10a 26 03 bne *+5 0028 a10c 7e a1 84 jmp prompt ; no file name provided 0029 a10f bd a5 a5 jsr copy_to_fname ; copy file name argument to local buffer 0030 a112 ce a9 04 ldx #file_name ; set file name in fcb 0031 a115 ff a9 46 stx fcb0+2 0032 ;;; Load file info 0033 a118 86 01 ldaa #$01 ; check file fommand 0034 a11a b7 a9 44 staa fcb0 0035 a11d ce a9 44 ldx #fcb0 0036 a120 bd d0 06 jsr sys_call 0037 a123 7d a9 45 tst fcb0+1 ; read error code 0038 a126 26 3c bne file_not_found 0039 ;;; Check file 0040 a128 b6 a9 48 ldaa fcb0+4 ; get flags 0041 a12b 85 40 bita #$40 0042 a12d 26 45 bne file_is_directory 0043 ;;; Calculate end of file 0044 a12f fe a9 4b ldx fcb0+7 0045 a132 26 48 bne file_too_big 0046 a134 fe a9 4d ldx fcb0+9 0047 a137 c6 ff ldab #$ff 0048 a139 3a abx 0049 a13a ff a8 f9 stx xtemp1 ; save file end 0050 a13d bc a8 f2 cpx mem_end 0051 a140 22 3a bhi file_too_big 0052 ;;; Load file contents into memory 0053 a142 86 10 ldaa #$10 ; load file fommand 0054 a144 b7 a9 44 staa fcb0 0055 a147 fe a8 f0 ldx mem_start 0056 a14a ff a9 48 stx fcb0+4 0057 a14d ce a9 44 ldx #fcb0 0058 a150 bd d0 06 jsr sys_call 0059 a153 7d a9 45 tst fcb0+1 ; read error code 0060 a156 26 14 bne file_read_error 0061 ;;; Make sure last line of file has a line ending 0062 a158 fe a8 f9 ldx xtemp1 0063 * ldaa ,x 0064 * cmpa eol 0065 * beq load_complete 0066 a15b 08 inx 0067 a15c b6 a9 01 ldaa eol 0068 a15f a7 00 staa ,x 0069 load_complete: 0070 a161 7e a1 84 jmp prompt 0071 ;;; File error handlers 0072 file_not_found: 0073 a164 ce a8 55 ldx #txt_not_found 0074 a167 bd c0 09 jsr mon_pdata 0075 a16a 20 72 bra cmd_quit 0076 file_read_error: 0077 a16c ce a8 66 ldx #txt_read_error 0078 a16f bd c0 09 jsr mon_pdata 0079 a172 20 6a bra cmd_quit 0080 file_is_directory: 0081 a174 ce a8 78 ldx #txt_is_directory 0082 a177 bd c0 09 jsr mon_pdata 0083 a17a 20 62 bra cmd_quit 0084 file_too_big: 0085 a17c ce a7 73 ldx #txt_out_of_memory 0086 a17f bd c0 09 jsr mon_pdata 0087 a182 20 5a bra cmd_quit 0088 0089 ;;; 0090 ;;; Command prompt 0091 ;;; 0092 prompt: 0093 a184 ce a7 68 ldx #txt_prmt 0094 a187 bd c0 09 jsr mon_pdata 0095 a18a bd a3 e3 jsr clbuf ; clear existing line buffer 0096 a18d bd a4 e8 jsr edit_line 0097 a190 24 47 bcc prompt_abort 0098 a192 bd c0 21 jsr mon_pcrlf 0099 a195 b6 a8 af ldaa line_buffer ; get first char 0100 a198 27 ea beq prompt 0101 a19a 84 df anda #$df 0102 a19c 81 49 cmpa #'I 0103 a19e 26 03 bne *+5 0104 a1a0 7e a1 e1 jmp cmd_insert 0105 a1a3 81 44 cmpa #'D 0106 a1a5 26 03 bne *+5 0107 a1a7 7e a2 3b jmp cmd_delete 0108 a1aa 81 50 cmpa #'P 0109 a1ac 26 03 bne *+5 0110 a1ae 7e a2 65 jmp cmd_print 0111 a1b1 81 52 cmpa #'R 0112 a1b3 26 03 bne *+5 0113 a1b5 7e a2 c3 jmp cmd_replace 0114 a1b8 81 53 cmpa #'S 0115 a1ba 26 03 bne *+5 0116 a1bc 7e a3 2c jmp cmd_save 0117 a1bf 81 48 cmpa #'H 0118 a1c1 26 03 bne *+5 0119 a1c3 7e a3 ab jmp cmd_help 0120 a1c6 81 4e cmpa #'N 0121 a1c8 26 03 bne *+5 0122 a1ca 7e a3 b4 jmp cmd_numbers 0123 a1cd 81 51 cmpa #'Q 0124 a1cf 26 03 bne *+5 0125 a1d1 7e a1 de jmp cmd_quit 0126 a1d4 86 3f ldaa #'? 0127 a1d6 bd 7f e8 jsr conovec 0128 prompt_abort: 0129 a1d9 bd c0 21 jsr mon_pcrlf 0130 a1dc 20 a6 bra prompt 0131 0132 ;;; 0133 ;;; Quit command 0134 ;;; 0135 cmd_quit: 0136 a1de 7e d0 03 jmp sys_return 0137 0138 ;;; 0139 ;;; Insert command 0140 ;;; 0141 cmd_insert: 0142 a1e1 ce a8 af ldx #line_buffer ; read line number argument 0143 a1e4 bd a4 c6 jsr str_skp_next 0144 a1e7 bd a4 60 jsr parse_dec 0145 a1ea fe a8 f9 ldx xtemp1 0146 a1ed 8c 00 00 cpx #0 0147 a1f0 26 05 bne cmd_insert_verify 0148 a1f2 bd a6 a4 jsr find_last 0149 a1f5 20 14 bra cmd_insert_loop 0150 cmd_insert_verify: 0151 a1f7 ff a8 f9 stx xtemp1 0152 a1fa bd a6 a4 jsr find_last ; find last line in memory 0153 a1fd fe a8 f9 ldx xtemp1 0154 a200 bc a8 f6 cpx line_pointer 0155 a203 22 2d bhi cmd_insert_end ; make sure given line is valid 0156 a205 ff a8 f6 stx line_pointer 0157 a208 bd a6 d0 jsr find_line 0158 cmd_insert_loop: 0159 a20b bd c0 21 jsr mon_pcrlf 0160 a20e bd a3 e3 jsr clbuf ; clear line buffer 0161 a211 7d a9 00 tst line_numbers_enable 0162 a214 27 0c beq cmd_insert2 ; line numbers enabled? 0163 a216 ce a8 f6 ldx #line_pointer 0164 a219 bd a3 f0 jsr outdec ; print line number 0165 * ldx #mem_pointer 0166 * jsr mon_out4hs 0167 a21c ce a8 4a ldx #txt_zdel 0168 a21f bd c0 09 jsr mon_pdata 0169 cmd_insert2: 0170 a222 bd a4 e8 jsr edit_line ; read line into buffer 0171 a225 24 0b bcc cmd_insert_end 0172 a227 bd a5 d1 jsr mem_insert ; insert new line into memory 0173 a22a 25 df bcs cmd_insert_loop ; insert OK, enter next line 0174 a22c ce a7 73 ldx #txt_out_of_memory ; out of memory 0175 a22f bd c0 09 jsr mon_pdata 0176 cmd_insert_end: 0177 a232 bd c0 21 jsr mon_pcrlf 0178 a235 bd c0 21 jsr mon_pcrlf 0179 a238 7e a1 84 jmp prompt 0180 0181 ;;; 0182 ;;; Delete command 0183 ;;; 0184 cmd_delete: 0185 a23b ce a8 af ldx #line_buffer ; read line number argument 0186 a23e bd a4 c6 jsr str_skp_next 0187 a241 bd a4 60 jsr parse_dec 0188 a244 25 19 bcs cmd_delete_end 0189 a246 bd a6 a4 jsr find_last ; find last line in memory 0190 a249 fe a8 f9 ldx xtemp1 0191 a24c 8c 00 00 cpx #0 0192 a24f 27 0e beq cmd_delete_end ; line zero is invalid 0193 a251 bc a8 f6 cpx line_pointer 0194 a254 22 09 bhi cmd_delete_end ; make sure given line is valid 0195 a256 ff a8 f6 stx line_pointer 0196 a259 bd a6 d0 jsr find_line 0197 a25c bd a6 63 jsr mem_delete 0198 cmd_delete_end: 0199 a25f bd c0 21 jsr mon_pcrlf 0200 a262 7e a1 84 jmp prompt 0201 0202 ;;; 0203 ;;; Print command 0204 ;;; 0205 cmd_print: 0206 a265 ce a8 af ldx #line_buffer ; read line number argument 0207 a268 bd a4 c6 jsr str_skp_next 0208 a26b bd a4 60 jsr parse_dec 0209 a26e 24 0e bcc cmd_print0 ; when invalid line print from start 0210 a270 fe a8 f9 ldx xtemp1 0211 a273 8c 00 00 cpx #0 0212 a276 26 06 bne cmd_print0 ; when line is zero print from start 0213 a278 ce 00 01 ldx #1 0214 a27b ff a8 f9 stx xtemp1 0215 cmd_print0: 0216 a27e bd a6 a4 jsr find_last ; find last line in memory 0217 a281 fe a8 f9 ldx xtemp1 0218 a284 bc a8 f6 cpx line_pointer 0219 a287 22 34 bhi cmd_print_end ; make sure given line is valid 0220 a289 ff a8 f6 stx line_pointer 0221 a28c bd a6 d0 jsr find_line 0222 a28f bd c0 21 jsr mon_pcrlf 0223 a292 b6 a9 02 ldaa term_lines 0224 a295 b7 a8 f8 staa temp 0225 cmd_print1: 0226 a298 bd a7 1f jsr print_line 0227 a29b fe a8 f4 ldx mem_pointer 0228 a29e 6d 00 tst ,x ; all done? 0229 a2a0 27 1b beq cmd_print_end 0230 a2a2 bd 7f eb jsr conivec 0231 a2a5 b1 a9 03 cmpa term_escape ; escape? 0232 a2a8 27 13 beq cmd_print_end 0233 a2aa 81 0d cmpa #$0d 0234 a2ac 27 08 beq cmd_print2 0235 a2ae b6 a9 02 ldaa term_lines 0236 a2b1 b7 a8 f8 staa temp 0237 a2b4 20 e2 bra cmd_print1 0238 cmd_print2: 0239 a2b6 86 01 ldaa #1 0240 a2b8 b7 a8 f8 staa temp 0241 a2bb 20 db bra cmd_print1 0242 cmd_print_end: 0243 a2bd bd c0 21 jsr mon_pcrlf 0244 a2c0 7e a1 84 jmp prompt 0245 0246 ;;; 0247 ;;; Replace command 0248 ;;; 0249 cmd_replace: 0250 a2c3 ce a8 af ldx #line_buffer ; read line number argument 0251 a2c6 bd a4 c6 jsr str_skp_next 0252 a2c9 bd a4 60 jsr parse_dec 0253 a2cc 25 58 bcs cmd_replace_end 0254 a2ce bd a6 a4 jsr find_last ; find last line in memory 0255 a2d1 fe a8 f9 ldx xtemp1 0256 a2d4 27 50 beq cmd_replace_end ; line zero is invalid 0257 a2d6 bc a8 f6 cpx line_pointer 0258 a2d9 22 4b bhi cmd_replace_end ; make sure given line is valid 0259 a2db ff a8 f6 stx line_pointer 0260 a2de bd a6 d0 jsr find_line 0261 a2e1 bd c0 21 jsr mon_pcrlf 0262 ;;; Print existing line 0263 a2e4 86 01 ldaa #1 0264 a2e6 b7 a8 f8 staa temp ; print single line 0265 a2e9 bd a7 1f jsr print_line 0266 ;;; Edit line 0267 a2ec fe a8 f6 ldx line_pointer ; restore line pointer since 0268 a2ef 09 dex ; ends with line_pointer + 1 0269 a2f0 ff a8 f6 stx line_pointer 0270 a2f3 7d a9 00 tst line_numbers_enable 0271 a2f6 27 0c beq cmd_replace1 ; line numbers enabled? 0272 a2f8 ce a8 f6 ldx #line_pointer 0273 a2fb bd a3 f0 jsr outdec 0274 * ldx #mem_pointer 0275 * jsr mon_out4hs 0276 a2fe ce a8 4a ldx #txt_zdel 0277 a301 bd c0 09 jsr mon_pdata 0278 cmd_replace1: 0279 a304 bd a3 e3 jsr clbuf ; clear existing line buffer 0280 a307 bd a4 e8 jsr edit_line ; enter new line 0281 a30a 24 1a bcc cmd_replace_end 0282 ;;; Replace line in memory 0283 a30c bd a6 d0 jsr find_line 0284 a30f bd a5 d1 jsr mem_insert ; insert new line into memory 0285 a312 25 0c bcs cmd_replace2 ; insert OK, enter next line 0286 a314 ce a7 73 ldx #txt_out_of_memory ; out of memory 0287 a317 bd c0 09 jsr mon_pdata 0288 a31a bd c0 21 jsr mon_pcrlf 0289 a31d 7e a1 84 jmp prompt 0290 cmd_replace2: 0291 a320 bd a6 d0 jsr find_line 0292 a323 bd a6 63 jsr mem_delete ; delete old line 0293 cmd_replace_end: 0294 a326 bd c0 21 jsr mon_pcrlf 0295 a329 7e a1 84 jmp prompt 0296 0297 ;;; 0298 ;;; Save command 0299 ;;; 0300 cmd_save: 0301 a32c ce a8 8f ldx #txt_name 0302 a32f bd c0 09 jsr mon_pdata 0303 a332 bd a5 66 jsr fname_to_buffer ; prepare file name for user edit 0304 a335 bd a4 e8 jsr edit_line 0305 a338 24 59 bcc save_abort 0306 a33a bd a5 94 jsr buffer_to_fname 0307 a33d bd c0 21 jsr mon_pcrlf 0308 a340 ce a9 04 ldx #file_name 0309 a343 ff a9 46 stx fcb0+2 0310 a346 bd a6 a4 jsr find_last ; update mem_pointer to end of file contents 0311 a349 86 08 ldaa #$08 ; delete file command 0312 a34b b7 a9 44 staa fcb0 0313 a34e ce a9 44 ldx #fcb0 0314 a351 bd d0 06 jsr sys_call 0315 a354 fe a8 f0 ldx mem_start 0316 a357 ff a9 48 stx fcb0+4 0317 a35a fe a8 f4 ldx mem_pointer 0318 a35d bc a8 f0 cpx mem_start 0319 a360 27 0e beq cmd_save1 0320 a362 09 dex ; adjust to end of file data 0321 a363 bc a8 f0 cpx mem_start 0322 a366 27 08 beq cmd_save1 0323 a368 a6 00 ldaa ,x 0324 a36a b1 a9 01 cmpa eol 0325 a36d 26 01 bne cmd_save1 0326 a36f 09 dex ; remove last eol character 0327 cmd_save1: 0328 a370 ff a9 4a stx fcb0+6 0329 a373 86 20 ldaa #$20 ; save file command 0330 a375 b7 a9 44 staa fcb0 0331 a378 86 03 ldaa #$03 ; set file flags 0332 a37a b7 a9 4c staa fcb0+8 0333 a37d ce a9 44 ldx #fcb0 0334 a380 bd d0 06 jsr sys_call 0335 a383 ce a9 44 ldx #fcb0 ; check for error 0336 a386 6d 01 tst 1,x 0337 a388 26 0f bne save_error 0338 a38a ce a8 96 ldx #txt_save_ok 0339 a38d bd c0 09 jsr mon_pdata 0340 a390 7e a1 84 jmp prompt 0341 save_abort: 0342 a393 bd c0 21 jsr mon_pcrlf 0343 a396 7e a1 84 jmp prompt 0344 save_error: 0345 a399 ce a8 a0 ldx #txt_save_error 0346 a39c bd c0 09 jsr mon_pdata 0347 a39f ce a9 44 ldx #fcb0 0348 a3a2 bd a4 5c jsr out4hs 0349 a3a5 bd c0 21 jsr mon_pcrlf 0350 a3a8 7e a1 84 jmp prompt 0351 0352 ;;; 0353 ;;; Help command 0354 ;;; 0355 cmd_help: 0356 a3ab ce a7 88 ldx #txt_help 0357 a3ae bd c0 09 jsr mon_pdata 0358 a3b1 7e a1 84 jmp prompt 0359 0360 ;;; 0361 ;;; Line numbers commandd 0362 ;;; 0363 cmd_numbers: 0364 a3b4 7d a9 00 tst line_numbers_enable 0365 a3b7 27 0f beq cmd_numbers0 0366 a3b9 7f a9 00 clr line_numbers_enable 0367 a3bc ce a8 51 ldx #txt_off 0368 a3bf bd c0 09 jsr mon_pdata 0369 a3c2 bd c0 21 jsr mon_pcrlf 0370 a3c5 7e a1 84 jmp prompt 0371 cmd_numbers0: 0372 a3c8 7c a9 00 inc line_numbers_enable 0373 a3cb ce a8 4e ldx #txt_on 0374 a3ce bd c0 09 jsr mon_pdata 0375 a3d1 bd c0 21 jsr mon_pcrlf 0376 a3d4 7e a1 84 jmp prompt 0377 0378 ;;; 0379 ;;; Clear memory 0380 ;;; 0381 mem_clear: 0382 a3d7 fe a8 f0 ldx mem_start 0383 mem_clear_loop: 0384 a3da 6f 00 clr ,x 0385 a3dc 08 inx 0386 a3dd bc a8 f2 cpx mem_end 0387 a3e0 26 f8 bne mem_clear_loop 0388 a3e2 39 rts 0389 0390 ;;; 0391 ;;; Clear line buffer 0392 ;;; 0393 clbuf: 0394 a3e3 ce a8 af ldx #line_buffer 0395 a3e6 5f clrb 0396 clbufl: 0397 a3e7 6f 00 clr ,x 0398 a3e9 08 inx 0399 a3ea 5c incb 0400 a3eb c1 3f cmpb #line_buffer_length 0401 a3ed 26 f8 bne clbufl 0402 a3ef 39 rts 0403 0404 ;;; 0405 ;;; Decimal output routine borrowed from FLEX. Modified to make use of D-reg. 0406 ;;; IN: X = pointer to 16-bit unsigned binary number 0407 ;;; 0408 outdec: 0409 a3f0 7f a8 fd clr outdec_digit 0410 a3f3 86 04 ldaa #4 0411 a3f5 b7 a8 fe staa outdec_loop1 0412 a3f8 ec 00 ldd 0,x 0413 a3fa ce a4 38 ldx #decimal_table 0414 ;;; Iterate over table for each position 0415 outdec_1: 0416 a3fd 8d 0b bsr outdec_2 0417 a3ff 08 inx 0418 a400 08 inx 0419 a401 7a a8 fe dec outdec_loop1 0420 a404 26 f7 bne outdec_1 0421 a406 17 tba 0422 a407 7e a4 44 jmp outhr 0423 ;;; Binary to decimal conversion 0424 outdec_2: 0425 a40a 7f a8 ff clr outdec_loop2 0426 outdec_3: 0427 a40d a1 00 cmpa 0,x 0428 a40f 25 0d bcs outdec_5 0429 a411 22 04 bhi outdec_4 0430 a413 e1 01 cmpb 1,x 0431 a415 25 07 bcs outdec_5 0432 outdec_4: 0433 a417 a3 00 subd 0,x 0434 a419 7c a8 ff inc outdec_loop2 0435 a41c 20 ef bra outdec_3 0436 ;;; Print digit or leading space 0437 outdec_5: 0438 a41e 36 psha 0439 a41f b6 a8 ff ldaa outdec_loop2 0440 a422 26 0c bne outdec_6 0441 a424 7d a8 fd tst outdec_digit 0442 a427 26 07 bne outdec_6 0443 a429 86 20 ldaa #$20 0444 a42b bd 7f e8 jsr conovec 0445 a42e 20 06 bra outdec_7 0446 outdec_6: 0447 a430 7c a8 fd inc outdec_digit 0448 a433 bd a4 44 jsr outhr 0449 outdec_7: 0450 a436 32 pula 0451 a437 39 rts 0452 ;;; Decimal table 0453 decimal_table: 0454 a438 27 10 fdb 10000 0455 a43a 03 e8 fdb 1000 0456 a43c 00 64 fdb 100 0457 a43e 00 0a fdb 10 0458 0459 ;;; 0460 ;;; Print hex values 0461 ;;; 0462 outhl: 0463 a440 44 lsra 0464 a441 44 lsra 0465 a442 44 lsra 0466 a443 44 lsra 0467 outhr: 0468 a444 84 0f anda #$0f 0469 a446 8b 30 adda #$30 0470 a448 81 39 cmpa #$39 0471 a44a 23 02 bls outhe 0472 a44c 8b 27 adda #$27 ; $07=lower case & $27=upper case 0473 outhe: 0474 a44e 7e 7f e8 jmp conovec 0475 out2h: 0476 a451 a6 00 ldaa 0,x 0477 a453 bd a4 40 jsr outhl 0478 a456 a6 00 ldaa 0,x 0479 a458 08 inx 0480 a459 7e a4 44 jmp outhr 0481 out4hs: 0482 a45c 8d f3 bsr out2h 0483 out2hs: 0484 a45e 8d f1 bsr out2h 0485 0486 ;;; 0487 ;;; Parse decimal value from ASCII string at X 0488 ;;; Result in variable 'xtemp1' 0489 ;;; 0490 parse_dec: 0491 a460 7f a8 f9 clr xtemp1 0492 a463 7f a8 fa clr xtemp1+1 0493 a466 a6 00 ldaa ,x 0494 a468 27 2c beq parse_dec_err 0495 a46a 81 20 cmpa #$20 0496 a46c 27 28 beq parse_dec_err 0497 parse_dec_loop: 0498 a46e a6 00 ldaa ,x 0499 a470 27 22 beq parse_dec_end 0500 a472 81 20 cmpa #$20 0501 a474 27 1e beq parse_dec_end 0502 a476 bd a4 ac jsr char_to_hex 0503 a479 24 1b bcc parse_dec_err 0504 a47b 81 09 cmpa #$09 0505 a47d 2e 17 bgt parse_dec_err 0506 a47f bd a4 98 jsr mult10 0507 a482 7f a8 fb clr xtemp2 ; add value 0508 a485 b7 a8 fc staa xtemp2+1 0509 a488 fc a8 f9 ldd xtemp1 0510 a48b f3 a8 fb addd xtemp2 0511 a48e fd a8 f9 std xtemp1 0512 a491 08 inx 0513 a492 20 da bra parse_dec_loop 0514 parse_dec_end: 0515 a494 0c clc 0516 a495 39 rts 0517 parse_dec_err: 0518 a496 0d sec 0519 a497 39 rts 0520 0521 ;;; 0522 ;;; Multiply variable 'xtemp1' by 10 0523 ;;; 0524 mult10: 0525 a498 36 psha 0526 a499 37 pshb 0527 a49a fc a8 f9 ldd xtemp1 0528 a49d 05 asld ; * 2 0529 a49e fd a8 f8 std temp 0530 a4a1 05 asld ; * 4 0531 a4a2 05 asld ; * 8 0532 a4a3 f3 a8 f8 addd temp ; D = D*8+D*2 0533 a4a6 fd a8 f9 std xtemp1 0534 a4a9 33 pulb 0535 a4aa 32 pula 0536 a4ab 39 rts 0537 0538 ;;; 0539 ;;; Convert ASCII char to hex 0540 ;;; IN: Chanracter in A 0541 ;;; OUT: Value in A. Carry set on OK 0542 ;;; 0543 char_to_hex: 0544 a4ac 27 16 beq char_to_hex_fail ; end of string 0545 a4ae 80 30 suba #$30 0546 a4b0 2b 12 bmi char_to_hex_fail ; not hex 0547 a4b2 81 09 cmpa #$09 0548 a4b4 2f 0c ble char_to_hex_ok ; $9 and below 0549 a4b6 84 df anda #$df ; to upper case 0550 a4b8 81 11 cmpa #$11 0551 a4ba 2b 08 bmi char_to_hex_fail ; not hex 0552 a4bc 81 16 cmpa #$16 0553 a4be 2e 04 bgt char_to_hex_fail ; not hex 0554 a4c0 80 07 suba #7 0555 char_to_hex_ok: 0556 a4c2 0d sec 0557 a4c3 39 rts 0558 char_to_hex_fail: 0559 a4c4 0c clc 0560 a4c5 39 rts 0561 0562 ;;; 0563 ;;; Find next word in string pointed at by X 0564 ;;; 0565 str_skp_next: 0566 a4c6 a6 00 ldaa ,x 0567 a4c8 27 12 beq str_skp_next_e 0568 a4ca 81 20 cmpa #$20 0569 a4cc 27 03 beq str_skp_next_1 0570 a4ce 08 inx 0571 a4cf 20 f5 bra str_skp_next 0572 str_skp_next_1: 0573 a4d1 a6 00 ldaa ,x 0574 a4d3 27 07 beq str_skp_next_e 0575 a4d5 81 20 cmpa #$20 0576 a4d7 26 03 bne str_skp_next_e 0577 a4d9 08 inx 0578 a4da 20 f5 bra str_skp_next_1 0579 str_skp_next_e: 0580 a4dc 39 rts 0581 0582 ;;; 0583 ;;; Print zero terminated string 0584 ;;; 0585 str_print: 0586 a4dd a6 00 ldaa ,x 0587 a4df 27 06 beq str_print_end 0588 a4e1 bd 7f e8 jsr conovec 0589 a4e4 08 inx 0590 a4e5 20 f6 bra str_print 0591 str_print_end: 0592 a4e7 39 rts 0593 0594 ;;; 0595 ;;; Edit line in buffer 0596 ;;; updates line_length 0597 ;;; carry set on ok 0598 ;;; carry clear on abort 0599 ;;; 0600 edit_line: 0601 a4e8 5f clrb 0602 a4e9 ce a8 af ldx #line_buffer 0603 edit_line_print_loop: 0604 a4ec a6 00 ldaa ,x ; print existing buffer 0605 a4ee 81 00 cmpa #$00 0606 a4f0 27 0b beq edit_line_loop ; found end of buffer 0607 a4f2 bd 7f e8 jsr conovec 0608 a4f5 08 inx 0609 a4f6 5c incb 0610 a4f7 c1 3f cmpb #line_buffer_length 0611 a4f9 22 02 bhi *+4 0612 a4fb 20 ef bra edit_line_print_loop 0613 edit_line_loop: 0614 a4fd bd 7f eb jsr conivec ; get character from acia 0615 a500 b1 a9 03 cmpa term_escape ; is character escape ($1b)? 0616 a503 27 5c beq edit_line_es ; exit 0617 a505 81 7f cmpa #$7f ; is character delete ($7f) or non-printable? 0618 a507 27 f4 beq edit_line_loop ; read new character 0619 a509 22 f2 bhi edit_line_loop ; read new character 0620 a50b 81 08 cmpa #$08 ; is character a backspace ($08)? 0621 a50d 27 0f beq edit_line_bs 0622 a50f 81 09 cmpa #$09 ; is character a tab ($09)? 0623 a511 27 24 beq edit_line_tab 0624 a513 81 0d cmpa #$0d ; is character a carriage return ($0d)? 0625 a515 27 43 beq edit_line_cr 0626 a517 81 1f cmpa #$1f ; is character nonprintable? 0627 a519 23 e2 bls edit_line_loop ; read new character 0628 a51b 7e a5 4c jmp edit_line_ok ; if we have come this far character is ok 0629 edit_line_bs: 0630 a51e c1 00 cmpb #0 0631 a520 27 db beq edit_line_loop ; if at beginning of buffer dont delete 0632 a522 09 dex 0633 a523 5a decb 0634 a524 bd 7f e8 jsr conovec ; print the recieved backspace 0635 a527 86 20 ldaa #$20 0636 a529 bd 7f e8 jsr conovec ; print space 0637 a52c 86 08 ldaa #$08 0638 a52e bd 7f e8 jsr conovec ; print backspace 0639 a531 4f clra 0640 a532 a7 00 staa ,x ; clear character from buffer (store $00 at its place) 0641 a534 7e a4 fd jmp edit_line_loop ; read new character 0642 edit_line_tab: 0643 a537 c1 3f cmpb #line_buffer_length 0644 a539 27 c2 beq edit_line_loop ; if at end of buffer dont enter new character 0645 a53b 86 20 ldaa #$20 0646 a53d bd 7f e8 jsr conovec 0647 a540 a7 00 staa ,x 0648 a542 08 inx 0649 a543 5c incb 0650 a544 17 tba 0651 a545 84 07 anda #$07 0652 a547 26 ee bne edit_line_tab 0653 a549 7e a4 fd jmp edit_line_loop ; read new character 0654 edit_line_ok: 0655 a54c c1 3f cmpb #line_buffer_length 0656 a54e 27 ad beq edit_line_loop ; if at end of buffer dont enter new character 0657 a550 bd 7f e8 jsr conovec ; echo entered character 0658 a553 a7 00 staa ,x 0659 a555 08 inx 0660 a556 5c incb 0661 a557 7e a4 fd jmp edit_line_loop ; read new character 0662 edit_line_cr: 0663 a55a f7 a8 ef stab line_length 0664 a55d 6f 00 clr ,x ; terminate string 0665 a55f 0d sec ; entry OK 0666 a560 39 rts 0667 edit_line_es: 0668 a561 f7 a8 ef stab line_length 0669 a564 0c clc ; entry aborted 0670 a565 39 rts 0671 0672 ;;; 0673 ;;; Copy file name to/from line buffer 0674 ;;; 0675 fname_to_buffer: 0676 a566 7f a8 ef clr line_length 0677 a569 ce a9 04 ldx #file_name 0678 a56c ff a8 f9 stx xtemp1 0679 a56f ce a8 af ldx #line_buffer 0680 a572 ff a8 fb stx xtemp2 0681 fname_to_buffer_loop: 0682 a575 fe a8 f9 ldx xtemp1 0683 a578 a6 00 ldaa ,x 0684 a57a 27 12 beq fname_to_buffer_done 0685 a57c 08 inx 0686 a57d ff a8 f9 stx xtemp1 0687 a580 fe a8 fb ldx xtemp2 0688 a583 a7 00 staa ,x 0689 a585 08 inx 0690 a586 ff a8 fb stx xtemp2 0691 a589 7c a8 ef inc line_length 0692 a58c 20 e7 bra fname_to_buffer_loop 0693 fname_to_buffer_done: 0694 a58e fe a8 fb ldx xtemp2 0695 a591 6f 00 clr ,x 0696 a593 39 rts 0697 buffer_to_fname: 0698 a594 7f a8 ef clr line_length 0699 a597 ce a8 af ldx #line_buffer 0700 a59a ff a8 f9 stx xtemp1 0701 a59d ce a9 04 ldx #file_name 0702 a5a0 ff a8 fb stx xtemp2 0703 a5a3 20 d0 bra fname_to_buffer_loop 0704 0705 ;;; 0706 ;;; Copy string at X to file name buffer 0707 ;;; 0708 copy_to_fname: 0709 a5a5 ff a8 f9 stx xtemp1 0710 a5a8 ce a9 04 ldx #file_name 0711 a5ab ff a8 fb stx xtemp2 0712 a5ae c6 64 ldab #$64 0713 copy_to_fname_loop: 0714 a5b0 fe a8 f9 ldx xtemp1 0715 a5b3 a6 00 ldaa ,x 0716 a5b5 27 14 beq copy_to_fname_done 0717 a5b7 81 20 cmpa #$20 0718 a5b9 27 10 beq copy_to_fname_done 0719 a5bb 08 inx 0720 a5bc ff a8 f9 stx xtemp1 0721 a5bf fe a8 fb ldx xtemp2 0722 a5c2 a7 00 staa ,x 0723 a5c4 08 inx 0724 a5c5 ff a8 fb stx xtemp2 0725 a5c8 5a decb 0726 a5c9 28 e5 bvc copy_to_fname_loop 0727 copy_to_fname_done: 0728 a5cb fe a8 fb ldx xtemp2 0729 a5ce 6f 00 clr ,x 0730 a5d0 39 rts 0731 0732 ;;; 0733 ;;; Insert line from buffer 0734 ;;; into memory at mem_pointer 0735 ;;; updates line_pointer and mem_pointer 0736 ;;; carry set on OK 0737 ;;; carry clear on fail 0738 ;;; 0739 mem_insert: 0740 a5d1 fe a8 f4 ldx mem_pointer 0741 a5d4 a6 00 ldaa ,x 0742 a5d6 81 00 cmpa #$00 ; non-existing line in memory? 0743 a5d8 27 05 beq mem_insert1 0744 a5da bd a6 2a jsr mem_make_room ; make room for new line 0745 a5dd 24 49 bcc mem_insert_fail ; unable to make room in memory for new line 0746 mem_insert1: 0747 a5df ce a8 af ldx #line_buffer 0748 a5e2 ff a8 f9 stx xtemp1 0749 a5e5 f6 a8 ef ldab line_length 0750 mem_insert2: 0751 a5e8 5d tstb 0752 a5e9 27 1b beq mem_insert3 0753 a5eb fe a8 f9 ldx xtemp1 0754 a5ee a6 00 ldaa ,x 0755 a5f0 08 inx 0756 a5f1 ff a8 f9 stx xtemp1 0757 a5f4 fe a8 f4 ldx mem_pointer 0758 a5f7 a7 00 staa ,x 0759 a5f9 08 inx 0760 a5fa ff a8 f4 stx mem_pointer 0761 a5fd 08 inx 0762 a5fe bc a8 f2 cpx mem_end 0763 a601 27 1d beq mem_insert_oom ; out of memory 0764 a603 5a decb 0765 a604 20 e2 bra mem_insert2 0766 mem_insert3: 0767 a606 fe a8 f4 ldx mem_pointer 0768 a609 bc a8 f2 cpx mem_end 0769 a60c 27 12 beq mem_insert_oom ; out of memory 0770 a60e b6 a9 01 ldaa eol 0771 a611 a7 00 staa ,x 0772 a613 08 inx 0773 a614 ff a8 f4 stx mem_pointer 0774 a617 fe a8 f6 ldx line_pointer 0775 a61a 08 inx 0776 a61b ff a8 f6 stx line_pointer 0777 a61e 0d sec ; line insert OK 0778 a61f 39 rts 0779 mem_insert_oom: 0780 a620 fe a8 f4 ldx mem_pointer ; make sure last line ends with EOL 0781 a623 b6 a9 01 ldaa eol 0782 a626 a7 00 staa ,x 0783 mem_insert_fail: 0784 a628 0c clc ; line insert failed 0785 a629 39 rts 0786 0787 ;;; 0788 ;;; Make room in memory for new line 0789 ;;; uses line_length and mem_pointer 0790 ;;; carry set on OK 0791 ;;; carry clear on fail 0792 ;;; 0793 mem_make_room: 0794 a62a fe a8 f4 ldx mem_pointer 0795 mem_make_room1: 0796 a62d a6 00 ldaa ,x ; find end of file 0797 a62f 08 inx 0798 a630 81 00 cmpa #$00 0799 a632 26 f9 bne mem_make_room1 0800 a634 ff a8 f9 stx xtemp1 0801 a637 f6 a8 ef ldab line_length 0802 a63a 5c incb 0803 a63b 3a abx 0804 a63c ff a8 fb stx xtemp2 0805 a63f bc a8 f2 cpx mem_end 0806 a642 22 1d bhi mem_make_room4 ; out of memory 0807 mem_make_room2: 0808 a644 fe a8 f9 ldx xtemp1 0809 a647 a6 00 ldaa ,x 0810 a649 09 dex 0811 a64a ff a8 f9 stx xtemp1 0812 a64d fe a8 fb ldx xtemp2 0813 a650 a7 00 staa ,x 0814 a652 09 dex 0815 a653 ff a8 fb stx xtemp2 0816 a656 fe a8 f9 ldx xtemp1 0817 a659 bc a8 f4 cpx mem_pointer 0818 a65c 08 inx 0819 a65d 22 e5 bhi mem_make_room2 0820 mem_make_room3: 0821 a65f 0d sec 0822 a660 39 rts 0823 mem_make_room4: 0824 a661 0c clc 0825 a662 39 rts 0826 0827 ;;; 0828 ;;; Delete line from memory given by mem_pointer 0829 ;;; 0830 mem_delete: 0831 a663 fe a8 f4 ldx mem_pointer 0832 a666 ff a8 f9 stx xtemp1 0833 a669 a6 00 ldaa ,x 0834 a66b 81 00 cmpa #$00 ; non-existing line in memory? 0835 a66d 27 34 beq mem_delete_end 0836 a66f c6 01 ldab #1 ; length counter (chars + EOL) 0837 mem_delete1: 0838 a671 a6 00 ldaa ,x ; locate end of line 0839 a673 81 00 cmpa #$00 0840 a675 27 09 beq mem_delete2 0841 a677 b1 a9 01 cmpa eol 0842 a67a 27 04 beq mem_delete2 0843 a67c 08 inx 0844 a67d 5c incb 0845 a67e 20 f1 bra mem_delete1 0846 mem_delete2: 0847 a680 fe a8 f9 ldx xtemp1 ; copy data 0848 a683 3a abx 0849 a684 ff a8 fb stx xtemp2 0850 a687 a6 00 ldaa ,x 0851 a689 81 00 cmpa #$00 ; end of file? 0852 a68b 27 0b beq mem_delete3 0853 a68d fe a8 f9 ldx xtemp1 0854 a690 a7 00 staa ,x 0855 a692 08 inx 0856 a693 ff a8 f9 stx xtemp1 0857 a696 20 e8 bra mem_delete2 0858 mem_delete3: 0859 a698 fe a8 fb ldx xtemp2 ; clear last line in memory 0860 mem_delete4: 0861 a69b 09 dex 0862 a69c 6f 00 clr ,x 0863 a69e bc a8 f9 cpx xtemp1 0864 a6a1 26 f8 bne mem_delete4 0865 mem_delete_end: 0866 a6a3 39 rts 0867 0868 ;;; 0869 ;;; Find last line_pointer and mem_pointer 0870 ;;; 0871 find_last: 0872 a6a4 ce 00 01 ldx #1 0873 a6a7 ff a8 f6 stx line_pointer 0874 a6aa fe a8 f0 ldx mem_start 0875 find_last1: 0876 a6ad bc a8 f2 cpx mem_end ; end of memory? 0877 a6b0 27 11 beq find_last2 0878 a6b2 ff a8 f4 stx mem_pointer 0879 a6b5 a6 00 ldaa ,x 0880 a6b7 81 00 cmpa #$00 ; end of file found? 0881 a6b9 27 08 beq find_last2 0882 a6bb b1 a9 01 cmpa eol ; end of line found? 0883 a6be 27 04 beq find_last3 0884 a6c0 08 inx 0885 a6c1 20 ea bra find_last1 0886 find_last2: 0887 a6c3 39 rts 0888 find_last3: 0889 a6c4 fc a8 f6 ldd line_pointer ; increase line counter 0890 a6c7 c3 00 01 addd #1 0891 a6ca fd a8 f6 std line_pointer 0892 a6cd 08 inx 0893 a6ce 20 dd bra find_last1 0894 0895 ;;; 0896 ;;; Find mem_pointer from line_pointer 0897 ;;; 0898 find_line: 0899 a6d0 ce 00 01 ldx #1 0900 a6d3 ff a8 f9 stx xtemp1 0901 a6d6 fe a8 f0 ldx mem_start 0902 a6d9 ff a8 f4 stx mem_pointer 0903 a6dc fe a8 f6 ldx line_pointer 0904 a6df 8c 00 01 cpx #1 0905 a6e2 27 19 beq find_line2 ; special case for first line 0906 a6e4 fe a8 f4 ldx mem_pointer 0907 find_line1: 0908 a6e7 bc a8 f2 cpx mem_end ; end of memory 0909 a6ea 27 11 beq find_line2 0910 a6ec a6 00 ldaa ,x 0911 a6ee 81 00 cmpa #$00 ; end of file found? 0912 a6f0 27 0b beq find_line2 0913 a6f2 b1 a9 01 cmpa eol ; end of line found? 0914 a6f5 27 07 beq find_line3 0915 a6f7 08 inx 0916 a6f8 ff a8 f4 stx mem_pointer 0917 a6fb 20 ea bra find_line1 0918 find_line2: 0919 a6fd 39 rts 0920 find_line3: 0921 a6fe fc a8 f9 ldd xtemp1 ; increase line counter 0922 a701 c3 00 01 addd #1 0923 a704 fd a8 f9 std xtemp1 0924 a707 b6 a8 f7 ldaa line_pointer+1 ; line found? 0925 a70a b1 a8 fa cmpa xtemp1+1 0926 a70d 26 0d bne find_line4 0927 a70f b6 a8 f6 ldaa line_pointer 0928 a712 b1 a8 f9 cmpa xtemp1 0929 a715 26 05 bne find_line4 0930 a717 08 inx 0931 a718 ff a8 f4 stx mem_pointer 0932 a71b 39 rts 0933 find_line4: 0934 a71c 08 inx 0935 a71d 20 c8 bra find_line1 0936 0937 ;;; 0938 ;;; Print lines 0939 ;;; start at mem_pointer 0940 ;;; end after number of lines 0941 ;;; given by val in temp 0942 ;;; 0943 print_line: 0944 a71f fe a8 f4 ldx mem_pointer 0945 a722 bc a8 f2 cpx mem_end 0946 a725 22 40 bhi print_line_end ; end of mem? 0947 a727 a6 00 ldaa ,x 0948 a729 81 00 cmpa #0 0949 a72b 27 3a beq print_line_end ; end of file? 0950 a72d 7d a8 f8 tst temp 0951 a730 2b 05 bmi print_line1 ; no pause? 0952 a732 27 33 beq print_line_end ; all done? 0953 a734 7a a8 f8 dec temp 0954 print_line1: 0955 a737 7d a9 00 tst line_numbers_enable 0956 a73a 27 0c beq print_line2 ; line numbers enabled? 0957 a73c ce a8 f6 ldx #line_pointer 0958 a73f bd a3 f0 jsr outdec 0959 * ldx #mem_pointer 0960 * jsr mon_out4hs 0961 a742 ce a8 4a ldx #txt_zdel 0962 a745 bd c0 09 jsr mon_pdata 0963 print_line2: 0964 a748 fe a8 f4 ldx mem_pointer 0965 a74b a6 00 ldaa ,x 0966 a74d 08 inx 0967 a74e ff a8 f4 stx mem_pointer 0968 a751 b1 a9 01 cmpa eol ; end of line? 0969 a754 27 05 beq print_line3 0970 a756 bd 7f e8 jsr conovec 0971 a759 20 ed bra print_line2 0972 print_line3: 0973 a75b fe a8 f6 ldx line_pointer 0974 a75e 08 inx 0975 a75f ff a8 f6 stx line_pointer 0976 a762 bd c0 21 jsr mon_pcrlf 0977 a765 20 b8 bra print_line 0978 print_line_end: 0979 a767 39 rts 0980 0981 ;;; 0982 ;;; Texts 0983 ;;; 0984 txt_prmt: 0985 a768 3a 3a 20 fcc ":: " 0986 a76b 04 fcb $04 0987 txt_sure: 0988 a76c 53 75 72 65 3f 20 fcc "Sure? " 0989 a772 04 fcb $04 0990 txt_out_of_memory: 0991 a773 0d 0a 0a fcb $0d,$0a,$0a 0992 a776 20 4f 75 74 20 6f fcc " Out of memory" 66 20 6d 65 6d 6f 72 79 0993 a784 0d 0a 0a 04 fcb $0d,$0a,$0a,$04 0994 txt_help: 0995 a788 0d 0a fcb $0d,$0a 0996 a78a 20 4c 69 6e 65 20 fcc " Line editor v1.2" 65 64 69 74 6f 72 20 76 31 2e 32 0997 a79b 0d 0a fcb $0d,$0a 0998 a79d 20 44 61 6e 69 65 fcc " Daniel Tufvesson 2017-2022" 6c 20 54 75 66 76 65 73 73 6f 6e 20 32 30 31 37 2d 32 30 32 32 0999 a7b8 0d 0a 0a fcb $0d,$0a,$0a 1000 a7bb 20 49 6e 73 65 72 fcc " Insert " 74 20 3c 6c 69 6e 65 20 6e 75 6d 62 65 72 3e 1001 a7d0 0d 0a fcb $0d,$0a 1002 a7d2 20 44 65 6c 65 74 fcc " Delete " 65 20 3c 6c 69 6e 65 20 6e 75 6d 62 65 72 3e 1003 a7e7 0d 0a fcb $0d,$0a 1004 a7e9 20 50 72 69 6e 74 fcc " Print " 20 3c 73 74 61 72 74 69 6e 67 20 6c 69 6e 65 20 6e 75 6d 62 65 72 3e 1005 a806 0d 0a fcb $0d,$0a 1006 a808 20 52 65 70 6c 61 fcc " Replace " 63 65 20 3c 6c 69 6e 65 20 6e 75 6d 62 65 72 3e 1007 a81e 0d 0a fcb $0d,$0a 1008 a820 20 53 61 76 65 fcc " Save" 1009 a825 0d 0a fcb $0d,$0a 1010 a827 20 48 65 6c 70 fcc " Help" 1011 a82c 0d 0a fcb $0d,$0a 1012 a82e 20 4e 75 6d 62 65 fcc " Numbers (on/off)" 72 73 20 28 6f 6e 2f 6f 66 66 29 1013 a83f 0d 0a fcb $0d,$0a 1014 a841 20 51 75 69 74 fcc " Quit" 1015 a846 0d 0a 0a 04 fcb $0d,$0a,$0a,$04 1016 txt_zdel: 1017 a84a 20 3a 20 fcc " : " 1018 a84d 04 fcb $04 1019 txt_on: 1020 a84e 6f 6e fcc "on" 1021 a850 04 fcb $04 1022 txt_off: 1023 a851 6f 66 66 fcc "off" 1024 a854 04 fcb $04 1025 txt_not_found: 1026 a855 46 69 6c 65 20 6e fcc "File not found" 6f 74 20 66 6f 75 6e 64 1027 a863 0d 0a 04 fcb $0d,$0a,$04 1028 txt_read_error: 1029 a866 46 69 6c 65 20 72 fcc "File read error" 65 61 64 20 65 72 72 6f 72 1030 a875 0d 0a 04 fcb $0d,$0a,$04 1031 txt_is_directory: 1032 a878 45 6e 74 72 79 20 fcc "Entry is a directory" 69 73 20 61 20 64 69 72 65 63 74 6f 72 79 1033 a88c 0d 0a 04 fcb $0d,$0a,$04 1034 txt_name: 1035 a88f 4e 61 6d 65 3a 20 fcc "Name: " 1036 a895 04 fcb $04 1037 txt_save_ok: 1038 a896 53 61 76 65 20 4f fcc "Save OK" 4b 1039 a89d 0d 0a 04 fcb $0d,$0a,$04 1040 txt_save_error: 1041 a8a0 53 61 76 65 20 66 fcc "Save failed! $" 61 69 6c 65 64 21 20 24 1042 a8ae 04 fcb $04 1043 1044 ;;; 1045 ;;; Variables 1046 ;;; 1047 a8af line_buffer: rmb 64 ; line buffer 1048 003f line_buffer_length: equ 63 ; line buffer length (leave room for trailing zero) 1049 a8ef line_length: rmb 1 ; line length 1050 a8f0 01 00 mem_start: fdb $0100 ; start of memory 1051 a8f2 7d ff mem_end: fdb $7dff ; end of memory 1052 a8f4 mem_pointer: rmb 2 ; memory pointer 1053 a8f6 line_pointer: rmb 2 ; line pointer 1054 a8f8 temp: rmb 1 1055 a8f9 xtemp1: rmb 2 1056 a8fb xtemp2: rmb 2 1057 a8fd outdec_digit: rmb 1 ; decimal print digit counter 1058 a8fe outdec_loop1: rmb 1 ; decimal print loop1 counter 1059 a8ff outdec_loop2: rmb 1 ; decimal print loop2 counter 1060 a900 01 line_numbers_enable: fcb $01 ; enable line numbers 1061 a901 0a eol: fcb $0a ; end of line marker 1062 a902 14 term_lines: fcb 20 ; number of terminal lines 1063 a903 1b term_escape: fcb $1b ; escape code 1064 a904 75 6e 74 69 74 6c file_name: fcc "untitled" 65 64 1065 a90c 00 fcb $0 1066 a90d rmb 55 1067 1068 ;;; 1069 ;;; File Control Block 1070 ;;; 1071 a944 00 fcb0: fcb 0 ; command 1072 a945 00 fcb 0 ; error code 1073 a946 00 00 fdb 0 ; file name 1074 a948 00 fcb 0 ; flags 1075 a949 00 00 fdb 0 ; sectors 1076 a94b 00 00 fdb 0 ; size MSB 1077 a94d 00 00 fdb 0 ; size LSB 1078 a94f 00 00 fdb 0 ; year 1079 a951 00 fcb 0 ; month 1080 a952 00 fcb 0 ; day 1081 a953 00 fcb 0 ; hours 1082 a954 00 fcb 0 ; minutes 1083 a955 00 fcb 0 ; seconds Number of errors 0