From 662aef4efaf01cadbe7b690266466c1c0fc9fbf8 Mon Sep 17 00:00:00 2001 From: Greg King Date: Thu, 25 Apr 2013 12:32:49 -0400 Subject: [PATCH] Made CBM scrcode assembly-macro properly handle all 256 codes. And, made it smaller. --- asminc/cbm.mac | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/asminc/cbm.mac b/asminc/cbm.mac index a6ec9f8db..b2bfe5992 100644 --- a/asminc/cbm.mac +++ b/asminc/cbm.mac @@ -2,20 +2,8 @@ ; Helper macro that converts and outputs one character .macro _scrcode char - .if (char >= '@' .and char <= 'z') - .byte (char - '@') - .elseif (char >= 'A' .and char <= 'Z') - .byte (char - 'A' + 65) - .elseif (char = '[') - .byte 27 - .elseif (char = ']') - .byte 29 - .elseif (char = '^') - .byte 30 - .elseif (char = '_') - .byte 31 - .elseif (char < 256) - .byte char + .if (char < 256) + .byte <(.strat ("h@dbdlhh", char >> 5) << 4) ^ char .else .error "scrcode: Character constant out of range" .endif @@ -24,7 +12,7 @@ .macro scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ; Bail out if next argument is empty - .if .blank (arg1) + .if .blank ({arg1}) .exitmacro .endif -- 2.39.5