mirror of
https://github.com/a2-4am/4cade.git
synced 2025-01-21 00:31:52 +00:00
shave some bytes
This commit is contained in:
parent
29536bd901
commit
5decadcabc
@ -1,86 +1,56 @@
|
|||||||
;license:MIT
|
;license:MIT
|
||||||
;(c) 2019 by qkumba
|
;(c) 2017-2021 by qkumba/4am/John Brooks
|
||||||
|
|
||||||
!cpu 6502
|
!cpu 6502
|
||||||
!to "build/GR.FIZZLE",plain
|
!to "build/GR.FIZZLE",plain
|
||||||
*=$6000
|
*=$6000
|
||||||
|
|
||||||
;init RNG
|
ldx #(end-start+1) ; copy LFSR code to zero page
|
||||||
|
- ldy start-2, x
|
||||||
ldx #1
|
sty $FE, x
|
||||||
stx @rnd1+1
|
|
||||||
dex
|
dex
|
||||||
stx @rnd2+1
|
bne -
|
||||||
|
jmp loop
|
||||||
|
|
||||||
;iterate
|
start
|
||||||
|
!pseudopc 0 {
|
||||||
@loop
|
;X=0
|
||||||
ldy @rnd1+1
|
;Y=0
|
||||||
ldx @rnd2+1
|
loop txa
|
||||||
lsr @rnd2+1
|
loop1 eor #$05 ; LFSR form 0x0500 with period 2047
|
||||||
ror @rnd1+1
|
wait inx
|
||||||
bcc +
|
bpl wait
|
||||||
|
tax
|
||||||
;feedback polynomial forms #$402 for period of 2047
|
loop2 txa
|
||||||
|
and #$03
|
||||||
lda @rnd1+1
|
ora #$04
|
||||||
eor #2
|
sta <dst+2
|
||||||
sta @rnd1+1
|
|
||||||
lda @rnd2+1
|
|
||||||
eor #4
|
|
||||||
sta @rnd2+1
|
|
||||||
|
|
||||||
;little hack to avoid missing offset zero
|
|
||||||
;screen hole at $xxFF is missed instead
|
|
||||||
|
|
||||||
+ tya
|
|
||||||
eor #$ff
|
|
||||||
sta $26
|
|
||||||
sta $3c
|
|
||||||
and #$78
|
|
||||||
cmp #$78
|
|
||||||
beq @rnd2
|
|
||||||
txa
|
|
||||||
and #3
|
|
||||||
|
|
||||||
;target page 1
|
|
||||||
|
|
||||||
ora #4
|
|
||||||
sta $3d
|
|
||||||
eor #$44
|
eor #$44
|
||||||
sta $27
|
sta <src+2
|
||||||
|
lda #%00001111
|
||||||
;set mask according to offset
|
cpx #$04
|
||||||
|
bcc +
|
||||||
lda #$0f
|
lda #%11110000
|
||||||
cpx #4
|
+ sta <mask+1
|
||||||
bcc @src
|
src and $FD00, y ; SMC high byte
|
||||||
lda #$f0
|
eor (dst+1), y
|
||||||
|
mask and #$FD ; SMC
|
||||||
;copy half-pixel from other page to this page
|
eor (dst+1), y
|
||||||
|
dst sta $FD00, y ; SMC high byte
|
||||||
@src sta @mask+1
|
txa
|
||||||
ldy #0
|
lsr
|
||||||
and ($26),y ; isolate source half
|
tax
|
||||||
eor ($3c),y ; merge with whole target
|
tya
|
||||||
@mask and #$d1 ; SMC isolate merged half
|
ror
|
||||||
eor ($3c),y ; unmerge half of target
|
tay
|
||||||
sta ($3c),y ; store both halves
|
bcc loop2
|
||||||
|
bne loop
|
||||||
;wait while checking for keypress
|
bit $C000
|
||||||
|
bmi exit
|
||||||
ldx #$10
|
txa
|
||||||
@wait lda $c000
|
bne loop1
|
||||||
bmi @exit
|
lda (src+1), y
|
||||||
dex
|
sta (dst+1), y
|
||||||
bne @wait
|
exit rts
|
||||||
|
}
|
||||||
;and exit condition
|
end
|
||||||
|
|
||||||
@rnd2 lda #0
|
|
||||||
bne @loop
|
|
||||||
@rnd1 lda #0
|
|
||||||
cmp #1
|
|
||||||
bne @loop
|
|
||||||
|
|
||||||
@exit rts
|
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 10952924
|
!be24 10952893
|
||||||
!le16 448
|
!le16 448
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 10953372
|
!be24 10953341
|
||||||
!le16 303
|
!le16 303
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 10952656
|
!be24 10952625
|
||||||
!le16 67
|
!le16 67
|
||||||
|
@ -5,4 +5,4 @@
|
|||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 10952549
|
!be24 10952549
|
||||||
!le16 107
|
!le16 76
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 10952723
|
!be24 10952692
|
||||||
!le16 201
|
!le16 201
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 10953675
|
!be24 10953644
|
||||||
!le16 2370
|
!le16 2370
|
||||||
|
Loading…
x
Reference in New Issue
Block a user