Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specasm v10 #13

Merged
merged 34 commits into from
Sep 24, 2024
Merged

Specasm v10 #13

merged 34 commits into from
Sep 24, 2024

Conversation

markdryan
Copy link
Owner

Version v10 of Specasm includes the following enhancements and fixes:

  • There's a 128kb version of the Specasm editor that includes all the features from the Next version
  • The drawing code has been rewritten in assembler making the editor feel much more responsive
  • Three new commands are available on the Next and Specrtrum 128 versions of the editor; gc to garbage collect old strings, and t and fl to report the number of t-states and the flags modified by a selected block of code.
  • It's now possible to use Page Up/Page Down/File Start/File End commands in selection mode.
  • The size of the clipboard in the Next version of Specasm has been increased to 16kb
  • A numeric literal can now be passed to the jp instruction, e.g., jp 100.
  • Character literals can now be used in expressions, e.g., ld a, =‘a’+7
  • Fixed a bug which prevented labels of 12 characters from being used in an equ statement
  • Error handling for failed commands is improved. If a ‘l’ command fails, the Specasm editor stays in command mode and allows the command to be edited, rather than returning to editor mode.
  • Relative paths, containing .., can now be used when loading and saving files in the Specasm editor
  • Fixed an incorrect error message that was reported when an expression was used with the cp instruction
  • Fixed a bug in the linker which led to a ‘multiply defined org statement error’ when linking test programs if the project being tested contained an org statement in a .x file.
  • The editor now only accepts statements that are 32 characters or less when formatted. Previous version of Specasm accepted lines that could be longer than 32 characters after formatting and this lead to memory corruption.
  • Fixed a bug which prevented + includes, i.e., includes relative to the /specasm directory from working if they were not present in the main project folder, i.e., the one with the Main label.
  • Fixed a bug which prevented single letter .t files, e.g., s.t.
  • Fixed some nasty memory corruption bugs related to nested expressions, in which recursive functions in the expression parser were causing the stack to overwrite the linker’s data. This was particularly acute one the Next. More space has been made available for the stack and the limit on the number of nested expressions has been reduced to 4.
  • Worked around what appears to be a weird ESXDOS sdcard corruption issue when the linker encountered an error. It seems like creating, closing and removing a 0 length file prevents the sdcard from subsequently being mounted in MacOS. Still need to create stand alone reproducer for this.

The linker reported an error when a 12 character label appeared in an
equ statement, due to an incorrect comparison.  The bug is fixed and
a test has been added.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
Otherwise, statements that allow labels to be used directly without
the expression syntax would be ambiguous, e.g.,

.hl equ 1000
ld a, (hl)

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
A failure encountered during saving no longer messes up the UI.  Load
failure when openning a non-existant file now behaves the same way
as other failures, i.e., the cursor stays on the command prompt.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
In the salink output.  Also, make sure we don't try to display more
than 11 characters for the image and the map name.  The print
routines aren't designed to handle cases where more characters are
written that fit on a row.  Using them in this way will cause
memory corruption.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
Specasm reported an error when users tried to open or save a file
using a relative path, e.g., ../code.x.  This commit fixes that
bug.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
Specasm was confusingly reporting a bad register error instead of a
too many strings error, which is quite confusing.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
There was a bug in the linker which led to a multiply defined org
statement error when linking test programs if the project being
tested contained an org statement in a .x file.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
There's now a 128 version of the Specasm editor.  The 128 version of
Specasm is faster than the 48 version as none of its code or data
(apart from the clipboard) is resides in contended memory.

The Next version of Specasm has also been updated to use 16kb banks
rather than 8kb banks.  This unifies the paging mechanism used by
the 128 and next versions of Specasm, and so simplifies the code,
but also increases the size of the clipboard on the Next version from
8 to 16kb, which should be large enough to store the entire contents
of any file.

Finally, we add a unitest tap file for the 128kb Spectrum and modify
the existing Next unittest program to use 16kb banks, to be
consistent with the editor.

salink still uses 8kb banks on the Next and there's no 128 kb version
yet.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
The code that manages the clipboard is moved into the main section.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
We now have a custom 128 bootstrap helper that contains the
calibration code and some bankswitching code.  The bank switching
code in the bootstrap helper and in specasm_trampolines_128.c
should be Amstrad friendly, using non-contended memory banks
on both Amstrad and Sinclair machines (although this has only
been tested on Sinclair machines and Harlequin based clones).
The location of the keyboard calibration parameter has been
changed to be just above the top of the stack.  The old
address seems to hang Amstrad machines.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
Two new commands, t and fl, can be used to compute the machine cycles and
t states and also the flags modified by selected blocks of code.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
The compiler was complaining about missing brackets.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
On the 128 and Next only.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
The drawing code for the 48 and 128 kb versions of specasm has been
re-written in assembler resulting in an almost 3x performance boost.
The Next drawing code has yet to be rewritten, althought this isn't
so crucial as the Next version runs at 8x the speed of the Spectrum
versions.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
As the editor re-formats entered lines, indenting instructions and
adding spaces after commas, it's possible for the user to enter
an instruction that when formatted is > 32 characters, and so
cannot be displayed by the editor.  This was overflowing memory.
We fix the bug by checking that the length of formatted lines
are <= 32 characters, preventing the user for entering the line
if its formatted length is too long.  We also fix another issue
with the formatting of short comments used in long lines.

saimport is also modified on non ZX platforms to check that the
formatted length of a parsed line is <= 32 characters, returning
an error if it is not.  Unfortunately, the ZX versions of
saimport cannot perform this check as there's not enough
memory free, so for now a warning has been added to the
documentation.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
These additional key strokes can now be used in selection mode which
makes it much quicker to select large blocks of text.  This works
on the 48kb as well as the 128 and Next.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
This was previously disallowed for some reason and there was a whole
pile of code designed to prevent it.  Remove this code, free up some
space in specasm and allow jp $a000.  This was already permitted with
the call instruction so it should work with jp as well.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
Previously, the linker did now allow character literals in
expressions.  This was an oversight rather than something which
was done intentionally, so we fix this now.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
+ includes, i.e., includes relative to the /specasm directory
only worked if they were present in the main project folder.
They did not work from sub folders as the linker was treating
them as relative paths.  This is all fixed now.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
Previously, it was impossible to save a .t file whose filename
contained a single letter, excluding the extension, e.g.,
w.t.  It was also not possible to save a .x file with a single
letter when explicitly specifying the extension, e.g,

> s w.x

Both this issues have now been fixed.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
Mostly by copying the files from the 48kb release.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
Signed-off-by: Mark Ryan <markusdryan@gmail.com>
Make sure we always return to the calling bank once the called
function has returned.  Previously, the bank mapped back in
after the function had returned was hard coded which was very
fragile and resulted in a bug in version v9 of specasm which
could cause memory corruption during linking.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
This saves space in the Next version of salink where there's
not enough stack stack to process deep expressions.  This
change helps but still isn't enough to prevent the stack
overwriting the bss_section with very deep expressions.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
This speeds things up and makes the code slightly smaller.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
We use a parallel stack to try to save space on the stack.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
In the main binary.  We need it for the stack.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
So we can keep an eye on that stack.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
From 9 to 5.  There's just not enough stack space left for 9 levels
of recursion and I don't really want to sacrifice the precious RAM
used for any of the other buffers, e.g., number of labels.  Since
using 9 levels of recursion on earlier versions of Specasm would have
rebooted your Spectrum, this is unlikely to break any programs.

Also, the depth limit now applies to bracketed expressions as well,
e.g.,

((((((1))))))

won't compile any more.  It won't reboot your Spectrum either.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
It seems that closing and deleting an empty file causes some
sort of sd card corruption, which prevents the SD card from
subsequently being mounted on macos without being repaired.
The Next doesn't have this issue.  So on ESXDOS we now ensure
that the binary the linker is creating when an error occurs
has at least one byte written to it before we close and
delete it.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
Code analysis did not work for instructions that contained expressions.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
The format of the error message from TstCheckRegs had changed breaking
some of the unit tests.  Also a lot of the tests didn't disable
interrupts and save and restore iy and the prime registers, which
led to crashes and weird behaviour.  I think I must have originally
just tested this on the Next.  The tests all work on a Spectrum
now.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
The parameter to the function that handles page down in select
mode had a parameter of the wrong type.

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
To specasm v10

Signed-off-by: Mark Ryan <markusdryan@gmail.com>
@markdryan markdryan merged commit adaaeff into main Sep 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant