From 707a8aec510a96dd597ac362bc8c83ee193ff00e Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 16 Jul 2024 19:33:19 -0400 Subject: listbas: colorize BXL/BXE ops correctly. --- listbas.c | 81 +++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/listbas.c b/listbas.c index de375fd..c179b56 100644 --- a/listbas.c +++ b/listbas.c @@ -508,6 +508,50 @@ void aplus_op_color_on(unsigned char tok) { color_on(c); } +void turbo_op_color_on(unsigned char tok) { + switch(tok) { + case 0x55: + case 0x58: + case 0x59: /* pseudo-func */ + case 0x5b: + case 0x5c: + case 0x5e: + case 0x5f: /* pseudo-func */ + case 0x60: /* pseudo-func */ + case 0x63: /* pseudo-func */ + case 0x64: + case 0x65: + case 0x6b: + case 0x6c: /* pseudo-func */ + case 0x6d: /* pseudo-func */ + color_on(color_func); + break; + case 0x5a: + case 0x5d: + case 0x61: + case 0x62: + case 0x6a: + color_on(color_cmd); + break; + default: + color_on(color_op); + break; + } +} + +/* BXL and BXE use the same operator tokens */ +void bxlxe_op_color_on(unsigned char tok) { + int c = color_op; + + if(tok == 0x55) { + c = color_cmd; + } else if(tok >= 0x5a) { + c = color_func; + } + + color_on(c); +} + void op_color_on(unsigned char tok) { if(!color) return; @@ -529,37 +573,12 @@ void op_color_on(unsigned char tok) { return; } - if(bas_type == B_TURBO) { - switch(tok) { - case 0x55: - case 0x58: - case 0x59: /* pseudo-func */ - case 0x5b: - case 0x5c: - case 0x5e: - case 0x5f: /* pseudo-func */ - case 0x60: /* pseudo-func */ - case 0x63: /* pseudo-func */ - case 0x64: - case 0x65: - case 0x6b: - case 0x6c: /* pseudo-func */ - case 0x6d: /* pseudo-func */ - color_on(color_func); - return; - case 0x5a: - case 0x5d: - case 0x61: - case 0x62: - case 0x6a: - color_on(color_cmd); - return; - default: - break; - } - } - - color_on(color_op); + if(bas_type == B_TURBO) + turbo_op_color_on(tok); + else if(bas_type == B_BXL || bas_type == B_BXE) + bxlxe_op_color_on(tok); + else + color_on(color_op); /* should never get here actually */ } CALLBACK(print_op) { -- cgit v1.2.3