Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lock CAPS poking memory
#1
Hi all

AFAIK, poking 23617 address with 128 locks the CAPS in BASIC. I'm trying this inside the compiler but only works with a bunch of keys, while using others (like W, Z or X) shows garbage instead of the CAPS.
Is there any other way to force CAPS inside ZX Basic? I already tried all possible values 0 to 255) with no luck.

Thanks and regards
Reply
#2
I thought it was the lower bits that did this?

http://www.users.globalnet.co.uk/~jg27pa...r02_78.htm

0,1,2,4

How are you reading the keypresses, Oblo? Something like multikeys or inkey$ might not work for this. You could always set it by flipping the CODE value with BAND 11011111 after reading in a key. if its between 61 and 122. This turns lower case into upper case. (It subtracts 32)
Reply
#3
I'm reading LastK, and it's for the "redefine keyboard" feature. Here is the code:
Code:
REM subrutina para definir las teclas del juego
sub redefinir()

    print at 16,11; flash 1; "\::"; : pause 0 : pause 0 :    arriba = PEEK 23560
    print at 16,6; "UP _ "; INK 3; chr$(arriba);
    print at 16,25; flash 1; "\::"; : pause 0 : abajo = PEEK 23560
    print at 16,18; "DOWN _ "; INK 3; chr$(abajo);
    print at 17,13; flash 1; "\::"; : pause 0 : izqui = PEEK 23560
    print at 17,6; "LEFT _ "; INK 3; chr$(izqui);
    print at 17,25; flash 1; "\::"; : pause 0 : dere = PEEK 23560
    print at 17,17; "RIGHT _ "; INK 3; chr$(dere);
    
    PRINT AT 18,13; "   ";
    print at 18,13; flash 1; "\::"; : pause 0 : cambio = PEEK 23560
    if cambio = 32 then
        PRINT AT 18,6; "SWAP _ "; INK 3; "SPC";
    else if cambio = 13 then
        PRINT AT 18,6; "SWAP _ "; INK 3; "ENT";
    else
        PRINT AT 18,6; "SWAP _ "; INK 3; chr$(cambio);
    end if
    
    PRINT AT 18,25; "   ";
    print at 18,25; flash 1; "\::"; : pause 0 : subir = PEEK 23560
    if subir = 32 then
        PRINT AT 18,17; "RAISE _ "; INK 3; "SPC";
    else if subir = 13 then
        PRINT AT 18,17; "RAISE _ "; INK 3; "ENT";
    else
        PRINT AT 18,17; "RAISE _ "; INK 3; chr$(subir);
    end if

end sub

I evaluated the 32 substracts option, but it only counts for letter (obviously) so I have to control if the pressed key is a letter or not and right now I'm in the last stage of the game development and... truth is I feel lazy, so I was looking for the shortcut -get CAPS always on :roll:

Cheers


EDIT: tried the values your link says and you were right on BASIC, but it didn't work on ZX Basic. Anyway, there's a thing I don't get. This is what Your Spectrum says:
Quote:Specifies cursor. Values zero, one, two or four specify the L/C mode, E mode, G mode or K mode respectively.

How can value 0 be L and C at the same time? Is not any other value/variable in the ZX Spectrum to check that CAPS is ON? And thanks again, 2018 and still learning things about this computer Big Grin
Reply
#4
oblo Wrote:How can value 0 be L and C at the same time? Is not any other value/variable in the ZX Spectrum to check that CAPS is ON? And thanks again, 2018 and still learning things about this computer Big Grin
If what you need is to get always the Uppercase value of the key pressed, you can use the Upper() function.
Code:
#include <ucase.bas>

POKE 23611, PEEK 23611 bOR 8: REM <== VERY Recommended initialization, to make it work an all Spectrum modes / clones

10 PRINT "Please, press a letter key"
20 LET k$ = UCase(CHR$(PEEK 23560)): PRINT AT 0, 0; k$; " ";
30 IF k$ < "A" OR k$ > "Z" THEN GOTO 20
40 PRINT "You pressed "; k$
Reply
#5
Great, didn't know that, thanks! Big Grin
I usually check the Identifiers webpage, but never found it. Is any other site with more documentation of functions/commands/identifiers/etc...?
Reply
#6
Unfortunately not, but I'm trying to migrate the Wiki (currently broken, btw) to another system.
Anyway, these are no reserved words, but normal functions from a library.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)