monkey: add title overlay

makes things a bit hard to see
This commit is contained in:
Vince Weaver 2020-09-17 13:34:38 -04:00
parent 489cf18e0e
commit 47559c8cf4
4 changed files with 154 additions and 3 deletions

View File

@ -38,7 +38,7 @@ TITLE: title.o
title.o: title.s \
graphics_intro/title_graphics.inc \
interrupt_handler.s mockingboard.s ym_play.s
interrupt_handler.s mockingboard.s ym_play.s gr_overlay.s
ca65 -o title.o title.s -l title.lst

100
monkey/gr_overlay.s Normal file
View File

@ -0,0 +1,100 @@
;=========================================================
; gr_overlay, 40x40 version
;=========================================================
; overlay with 0x4400, treating 0xa as transparent
gr_overlay_40x40_noload:
lda #40
sta CH ; xsize is in CH ; 3
lda #38
sta CV ; ysize is in CV ; 3
ldy #0
gr_overlay_loop:
ldy CV ; 3
lda gr_offsets,Y ; lookup low-res memory address ; 4
sta OUTL ; store out low byte of addy ; 3
sta INL
lda gr_offsets+1,Y ; look up high byte ; 4
clc
adc DRAW_PAGE ; ; 3
sta OUTH ; and store it out ; 3
lda gr_offsets+1,Y ; look up high byte ; 4
clc
adc #$40 ; force to start at $4400
sta INH
; OUTH:OUTL now points at right place
ldx CH ; load xsize into x ; 3
ldy #0
gr_overlay_put_pixel:
lda (INL),Y ; get sprite colors ; 5
; check if completely transparent
; if so, skip
cmp #$aa ; if all zero, transparent ; 2
beq gr_overlay_done_draw ; don't draw it ; 2nt/3
sta COLOR ; save color for later ; 3
; check if top pixel transparent
and #$f0 ; check if top nibble zero ; 2
cmp #$a0
bne gr_overlay_bottom ; if not skip ahead ; 2nt/3
lda COLOR
and #$0f
sta COLOR
lda #$f0 ; setup mask ; 2
sta MASK ; 3
bmi gr_overlay_mask ; always? ; 3
gr_overlay_bottom:
lda COLOR ; re-load color ; 3
and #$0f ; check if bottom nibble zero ; 2
cmp #$0a
bne overlay_put_sprite_all ; if not, skip ahead ; 2nt/3
;=============
; 7/8
lda COLOR
and #$f0
sta COLOR
lda #$0f ; 2
sta MASK ; setup mask ; 3
;===========
; 5
gr_overlay_mask:
lda (OUTL),Y ; get color at output ; 5
and MASK ; mask off unneeded part ; 3
ora COLOR ; or the color in ; 3
sta (OUTL),Y ; store it back ; 6
jmp gr_overlay_done_draw ; we are done ; 3
overlay_put_sprite_all:
lda COLOR ; load color ; 3
sta (OUTL),Y ; and write it out ; 6
gr_overlay_done_draw:
iny
dex ; decrement x counter ; 2
bne gr_overlay_put_pixel ; if not done, keep looping ; 2nt/3
dec CV ; decemenet total y count ; 5
dec CV
bpl gr_overlay_loop ; loop if not done ; 2nt/3
rts ; return ; 6

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -49,6 +49,18 @@ title_start:
lda #$c ; load to page $c00
jsr decompress_lzsa2_fast
;=====================================
; load text overlay
;=====================================
lda #<monkey_lzsa
sta LZSA_SRC_LO
lda #>monkey_lzsa
sta LZSA_SRC_HI
lda #$44 ; load to page $4800-400=$4400
jsr decompress_lzsa2_fast
setup_music:
; decompress music
@ -203,6 +215,10 @@ monkey_loop:
jsr put_sprite_crop
; copy title overlay
jsr gr_overlay_40x40_noload
; page flip
jsr page_flip
@ -260,14 +276,13 @@ done_with_title:
; level graphics
.include "graphics_intro/title_graphics.inc"
.include "text_print.s"
.include "gr_offsets.s"
.include "gr_fast_clear.s"
.include "gr_copy.s"
.include "gr_putsprite_crop.s"
.include "gr_pageflip.s"
.include "gr_overlay.s"
.include "decompress_fast_v2.s"
.include "ym_play.s"
@ -390,3 +405,39 @@ mountain_top_sprite:
.byte $AA,$2A,$22,$22,$00,$00,$22,$07,$70,$00,$AA
.byte $2A,$22,$00,$22,$00,$22,$02,$22,$07,$70,$0A
credits_text:
; DEEP IN THE CARIBBEAN
; ^ ,
; THE ISLAND OF MELEE
; TITLE CARD APPEARS
; TM&(C) 1990 LUCAS ARTS
; ALL RIGHTS RESERVED
; CREATED AND DESIGNED BY
; RON GILBERT
; WRITTEN AND PROGRAMMED BY
; RON GILBERT, DAVE GROSSMAN
; AND TIM SCHAFER
; BACKGROUND ART BY
; STEVE PURCELL, MARK FERRARI
; AND MIKE EBERT
; ANIMATION BY
; STEVE PURCELL, MIKE EBERT
; AND MARTIN CAMERON AS "BUCKY"
; ORIGINAL MUSIC BY
; MICHAEL LAND
; BARNEY JONES AND ANDY NEWELL
; OF EARWAX PRODUCTIONS...
; ... AND
; PATRICK MUNDY
; TESTERS, PRODUCER, SCUMM