Files
Young-lumberjack/art/DM_logo_src/digital_melody_logo.asm
T
Pecusx f82645ba91 Second joystick button added to controls.
Not just the second joystick button. Also the button on the second joystick.

It works :)
2026-03-12 20:44:24 +01:00

295 lines
3.5 KiB
NASM

/***************************************/
/* Use MADS http://mads.atari8.info/ */
/* Mode: DLI (char mode) */
/***************************************/
icl "digital_melody_logo.h"
org $f0
fcnt .ds 2
fadr .ds 2
fhlp .ds 2
cloc .ds 2
regA .ds 1
regX .ds 1
regY .ds 1
WIDTH = 40
HEIGHT = 30
; --- BASIC switch OFF
org $2000\ mva #$ff portb\ rts\ ini $2000
; --- MAIN PROGRAM
org $2000
ant dta $42,a(scr)
dta $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02
dta $02,$02,$02,$02,$02,$02,$02,$02,$82,$04,$02,$02,$22
dta $41,a(ant)
scr ins "digital_melody_logo.scr"
.ds 0*40
.ALIGN $0400
fnt ins "digital_melody_logo.fnt"
ift USESPRITES
.ALIGN $0800
pmg .ds $0300
ift FADECHR = 0
SPRITES
els
.ds $500
eif
eif
main
; --- init PMG
ift USESPRITES
mva >pmg pmbase ;missiles and players data address
mva #$03 pmcntl ;enable players and missiles
eif
lda:cmp:req $14 ;wait 1 frame
sei ;stop IRQ interrupts
mva #$00 nmien ;stop NMI interrupts
sta dmactl
mva #$fe portb ;switch off ROM to get 16k more ram
mwa #NMI $fffa ;new NMI handler
mva #1 vscrol
mva #$c0 nmien ;switch on NMI+DLI again
ift CHANGES ;if label CHANGES defined
_lp lda trig0 ; FIRE #0
beq stop
lda trig1 ; FIRE #1
beq stop
lda consol ; START
and #1
beq stop
cpw cloc #500 ; timer 10s
bcs stop
lda skctl
and #$04
bne _lp ;wait to press any key; here you can put any own routine
els
null jmp DLI.dli1 ;CPU is busy here, so no more routines allowed
eif
stop
mva #0 dmactls ; dark screen
sta dmactl
mva #$00 pmcntl ;PMG disabled
tax
sta:rne hposp0,x+
mva #$ff portb ;ROM switch on
mva #$40 nmien ;only NMI interrupts, DLI disabled
cli ;IRQ enabled
rts ;return to ... DOS
; --- DLI PROGRAM
.local DLI
?old_dli = *
ift !CHANGES
dli1 lda trig0 ; FIRE #0
beq stop
lda trig1 ; FIRE #1
beq stop
lda consol ; START
and #1
beq stop
lda skctl
and #$04
beq stop
lda vcount
cmp #$02
bne dli1
:3 sta wsync
DLINEW dli4
eif
dli_start
dli4
sta regA
stx regX
sty regY
c9 lda #$38
c10 ldx #$04
c11 ldy #$0E
sta wsync ;line=208
sta color0
stx color1
sty color2
c12 lda #$82
sta color3
lda #$01
sta gtictl
lda regA
ldx regX
ldy regY
rti
.endl
; ---
CHANGES = 1
FADECHR = 0
SCHR = 127
; ---
.proc NMI
bit nmist
bpl VBL
jmp DLI.dli_start
dliv equ *-2
VBL
sta regA
stx regX
sty regY
sta nmist ;reset NMI flag
mwa #ant dlptr ;ANTIC address program
mva #@dmactl(standard|dma|lineX1|players|missiles) dmactl ;set new screen width
inw cloc ;little timer
; Initial values
lda >fnt+$400*$00
sta chbase
c0 lda #$0E
sta colpm0
c1 lda #$38
sta colpm1
c2 lda #$04
sta colpm2
c3 lda #$0E
sta colpm3
c4 lda #$82
sta color0
c5 lda #$02
sta color1
c6 lda #$56
sta color2
c7 lda #$86
sta color3
c8 lda #$0E
sta colbak
lda #$02
sta chrctl
lda #$81
sta gtictl
x0 lda #$00
sta hposp0
sta hposp1
sta hposp2
sta hposp3
sta hposm0
sta hposm1
sta hposm2
sta hposm3
sta sizep0
sta sizep1
sta sizep2
sta sizep3
sta sizem
mwa #DLI.dli_start dliv ;set the first address of DLI interrupt
;this area is for yours routines
quit
lda regA
ldx regX
ldy regY
rti
.endp
; ---
ini main
; ---
opt l-
.MACRO SPRITES
missiles
.ds $100
player0
.ds $100
player1
.ds $100
player2
.ds $100
player3
.ds $100
.ENDM
USESPRITES = 0
.MACRO DLINEW
mva <:1 NMI.dliv
ift [>?old_dli]<>[>:1]
mva >:1 NMI.dliv+1
eif
ift :2
lda regA
eif
ift :3
ldx regX
eif
ift :4
ldy regY
eif
rti
.def ?old_dli = *
.ENDM