Author Topic: CPCBasic Unchained  (Read 19988 times)

0 Members and 1 Guest are viewing this topic.

Offline mv

  • Supporter
  • CPC464
  • *
  • Posts: 44
  • Country: de
  • CPCBasic, CPCemu, CPC 6128
    • Awards
Re: CPCBasic Unchained
« Reply #50 on: 18:34, 29 October 20 »
I just learned that the transparent background mode  GRAPHICS PEN ,1  also affects DRAW with MASK.
You can see the effect in the linemask example:
https://benchmarko.github.io/CPCBasic/cpcbasic.html?example=test/linemask

Now the searchlight in the Amstrad CPC 6128 Demo also works:
https://github.com/benchmarko/CPCBasicApps#amstrad-cpc-6128-demo
like
0
No reactions

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
    • Awards
Re: CPCBasic Unchained
« Reply #51 on: 23:57, 30 October 20 »
I just learned that the transparent background mode  GRAPHICS PEN ,1  also affects DRAW with MASK.
You can see the effect in the linemask example:
https://benchmarko.github.io/CPCBasic/cpcbasic.html?example=test/linemask

Now the searchlight in the Amstrad CPC 6128 Demo also works:
https://github.com/benchmarko/CPCBasicApps#amstrad-cpc-6128-demo


Its used to set the Graphic Write Mode, though in the firmware it's part of the Screen Pack (SCR ACCESS), with 0 = Normal, 1 = XOR, 2 = AND and 3 = OR. All the Graphical Statements adbide by it though, PLOT, DRAW, etc. On a 464 it's only accessable with PRINT CHR$(23);CHR$(n); with 'n' representing one of those values. I used the OR writing mode a couple of years ago to write Red's Exit, which helped produce that Maze effect. So essentually this is the Graphical equivalent of Transparent Mode CHR$(22); though a little different, XOR can be used to create Multicoloured Images like Transparent Mode, though can be cleared by simply printing over the Image again.
like
0
No reactions
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline mv

  • Supporter
  • CPC464
  • *
  • Posts: 44
  • Country: de
  • CPCBasic, CPCemu, CPC 6128
    • Awards
Re: CPCBasic Unchained
« Reply #52 on: 22:11, 08 November 20 »
I am working on a pretty print feature for BASIC. It seems to work pretty well already.
For testing purpose, the differences are put in the JavaScript window (except for lowercase and uppercase).
Undo and redo is also possible.

It has a fixed style with an extra space inserted between commands and arguments. But not always. If there is a stream, no space is inserted:
Code: [Select]
10 INPUT"key";a$ :'not pretty
20 INPUT "key";a$:'pretty
30 INPUT#2,"key";a$:'pretty
Not sure if this a good approach.

For arithmetic operations, it only keeps the necessary parentheses determined from the operator precedences.
This could be an issue, if parentheses are used to prevent an overflow, e.g.
Code: [Select]
10 ?1E+38*(10/100)
20 ?1E+38*10/100

Maybe the pretty print feature can also be used to minify BASIC later...
like
0
No reactions

Offline genesis8

  • CPC6128
  • ****
  • Posts: 286
  • Country: fr
    • Genesis8 Amstrad Page
    • Awards
Re: CPCBasic Unchained
« Reply #53 on: 23:16, 15 November 20 »
I would like to add CPCBasic Unchained on my web site, and load ascii basic files while calling CPCBasic, is it possible ?
like
0
No reactions
____________
Amstrad news site at Genesis8 Amstrad Page

Offline mv

  • Supporter
  • CPC464
  • *
  • Posts: 44
  • Country: de
  • CPCBasic, CPCemu, CPC 6128
    • Awards
Re: CPCBasic Unchained
« Reply #54 on: 19:00, 19 November 20 »
I would like to add CPCBasic Unchained on my web site, and load ascii basic files while calling CPCBasic, is it possible ?
Good point.
If you are happy with the current CPCBasic UI, you can put it in an IFrame like:
https://benchmarko.github.io/CPCBasic/test/testIFrames.html

To get your own examples, set the parameter databaseDirs as I did in https://github.com/benchmarko/CPCBasic/blob/master/cpcconfig.js:
databaseDirs: "examples,https://benchmarko.github.io/CPCBasicApps/apps,storage"

This parameter can also be used as an URL parameter, e.g.
https://benchmarko.github.io/CPCBasic/cpcbasic.html?databaseDirs=https://<mySite>/myExamples

From this location, a file 0index.js is loaded with the "diectory" of the samples:
https://github.com/benchmarko/CPCBasic/blob/master/examples/0index.js
Code: [Select]
cpcBasic.addIndex("./examples", function () { /*
[
    {
        "key": "1st",
        "title": "First Program (empty)"
    },
...
    {
        "key": "archi/archidr",
        "title": "Little Architect Draw (BASIC)"
    },
    {
        "key": "archi/archi1.bil",
        "title": "Drawing Set 1",
        "meta": "D"
    },
...
]
*/ });

Use meta: "D" to mark a file containing data, not be selectable on the UI.


As files, you can use plain ASCII/BASIC, or BASE64 encoded files with a prefix containing file type ASCII (A), tokenized BASIC (T) or Binary (B) and the format:
CPCBasic;<file type>;<load addess>;<length>;<entry>;base64;<BASE64 encoded data>

- Plain ASCII, BASIC:
https://github.com/benchmarko/CPCBasic/blob/master/examples/blkedit.js
Code: [Select]
cpcBasic.addItem("", function () { /*
10 rem blkedit - Block Editor
...
*/ });

- Tokenized BASIC (T;<load addess>;<length>;<entry>;base64;<BASE64 encoded data>):
https://github.com/benchmarko/CPCBasic/blob/master/examples/math/ninedig2.js
Code: [Select]
cpcBasic.addItem("", function () { /*
CPCBasic;T;368;1126;0;base64,EgBkA...
*/ });

- Binary (B;<load addess>;<length>;<entry>;base64;<BASE64 encoded data>):
https://github.com/benchmarko/CPCBasic/blob/master/examples/archi/archi1.bil.js
Code: [Select]
cpcBasic.addItem("", function () { /*
CPCBasic;B;16384;3728;0;base64,Dl8ANg...
*/ });

If you plan to create your own UI for CPCBasic, please tell me. Maybe we can define an API to make it easier.
And if you prefer, you can also put the whole stuff on your site.
like
0
No reactions

Offline mv

  • Supporter
  • CPC464
  • *
  • Posts: 44
  • Country: de
  • CPCBasic, CPCemu, CPC 6128
    • Awards
Re: CPCBasic Unchained
« Reply #55 on: 01:12, 08 July 21 »
In the meantime I have implemented CpcBasic in TypeScript.
Mainly to learn TypeScript, but also to add some new functionality.
It is now possible to generate and download BASIC programs in tokenized form.
(At the moment, superfluous spaces are ignored.)
If you want to try it:
https://benchmarko.github.io/CPCBasicTS/
like
0
No reactions