Skip to content

Commit 93cdd8a

Browse files
committed
Merge pull request #385 from boriel/feature/architectures
Dynamically import architecture
2 parents c582ef4 + 9c0cd4c commit 93cdd8a

292 files changed

Lines changed: 33678 additions & 20 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

arch/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,22 @@
22
# -*- coding: utf-8 -*-
33
# vim:ts=4:et:sw=4:
44

5-
from . import zx48k
5+
import importlib
66

77

88
__all__ = [
99
'zx48k',
10+
'zxnext'
1011
]
1112

1213
AVAILABLE_ARCHITECTURES = __all__
14+
target = None
15+
16+
17+
def set_target_arch(target_arch: str):
18+
global target
19+
assert target_arch in AVAILABLE_ARCHITECTURES
20+
target = importlib.import_module(f'.{target_arch}', 'arch')
21+
22+
23+
set_target_arch(AVAILABLE_ARCHITECTURES[0])

arch/zxnext/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
# vim:ts=4:et:sw=4:
4+
5+
from . import beep
6+
from .translator import * # noqa
7+
8+
import api.global_
9+
from api.constants import TYPE
10+
11+
12+
__all__ = [
13+
'beep',
14+
]
15+
16+
17+
# -----------------------------------------
18+
# Arch initialization setup
19+
# -----------------------------------------
20+
api.global_.PARAM_ALIGN = 2 # Z80 param align
21+
api.global_.BOUND_TYPE = TYPE.uinteger
22+
api.global_.SIZE_TYPE = TYPE.ubyte
23+
api.global_.PTR_TYPE = TYPE.uinteger
24+
api.global_.STR_INDEX_TYPE = TYPE.uinteger
25+
api.global_.MIN_STRSLICE_IDX = 0 # Min. string slicing position
26+
api.global_.MAX_STRSLICE_IDX = 65534 # Max. string slicing position

0 commit comments

Comments
 (0)