
 opt h+ l- g-
 org $8000

tbss equ $ee00
tbsm equ $ef00

xoff equ $ef


zerohi equ $00 *
zerolo equ $86

x2 equ $ed

screen equ $e000
screen2 equ $d800

gr9clear1 equ $db00
gr9clear2 equ $bb00

dl1 equ $f000
dl2 equ $f400

font_l1
      ins 'logo.fnt'

font_l2 equ font_l1+$400




start sei
 ldy #0
 sty $d40e
 sty $d400

 lda #$fe 		; basic-off , rom-off
 sta $d301

 jsr init

 ldy #0
p_www1 equ *

 ldx #0
vvv lda <kolo+80*49
 sta tbsm,y
 sta 203

 lda >kolo+80*49
 sta tbss,y
 iny
 inx
 cpx #50
 bcc vvv
 ldx #0

p_lptt1 sta 204
 sta tbss,y
 lda 203
 sta tbsm,y
 sec
 sbc #80
 sta 203
 lda 204
 sbc #0
 iny

 beq p_www2
 inx
 cpx #49 ;50
 bcc p_lptt1
 bcs p_www1

p_www2 equ *

 ldx #0
 stx x2
oor txa
 asl @
 asl @
 and #$f0
 sta zerohi,x
 lsr @
 lsr @
 lsr @
 lsr @
 sta zerolo,x
 lda zp_code,x
 sta $0046,x

 inx
 cpx #$40
 bcc oor

 lda #64
 sta $d01b

 ldx <screen
 ldy >screen

 jsr plasma

cont
waitvbl bit $d40b
 bpl waitvbl
 lda <dl1
 sta $d402
 lda >dl1
 sta $d403
 lda #34
 sta $d400


 lda x2
 beq end_o

 ldx <screen2
 ldy >screen2

 jsr plasma

waitvbl1 bit $d40b
 bpl waitvbl1
 lda <dl2
 sta $d402
 lda >dl2
 sta $d403

 lda x2
 beq end_o

 ldx <screen
 ldy >screen

 jsr plasma
 jmp cont

end_o lda <dl
 sta $d402
 lda >dl
 sta $d403

 lda #$e
 sta $d016

 lda #$4
 sta $d017

 lda #$a
 sta $d018

 lda #0
 sta $d01b

tu lda $d40b
 bne tu

 lda >font_l1
 sta $d409
 ldx >font_l2

 lda #14*4+4
tu1 cmp $d40b
 bne tu1
 stx $d409

; lda wait
; bne tu

 jmp tu


plasma stx $6a-3
 sty $6b-3

 lda x2
 tay
 clc
 adc #2
 sta x2
 lda xsine,y

 sta move5+1
 beq secsta

 lda #80 79
 sec
 sbc move5+1

secsta sta move6+1

p_y equ 52

 lda ysine,y
 clc
 adc #50
 sta move3+1

 lda #100 ; 99 100 ; 49
 sec
 sbc move3+1
 sta move4+1

 ldx #47
 stx xoff

lpkolo1 ldx XOFF

 lda tbsm+p_y,x
move5 adc #0
 sta rop0+1
 sta crop0+1
 lda tbss+p_y,x
 adc #0
 sta rop0+2
 sta crop0+2


 lda tbsm+p_y,x
move6 adc #0
 sta rop1+1
 sta crop1+1
 lda tbss+p_y,x
 adc #0
 sta rop1+2
 sta crop1+2

 txa
move3 ADC #5
 TAY
 lda tbsm+2,y

 sta rop2+1
 sta crop2+1
 lda tbss+2,y

 sta rop2+2
 sta crop2+2

 txa
move4 ADC #5
 TAY
 lda tbsm+2,y

 sta rop3+1
 sta crop3+1
 lda tbss+2,y

 sta rop3+2
 sta crop3+2

 ldy #79
 clc
 jsr rop0
 dec xoff
 bpl lpkolo1
 rts

; tworzenie dl

init lda >screen
 sta 206
 ldx <screen
 stx 205

 ldx <dl1
 stx 203
 lda >dl1
 sta 204
 jsr dlgener
 lda <dl2
 sta 203
 lda >dl2
 sta 204
 
 lda >screen2
 sta 206
 ldx <screen2
 stx 205

dlgener ldx #48

 lda 203
 sta $ee
 lda 204
 sta $ef

 ldy #0
 lda #$70
 sta (203),y
 iny
 sta (203),y
 iny
 sta (203),y

lp1 ldy #0+3
 lda #64+15
 sta (203),y
 ldy #3+3
 sta (203),y
 ldy #6+3
 sta (203),y

 lda #15
 ldy #9+3
 sta (203),y

 lda 206
 ldy #2+3
 sta (203),y
 ldy #5+3
 sta (203),y
 ldy #8+3
 sta (203),y

 lda 205
 ldy #1+3
 sta (203),y
 ldy #4+3
 sta (203),y
 ldy #7+3
 sta (203),y

 clc
 adc #40
 sta 205
 bcc k
 inc 206
 clc
k lda 203
 adc #10 * 12
 sta 203
 bcc j
 inc 204
j dex
 bne lp1
 ldy #3
 lda #65
 sta (203),y
 iny
 lda $ee
 sta (203),y
 iny
 lda $ef
 sta (203),y
 rts

xsine ins 'gas_x.dat'
ysine ins 'gas_y.dat'
; org $0046

zp_code

rop00
 lda kolo,y
 adc kolo,y
 adc kolo,y
 adc kolo,y
 sta $68-3
 dey

 lda kolo,y
 adc kolo,y
 adc kolo,y
 adc kolo,y
 tax
 lda zerolo,x
 ora $ff
 sta $8000
 inc $6a-3
 bne op5
 inc $6b-3
op5 dey
 bpl rop00
 rts

dl
:9 dta b($70)
 dta b(64+4),a(ekran)
:9 dta b(4)
 dta b(65),a(dl)
 
ekran ins 'logo.map'

 org $0f00
kolo
; ins 'picture1.dat'
 ins 'zelax.log'



rop0 equ $10+$36
rop1 equ $13+$36
rop2 equ $16+$36
rop3 equ $19+$36

crop0 equ $22+$36-3
crop1 equ $25+$36-3
crop2 equ $28+$36-3
crop3 equ $2b+$36-3





 run start
