home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_25_1988_Transactor_Publishing.d64 / fastpx < prev    next >
Text File  |  2023-02-26  |  4KB  |  134 lines

  1. ;            FASTPX
  2. ;
  3. ;   FASTPX is a subroutine that is
  4. ; designed to light up a dot on the
  5. ; hi-res screen in about 75 cycles,
  6. ; including six cycles for a jsr to
  7. ; get us here.
  8. ;   It should be called in the
  9. ; following manner:
  10. ;
  11. ; y  =  (0-199)  y axis range
  12. ; x  =  (0-255)  x axis range
  13. ; a  =  (0 or 1) if x > 255
  14. ;
  15. pntr = $fb      ;zero page pointer
  16. ;
  17.            * = $8000
  18. ;
  19. ; first, calculate the offset for
  20. ; the row
  21. fastpx sta pntr+1  ;store upper byte of x
  22.        lda scrlo,y ;get lo byte of offset
  23.        sta pntr    ;set up lo byte of pointer
  24.        clc         ;prepare for addition
  25.        lda scrhi,y ;get hi byte of offset
  26.        adc pntr+1  ;add to hi x
  27.        sta pntr+1  ;set up hi byte of offset
  28. ;
  29. ; now we can calculate what bit we
  30. ; will light up at our address..
  31.        txa         ;move in lo byte of x
  32.        and #$07    ;get the bit to light up
  33.        tay         ;save it in y
  34. ;
  35. ; here we calculate the address
  36. ; of byte to modify, by adding in
  37. ; x coordinate and screen base
  38.        txa         ;get lo byte of x
  39.        and #$f8    ;make it a power of 8
  40.        adc pntr    ;add x to offset
  41.        sta pntr    ;update offset
  42. ;
  43. ; now add the hi byte and screen base
  44.        lda #$20     ;screen base at $2000
  45.        adc pntr+1   ;add to offset
  46.        sta pntr+1   ;update offset
  47. ;
  48. ; we now have the address to modify
  49. ; let's light up a bit in that byte!
  50.        lda table,y  ;pick up the bit position to lite
  51.        ldy #$00     ;set y index to 0
  52.        ora (pntr),y ;lite up that bit
  53.        sta (pntr),y ;and make change permanent
  54.        rts          ;go home...
  55. ;
  56. table  .byte $80,$40,$20,$10,$08,$04,$02,$01
  57. ;
  58.        * = $8100
  59. ;
  60. ;    this data file contains
  61. ; offsets to add to a screen base
  62. ; address. these offsets will give
  63. ; you the address of the leftmost
  64. ; byte, in the y position. use the
  65. ; y value for an index
  66. ;
  67. scrlo .byte $00,$01,$02,$03,$04,$05,$06,$07
  68.       .byte $40,$41,$42,$43,$44,$45,$46,$47
  69.       .byte $80,$81,$82,$83,$84,$85,$86,$87
  70.       .byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7
  71. ;
  72.       .byte $00,$01,$02,$03,$04,$05,$06,$07
  73.       .byte $40,$41,$42,$43,$44,$45,$46,$47
  74.       .byte $80,$81,$82,$83,$84,$85,$86,$87
  75.       .byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7
  76. ;
  77.       .byte $00,$01,$02,$03,$04,$05,$06,$07
  78.       .byte $40,$41,$42,$43,$44,$45,$46,$47
  79.       .byte $80,$81,$82,$83,$84,$85,$86,$87
  80.       .byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7
  81. ;
  82.       .byte $00,$01,$02,$03,$04,$05,$06,$07
  83.       .byte $40,$41,$42,$43,$44,$45,$46,$47
  84.       .byte $80,$81,$82,$83,$84,$85,$86,$87
  85.       .byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7
  86. ;
  87.       .byte $00,$01,$02,$03,$04,$05,$06,$07
  88.       .byte $40,$41,$42,$43,$44,$45,$46,$47
  89.       .byte $80,$81,$82,$83,$84,$85,$86,$87
  90.       .byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7
  91. ;
  92.       .byte $00,$01,$02,$03,$04,$05,$06,$07
  93.       .byte $40,$41,$42,$43,$44,$45,$46,$47
  94.       .byte $80,$81,$82,$83,$84,$85,$86,$87
  95.       .byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7
  96. ;
  97.       .byte $00,$01,$02,$03,$04,$05,$06,$07
  98.       .byte $40,$41,$42,$43,$44,$45,$46,$47
  99. ;
  100.       * = $8200
  101. ;
  102. scrhi .byte 0,0,0,0,0,0,0,0
  103.       .byte 1,1,1,1,1,1,1,1
  104.       .byte 2,2,2,2,2,2,2,2
  105.       .byte 3,3,3,3,3,3,3,3
  106. ;
  107.       .byte 5,5,5,5,5,5,5,5
  108.       .byte 6,6,6,6,6,6,6,6
  109.       .byte 7,7,7,7,7,7,7,7
  110.       .byte 8,8,8,8,8,8,8,8
  111. ;
  112.       .byte $0a,$0a,$0a,$0a,$0a,$0a,$0a,$0a
  113.       .byte $0b,$0b,$0b,$0b,$0b,$0b,$0b,$0b
  114.       .byte $0c,$0c,$0c,$0c,$0c,$0c,$0c,$0c
  115.       .byte $0d,$0d,$0d,$0d,$0d,$0d,$0d,$0d
  116. ;
  117.       .byte $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f
  118.       .byte $10,$10,$10,$10,$10,$10,$10,$10
  119.       .byte $11,$11,$11,$11,$11,$11,$11,$11
  120.       .byte $12,$12,$12,$12,$12,$12,$12,$12
  121. ;
  122.       .byte $14,$14,$14,$14,$14,$14,$14,$14
  123.       .byte $15,$15,$15,$15,$15,$15,$15,$15
  124.       .byte $16,$16,$16,$16,$16,$16,$16,$16
  125.       .byte $17,$17,$17,$17,$17,$17,$17,$17
  126. ;
  127.       .byte $19,$19,$19,$19,$19,$19,$19,$19
  128.       .byte $1a,$1a,$1a,$1a,$1a,$1a,$1a,$1a
  129.       .byte $1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b
  130.       .byte $1c,$1c,$1c,$1c,$1c,$1c,$1c,$1c
  131. ;
  132.       .byte $1e,$1e,$1e,$1e,$1e,$1e,$1e,$1e
  133.       .byte $1f,$1f,$1f,$1f,$1f,$1f,$1f,$1f
  134.