  !src "acme-macros.asm"



  SCREEN_BASE       = $0400

  COLOR_BASE        = $d800

  MUSIC_BASE        = $1000

  CHAR_BASE         = $2000



  COLOR_BLACK       = $00

  COLOR_WHITE       = $01

  COLOR_RED         = $02

  COLOR_CYAN        = $03

  COLOR_PURPLE      = $04

  COLOR_GREEN       = $05

  COLOR_BLUE        = $06

  COLOR_YELLOW      = $07

  COLOR_ORANGE      = $08

  COLOR_BROWN       = $09

  COLOR_PINK        = $0a

  COLOR_DARKGREY    = $0b

  COLOR_GREY        = $0c

  COLOR_LIGHTGREEN  = $0d

  COLOR_LIGHTBLUE   = $0e

  COLOR_LIGHTGREY   = $0f



  +BasicStart 2019



  ;+RunStopRestore 0

  ;+ShiftCommodore 0



  +SetColors COLOR_BLACK

  +FillBlock SCREEN_BASE, 32

  +FillBlock COLOR_BASE, COLOR_WHITE

  +CopyBlock SCREEN_BASE, logo, SCREEN_BASE + 240, logo + 240, 240

  +PrintText SCREEN_BASE + 40 * 12 + 6, copyright, copyright_end

  +PrintText_1x2 SCREEN_BASE + 40 * 20, scrolltext, scrolltext_end



  lda #0

	jsr MUSIC_BASE



  +EnableRasters 0, irq_music



  ;+CheckSpaceKey

  ;+DisableRasters

  ;rts

  jmp *



irq_music

	inc $d019

	jsr MUSIC_BASE + 3

  +SetRaster 48, irq_logo

	jmp $ea31



irq_logo

	inc $d019

  +UpperCase

  lda #$14

  sta $d018

  lda colors

  sta colors_end

  ldx #$00

-

  lda colors + $01, x

  sta colors, x

  sta COLOR_BASE + 40 * 2 + 1, x

  sta COLOR_BASE + 40 * 3 + 1, x

  sta COLOR_BASE + 40 * 4 + 1, x

  sta COLOR_BASE + 40 * 5 + 1, x

  sta COLOR_BASE + 40 * 6 + 1, x

  sta COLOR_BASE + 40 * 7 + 1, x

  sta COLOR_BASE + 40 * 8 + 1, x

  sta COLOR_BASE + 40 * 9 + 1, x

  inx

  cpx #colors_end - colors

  bne -

	ldx #$00

	lda colors

-

	sta COLOR_BASE + 40 * 12 + 6, x

	inx

	cpx #copyright_end - copyright

	bne -

  +SetRaster 144, irq_copyright

	jmp $ea31



irq_copyright

	inc $d019

  +LowerCase

  +SetRaster 192, irq_rasterbar1

	jmp $ea31



irq_rasterbar1

	inc $d019

  ldx #$00

--

  lda rascol1, x

  ldy timing, x

-

  dey

  bne -

  sta $d020

  sta $d021

  inx

  cpx #rascol1_end - rascol1

  bne --

  +SetRaster 208, irq_scroll

	jmp $ea31



irq_scroll

	inc $d019

  +UpperCase

  lda #$18

  sta $d018

  +SetRaster 232, irq_rasterbar2

	jmp $ea31



irq_rasterbar2

	inc $d019

  ldx #$00

--

  lda rascol2, x

  ldy timing, x

-

  dey

  bne -

  sta $d020

  sta $d021

  inx

  cpx #rascol2_end - rascol2

  bne --

  +SetRaster 0, irq_music

	jmp $ea31



logo

  !bin "simtro_petscii/logo.bin"

logo_end



copyright

  !pet "Copyright (C)2019 Simon/CGTr"

copyright_end



scrolltext

  !pet "hello world, this will be a scroll text!"

scrolltext_end



colors

  !byte $01,$07,$0d,$05,$0e,$04,$06,$0d,$05,$0e,$04,$06,$05,$0e,$04,$06,$0e,$04,$04

  !byte $04,$04,$0e,$06,$04,$0e,$05,$06,$04,$0e,$05,$0d,$06,$04,$0e,$05,$0d,$07,$01

colors_end

  !byte $00



rascol1

  !byte $09,$02,$0a,$07,$01,$03,$0e,$06,$00

rascol1_end



rascol2

  !byte $06,$0e,$03,$01,$07,$0a,$02,$09,$00

rascol2_end



timing

  !byte $02,$08,$08,$01,$08,$08,$08,$08,$08

timing_end



*=MUSIC_BASE

	!bin "simtro_petscii/music.prg",,2



*=CHAR_BASE

	!bin "simtro_petscii/charset.prg",,2