Merge pull request #403 from dbrotz/multiple-charmaps

Add support for multiple charmaps
This commit is contained in:
Eldred Habert
2019-08-31 04:44:58 +02:00
committed by GitHub
18 changed files with 486 additions and 33 deletions

View File

@@ -1,4 +1,4 @@
SECTION "sec", ROM0
charmap "A", 1
SECTION "sec", ROM0
_A_ EQU "A"
db _A_

View File

@@ -0,0 +1,104 @@
new_: MACRO
IF _NARG > 1
printt "newcharmap \1, \2\n"
newcharmap \1, \2
ELSE
printt "newcharmap \1\n"
newcharmap \1
ENDC
ENDM
set_: MACRO
printt "setcharmap \1\n"
setcharmap \1
ENDM
push_: MACRO
printt "pushc\n"
pushc
ENDM
pop_: MACRO
printt "popc\n"
popc
ENDM
print: MACRO
x = \1
printt "{x}\n"
ENDM
printt "main charmap\n"
charmap "ab", $0
print "ab"
new_ map1
print "ab"
new_ map2, main
print "ab"
set_ map1
print "ab"
new_ map3
charmap "ab", $1
print "ab"
new_ map4, map3
charmap "ab", $1
charmap "cd", $2
print "ab"
print "cd"
set_ map3
print "ab"
print "cd"
set_ main
SECTION "sec0", ROM0
print "ab"
printt "override main charmap\n"
charmap "ef", $3
print "ab"
print "ef"
set_ map1
push_
set_ map2
push_
set_ map3
print "ab"
print "cd"
print "ef"
pop_
print "ab"
pop_
print "ab"
new_ map1
set_ map5
pop_

View File

@@ -0,0 +1,44 @@
warning: multiple-charmaps.asm(75):
Using 'charmap' within a section when the current charmap is 'main' is deprecated
ERROR: multiple-charmaps.asm(100) -> new_(5):
Charmap 'map1' already exists
ERROR: multiple-charmaps.asm(102) -> set_(2):
Charmap 'map5' doesn't exist
ERROR: multiple-charmaps.asm(104) -> pop_(2):
No entries in the charmap stack
main charmap
$0
newcharmap map1
$6162
newcharmap map2, main
$0
setcharmap map1
$6162
newcharmap map3
$1
newcharmap map4, map3
$1
$2
setcharmap map3
$1
$6364
setcharmap main
$0
override main charmap
$6162
$3
setcharmap map1
pushc
setcharmap map2
pushc
setcharmap map3
$1
$6364
$6566
popc
$0
popc
$6162
newcharmap map1
setcharmap map5
popc

View File

@@ -0,0 +1,44 @@
warning: -(75):
Using 'charmap' within a section when the current charmap is 'main' is deprecated
ERROR: -(100) -> new_(5):
Charmap 'map1' already exists
ERROR: -(102) -> set_(2):
Charmap 'map5' doesn't exist
ERROR: -(104) -> pop_(2):
No entries in the charmap stack
main charmap
$0
newcharmap map1
$6162
newcharmap map2, main
$0
setcharmap map1
$6162
newcharmap map3
$1
newcharmap map4, map3
$1
$2
setcharmap map3
$1
$6364
setcharmap main
$0
override main charmap
$6162
$3
setcharmap map1
pushc
setcharmap map2
pushc
setcharmap map3
$1
$6364
$6566
popc
$0
popc
$6162
newcharmap map1
setcharmap map5
popc