remove all anonymous labels, fix indenting etc
This commit is contained in:
1 parent
201f1a378f
commit
efc83a0611
1 file changed
+59
-49
+59
-49
@@ -62,14 +62,14 @@
|
|||||||
scan_keyboard:
|
scan_keyboard:
|
||||||
;; Call main keyboard scanning routine
|
;; Call main keyboard scanning routine
|
||||||
jsr Main
|
jsr Main
|
||||||
bcc +
|
bcc sk_success
|
||||||
rts
|
rts
|
||||||
*
|
sk_success:
|
||||||
;; Work out what is new and needs to be added
|
;; Work out what is new and needs to be added
|
||||||
;; to the input buffer.
|
;; to the input buffer.
|
||||||
;; Also update the bucky key status flags etc
|
;; Also update the bucky key status flags etc
|
||||||
cmp #$ff
|
cmp #$ff
|
||||||
beq +
|
beq sk_nokey
|
||||||
;; Got a key, turn it from matrix position to key value,
|
;; Got a key, turn it from matrix position to key value,
|
||||||
;; and stuff it in the keyboard buffer
|
;; and stuff it in the keyboard buffer
|
||||||
|
|
||||||
@@ -85,16 +85,16 @@ scan_keyboard:
|
|||||||
tax
|
tax
|
||||||
lda keyboard_matrixes,x
|
lda keyboard_matrixes,x
|
||||||
;; But don't insert $00 characters
|
;; But don't insert $00 characters
|
||||||
beq +
|
beq sk_nokey
|
||||||
|
|
||||||
;; Stash key into keyboard buffer
|
;; Stash key into keyboard buffer
|
||||||
ldx keys_in_key_buffer
|
ldx keys_in_key_buffer
|
||||||
cpx key_buffer_size
|
cpx key_buffer_size
|
||||||
beq +
|
beq sk_nokey
|
||||||
sta keyboard_buffer,x
|
sta keyboard_buffer,x
|
||||||
inc keys_in_key_buffer
|
inc keys_in_key_buffer
|
||||||
|
|
||||||
*
|
sk_nokey:
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@@ -104,14 +104,14 @@ scan_keyboard:
|
|||||||
|
|
||||||
KeyInRow:
|
KeyInRow:
|
||||||
ldy #7
|
ldy #7
|
||||||
*
|
NextKeyInRow:
|
||||||
ror
|
ror
|
||||||
bcs nokey
|
bcs nokey
|
||||||
jsr KeyFound
|
jsr KeyFound
|
||||||
nokey:
|
nokey:
|
||||||
inx
|
inx
|
||||||
dey
|
dey
|
||||||
bpl -
|
bpl NextKeyInRow
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@@ -161,9 +161,6 @@ NoActivityDetected:
|
|||||||
lda #$00
|
lda #$00
|
||||||
sta key_bucky_state
|
sta key_bucky_state
|
||||||
|
|
||||||
stx BufferOld
|
|
||||||
stx BufferOld+1
|
|
||||||
stx BufferOld+2
|
|
||||||
sec
|
sec
|
||||||
lda #$ff
|
lda #$ff
|
||||||
;; Reset key repeat, so that pressing a key that was
|
;; Reset key repeat, so that pressing a key that was
|
||||||
@@ -214,7 +211,8 @@ skip0:
|
|||||||
|
|
||||||
ldx #7
|
ldx #7
|
||||||
lda #%11111110
|
lda #%11111110
|
||||||
* sta $dc00
|
next_row:
|
||||||
|
sta $dc00
|
||||||
pha
|
pha
|
||||||
lda $dc01
|
lda $dc01
|
||||||
sta ScanResult,x
|
sta ScanResult,x
|
||||||
@@ -222,7 +220,7 @@ skip0:
|
|||||||
sec
|
sec
|
||||||
rol
|
rol
|
||||||
dex
|
dex
|
||||||
bpl -
|
bpl next_row
|
||||||
|
|
||||||
;; X gets back to $FF here, which is assumed below
|
;; X gets back to $FF here, which is assumed below
|
||||||
|
|
||||||
@@ -233,15 +231,6 @@ skip0:
|
|||||||
cpx $dc01 ;// Only Control Port activity will be detected
|
cpx $dc01 ;// Only Control Port activity will be detected
|
||||||
bne ControlPort
|
bne ControlPort
|
||||||
|
|
||||||
|
|
||||||
;; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
;; // Initialize Buffer, Flags and Max Keys
|
|
||||||
|
|
||||||
;; // Reset current read buffer
|
|
||||||
stx BufferNew
|
|
||||||
stx BufferNew+1
|
|
||||||
stx BufferNew+2
|
|
||||||
|
|
||||||
;; Make X = $00, assumed below
|
;; Make X = $00, assumed below
|
||||||
inx
|
inx
|
||||||
|
|
||||||
@@ -325,44 +314,44 @@ no_case_toggle:
|
|||||||
|
|
||||||
lda ScanResult+7
|
lda ScanResult+7
|
||||||
cmp #$ff
|
cmp #$ff
|
||||||
beq +
|
beq sk6
|
||||||
jsr KeyInRow
|
jsr KeyInRow
|
||||||
*
|
sk6:
|
||||||
ldx #8
|
ldx #8
|
||||||
lda ScanResult+6
|
lda ScanResult+6
|
||||||
beq +
|
beq sk5
|
||||||
jsr KeyInRow
|
jsr KeyInRow
|
||||||
*
|
sk5:
|
||||||
ldx #16
|
ldx #16
|
||||||
lda ScanResult+5
|
lda ScanResult+5
|
||||||
beq +
|
beq sk4
|
||||||
jsr KeyInRow
|
jsr KeyInRow
|
||||||
*
|
sk4:
|
||||||
ldx #24
|
ldx #24
|
||||||
lda ScanResult+4
|
lda ScanResult+4
|
||||||
beq +
|
beq sk3
|
||||||
jsr KeyInRow
|
jsr KeyInRow
|
||||||
*
|
sk3:
|
||||||
ldx #32
|
ldx #32
|
||||||
lda ScanResult+3
|
lda ScanResult+3
|
||||||
beq +
|
beq sk2
|
||||||
jsr KeyInRow
|
jsr KeyInRow
|
||||||
*
|
sk2:
|
||||||
ldx #40
|
ldx #40
|
||||||
lda ScanResult+2
|
lda ScanResult+2
|
||||||
beq +
|
beq sk1
|
||||||
jsr KeyInRow
|
jsr KeyInRow
|
||||||
*
|
sk1:
|
||||||
ldx #48
|
ldx #48
|
||||||
lda ScanResult+1
|
lda ScanResult+1
|
||||||
beq +
|
beq sk0
|
||||||
jsr KeyInRow
|
jsr KeyInRow
|
||||||
*
|
sk0:
|
||||||
ldx #56
|
ldx #56
|
||||||
lda ScanResult+0
|
lda ScanResult+0
|
||||||
beq +
|
beq skdone
|
||||||
jsr KeyInRow
|
jsr KeyInRow
|
||||||
*
|
skdone:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -371,33 +360,53 @@ no_case_toggle:
|
|||||||
|
|
||||||
;; // Put any new key (not in old scan) into buffer
|
;; // Put any new key (not in old scan) into buffer
|
||||||
ldx #MaxKeyRollover-1
|
ldx #MaxKeyRollover-1
|
||||||
* lda BufferNew,x
|
|
||||||
|
ProcessPressedKeys:
|
||||||
|
|
||||||
|
;; Check if the currently pressed key is continuing to be held down
|
||||||
|
lda BufferNew,x
|
||||||
|
sta $047A,X
|
||||||
cmp #$ff
|
cmp #$ff
|
||||||
beq Exist ;; // Handle 'null' values
|
beq ConsiderNextKey
|
||||||
cmp BufferOld
|
cmp BufferOld
|
||||||
beq KeyHeld
|
beq KeyHeld
|
||||||
cmp BufferOld+1
|
cmp BufferOld+1
|
||||||
beq KeyHeld
|
beq KeyHeld
|
||||||
cmp BufferOld+2
|
cmp BufferOld+2
|
||||||
beq KeyHeld
|
beq KeyHeld
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
sta $0450
|
||||||
|
pha
|
||||||
|
lda BufferOld
|
||||||
|
sta $0452
|
||||||
|
lda BufferOld+1
|
||||||
|
sta $0453
|
||||||
|
lda BufferOld+2
|
||||||
|
sta $0454
|
||||||
|
pla
|
||||||
|
|
||||||
RecordKeypress:
|
RecordKeypress:
|
||||||
|
|
||||||
;; // New Key Detected
|
;; // New Key Detected
|
||||||
ldy BufferQuantity
|
ldy BufferQuantity
|
||||||
cpy #$ff
|
cpy #$ff
|
||||||
beq +
|
beq NothingInBQ
|
||||||
cpy #MaxKeyRollover-1
|
cpy #MaxKeyRollover-1
|
||||||
bcs TooManyNewKeys
|
bcs TooManyNewKeys
|
||||||
*
|
NothingInBQ:
|
||||||
iny
|
iny
|
||||||
sty BufferQuantity
|
sty BufferQuantity
|
||||||
sta Buffer,y
|
sta Buffer,y
|
||||||
|
|
||||||
Exist:
|
ConsiderNextKey:
|
||||||
dex
|
dex
|
||||||
bpl -
|
bpl ProcessPressedKeys
|
||||||
|
|
||||||
;; // Anything in Buffer?
|
;; // Anything in Buffer?
|
||||||
ldy BufferQuantity
|
ldy BufferQuantity
|
||||||
|
|
||||||
bmi BufferEmpty
|
bmi BufferEmpty
|
||||||
;; // Yes: Then return it and tidy up the buffer
|
;; // Yes: Then return it and tidy up the buffer
|
||||||
dec BufferQuantity
|
dec BufferQuantity
|
||||||
@@ -434,14 +443,14 @@ KeyHeld:
|
|||||||
sta key_repeat_counter
|
sta key_repeat_counter
|
||||||
pla
|
pla
|
||||||
BuckyHeld:
|
BuckyHeld:
|
||||||
jmp Exist
|
jmp ConsiderNextKey
|
||||||
|
|
||||||
SameKeyHeld:
|
SameKeyHeld:
|
||||||
dec key_repeat_counter
|
dec key_repeat_counter
|
||||||
bne +
|
bne KeyRepeatWait
|
||||||
;; Count down ended, so repeat key now
|
;; Count down ended, so repeat key now
|
||||||
|
|
||||||
;; Reload key repeat counter
|
|
||||||
;; (Compute's Mapping the 64 p58)
|
;; (Compute's Mapping the 64 p58)
|
||||||
pha
|
pha
|
||||||
lda #6-2 ; Fudge factor to match speed
|
lda #6-2 ; Fudge factor to match speed
|
||||||
@@ -449,8 +458,8 @@ SameKeyHeld:
|
|||||||
pla
|
pla
|
||||||
|
|
||||||
jmp RecordKeypress
|
jmp RecordKeypress
|
||||||
|
KeyRepeatWait:
|
||||||
* jmp Exist
|
jmp ConsiderNextKey
|
||||||
|
|
||||||
BufferEmpty: ;; // No new Alphanumeric keys to handle.
|
BufferEmpty: ;; // No new Alphanumeric keys to handle.
|
||||||
lda #$ff
|
lda #$ff
|
||||||
@@ -458,6 +467,7 @@ BufferEmpty: ;; // No new Alphanumeric keys to handle.
|
|||||||
Return: ;; // A is preset
|
Return: ;; // A is preset
|
||||||
clc
|
clc
|
||||||
;; // Copy BufferNew to BufferOld
|
;; // Copy BufferNew to BufferOld
|
||||||
|
|
||||||
ldx BufferNew
|
ldx BufferNew
|
||||||
stx BufferOld
|
stx BufferOld
|
||||||
ldx BufferNew+1
|
ldx BufferNew+1
|
||||||
|
|||||||
Reference in new issue
Block a user