Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; MADS options
- ; generate headers
- opt h+
- ; zero page variables
- screen_pointer = $80
- current_color = $82
- lines_counter = $83
- lines_counter_add = $84
- bar_counter = $85
- ; OS equates
- RTCLOK = $0012
- SDLSTL = $0230
- GPRIOR = $026f
- COLOR4 = $02c8
- COLBK = $d01a
- WSYNC = $d40a
- VCOUNT = $d40b
- org $2000
- ; init with black color
- lda #0
- sta COLOR4
- ; store screen pointer on zero page
- jsr set_screen_pointer
- ; set display list
- lda <display_list
- sta SDLSTL
- lda >display_list
- sta SDLSTL+1
- ; activate GTIA mode
- lda #$40
- sta GPRIOR
- ; initialize color to 0 (black)
- lda #0
- sta current_color
- ; draw 6 horizontal bars
- lda #6
- sta bar_counter
- ; colors 0 → 14
- @ ldx #14
- @ jsr draw_line
- jsr increase_color_brightness
- jsr increase_screen_pointer
- dex
- bpl @-
- ; colors 14 → 0
- ldx #14
- @ jsr draw_line
- jsr decrease_color_brightness
- jsr increase_screen_pointer
- dex
- bpl @-
- dec bar_counter
- bne @-2
- ; reset screen pointer
- jsr set_screen_pointer
- ; center add bar
- adw screen_pointer #11
- ; start loop which will create center bar
- lda #192
- sta lines_counter
- ; move to center of line
- @ adw screen_pointer #40
- ; and copy 15 bytes
- ldy #0
- ldx #0
- @ lda colors_pixels,x
- sta (screen_pointer),y
- iny
- inx
- cpx #18
- bne @-
- dec lines_counter
- bne @-1
- ; add one more bar in the middle
- lda <screen+((192/2)-20)*40
- sta screen_pointer
- lda >screen+((192/2)-20)*40
- sta screen_pointer + 1
- ; colors 0 → 14
- ldx #14
- @ jsr draw_line
- jsr increase_color_brightness
- jsr increase_screen_pointer
- dex
- bpl @-
- ; colors 14 → 0
- ldx #14
- @ jsr draw_line
- jsr decrease_color_brightness
- jsr increase_screen_pointer
- dex
- bpl @-
- ; dirty method for coloring the screen
- ; without display list interrupts
- loop
- ; wait for start of new frame
- lda RTCLOK+2
- cmp RTCLOK+2
- beq *-2
- ; border should be black
- ; set black color
- lda #0
- sta COLOR4
- ; so wait for 8 lines
- lda #8
- sta lines_counter
- ; set color index
- ldx #7
- ; draw 2 full bars
- ; first
- ldy #15
- jsr draw_bar
- ; move color index
- dex
- ; second full bar
- ldy #15
- jsr draw_bar
- ; move color index
- dex
- ; draw half bar
- ldy #8
- jsr draw_bar
- ; move color index
- dex
- ; draw full bar (in the middle)
- ldy #14
- jsr draw_bar
- ; move color index
- dex
- ; draw half bar
- ldy #7
- jsr draw_bar
- ; move color index
- dex
- ; draw full bar
- ldy #15
- jsr draw_bar
- ; move color index
- dex
- ; draw full bar
- ldy #15
- jsr draw_bar
- ; move color index
- dex
- ; draw full bar
- ldy #17
- jsr draw_bar
- jmp loop
- ; procedures ------------------------
- ; set screen pointer
- set_screen_pointer
- lda <screen
- sta screen_pointer
- lda >screen
- sta screen_pointer + 1
- rts
- ; drawing line - simply put 40 bytes
- draw_line
- ldy #39
- lda current_color
- @ sta (screen_pointer),y
- dey
- bpl @-
- rts
- ; increase color + 1
- increase_color_brightness
- lda current_color
- clc
- adc #17
- sta current_color
- rts
- ; decrease color - 1
- decrease_color_brightness
- lda current_color
- sec
- sbc #17
- sta current_color
- rts
- ; move screen pointer by 40 bytes
- increase_screen_pointer
- lda screen_pointer
- clc
- adc #40
- sta screen_pointer
- bcc @+
- inc screen_pointer+1
- @ rts
- draw_bar ; x = color_table index, y = lines
- sty lines_counter_add
- lda VCOUNT
- cmp lines_counter
- bne *-5
- lda colors_horizontal,x
- sta WSYNC
- sta COLBK
- lda lines_counter
- add lines_counter_add
- sta lines_counter
- rts
- ; display list
- org $3000
- display_list
- .byte $70 ; 8 empty lines
- .byte $4f ; LMS + ANTIC $f
- .word $4010
- :100 .byte $f ; 101 lines
- .byte $4f ; LMS + ANTIC $f
- .word $5000
- :77 .byte $f ; 80 lines
- .byte $41 ; JVB
- .word display_list
- ; horizontal stripes
- colors_pixels
- .byte 0, $01, $23, $45, $67, $89, $ab, $cd, $ef, $fe, $dc, $ba, $98, $76, $54, $32, $10, 0
- ; center bar - table of colors
- colors_horizontal
- .byte $0, $70, $80, $90, $a0, $c0, $10, $30
- ; video RAM
- org $4010
- screen .byte 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement