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