1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-28 19:29:53 +00:00

Look for NULL pointer more efficiently.

This commit is contained in:
Greg King 2013-07-05 12:32:19 -04:00
parent a555b5f6a5
commit 078a1df2f6
2 changed files with 18 additions and 16 deletions

View File

@ -1,7 +1,7 @@
;
; Driver for the Inkwell Systems 170-C and 184-C lightpens.
;
; 2013-06-17, Greg King
; 2013-07-01, Greg King
;
.include "zeropage.inc"
@ -148,14 +148,13 @@ INSTALL:
ldx LIBREF+1
sta ptr1 ; Point to mouse_adjuster
stx ptr1+1
ldy #0
ldy #1
lda (ptr1),y
sta Calibrate+1 ; Point to function
iny
bze @L1 ; Don't call pointer if it's NULL
sta Calibrate+2 ; Point to function
dey
lda (ptr1),y
sta Calibrate+2
ora Calibrate+1 ; Don't call pointer if it's NULL
bze @L1
sta Calibrate+1
lda #<XOffset ; Function will set this variable
ldx #>XOffset
jsr Calibrate
@ -164,7 +163,8 @@ INSTALL:
; It needs to be done here because the lightpen interrupt handler doesn't
; set the lightpen position if it hasn't changed.
@L1: jsr CHIDE
@L1: sei
jsr CHIDE
lda #<(SCREEN_HEIGHT / 2)
ldx #>(SCREEN_HEIGHT / 2)
@ -172,6 +172,7 @@ INSTALL:
lda #<(SCREEN_WIDTH / 2)
ldx #>(SCREEN_WIDTH / 2)
jsr MoveX
cli
; Done, return zero.

View File

@ -1,7 +1,7 @@
;
; Driver for the Inkwell Systems 170-C and 184-C lightpens.
;
; 2013-06-17, Greg King
; 2013-07-01, Greg King
;
.include "zeropage.inc"
@ -133,14 +133,13 @@ INSTALL:
ldx LIBREF+1
sta ptr1 ; Point to mouse_adjuster
stx ptr1+1
ldy #0
ldy #1
lda (ptr1),y
sta Calibrate+1 ; Point to function
iny
bze @L1 ; Don't call pointer if it's NULL
sta Calibrate+2 ; Point to function
dey
lda (ptr1),y
sta Calibrate+2
ora Calibrate+1 ; Don't call pointer if it's NULL
bze @L1
sta Calibrate+1
lda #<XOffset ; Function will set this variable
ldx #>XOffset
jsr Calibrate
@ -149,7 +148,8 @@ INSTALL:
; It needs to be done here because the lightpen interrupt handler doesn't
; set the lightpen position if it hasn't changed.
@L1: jsr CHIDE
@L1: sei
jsr CHIDE
lda #<(SCREEN_HEIGHT / 2)
ldx #>(SCREEN_HEIGHT / 2)
@ -157,6 +157,7 @@ INSTALL:
lda #<(SCREEN_WIDTH / 2)
ldx #>(SCREEN_WIDTH / 2)
jsr MoveX
cli
; Done, return zero.