Author Topic: CPCBasic Unchained  (Read 1947 times)

0 Members and 1 Guest are viewing this topic.

Offline SkulleateR

  • CPC6128
  • ****
  • Posts: 151
  • Country: de
  • Liked: 72
  • Likes Given: 46
Re: CPCBasic Unchained
« Reply #25 on: 11:03, 23 January 20 »
Very nice, have to trry this out on my iPad this weekend  :D 8)

Offline SkulleateR

  • CPC6128
  • ****
  • Posts: 151
  • Country: de
  • Liked: 72
  • Likes Given: 46
Re: CPCBasic Unchained
« Reply #26 on: 13:26, 25 January 20 »
Ok, works nicely with Android/Chrome, doesn't work on iOS/Safari on my iPad Mini


The buttons below the emulation windows do not work at all. I´ll try an other browser on iOS later ...


edit : just checked, works fine with Safari on my MacBook, hmmm ....
« Last Edit: 13:27, 25 January 20 by SkulleateR »

Offline mv

  • CPC464
  • **
  • Posts: 25
  • Country: de
  • CPC6128
  • Liked: 66
  • Likes Given: 47
Re: CPCBasic Unchained
« Reply #27 on: 21:34, 28 January 20 »
Ok, works nicely with Android/Chrome, doesn't work on iOS/Safari on my iPad Mini
The buttons below the emulation windows do not work at all. I´ll try an other browser on iOS later ...
edit : just checked, works fine with Safari on my MacBook, hmmm ....
It seems that iOS/Safari added support for pointer events just recently with iOS 13.
There is a fallback to use touch events. I do not have an iOS device so I cannot check.

I have put in some debug output in CPCBasic. Please try the following link and check the console output when pressing a virtual key:
https://benchmarko.github.io/CPCBasic/cpcbasic.html?debug=2&example=test/keyboard&showInput=false&showKeyboard=true&showConsole=true
The output can be lengthy. When pressing e.g. "1", there should be an onVirtualKeyboardKeydown/Keyup event and
fnPressCpcKey: sPressedKey=49Digit1, affected cpc key=64

It would be also interesting to know if another virtual keyboard works on iOS:
https://virtual-keyboard.js.org/


Offline SkulleateR

  • CPC6128
  • ****
  • Posts: 151
  • Country: de
  • Liked: 72
  • Likes Given: 46
Re: CPCBasic Unchained
« Reply #28 on: 21:44, 28 January 20 »
It seems that iOS/Safari added support for pointer events just recently with iOS 13.
There is a fallback to use touch events. I do not have an iOS device so I cannot check.
Sorry, only an old iOS here, iPad Mini second gen I think, no "modern" iOS >:(
Quote
I have put in some debug output in CPCBasic. Please try the following link and check the console output when pressing a virtual key:
https://benchmarko.github.io/CPCBasic/cpcbasic.html?debug=2&example=test/keyboard&showInput=false&showKeyboard=true&showConsole=true
The output can be lengthy. When pressing e.g. "1", there should be an onVirtualKeyboardKeydown/Keyup event and
fnPressCpcKey: sPressedKey=49Digit1, affected cpc key=64
Anyway, THAT works fine ... the only thing that won't work in the original link : the keyboard won't show up when pressing "KEYBOARD", maybe I should have mentioned it before :picard:


Quote
It would be also interesting to know if another virtual keyboard works on iOS:
https://virtual-keyboard.js.org/


Also works....

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.764
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1011
  • Likes Given: 1722
Re: CPCBasic Unchained
« Reply #29 on: 22:54, 04 February 20 »

Now I put in a virtual keyboard. For some reason, an extra line appears on my mobile.


I tried it earlier (see attachment pic), but my screen is so small...


Silly me didn't realise I could purchase a Bluetooth Keyboard, so I'll have a go with that.
* 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

  • CPC464
  • **
  • Posts: 25
  • Country: de
  • CPC6128
  • Liked: 66
  • Likes Given: 47
Re: CPCBasic Unchained
« Reply #30 on: 23:32, 07 February 20 »
Anyway, THAT works fine ... the only thing that won't work in the original link : the keyboard won't show up when pressing "KEYBOARD", maybe I should have mentioned it before
Oh, now I understand. I was confused about "buttons". The virtual keyboard has buttons but "Keyboard" is just a clickable field in HTML. I assume that all green "buttons" do not work with iOS.It seems that iOS has some issues with event bubbling of the "click" event:
https://gravitydept.com/blog/js-click-event-bubbling-on-ios
There are several workarounds that I do not really like.
I put in real buttons and hope that it is ok for iOS.
Thank you for testing.
« Last Edit: 23:44, 07 February 20 by mv »

Offline mv

  • CPC464
  • **
  • Posts: 25
  • Country: de
  • CPC6128
  • Liked: 66
  • Likes Given: 47
Re: CPCBasic Unchained
« Reply #31 on: 17:54, 12 February 20 »
I tried it earlier (see attachment pic), but my screen is so small...

Silly me didn't realise I could purchase a Bluetooth Keyboard, so I'll have a go with that.

The screen on my mobile is also very small. I have checked with a bluetooth keyboard (good idea, did not use it for years). And yes, it is an option, even if it is a small one and has not all the keys.
And there are other options now:
- Select a layout with fewer keys, or
- Move the virtual keyboard over the CPC screen (best by dragging the "Keyboard" button)

The next step would be to let the user select the keys... ;)

And recently I have put in flashing colors. Helps to follow the cursor in the block editor.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.764
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1011
  • Likes Given: 1722
Re: CPCBasic Unchained
« Reply #32 on: 10:56, 13 February 20 »
I went ahead purchasing a Bluetooth Keyboard which had turned my Phone into a small Computer & Monitor, I was able to get a Tablet resting Cushon and put my phone in that with Keyboard on top. Some Bluetooth Keyboards already have that, though were more expensive, just a pity Bluetooth drains the Battery. :o


---


I've been working out how to redefine lots of characters while avoiding using SYMBOL, I knew by default Locomotive BASIC reserves Characters 240 to 255, which from a BASIC 10-Liner Perspective saves me from using SYMBOL AFTER 240 since it's defined by Default, however when I lower the number, HIMEM is lowered and the new Character Definitions becomes HIMEM+1, which means I can use POKE with the Graphic Data as Characters (0 to 255) representing the Graphic. I don't know if this is meaningful for a couple of Graphical Characters, but maybe in a whole set it might save some space?


I tested this in CPC BASIC without reault as well as other Emulators to determine it being valid. The funny thing is HIMEM in CPC BASIC is set at 42619, so normally Locomotive BASIC has 15x8 places reserved for the last 15 characters 42620 onwards. The only other pain in my routine is the Graphical Data being represented in Characters and not really having much say into which Higher Characters I want to get from the Mac, on a PC from memory it's CTRL+0<key number>?


Code: [Select]
100 a=HIMEM+1
110 FOR c=1 TO 2
120   READ a$
130   FOR p=1 TO 8
140     POKE a,ASC(MID$(a$,p,1))
150     a=a+1
160   NEXT p
170 NEXT c
200 DATA"ABCDEFGH","HGFEDCBA"
* 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 SkulleateR

  • CPC6128
  • ****
  • Posts: 151
  • Country: de
  • Liked: 72
  • Likes Given: 46
Re: CPCBasic Unchained
« Reply #33 on: 12:07, 13 February 20 »
I put in real buttons and hope that it is ok for iOS.
Amazing, works really fine on iOS now ....
Quote
Thank you for testing.
Thx for putting it online, nice work so far  8)

Offline mv

  • CPC464
  • **
  • Posts: 25
  • Country: de
  • CPC6128
  • Liked: 66
  • Likes Given: 47
Re: CPCBasic Unchained
« Reply #34 on: Today at 00:30 »
I've been working out how to redefine lots of characters while avoiding using SYMBOL, I knew by default Locomotive BASIC reserves Characters 240 to 255, which from a BASIC 10-Liner Perspective saves me from using SYMBOL AFTER 240 since it's defined by Default, however when I lower the number, HIMEM is lowered and the new Character Definitions becomes HIMEM+1, which means I can use POKE with the Graphic Data as Characters (0 to 255) representing the Graphic. I don't know if this is meaningful for a couple of Graphical Characters, but maybe in a whole set it might save some space?

I tested this in CPC BASIC without reault as well as other Emulators to determine it being valid. The funny thing is HIMEM in CPC BASIC is set at 42619, so normally Locomotive BASIC has 15x8 places reserved for the last 15 characters 42620 onwards. The only other pain in my routine is the Graphical Data being represented in Characters and not really having much say into which Higher Characters I want to get from the Mac, on a PC from memory it's CTRL+0<key number>?


Nice trick to access the character map at HIMEM+1. I also think that it could be useful for BASIC 10-liners so I put it in.
Moving the character map to another place should also work, e.g. with SYMBOL AFTER 256:MEMORY &7FFF:SYMBOL AFTER 0.
It gets more tricky when setting the screen base to &4000 or switching RAM banks. I stopped there, so you will not see the character map on the screen as it is on a real CPC.

CTRL+0<key number>: Do you mean how to type in ASCII codes on a PC? That is ALT+0<key number> on the numpad.

And I did some tests with DATA lines and which lower or higher characters you can put in.
When using chr$(25) to set the SYMBOLs, your example with simple letter data can also be written as:
Code: [Select]
100 read a$,b$:?a$;b$;
110 ?CHR$(240);CHR$(241)
120 DATA "ðABCDEFGH", "ñHGFEDCBA"

Not sure how compatible this is when copying as ASCII between systems. The chr$(25) character does not need to be part of the data, can also be added in line 100.

Unfortunately there are other characters which should not be in DATA lines. A test program with characters 14-127,129-255 in DATA lines:

Code: [Select]
100 MODE 1:a$="":i=14
110 WHILE i<=255
120 READ a$
130 FOR p=1 TO LEN(a$)
140 c$=MID$(a$,p,1):b=ASC(c$):IF b<32 THEN c$=CHR$(1)+c$
150 IF i=&80 THEN i=i+1
152 PRINT c$;HEX$(b,2);
154 IF b<>i THEN PRINT"<>";HEX$(i,2);
155 PRINT" ";
157 i=i+1
160 NEXT p
170 WEND
180 CALL &BB18
190 STOP
195 DATA ""
200 DATA " ",!"#$%&'()*+,","
210 DATA "-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
220 DATA "‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"

Comma and colon must be quoted. And quotes must not be quoted and also not the first character of a data item.

Maybe some sort of uuencoding would be better.