Jump to content

Photo

New SpartaDOS CL utility: CLICK.COM

Action! SpartaDOS CLI key click batch

16 replies to this topic

#1 fujidude OFFLINE  

fujidude

    Quadrunner

  • 5,217 posts
  • Location:United States of America

Posted Fri Oct 2, 2015 11:27 PM

Howdy everyone!  Recently I read a post by someone here on AtariAge, in some forum or another, who mentioned how much he dislikes the key click sound on our beloved A8 machines.  I don't remember who or which forum right now but, I got thinking about it, and decided that for the most part, I too really don't care for the artificial key click sound the Atari makes.  There are times I like it, but mostly not.

 

Anyway, I use SpartaDOS X and thought that it would be handy to whip up a batch file which can turn the click on or off.  I did that, and it worked.  The problem is, it isn't callable from another batch file except as the last command.  The reason for this is SpartaDOS X only allows batch chaining, not nesting.  So I decided to just go ahead and make a .COM file which does the same job.  Of course this can be called from anywhere in an AUTOEXEC.BAT or of course manually at the command prompt too.

 

I just finished it and tested it some.  Works good so far.  I will post it tomorrow after I get everything put together into a package that is fit for distribution.

 

click.png


Edited by fujidude, Fri Oct 2, 2015 11:28 PM.


#2 Marius OFFLINE  

Marius

    River Patroller

  • 4,829 posts
  • Location:Netherlands

Posted Sat Oct 3, 2015 12:23 AM

I was under the impression that you could poke values under SDX. Doesn't this work in batch files?

#3 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 14,429 posts
  • Location:United Kingdom

Posted Sat Oct 3, 2015 2:51 AM

I was under the impression that you could poke values under SDX. Doesn't this work in batch files?


Yes it does. You can turn the click on and off with pokes if preferred.

#4 fujidude OFFLINE  

fujidude

    Quadrunner

  • Topic Starter
  • 5,217 posts
  • Location:United States of America

Posted Sat Oct 3, 2015 9:32 AM

I was under the impression that you could poke values under SDX. Doesn't this work in batch files?

 

Let me clarify... I wanted a utility to be able to turn on, or off, key click.  I wanted to be able to use this utility any time, at will.  But I also wanted to use it to turn off key click at boot time, every time.  It's true, I could have just coded in a poke in my AUTOEXEC.BAT to turn off key click, and then created a batch file to process on demand changes once up and running.  In fact, I did create such a batch, but... where's the fun in that?  ;)  The truth is, rather than pay for ESPN, I like to do things like program and learn things.  So I decided I wanted a .COM file.

 

Either will get the job done.  Anyone who wants a .COM file to do it, it will be posted here shortly to download.  Otherwise feel free to use batch.  I'm also hoping there is some educational or inspirational benefit for those interested in the source code.  The more people that take an interest in that kind of thing, the better the odds of getting ever more and better software for our beloved Ataris.


Edited by fujidude, Sat Oct 3, 2015 9:32 AM.


#5 Stephen OFFLINE  

Stephen

    Quadrunner

  • 7,529 posts
  • A8 Gear Head
  • Location:No longer in Crakron, Ohio

Posted Sat Oct 3, 2015 10:02 AM

I was under the impression that you could poke values under SDX. Doesn't this work in batch files?

Yes - this is how I do it.



#6 Stephen OFFLINE  

Stephen

    Quadrunner

  • 7,529 posts
  • A8 Gear Head
  • Location:No longer in Crakron, Ohio

Posted Sat Oct 3, 2015 10:03 AM

Yes it does. You can turn the click on and off with pokes if preferred.

One thing I noticed though - I cannot disable the keyclick in LastWord.



#7 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 14,429 posts
  • Location:United Kingdom

Posted Sat Oct 3, 2015 10:09 AM

Presumably the advantage of using this special tool is that the keyclick setting survives reset?

One thing I noticed though - I cannot disable the keyclick in LastWord.

You can using KEYCLICK OFF in LW.CFG. The program doesn't use the OS keyclick.

Edited by flashjazzcat, Sat Oct 3, 2015 10:11 AM.


#8 Marius OFFLINE  

Marius

    River Patroller

  • 4,829 posts
  • Location:Netherlands

Posted Sat Oct 3, 2015 10:47 AM

 

Let me clarify... I wanted a utility to be able to turn on, or off, key click.  I wanted to be able to use this utility any time, at will.  But I also wanted to use it to turn off key click at boot time, every time.  It's true, I could have just coded in a poke in my AUTOEXEC.BAT to turn off key click, and then created a batch file to process on demand changes once up and running.  In fact, I did create such a batch, but... where's the fun in that?  ;)  The truth is, rather than pay for ESPN, I like to do things like program and learn things.  So I decided I wanted a .COM file.

 

Either will get the job done.  Anyone who wants a .COM file to do it, it will be posted here shortly to download.  Otherwise feel free to use batch.  I'm also hoping there is some educational or inspirational benefit for those interested in the source code.  The more people that take an interest in that kind of thing, the better the odds of getting ever more and better software for our beloved Ataris.

 

That was a pretty long answer on a short thinking-out-loud of me. 

 

I certainly do not hope you felt attacked by my comment.



#9 fujidude OFFLINE  

fujidude

    Quadrunner

  • Topic Starter
  • 5,217 posts
  • Location:United States of America

Posted Sat Oct 3, 2015 10:54 AM

 

That was a pretty long answer on a short thinking-out-loud of me. 

 

I certainly do not hope you felt attacked by my comment.

 

Not at all.  I tend to be on the "comprehensive" side in my communication sometimes. :grin:


Edited by fujidude, Sat Oct 3, 2015 10:54 AM.


#10 fujidude OFFLINE  

fujidude

    Quadrunner

  • Topic Starter
  • 5,217 posts
  • Location:United States of America

Posted Sat Oct 3, 2015 10:57 AM

Okay folks... here it is.  CLICK.COM.  Made for SpartaDOS command line use.  Usage: CLICK ON|OFF

 

Attached File  CLICK10.ATR   90.02KB   97 downloads



#11 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 14,429 posts
  • Location:United Kingdom

Posted Sun Oct 4, 2015 7:11 AM

Apropos to my earlier remark about reset protection, I thought it might be illustrative to show how the same task can be done as a native SDX relocatable COM file which becomes resident when it is first run.
 

;	Example keyboard click toggle for SDX by FJC

S_ADDIZ		SMB 'S_ADDIZ'
INSTALL		SMB 'INSTALL'
U_GONOFF	SMB 'U_GONOFF'
I_GETTD	 	SMB 'I_GETTD'
COMTAB		SMB 'COMTAB'
S_LOOKUP	smb 'S_LOOKUP'
SYMBOL		smb 'SYMBOL'
PRINTF		smb 'PRINTF'
S_ADD		smb 'S_ADD'

NoClick		equ $02DB

;	non-relocatable init section (jettisoned after use)

	blk sparta $600
	
	ldx #$0A
@
	lda ClickSymbol,x	; copy our new symbol to SYMBOL
	sta SYMBOL+$02,x
	dex
	bpl @-
	jsr S_LOOKUP		; has our symbol already been defined?
	bne GotSym		; if so, skip installation

	jsr S_ADD		; if symbol not found, add it

	lda MainP
	ldx MainP+1
	jsr S_ADDIZ		; run 'Main' on reset

	lda #$00		; initially set Quiet flag to false
	sta QuietFlag
	dec INSTALL		; tell SDX to make main section resident
        jmp Procedure		; read command args
GotSym
	lda Symbol+$0B		; we're already installed, so just jump into resident code
	sta Adr
	lda Symbol+$0C
	sta Adr+1
	jmp $FFFF
Adr	= *-2

MainP	.word Main		; pointer to Main address

ClickSymbol
	.byte '@CLICK  ',0	; symbol defines new procedure
	.word Procedure		; symbol value

	
; main (relocatable) section
	
	blk reloc main

Main
	lda QuietFlag		; we come here on system reset: just ensure OS reflects state of internal flag
	jmp SetOSFlag

Procedure			; read args
	jsr U_GONOFF		; 'ON' = Carry set, 'OFF' = Carry clear
	bcs ClickOn
   	jsr printf
   	.byte 'Click is OFF',0
   	lda #$FF
   	bne SetClick
ClickOn
	jsr printf
	.byte 'Click is ON',0
	lda #0
SetClick
	sta QuietFlag
SetOSFlag
	sta NoClick		; update OS flag
	clc			; say OK
	rts
	
QuietFlag .byte 0

	blk update address

	end

Attached File  Click.zip   1.31KB   87 downloads

 

The code is quite brief and does a couple of interesting things. The '@CLICK' symbol serves two purposes: it creates a resident procedure which is directly called from the command line when CLICK ON or CLICK OFF is subsequently typed. The presence of the symbol also signifies that the program has already been run once, is installed, and therefore need not be installed a second time. The state of the keyboard click should be preserved across system reset.

 

Not exhaustively tested, but I thought it may prove useful. It's loosely based on the example code in the MADS assembler download package, and MADS should be used to compile the source.


Edited by flashjazzcat, Sun Oct 4, 2015 7:12 AM.


#12 fujidude OFFLINE  

fujidude

    Quadrunner

  • Topic Starter
  • 5,217 posts
  • Location:United States of America

Posted Sun Oct 4, 2015 10:23 AM

That's an interesting program FJC, though it might be confusing for people since it has the same name as the one I just posted.  Anyway, I tried yours out and it too works good.  I see you took the resident approach.  It doesn't take away too much in free RAM as it's a small negligible amount, but then again it's not a big deal to call an external command like mine, if it's in the path.  Sure, it takes slightly longer to load but that time is so short I consider it negligible.  To me it seems one works as well as the other.  I think where yours has a real advantage is the reset survive.  That's pretty cool!

 

I wish I was more assembly/MADS/WUDSN literate, so I could better understand your code.  I always like learning.  Out of curiosity, did you ever learn the Action! language?


Edited by fujidude, Sun Oct 4, 2015 10:25 AM.


#13 fujidude OFFLINE  

fujidude

    Quadrunner

  • Topic Starter
  • 5,217 posts
  • Location:United States of America

Posted Sun Oct 4, 2015 10:31 AM

I have decided to use FJC's CLICK.COM over my own.  The reset proofing is what decided it for me.



#14 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 14,429 posts
  • Location:United Kingdom

Posted Sun Oct 4, 2015 11:40 AM

Not until today did I understand the mechanism for hooking resident commands into the command processor (@SYMBOL): I learned this from the example code supplied with MADS and I recommend it for study. Feel free to call program whatever you like, since the source is provided: it seemed to me hard to improve on "CLICK" as a descriptive name. You could change the program to alter just about any OS default you like, or a multitude thereof.

I never learned Action!, since my progression was from BASIC to TBXL to CC65 to assembly language.

#15 drac030 OFFLINE  

drac030

    Stargunner

  • 1,836 posts
  • Location:Warszawa, Poland

Posted Sun Oct 4, 2015 11:44 AM

Speaking of hooking resident symbols into the CP: the program which defines one does not have to be a TSR. It may be a normal, non-resident binary. Say FOO.COM defines symbol @FOO. If you just run FOO.COM, it will do what it should and terminate. But if you do LOAD FOO.COM, and then type "FOO" at the command prompt, the binary will not get loaded again, but the system will call the (now resident) symbol @FOO instead.


Edited by drac030, Sun Oct 4, 2015 11:47 AM.


#16 fujidude OFFLINE  

fujidude

    Quadrunner

  • Topic Starter
  • 5,217 posts
  • Location:United States of America

Posted Sun Oct 4, 2015 12:02 PM

@FJC: I agree, the name CLICK seems like the best one to use for such a command.  I recommend people stick with that name regardless of which version they use.

 

@drac030: If FJC (or anyone else) were able to set it up that way, it would remove the one "weakness" of his program as it sits currently.  I say "weakness" because the free RAM it takes up is pretty small.  But anyway, this is an 8-bit system we are talking about, so any extra free RAM one can spare without compromising functionality is usually a welcome thing.  Of course if making it non resident removes the reset proof feature, then I vote for leaving it as is.


Edited by fujidude, Sun Oct 4, 2015 12:27 PM.


#17 drac030 OFFLINE  

drac030

    Stargunner

  • 1,836 posts
  • Location:Warszawa, Poland

Posted Sun Oct 4, 2015 12:23 PM

Something like this, perhaps:

; Example keyboard click toggle for SDX by FJC

U_GONOFF SMB 'U_GONOFF'
PRINTF  smb 'PRINTF'

NoClick = $02DB

        blk reloc main

Main    jsr U_GONOFF            ; 'ON' = Carry set, 'OFF' = Carry clear
        bcs ClickOn

        jsr PRINTF
        .byte 'Click is OFF',0

        lda #$FF
        bne SetClick

ClickOn jsr PRINTF
        .byte 'Click is ON',0

        lda #0
SetClick
        sta NoClick             ; update OS flag
        rts

        blk update new Main '@CLICK'

        end

PS. It obviously removes the reset proof feature, but anyway the resident version also can be made a bit, if not shorter (because it will be physically longer), then certainly occupying less main memory. This can be done by setting up the 'Procedure' part so that it loads to the extended RAM (blk reloc extended). It of course needs adjustments in the init part and the base-RAM resident part.

 

EDIT: like this:

; Example keyboard click toggle for SDX by FJC

S_ADDIZ         SMB 'S_ADDIZ'
INSTALL         SMB 'INSTALL'
U_GONOFF        SMB 'U_GONOFF'
S_LOOKUP        smb 'S_LOOKUP'
SYMBOL          smb 'SYMBOL'
PRINTF          smb 'PRINTF'
S_ADD           smb 'S_ADD'
EXTENDED        smb 'EXTENDED'

jext_on = $07f1
jext_off = $07f4

NoClick = $02DB

; non-relocatable init section (jettisoned after use)

        blk sparta $600

        lda EXTENDED
        sta Procedure+1

        ldx #$0A
@       lda ClickSymbol,x       ; copy our new symbol to SYMBOL
        sta SYMBOL+$02,x
        dex
        bpl @-
        jsr S_LOOKUP            ; has our symbol already been defined?
        bne GotSym              ; if so, skip installation

        jsr S_ADD               ; if symbol not found, add it

        lda MainP
        ldx MainP+1
        jsr S_ADDIZ             ; run 'Main' on reset

        dec INSTALL             ; tell SDX to make main section resident

        jmp Procedure           ; read command args

GotSym  jmp (Symbol+$0B)        ; we are already installed, so just jump into resident code

MainP   .word Main              ; pointer to Main address

ClickSymbol
        .byte '@CLICK  ',0      ; symbol defines new procedure
        .word Procedure         ; symbol value

; main (relocatable) section

        blk reloc main

Main    lda #$00
        sta NoClick             ; update OS flag
        rts

Procedure
        lda #$00
        jsr jext_on
        jsr X_Procedure
        jmp jext_off

; Extended RAM section

        blk reloc extended

X_Procedure                     ; read args
        jsr U_GONOFF            ; 'ON' = Carry set, 'OFF' = Carry clear
        bcs ClickOn
        jsr PRINTF
        .byte 'Click is OFF',0
        lda #$FF
        bne SetClick
ClickOn
        jsr PRINTF
        .byte 'Click is ON',0
        lda #0
SetClick
        sta Main+1              ;= sta QuietFlag
        jmp Main

        end

Edited by drac030, Sun Oct 4, 2015 1:00 PM.






Also tagged with one or more of these keywords: Action!, SpartaDOS, CLI, key click, batch

1 user(s) are browsing this forum

0 members, 1 guests, 0 anonymous users