Jump to content
IGNORED

New SpartaDOS CL utility: CLICK.COM


fujidude

Recommended Posts

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.

 

post-40960-0-85105900-1443850059_thumb.png

Edited by fujidude
Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

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
  • Like 2
Link to comment
Share on other sites

 

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.

  • Like 1
Link to comment
Share on other sites

 

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
  • Like 2
Link to comment
Share on other sites

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

Click.zip

 

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
  • Like 2
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

@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
Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...