home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_25_1988_Transactor_Publishing.d64
/
quikpx
< prev
next >
Wrap
Text File
|
2023-02-26
|
3KB
|
97 lines
; QUIKPX
;
; This subroutine is designed to
; light a pixel on a hi-res screen
; in 114 cycles. This includes six
; cycles for a JSR to get us here.
; Values must be sent as follows:
;
; a = low x (0 - 255)
; x = high x (0 if a<255, else 1)
; y = y (0 - 199)
;
pntr = $fb ; low core pointer
;
*=$8000
;
; first, we save stuff to use later
;
quikpx pha ;save low part of x
tya ;move row # into a
pha ;save row
;
; now we use fact that low byte of
; row offset repeats every 32 bytes
;
and #$1f ;get number range of 0-31
tay ;now use as an index
lda lookup,y ;get lo byte of left column of row
sta pntr ;set it up in lowcore
;
; here, we calculate the high byte
; of the row offset from screen base
; by munging on the bits in y
;
pla ;get row
clc ;make it ok to shift bits
and #$f8 ;dont move anything into carry
ror a ;divide by 2
ror a ; ... by 4
ror a ; ... by 8
sta pntr+1 ;upper byte of screen offset for y value
;
and #$fc ;to prevent shifts into the carry
ror a ;divide by 16
ror a ;divide by 32
adc pntr+1 ;add to upper byte
sta pntr+1 ;make it official
;
; now, we save the bit position we
; will light up when after we calculate
; the byte address.
;
pla ;get low byte of x
tay ;hold it temporarily
and #$07 ;these will be the bits to light in byte
pha ;save them
;
; here, add in the value of the x
; coordinate.
;
tya ;get back low byte of x
and #$f8 ;make it a power of 8 (max of 224)
adc pntr ;carry still clear, add it
sta pntr ;make change official
;
; now we add in the base of our
; hi-res screen
;
txa ;get hi byte of x value
adc #$20 ;start of hi-res screen--hi byte
adc pntr+1 ;add to hi byte of offset
sta pntr+1 ;make it official
;
; get back our pixel position, and
; use it to look up value.
;
pla ;get bit to light in byte
tax ;use as index into table of bytes
lda litbit,x ;get value of byte to use
;
; and finally, we are ready to light
; up that pixel!
;
ldy #$00 ;set index = 0
ora (pntr),y ;create a new byte
sta (pntr),y ;store it !
;
rts ;jump home
;
litbit .byte $80,$40,$20,$10,$08,$04,$02,$01
;
lookup .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
.end