2002-06-22 21:40:24 +00:00
|
|
|
;
|
2018-07-27 13:07:40 +00:00
|
|
|
; 2002-06-22, Ullrich von Bassewitz
|
|
|
|
; 2018-07-27, Greg King
|
2002-06-22 21:40:24 +00:00
|
|
|
;
|
2018-07-27 13:07:40 +00:00
|
|
|
; Helper function for getpixel/setpixel. Load X/Y from arguments;
|
|
|
|
; and, check if the co-ordinates are valid. Return carry clear if so.
|
2002-06-22 21:40:24 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
.include "tgi-kernel.inc"
|
|
|
|
|
|
|
|
.import popax
|
|
|
|
.importzp ptr1, ptr2
|
|
|
|
|
|
|
|
|
2003-02-11 12:37:46 +00:00
|
|
|
.proc tgi_getset
|
|
|
|
|
2002-10-03 11:18:23 +00:00
|
|
|
jsr tgi_popxy ; Pop X/Y into ptr1/ptr2
|
2002-06-22 21:40:24 +00:00
|
|
|
|
2018-07-27 13:07:40 +00:00
|
|
|
; Are the co-ordinates out of range? First, check if any coord is negative.
|
2002-06-22 21:40:24 +00:00
|
|
|
|
2018-07-27 13:07:40 +00:00
|
|
|
txa ; (.X = ptr2+1 from tgi_popxy)
|
|
|
|
ora ptr1+1
|
|
|
|
sec ; Return carry set if number is negative
|
2002-10-03 11:18:23 +00:00
|
|
|
bmi @L9 ; Bail out if negative
|
2002-06-22 21:40:24 +00:00
|
|
|
|
2018-07-27 13:07:40 +00:00
|
|
|
; Check if X is larger than the maximum x coord. If so, bail out.
|
2002-06-22 21:40:24 +00:00
|
|
|
|
|
|
|
lda ptr1
|
|
|
|
cmp _tgi_xres
|
|
|
|
txa
|
|
|
|
sbc _tgi_xres+1
|
|
|
|
bcs @L9
|
|
|
|
|
|
|
|
; Check if Y is larger than the maximum y coord.
|
|
|
|
|
|
|
|
lda ptr2
|
|
|
|
cmp _tgi_yres
|
|
|
|
lda ptr2+1
|
|
|
|
sbc _tgi_yres+1
|
|
|
|
@L9: rts
|
|
|
|
|
2003-02-11 12:37:46 +00:00
|
|
|
.endproc
|