home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_25_1988_Transactor_Publishing.d64
/
fastpx
< prev
next >
Wrap
Text File
|
2023-02-26
|
4KB
|
134 lines
; FASTPX
;
; FASTPX is a subroutine that is
; designed to light up a dot on the
; hi-res screen in about 75 cycles,
; including six cycles for a jsr to
; get us here.
; It should be called in the
; following manner:
;
; y = (0-199) y axis range
; x = (0-255) x axis range
; a = (0 or 1) if x > 255
;
pntr = $fb ;zero page pointer
;
* = $8000
;
; first, calculate the offset for
; the row
fastpx sta pntr+1 ;store upper byte of x
lda scrlo,y ;get lo byte of offset
sta pntr ;set up lo byte of pointer
clc ;prepare for addition
lda scrhi,y ;get hi byte of offset
adc pntr+1 ;add to hi x
sta pntr+1 ;set up hi byte of offset
;
; now we can calculate what bit we
; will light up at our address..
txa ;move in lo byte of x
and #$07 ;get the bit to light up
tay ;save it in y
;
; here we calculate the address
; of byte to modify, by adding in
; x coordinate and screen base
txa ;get lo byte of x
and #$f8 ;make it a power of 8
adc pntr ;add x to offset
sta pntr ;update offset
;
; now add the hi byte and screen base
lda #$20 ;screen base at $2000
adc pntr+1 ;add to offset
sta pntr+1 ;update offset
;
; we now have the address to modify
; let's light up a bit in that byte!
lda table,y ;pick up the bit position to lite
ldy #$00 ;set y index to 0
ora (pntr),y ;lite up that bit
sta (pntr),y ;and make change permanent
rts ;go home...
;
table .byte $80,$40,$20,$10,$08,$04,$02,$01
;
* = $8100
;
; this data file contains
; offsets to add to a screen base
; address. these offsets will give
; you the address of the leftmost
; byte, in the y position. use the
; y value for an index
;
scrlo .byte $00,$01,$02,$03,$04,$05,$06,$07
.byte $40,$41,$42,$43,$44,$45,$46,$47
.byte $80,$81,$82,$83,$84,$85,$86,$87
.byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7
;
.byte $00,$01,$02,$03,$04,$05,$06,$07
.byte $40,$41,$42,$43,$44,$45,$46,$47
.byte $80,$81,$82,$83,$84,$85,$86,$87
.byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7
;
.byte $00,$01,$02,$03,$04,$05,$06,$07
.byte $40,$41,$42,$43,$44,$45,$46,$47
.byte $80,$81,$82,$83,$84,$85,$86,$87
.byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7
;
.byte $00,$01,$02,$03,$04,$05,$06,$07
.byte $40,$41,$42,$43,$44,$45,$46,$47
.byte $80,$81,$82,$83,$84,$85,$86,$87
.byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7
;
.byte $00,$01,$02,$03,$04,$05,$06,$07
.byte $40,$41,$42,$43,$44,$45,$46,$47
.byte $80,$81,$82,$83,$84,$85,$86,$87
.byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7
;
.byte $00,$01,$02,$03,$04,$05,$06,$07
.byte $40,$41,$42,$43,$44,$45,$46,$47
.byte $80,$81,$82,$83,$84,$85,$86,$87
.byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7
;
.byte $00,$01,$02,$03,$04,$05,$06,$07
.byte $40,$41,$42,$43,$44,$45,$46,$47
;
* = $8200
;
scrhi .byte 0,0,0,0,0,0,0,0
.byte 1,1,1,1,1,1,1,1
.byte 2,2,2,2,2,2,2,2
.byte 3,3,3,3,3,3,3,3
;
.byte 5,5,5,5,5,5,5,5
.byte 6,6,6,6,6,6,6,6
.byte 7,7,7,7,7,7,7,7
.byte 8,8,8,8,8,8,8,8
;
.byte $0a,$0a,$0a,$0a,$0a,$0a,$0a,$0a
.byte $0b,$0b,$0b,$0b,$0b,$0b,$0b,$0b
.byte $0c,$0c,$0c,$0c,$0c,$0c,$0c,$0c
.byte $0d,$0d,$0d,$0d,$0d,$0d,$0d,$0d
;
.byte $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f
.byte $10,$10,$10,$10,$10,$10,$10,$10
.byte $11,$11,$11,$11,$11,$11,$11,$11
.byte $12,$12,$12,$12,$12,$12,$12,$12
;
.byte $14,$14,$14,$14,$14,$14,$14,$14
.byte $15,$15,$15,$15,$15,$15,$15,$15
.byte $16,$16,$16,$16,$16,$16,$16,$16
.byte $17,$17,$17,$17,$17,$17,$17,$17
;
.byte $19,$19,$19,$19,$19,$19,$19,$19
.byte $1a,$1a,$1a,$1a,$1a,$1a,$1a,$1a
.byte $1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b
.byte $1c,$1c,$1c,$1c,$1c,$1c,$1c,$1c
;
.byte $1e,$1e,$1e,$1e,$1e,$1e,$1e,$1e
.byte $1f,$1f,$1f,$1f,$1f,$1f,$1f,$1f