Add pushc and popc directives

This commit is contained in:
dbrotz
2019-08-30 19:36:23 -07:00
parent 461ef6cea5
commit d3db5f0d76
8 changed files with 149 additions and 61 deletions

View File

@@ -1,88 +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
x = "ab"
printt "{x}\n"
print "ab"
printt "newcharmap map1\n"
newcharmap map1
new_ map1
x = "ab"
printt "{x}\n"
print "ab"
printt "newcharmap map2, main\n"
newcharmap map2, main
new_ map2, main
x = "ab"
printt "{x}\n"
print "ab"
printt "setcharmap map1\n"
setcharmap map1
set_ map1
x = "ab"
printt "{x}\n"
print "ab"
printt "newcharmap map3\n"
newcharmap map3
new_ map3
charmap "ab", $1
x = "ab"
printt "{x}\n"
print "ab"
printt "newcharmap map4, map3\n"
newcharmap map4, map3
new_ map4, map3
charmap "ab", $1
charmap "cd", $2
x = "ab"
printt "{x}\n"
print "ab"
print "cd"
x = "cd"
printt "{x}\n"
set_ map3
printt "setcharmap map3\n"
setcharmap map3
print "ab"
print "cd"
x = "ab"
printt "{x}\n"
x = "cd"
printt "{x}\n"
printt "setcharmap main\n"
setcharmap main
set_ main
SECTION "sec0", ROM0
x = "ab"
printt "{x}\n"
print "ab"
printt "override main charmap\n"
charmap "ef", $3
x = "ab"
printt "{x}\n"
print "ab"
print "ef"
x = "ef"
printt "{x}\n"
set_ map1
printt "setcharmap map3\n"
setcharmap map3
push_
set_ map2
push_
x = "ab"
printt "{x}\n"
set_ map3
x = "cd"
printt "{x}\n"
print "ab"
print "cd"
print "ef"
x = "ef"
printt "{x}\n"
pop_
printt "newcharmap map1\n"
newcharmap map1
print "ab"
printt "setcharmap map5\n"
setcharmap map5
pop_
print "ab"
new_ map1
set_ map5
pop_

View File

@@ -1,10 +1,11 @@
warning: multiple-charmaps.asm(64):
warning: multiple-charmaps.asm(75):
Using 'charmap' within a section when the current charmap is 'main' is deprecated
ERROR: multiple-charmaps.asm(85):
ERROR: multiple-charmaps.asm(100) -> new_(5):
Charmap 'map1' already exists
ERROR: multiple-charmaps.asm(88):
ERROR: multiple-charmaps.asm(102) -> set_(2):
Charmap 'map5' doesn't exist
error: Assembly aborted (2 errors)!
ERROR: multiple-charmaps.asm(104) -> pop_(2):
No entries in the charmap stack
main charmap
$0
newcharmap map1
@@ -26,9 +27,18 @@ $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

@@ -1,10 +1,11 @@
warning: -(64):
warning: -(75):
Using 'charmap' within a section when the current charmap is 'main' is deprecated
ERROR: -(85):
ERROR: -(100) -> new_(5):
Charmap 'map1' already exists
ERROR: -(88):
ERROR: -(102) -> set_(2):
Charmap 'map5' doesn't exist
error: Assembly aborted (2 errors)!
ERROR: -(104) -> pop_(2):
No entries in the charmap stack
main charmap
$0
newcharmap map1
@@ -26,9 +27,18 @@ $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