mirror of
https://github.com/cc65/cc65.git
synced 2025-02-08 11:31:34 +00:00
Merge pull request #130 from greg-king5/caps-lock
Disable the Atmos keyboard's CAPS LOCK for stdio too.
This commit is contained in:
commit
e702832e80
49
libsrc/atmos/capslock.s
Normal file
49
libsrc/atmos/capslock.s
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
;
|
||||||
|
; When Oric computers are in BASIC's command mode, the keyboard is in CAPS lock
|
||||||
|
; mode (because Oric BASIC keywords must be typed in upper-case). This
|
||||||
|
; constructor disables that mode, so that text will be typed as lower-case
|
||||||
|
; (which is the default on other cc65 platforms).
|
||||||
|
; This module is linked by the conio and POSIX input functions.
|
||||||
|
;
|
||||||
|
; 2014-09-04, Greg King
|
||||||
|
;
|
||||||
|
|
||||||
|
.constructor disable_caps
|
||||||
|
.destructor restore_caps
|
||||||
|
|
||||||
|
.include "atmos.inc"
|
||||||
|
|
||||||
|
|
||||||
|
;--------------------------------------------------------------------------
|
||||||
|
; Put this constructor into a segment that can be re-used by programs.
|
||||||
|
;
|
||||||
|
.segment "INIT"
|
||||||
|
|
||||||
|
; Turn the capitals lock off.
|
||||||
|
|
||||||
|
disable_caps:
|
||||||
|
lda CAPSLOCK
|
||||||
|
sta capsave
|
||||||
|
lda #$7F
|
||||||
|
sta CAPSLOCK
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
; Restore the old capitals-lock state.
|
||||||
|
|
||||||
|
restore_caps:
|
||||||
|
lda capsave
|
||||||
|
sta CAPSLOCK
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.bss
|
||||||
|
|
||||||
|
capsave:
|
||||||
|
.res 1
|
@ -1,13 +1,15 @@
|
|||||||
;
|
;
|
||||||
; 2003-04-13, Ullrich von Bassewitz
|
; 2003-04-13, Ullrich von Bassewitz
|
||||||
; 2013-07-26, Greg King
|
; 2014-09-04, Greg King
|
||||||
;
|
;
|
||||||
; char cgetc (void);
|
; char cgetc (void);
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _cgetc
|
.export _cgetc
|
||||||
.constructor initcgetc
|
.constructor initcgetc
|
||||||
|
|
||||||
.import cursor
|
.import cursor
|
||||||
|
.forceimport disable_caps
|
||||||
|
|
||||||
.include "atmos.inc"
|
.include "atmos.inc"
|
||||||
|
|
||||||
@ -22,11 +24,11 @@
|
|||||||
|
|
||||||
; No character, enable cursor and wait
|
; No character, enable cursor and wait
|
||||||
|
|
||||||
lda cursor ; Cursor currently off?
|
lda cursor ; Should cursor be off?
|
||||||
beq @L1 ; Skip if so
|
beq @L1 ; Skip if so
|
||||||
lda STATUS
|
lsr STATUS
|
||||||
ora #%00000001 ; Cursor ON
|
sec ; Cursor ON
|
||||||
sta STATUS
|
rol STATUS
|
||||||
@L1: lda KEYBUF
|
@L1: lda KEYBUF
|
||||||
bpl @L1
|
bpl @L1
|
||||||
|
|
||||||
@ -34,17 +36,17 @@
|
|||||||
|
|
||||||
ldx cursor
|
ldx cursor
|
||||||
beq @L2
|
beq @L2
|
||||||
ldx #$00 ; Zero high byte
|
|
||||||
dec STATUS ; Clear bit zero
|
dec STATUS ; Clear bit zero
|
||||||
|
|
||||||
; We have the character, clear avail flag
|
; We have the character, clear the "available" flag
|
||||||
|
|
||||||
@L2: and #$7F ; Mask out avail flag
|
@L2: and #$7F ; Mask out avail flag
|
||||||
sta KEYBUF
|
sta KEYBUF
|
||||||
|
ldx #>$0000
|
||||||
ldy MODEKEY
|
ldy MODEKEY
|
||||||
cpy #FUNCTKEY
|
cpy #FUNCTKEY
|
||||||
bne @L3
|
bne @L3
|
||||||
ora #$80 ; FUNCT pressed
|
ora #$80 ; FUNCT-key pressed
|
||||||
|
|
||||||
; Done
|
; Done
|
||||||
|
|
||||||
@ -53,16 +55,12 @@
|
|||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Switch the cursor off, disable capslock. Code goes into the INIT segment
|
; Switch the cursor off. Code goes into the INIT segment
|
||||||
; which may be reused after it is run.
|
; which may be reused after it is run.
|
||||||
|
|
||||||
.segment "INIT"
|
.segment "INIT"
|
||||||
|
|
||||||
initcgetc:
|
initcgetc:
|
||||||
lda STATUS
|
lsr STATUS
|
||||||
and #%11111110
|
asl STATUS ; Clear bit zero
|
||||||
sta STATUS
|
|
||||||
lda #$7F
|
|
||||||
sta CAPSLOCK
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
; Startup code for cc65 (Oric version)
|
; Startup code for cc65 (Oric version)
|
||||||
;
|
;
|
||||||
; By Debrune Jérôme <jede@oric.org> and Ullrich von Bassewitz <uz@cc65.org>
|
; By Debrune Jérôme <jede@oric.org> and Ullrich von Bassewitz <uz@cc65.org>
|
||||||
|
; 2014-08-22, Greg King
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _exit
|
.export _exit
|
||||||
@ -39,26 +40,26 @@
|
|||||||
|
|
||||||
.segment "STARTUP"
|
.segment "STARTUP"
|
||||||
|
|
||||||
; Save the zero page area we're about to use
|
; Save the zero-page area that we're about to use.
|
||||||
|
|
||||||
ldx #zpspace-1
|
ldx #zpspace-1
|
||||||
L1: lda sp,x
|
L1: lda sp,x
|
||||||
sta zpsave,x ; Save the zero page locations we need
|
sta zpsave,x
|
||||||
dex
|
dex
|
||||||
bpl L1
|
bpl L1
|
||||||
|
|
||||||
; Clear the BSS data
|
; Clear the BSS data.
|
||||||
|
|
||||||
jsr zerobss
|
jsr zerobss
|
||||||
|
|
||||||
; Unprotect columns 0 and 1
|
; Unprotect screen columns 0 and 1.
|
||||||
|
|
||||||
lda STATUS
|
lda STATUS
|
||||||
sta stsave
|
sta stsave
|
||||||
and #%11011111
|
and #%11011111
|
||||||
sta STATUS
|
sta STATUS
|
||||||
|
|
||||||
; Save system stuff and setup the stack
|
; Save some system stuff; and, set up the stack.
|
||||||
|
|
||||||
tsx
|
tsx
|
||||||
stx spsave ; Save system stk ptr
|
stx spsave ; Save system stk ptr
|
||||||
@ -68,26 +69,26 @@ L1: lda sp,x
|
|||||||
lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||||
sta sp+1 ; Set argument stack ptr
|
sta sp+1 ; Set argument stack ptr
|
||||||
|
|
||||||
; Call module constructors
|
; Call the module constructors.
|
||||||
|
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
; Push arguments and call main()
|
; Push the command-line arguments; and, call main().
|
||||||
|
|
||||||
jsr callmain
|
jsr callmain
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call the module destructors. This is also the exit() entry.
|
||||||
|
|
||||||
_exit: jsr donelib ; Run module destructors
|
_exit: jsr donelib ; Run module destructors
|
||||||
|
|
||||||
; Restore system stuff
|
; Restore the system stuff.
|
||||||
|
|
||||||
ldx spsave
|
ldx spsave
|
||||||
txs
|
txs
|
||||||
lda stsave
|
lda stsave
|
||||||
sta STATUS
|
sta STATUS
|
||||||
|
|
||||||
; Copy back the zero page stuff
|
; Copy back the zero-page stuff.
|
||||||
|
|
||||||
ldx #zpspace-1
|
ldx #zpspace-1
|
||||||
L2: lda zpsave,x
|
L2: lda zpsave,x
|
||||||
@ -95,7 +96,7 @@ L2: lda zpsave,x
|
|||||||
dex
|
dex
|
||||||
bpl L2
|
bpl L2
|
||||||
|
|
||||||
; Back to BASIC
|
; Back to BASIC.
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
;
|
;
|
||||||
; 2013-12-24, Greg King
|
; 2014-08-22, Greg King
|
||||||
;
|
;
|
||||||
; int read (int fd, void* buf, unsigned count);
|
; int read (int fd, void* buf, unsigned count);
|
||||||
;
|
;
|
||||||
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
.import popax
|
.import popax
|
||||||
.importzp ptr1, ptr2, ptr3
|
.importzp ptr1, ptr2, ptr3
|
||||||
|
.forceimport disable_caps
|
||||||
|
|
||||||
.macpack generic
|
.macpack generic
|
||||||
.include "atmos.inc"
|
.include "atmos.inc"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user