Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
e8c533a
test: refact test removing PRINT dependency
boriel Nov 17, 2024
f2f5dd0
refact: move memcpytest.bas to runtime test
boriel Nov 17, 2024
5c252b7
refact: remove PRINT depdendency from ON GOTO / ON GOSUB test
boriel Nov 17, 2024
8115454
test: refact tests removing PRINT dependency
boriel Nov 17, 2024
aed4789
Merge pull request #896 from boriel-basic/docs
boriel Nov 17, 2024
d704b44
Merge pull request #895 from boriel-basic/refact/runtime_lib
boriel Nov 17, 2024
ec0087c
fix: Ruff rule RET506 (superfluous-else-raise)
bartsanchez Nov 17, 2024
9b5de07
test: refact move read5.bas to runtime test
boriel Nov 17, 2024
8755c6d
test: refact tests to remove print dependency
boriel Nov 17, 2024
78ce6a3
Merge pull request #897 from bartsanchez/bart/fix-ruff-rule-RET506
boriel Nov 17, 2024
fc4c995
test: move read10 to runtime
boriel Nov 17, 2024
38f778e
fix: fix workflow file
boriel Nov 17, 2024
f51b61a
Merge pull request #898 from boriel-basic/refact/runtime_lib
boriel Nov 17, 2024
dc2e9f1
test: move read13.bas to runtime tests
boriel Nov 18, 2024
a660d83
fix: fixes reading a Ubyte as a Byte
boriel Nov 19, 2024
247e68e
Merge pull request #902 from boriel-basic/fix/read_ubytes_broken
boriel Nov 19, 2024
996bcde
fix: must show error when using READ with no DATA
boriel Nov 19, 2024
ea663ab
Merge pull request #903 from boriel-basic/fix/READ_without_data_shoul…
boriel Nov 19, 2024
2103037
fix: Ruff rule EXE001 (shebang-not-executable)
bartsanchez Nov 18, 2024
298c591
Merge pull request #899 from bartsanchez/bart/fix-ruff-rule-EXE001
boriel Nov 22, 2024
b7f0d36
refact: rename decorator to be more PEP8
boriel Nov 22, 2024
a76a88f
refact: improve typing
boriel Nov 22, 2024
518068b
Merge pull request #905 from boriel-basic/refact/improve_typing
boriel Nov 23, 2024
04405b4
refact: show more human readable help for format options
boriel Nov 23, 2024
43efd57
refact: improve typing
boriel Nov 23, 2024
ab9d43f
refact: use enum constants for u8, i8, u16, i16, etc...
boriel Nov 23, 2024
6dc075d
refact: improve typing and fix signatures
boriel Nov 23, 2024
445d4cc
refact: make actual use of binary functions operations
boriel Nov 23, 2024
9536b5b
Merge pull request #908 from boriel-basic/feat/unify_bool
boriel Nov 23, 2024
5e62646
fix: fixes a bug in sections parsing.
boriel Nov 23, 2024
cb218d7
typing: fix typing
boriel Nov 24, 2024
7ee2f02
Merge pull request #909 from boriel-basic/fix/fix_peephole_opt_recipe…
boriel Nov 24, 2024
db20710
ref: remove shebang from non-executable files
bartsanchez Nov 24, 2024
a43fb17
Merge pull request #910 from bartsanchez/bart/remove-unneeded-shebang
boriel Nov 24, 2024
4d30f37
refact: improve typing and improve parsing in opt parser
boriel Nov 24, 2024
36e9b5b
Merge branch 'main' into fix/fix_peephole_opt_recipe_parser
boriel Nov 24, 2024
a5ac454
Merge pull request #911 from boriel-basic/fix/fix_peephole_opt_recipe…
boriel Nov 24, 2024
298c0e9
feat: remove unneeded Bitbucket config file
bartsanchez Nov 25, 2024
ecd161b
Merge pull request #912 from bartsanchez/bart/remove-unneded-bitbucke…
boriel Nov 25, 2024
3f63a11
feat: show a better error message upon crash
boriel Nov 26, 2024
97dd410
fix: crash on undetected syntax error
boriel Nov 26, 2024
8d22b6f
Merge pull request #913 from boriel-basic/fix/crash_in_opt_evaluator
boriel Nov 26, 2024
9068de3
opt: add peephole recipe for new normalized boolean
boriel Nov 23, 2024
10f0bac
opt: improve norm bool sequence
boriel Nov 23, 2024
ebcc809
opt: this recipe can also be applied for .core.GEF
boriel Nov 23, 2024
5777f14
refact: no longer used. Dead code.
boriel Nov 23, 2024
545250f
opt: this recipe can also be applied for others cmps
boriel Nov 24, 2024
7bef7fa
feat: implement normalized boolan only when necessary
boriel Nov 24, 2024
d58b771
feat: update NE operator to be bool normalized
boriel Nov 25, 2024
a4ab332
feat: make NOT operant to be bool normalized
boriel Nov 25, 2024
7ce2707
feat: make OR operand bool normalized
boriel Nov 25, 2024
2d1dbae
feat: make XOR bool normalized
boriel Nov 25, 2024
8c30906
test: update zxnext tests
boriel Nov 25, 2024
2f57028
feat: make STRING operators bool normalized
boriel Nov 26, 2024
45d5174
test: update tests
boriel Nov 27, 2024
1ad9f1c
Merge pull request #914 from boriel-basic/feat/unify_bool
boriel Nov 27, 2024
115dbfa
ref: remove unneeded Travis config file
bartsanchez Nov 28, 2024
d90a26d
Merge pull request #916 from bartsanchez/bart/remove-unneeded-travis-…
boriel Dec 3, 2024
b035f5e
Fixed typos
polluks Dec 3, 2024
0efe923
Merge pull request #918 from polluks/main
boriel Dec 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
branches:
- main
pull_request:
branches:
- main
branches-ignore:
- docs

Expand Down
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

18 changes: 0 additions & 18 deletions bitbucket-pipelines.yml

This file was deleted.

6 changes: 3 additions & 3 deletions docs/architectures/uzebox.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* RAM Memory: 4kb
* Colours: 256 (same palette as from msx2-screen8, or zxspectrum-ulaplus)
* Video "Memory": 1 byte (!) - The video display is just a 8bit port, used defaultly from the interrupt video-mode kernels.
* Tile Display Memory Area: is (defaultly) inside the 4kb RAM memory, size depending on how is it used from the video-mode kernel choosed. Most of the ready video modes can have 256 different tiles available.
* Pattern Display Memory Area (tiles and sprites): is (defaultly) inside the 64kb Flash memory, size depending on how is it used from the video-mode kernel choosed
* Sprite Attribute Memory Area: is (defaultly) inside the 4kb RAM memory, size depending on how is it used from the video-mode kernel choosed
* Tile Display Memory Area: is (defaultly) inside the 4kb RAM memory, size depending on how is it used from the video-mode kernel chosen. Most of the ready video modes can have 256 different tiles available.
* Pattern Display Memory Area (tiles and sprites): is (defaultly) inside the 64kb Flash memory, size depending on how is it used from the video-mode kernel chosen
* Sprite Attribute Memory Area: is (defaultly) inside the 4kb RAM memory, size depending on how is it used from the video-mode kernel chosen
* Video Modes: 9 (up to now) - Since display modes are from interrupt, anyone is welcome on creating new video-modes when needed (and skilled for helping). Theoretically, from 1 cycle from ATmega644 processor, a display resolution like 1440x240 could be obtained. But since at least 4 cycles are needed to display a pixel, the width resolutions available from video modes are 360 (4 cycles), 288 (5), 240 (6), 180 (8), 144 (10) and 120 (12).

## more information
Expand Down
2 changes: 1 addition & 1 deletion docs/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Returned value type is [UByte](types.md#UByte).
REM ASCII CODE of "A"
PRINT "ASCII CODE of A is "; CODE("A")
LET a$ = ""
PRINT "ASCII CODE of emtpy string is "; CODE(a$)
PRINT "ASCII CODE of empty string is "; CODE(a$)
```

## Remarks
Expand Down
2 changes: 1 addition & 1 deletion docs/if.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ End If
```


Since **IF** is a _sentence_, it can be nested; however, remember that _every_ **IF** _must be closed with_ **END IF** when the line is splitted after **THEN** (mutiline **IF**):
Since **IF** is a _sentence_, it can be nested; however, remember that _every_ **IF** _must be closed with_ **END IF** when the line is split after **THEN** (mutiline **IF**):
```
If a < 5 Then
Print "A is less than five"
Expand Down
4 changes: 2 additions & 2 deletions docs/library/keys/getkey.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ x = GetKey
PRINT "You pressed the "; CHR x; " key"
```
Will print the key pressed. Unlike [INKEY$](../../inkey.md) it returns an Ubyte (ASCII code)
which is more efficent that working with strings.
which is more efficient that working with strings.

### See also

* [GetKeyScanCode](getkeyscancode.md)
* [MultiKeys](multikeys.md)


Back to parent page: [Keys ibrary](../keys.bas.md)
Back to parent page: [Keys library](../keys.bas.md)
2 changes: 1 addition & 1 deletion docs/library/print64.bas.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ BLp64_END_LOOP:
sra a ;
sra a ;
sra a ; Multiply by 8 60155 203 47
add a, 88 ; Add to attrbute base address
add a, 88 ; Add to attribute base address
ld h, a ; Put high byte value for attribute into H.
ld a, d ; get y value again
and 7 ; set within third
Expand Down
2 changes: 1 addition & 1 deletion docs/library/putchars.bas.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Asm
INC DE
INC H
ld a,(DE)
LD (HL),a ; Eigth Row
LD (HL),a ; Eighth Row

INC DE ; Move to next data item.

Expand Down
2 changes: 1 addition & 1 deletion docs/library/puttile.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ It uses 36 bytes of data, starting at the address given.


```
' Routine to place a 16 pixel by 16 pixel "Tile" onto the screen at character position x,y from adddress given.
' Routine to place a 16 pixel by 16 pixel "Tile" onto the screen at character position x,y from address given.
' Data must be in the format of 16 bit rows, followed by attribute data.
' (c) 2010 Britlion, donated to the ZX BASIC project.
' Thanks to Boriel, LCD and Na_than for inspiration behind this.
Expand Down
2 changes: 1 addition & 1 deletion docs/pause.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PAUSE <value>

Just as in Sinclair basic, this command pauses the execution for the given number of frames
(1 frame equals to 1/50th of second in Europe, 1/60th of second in the US: this is usually in
sync with the electricity AC frecuency) or until a key is pressed.
sync with the electricity AC frequency) or until a key is pressed.

Bear in mind the number 0 is actually taken as 65536.
Currently this sentence uses the Sinclair BASIC ROM, so **it needs interruptions enabled**.
Expand Down
4 changes: 2 additions & 2 deletions docs/zxb.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ZXB provides several (and useful) command line options. To see them, just type *
-T, --tzx Sets output format to tzx (default is .bin)
-t, --tap Sets output format to tap (default is .bin)
-B, --BASIC Creates a BASIC loader which loads the rest of the
CODE. Requires -T ot -t
CODE. Requires -T or -t
-a, --autorun Sets the program to be run once loaded
-A, --asm Sets output format to asm
-S ORG, --org ORG Start of machine code. By default 32768
Expand Down Expand Up @@ -184,7 +184,7 @@ and it size is fixed (won't change during program execution).
* **--debug-memory**
<br /> During your program execution, using strings might fail due to lack of memory, but your program won't report it
and will continue executing (except the strings not fitting into the heap will be converted to `NULL` string or `""`).
The same aplies to other dynamic objects. So enabling this flag, will make your program to stop reporting a
The same applies to other dynamic objects. So enabling this flag, will make your program to stop reporting a
ROM _Out of memory_ error. This will add a little overhead to your program execution, but it's useful to detect
_Out of Memory_ errors.

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ target-version = "py310"
select = [
"C4",
"E",
"EXE",
"F",
"I",
"PLR",
Expand All @@ -120,6 +121,7 @@ ignore = [
"E722",
"E731",
"E741",
"EXE002",
"PLR0124",
"PLR0911",
"PLR0912",
Expand All @@ -135,7 +137,6 @@ ignore = [
"RET501",
"RET503",
"RET504",
"RET506",
"RET507",
"RUF005",
"RUF012",
Expand Down
2 changes: 0 additions & 2 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python3

import sys

PYTHON_VERSION = 3, 10 # Minimum python version required
Expand Down
5 changes: 2 additions & 3 deletions src/api/check.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
# vim:ts=4:sw=4:et:

# ----------------------------------------------------------------------
Expand Down Expand Up @@ -407,7 +406,7 @@ def is_temporary_value(node) -> bool:
return node.token not in ("STRING", "VAR") and node.t[0] not in ("_", "#")


def common_type(a, b):
def common_type(a: symbols.TYPE | Type | None, b: symbols.TYPE | Type | None) -> symbols.TYPE | Type | None:
"""Returns a type which is common for both a and b types.
Returns None if no common types allowed.
"""
Expand Down Expand Up @@ -436,7 +435,7 @@ def common_type(a, b):
assert a.is_basic
assert b.is_basic

types = (a, b)
types = a, b

if Type.float_ in types:
return Type.float_
Expand Down
26 changes: 22 additions & 4 deletions src/api/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
# vim:ts=4:et:sw=4:

# ----------------------------------------------------------------------
Expand All @@ -13,7 +12,7 @@
import os
import sys
from collections.abc import Callable
from enum import Enum
from enum import StrEnum

from src.api import errmsg, global_, options, python_version_check
from src.api.options import ANYTYPE, Action
Expand All @@ -25,14 +24,21 @@
# Common setup and configuration for all tools
# ------------------------------------------------------
@enum.unique
class ConfigSections(str, Enum):
class ConfigSections(StrEnum):
ZXBC = "zxbc"
ZXBASM = "zxbasm"
ZXBPP = "zxbpp"


@enum.unique
class OPTION(str, Enum):
class OptimizationStrategy(StrEnum):
Size = "size"
Speed = "speed"
Auto = "auto"


@enum.unique
class OPTION(StrEnum):
OUTPUT_FILENAME = "output_filename"
INPUT_FILENAME = "input_filename"
STDERR_FILENAME = "stderr_filename"
Expand Down Expand Up @@ -77,6 +83,9 @@ class OPTION(str, Enum):
ASM_ZXNEXT = "zxnext"
FORCE_ASM_BRACKET = "force_asm_brackets"

# Optimization Preferences
OPT_STRATEGY = "opt_strategy"


OPTIONS = options.Options()
OPTIONS_NOT_SAVED = {
Expand Down Expand Up @@ -227,6 +236,15 @@ def init() -> None:
# Whether to show WXXX warning codes or not
OPTIONS(Action.ADD, name=OPTION.HIDE_WARNING_CODES, type=bool, default=False, ignore_none=True)

# Optimization preferences
OPTIONS(
Action.ADD,
name=OPTION.OPT_STRATEGY,
type=OptimizationStrategy,
default=OptimizationStrategy.Auto,
ignore_none=True,
)

OPTIONS(
Action.ADD,
name=OPTION.PROJECT_FILENAME,
Expand Down
Loading
Loading