mirror of
https://github.com/cc65/cc65.git
synced 2024-11-19 21:32:19 +00:00
276 lines
4.3 KiB
ArmAsm
276 lines
4.3 KiB
ArmAsm
;
|
|
; File generated by cc65 v 2.9.5
|
|
;
|
|
.fopt compiler,"cc65 v 2.9.5"
|
|
.autoimport on
|
|
.case on
|
|
.debuginfo off
|
|
.importzp sp, sreg, regsave, regbank, tmp1, ptr1, ptr2
|
|
.macpack longbranch
|
|
.import _joy_masks
|
|
.import _joy_read
|
|
.import _clock
|
|
.export _kbhit
|
|
.export _cgetc
|
|
|
|
.segment "DATA"
|
|
|
|
__lastkey:
|
|
.byte $00
|
|
__chardelay:
|
|
.dword $00000000
|
|
_rptkey:
|
|
.byte $00
|
|
|
|
; ---------------------------------------------------------------
|
|
; void _getkey (void)
|
|
; ---------------------------------------------------------------
|
|
|
|
.segment "CODE"
|
|
|
|
.proc __getkey
|
|
|
|
.segment "CODE"
|
|
|
|
jsr decsp2
|
|
ldx #$00
|
|
lda __lastkey
|
|
cmp #$00
|
|
jsr booleq
|
|
jeq L003F
|
|
lda #$00
|
|
jsr _joy_read
|
|
ldy #$01
|
|
sta (sp),y
|
|
ldx #$00
|
|
lda #$00
|
|
ldy #$00
|
|
sta (sp),y
|
|
ldy #$01
|
|
ldx #$00
|
|
lda (sp),y
|
|
jsr pushax
|
|
ldx #$00
|
|
lda _joy_masks+4
|
|
jsr tosandax
|
|
stx tmp1
|
|
ora tmp1
|
|
jeq L0010
|
|
ldx #$00
|
|
lda #$0A
|
|
ldy #$00
|
|
sta (sp),y
|
|
jmp L003A
|
|
L0010: ldy #$01
|
|
ldx #$00
|
|
lda (sp),y
|
|
jsr pushax
|
|
ldx #$00
|
|
lda _joy_masks
|
|
jsr tosandax
|
|
stx tmp1
|
|
ora tmp1
|
|
jeq L0016
|
|
ldx #$00
|
|
lda #$01
|
|
ldy #$00
|
|
sta (sp),y
|
|
jmp L003A
|
|
L0016: ldy #$01
|
|
ldx #$00
|
|
lda (sp),y
|
|
jsr pushax
|
|
ldx #$00
|
|
lda _joy_masks+2
|
|
jsr tosandax
|
|
stx tmp1
|
|
ora tmp1
|
|
jeq L001C
|
|
ldx #$00
|
|
lda #$03
|
|
ldy #$00
|
|
sta (sp),y
|
|
jmp L003A
|
|
L001C: ldy #$01
|
|
ldx #$00
|
|
lda (sp),y
|
|
jsr pushax
|
|
ldx #$00
|
|
lda _joy_masks+3
|
|
jsr tosandax
|
|
stx tmp1
|
|
ora tmp1
|
|
jeq L0022
|
|
ldx #$00
|
|
lda #$04
|
|
ldy #$00
|
|
sta (sp),y
|
|
jmp L003A
|
|
L0022: ldy #$01
|
|
ldx #$00
|
|
lda (sp),y
|
|
jsr pushax
|
|
ldx #$00
|
|
lda _joy_masks+1
|
|
jsr tosandax
|
|
stx tmp1
|
|
ora tmp1
|
|
jeq L0028
|
|
ldx #$00
|
|
lda #$02
|
|
ldy #$00
|
|
sta (sp),y
|
|
jmp L003A
|
|
L0028: ldy #$01
|
|
ldx #$00
|
|
lda (sp),y
|
|
jsr pushax
|
|
ldx #$00
|
|
lda _joy_masks+7
|
|
jsr tosandax
|
|
stx tmp1
|
|
ora tmp1
|
|
jeq L002E
|
|
ldx #$00
|
|
lda #$14
|
|
ldy #$00
|
|
sta (sp),y
|
|
jmp L003A
|
|
L002E: ldy #$01
|
|
ldx #$00
|
|
lda (sp),y
|
|
jsr pushax
|
|
ldx #$00
|
|
lda _joy_masks+5
|
|
jsr tosandax
|
|
stx tmp1
|
|
ora tmp1
|
|
jeq L0034
|
|
ldx #$00
|
|
lda #$15
|
|
ldy #$00
|
|
sta (sp),y
|
|
jmp L003A
|
|
L0034: ldy #$01
|
|
ldx #$00
|
|
lda (sp),y
|
|
jsr pushax
|
|
ldx #$00
|
|
lda _joy_masks+6
|
|
jsr tosandax
|
|
stx tmp1
|
|
ora tmp1
|
|
jeq L003A
|
|
ldx #$00
|
|
lda #$16
|
|
ldy #$00
|
|
sta (sp),y
|
|
L003A: ldy #$00
|
|
ldx #$00
|
|
lda (sp),y
|
|
cmp #$00
|
|
jsr boolne
|
|
jeq L003F
|
|
ldy #$00
|
|
ldx #$00
|
|
lda (sp),y
|
|
jsr pushax
|
|
ldx #$00
|
|
lda _rptkey
|
|
jsr toseqax
|
|
jeq L0043
|
|
lda __chardelay+3
|
|
sta sreg+1
|
|
lda __chardelay+2
|
|
sta sreg
|
|
ldx __chardelay+1
|
|
lda __chardelay
|
|
jsr pusheax
|
|
jsr _clock
|
|
jsr tosugteax
|
|
jeq L0043
|
|
jmp L003F
|
|
L0043: ldy #$00
|
|
ldx #$00
|
|
lda (sp),y
|
|
sta _rptkey
|
|
jsr _clock
|
|
ldy #$06
|
|
jsr inceaxy
|
|
sta __chardelay
|
|
stx __chardelay+1
|
|
ldy sreg
|
|
sty __chardelay+2
|
|
ldy sreg+1
|
|
sty __chardelay+3
|
|
ldy #$00
|
|
ldx #$00
|
|
lda (sp),y
|
|
sta __lastkey
|
|
L003F: jsr incsp2
|
|
rts
|
|
|
|
.endproc
|
|
|
|
; ---------------------------------------------------------------
|
|
; unsigned char __fastcall__ kbhit (void)
|
|
; ---------------------------------------------------------------
|
|
|
|
.segment "CODE"
|
|
|
|
.proc _kbhit
|
|
|
|
.segment "CODE"
|
|
|
|
jsr __getkey
|
|
ldx #$00
|
|
lda __lastkey
|
|
cmp #$00
|
|
jsr booleq
|
|
jeq L004E
|
|
ldx #$00
|
|
lda #$00
|
|
jmp L0052
|
|
jmp L0052
|
|
L004E: ldx #$00
|
|
lda #$01
|
|
jmp L0052
|
|
L0052: rts
|
|
|
|
.endproc
|
|
|
|
; ---------------------------------------------------------------
|
|
; unsigned char __fastcall__ cgetc (void)
|
|
; ---------------------------------------------------------------
|
|
|
|
.segment "CODE"
|
|
|
|
.proc _cgetc
|
|
|
|
.segment "CODE"
|
|
|
|
jsr decsp1
|
|
L0056: ldx #$00
|
|
lda __lastkey
|
|
cmp #$00
|
|
jsr booleq
|
|
jeq L0057
|
|
jsr __getkey
|
|
jmp L0056
|
|
L0057: ldx #$00
|
|
lda __lastkey
|
|
ldy #$00
|
|
sta (sp),y
|
|
ldx #$00
|
|
lda #$00
|
|
sta __lastkey
|
|
ldy #$00
|
|
ldx #$00
|
|
lda (sp),y
|
|
jmp L0055
|
|
L0055: jsr incsp1
|
|
rts
|
|
|
|
.endproc
|
|
|