Conversation
- abbreviation - shifted letter is needed - notation of remaining symbols consistent with cbm prg studio
…into basic-tokenizer-editor-abbreviation
…aced between program lines are ignored during tokenization
…andard from an editor I haven't encountered yet
…into basic-tokenizer-editor-abbreviation # Conflicts: # html/index.html
"additional entries found in COMPUTES!'s Gazette" moved to special.js file
… to analyze long lines of code
…into basic-tokenizer-editor-abbreviation # Conflicts: # html/index.html
clean short guide
… to the BASIC Tokenizer textarea to prevent visual distractions and ensure a proper coding experience.
…y notes. Switched // comments to !- within the BASIC template for CBM prg Studio compatibility. Standardized the external configuration file (SPECIAL.js logic/loader) for clarity.
- Replaced unreliable setTimeout with script.onload combined with jQuery readiness to eliminate race conditions. - Centralized editor and table initialization into initializeTokenizerUI() to ensure atomic UI updates. - Corrected loading order of jQuery and external assets in <head> to prevent reference errors. - Refactored renderSpecialTable to use .empty().append() for consistent UI refreshes when switching profiles. - Cleaned up redundant script blocks at the end of <body> to maintain a single source of truth for initialization.
Description: - Data: Reorganized SPECIAL token array to a full 0-255 PETSCII map, following the CBM prg Studio standard. - UI: Replaced the 16-column table with a high-density 8x32 grid for better space optimization. - Color: Integrated the Pepto PAL palette for authentic Commodore 64 color reproduction. - Accessibility: Implemented adaptive contrast logic to toggle white/black text based on background luminance. - Layout: Standardized spacing with 4px HEX-to-symbol gaps, 16px column gutters, and red vertical separators. - Stability: Fixed missing HEX assignments for alternate symbols and ensured strict monospace vertical alignment.
…tability to the C64. Key changes: 1. Added interactivity to renderSpecialTable(): - Special characters are now clickable and automatically inserted into the BASIC editor. - Insertion occurs at the current cursor position (selectionStart/End) instead of at the end of the text. - Added 'special-token' class and 'data-token' attributes for better DOM event handling. 2. Enhanced Editor UX: - Implemented scroll locking (preventScroll) and manual scroll position restoration to eliminate page "jumping" when selecting characters. - Added automatic focus on the editor after a symbol is selected. 3. Fixed a ReferenceError in parseBASIC: - Correctly synchronized the program's end address variables, ensuring stable code transmission to memory. 4. Organized technical documentation: - Refined internal comments within the rendering function (sections 1-4). Goal: To facilitate the input of PETSCII control characters and improve the overall consistency of the editor interface.
Terminate line processing immediately when 0x00 (NULL) is encountered.
Fixes incorrect line pointers in generated .prg files.
…on stub for initializeTokenizerUI.
…into basic-tokenizer-editor-abbreviation # Conflicts: # html/index.html
|
1. The description about falling back to the old built-in token mapping is outdated.
If the tokenizer tables cannot be loaded correctly, there is no fallback to the old mapping. Instead, the editor displays the following message:
I will update the description/comment so that it reflects this behavior. 2. Uppercase / case sensitivity The removal of the automatic The previous tokenizer converted typed/pasted text to lowercase. This made it impossible to distinguish between a character entered normally and the corresponding character entered with Shift. This distinction is important for entering C64/PETSCII characters that depend on Shift. The current implementation preserves the original case of the input and follows the approach used by CBMprgStudio. The existing When the checkbox is disabled, the original case is displayed again — characters entered with Shift remain uppercase and those entered without Shift remain lowercase. So this is an intentional change to the tokenizer input handling. |
* Add an optional `NORMALIZE_TO_LOWERCASE` setting to tokenizer profiles. * BASIC source lines are always trimmed before tokenization, removing leading and trailing whitespace. * When `NORMALIZE_TO_LOWERCASE = true`, the trimmed source is converted to lowercase before tokenization. For example, `10 PrInT "Hello"` is tokenized as `10 print "hello"`. * When `NORMALIZE_TO_LOWERCASE = false`, the original character case is preserved. * The `cbm_prg_studio.js` profile uses `NORMALIZE_TO_LOWERCASE = false` because its tokenizer uses case-sensitive abbreviations and character mappings. * The setting affects only the source copy used for tokenization; the text displayed in the editor is not modified. * Custom tokenizer profiles can set the option to `true` when BASIC keywords should be handled case-insensitively.
|
I decided to bring back This may be useful for someone creating a profile for pasting BASIC code that is already written in uppercase and does not use shifted characters. Personally, I currently handle such code by converting it to lowercase in Notepad++. With this option, the tokenizer can now handle that conversion itself. The The commit description and the comments in the code document how this option works and when it should be used. |
BASIC commands can now be entered using uppercase, lowercase, or supported abbreviations. For example: `GOTO`, `goto`, `gO`, `goT`. Non-keyword characters outside quoted strings are normalized to lowercase, including text following `REM` and `DATA`. Compatibility with the previous tokenizer version from master is preserved when full normalization is enabled by setting NORMALIZE_TO_LOWERCASE = true in the profile file. Tests were performed using BASIC programs from the Commodore 64 Games Book 1 collection: https://github.com/TypeInBooks/books/tree/master/commodore/c64/gamesbook1
|
The examples from the Commodore 64 Games Book 1 collection are particularly useful for testing this change because the programs were transcribed for use with CBMprgStudio. The same applies to the other .bas programs in the repository, which provide additional real-world BASIC source prepared for use with CBMprgStudio. https://github.com/TypeInBooks/books/tree/master/commodore/c64/gamesbook1 |
|
@radius75 Sounds great. Thanks for also making sure all tests pass on CI. |
@chrisgleissner I see that the test expects
but gets Can this be improved? Because the tokenizer works as is. -- |
|
Hi @radius75 , I was referring to this broken build: https://github.com/GideonZ/1541ultimate/actions/runs/34208712219/job/102004311447#step:5:12 On a related note, in future, we will run both unit and e2e tests automatically on CI as part of each PR build. For the time being, it is the responsibility of anyone who raises a PR to run the unit tests ( This ensures that merging in PRs does not regress functionality. Btw, thanks a lot for having spotted the Firefox regression last week. Thanks to you I created a Selenium-based E2E test for the index page. The change went live with the 3.15 release yesterday. Best wishes |
|
Hi Christian, I don't have a local firmware build environment on Windows 7. Instead, I install the latest generated master build and manually replace index.html, special.js, and cbm_prg_studio.js on the device. This allows me to test the tokenizer functionality on real hardware, but I understand it doesn't replace the full local build and test workflow. |
Colon ($3A) now terminates DATA mode, allowing subsequent statements to be tokenized. DATA ($83) and REM ($8F) bytes inside quoted strings no longer trigger tokenizer mode changes.
BASIC line numbers above 65535 are now rejected instead of being silently truncated to 16 bits. This matches CBMprgStudio behavior and prevents invalid line numbers such as 65536 or 70000 from being stored as different line numbers in the generated BASIC program.
|
Tests the BASIC line number limit introduced in the latest commit. Line numbers up to 65535 are accepted, while 65536 and 70000 are rejected to prevent 16-bit truncation and match CBMprgStudio behavior. |
Limit the total number of special character repetitions
in a BASIC line to prevent excessive memory usage during expansion.
Repetition counts are validated before generating
the expanded string. If the combined count exceeds the safety limit,
tokenization is stopped and the program is not sent.
This applies to both supported repetition
formats: {space*3} and {3 space}.
|
Regarding the latest commit limiting the number of special character repetitions, I tested the following program: Each line tests a different case: 10 — a single CBMprgStudio-style repetition at the safety limit (999). This verifies both supported repetition syntaxes as well as the cumulative repetition-count check. The safety limit prevents the browser from attempting to expand extremely large repetition counts, which could consume excessive memory and cause the page or browser tab to become unresponsive. -- |
|
I've done quite a lot of compatibility testing of the Ultimate tokenizer, As an additional source of real-world test programs, I've been using the https://archive.org/details/commodore-64-games-book_202304/mode/1up https://archive.org/details/commodore-64-games-book-2_202409/mode/2up Transcribed versions of these and many other C64 book listings can also https://github.com/TypeInBooks/books/tree/master/commodore/c64 One thing worth noting is that the descriptions/instructions for some One more question regarding the PR: should I now keep this branch updated |
|
Hi @radius75 , excellent work! About the target branch:
This is as per the Github Flow model aka trunk based development: Only a single The above has been discussed with @GideonZ (except for the Thanks |



The changes introduced here are an evolution and continuation of my comments in #450. Detailed technical descriptions of specific modifications are also included in the commit messages.
Description
This PR significantly improves the user experience (UX) and accessibility of the Ultimate64/II BASIC tokenizer. These changes make utilizing the full PETSCII range intuitive through a modern visual interface, a flexible tagging system, and a modular configuration architecture.

Key Enhancements:
index.html.{delete}) into the editor.{white},{sh a}) or by selecting from the provided table.{}syntax.Legacy Support: The original internal mapping inindex.htmlremains untouched, allowing maintainers to decide on its future development..jsmapping to load.Leaving it empty reverts the tokenizer to the legacy internal mapping..jsfiles now allow users to define the default text (instructions or example BASIC code) that appears in the editor window upon startup..
Note on AI-assisted development & Future Refinements
How to test
{delete}or{white}directly into the editor and verify correct tokenization.SPECIAL.js, then refresh the page (F5 and Ctrl+F5). Verify that the new table content, tooltips, and editor startup text load correctly.Sample test code in CBMprgStudio format:
Closes #450