sound chips added to pld file and added sn76489 test
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
.SILENT:
|
||||
ASM := zasm
|
||||
ASMFLAGS := -w -b
|
||||
BUILDDIR := ../../build
|
||||
|
||||
TOPTARGETS := all clean
|
||||
$(TOPTARGETS): $(SUBDIRS)
|
||||
|
||||
all: $(BUILDDIR) $(BUILDDIR)/sn76489.bin
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)
|
||||
|
||||
$(BUILDDIR):
|
||||
mkdir -p $(BUILDDIR)
|
||||
|
||||
$(BUILDDIR)/sn76489.bin: main.asm psglib_zasm.asm $(BUILDDIR)/memory.inc
|
||||
echo '>$<'
|
||||
$(ASM) $(ASMFLAGS) $< $@
|
||||
|
||||
.PHONY: $(TOPTARGETS) $(SUBDIRS)
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
#include "../../build/memory.inc"
|
||||
#include "../../bios.inc"
|
||||
#include "../../hardware.inc"
|
||||
|
||||
CTC_BASE .equ 020h
|
||||
CTC_CHANNEL_0 .equ CTC_BASE+000h
|
||||
CTC_CHANNEL_1 .equ CTC_BASE+001h
|
||||
CTC_CHANNEL_2 .equ CTC_BASE+002h
|
||||
CTC_CHANNEL_3 .equ CTC_BASE+003h
|
||||
|
||||
RAM_TOP .equ 0xbfff
|
||||
; workspace variables here vv
|
||||
; ------------------------ ^^
|
||||
SAVED_SP .equ RAM_TOP-0x02 ; word
|
||||
STACK_TOP .equ RAM_TOP-0x100
|
||||
|
||||
; -------------------------------------------------------
|
||||
; Entry
|
||||
; -------------------------------------------------------
|
||||
.org SN76489_ROM_START
|
||||
push bc
|
||||
push de
|
||||
push hl
|
||||
|
||||
ld hl, 0
|
||||
add hl, sp ; get sp
|
||||
ld (SAVED_SP), hl ; save sp for later
|
||||
ld hl, STACK_TOP
|
||||
ld sp, hl ; use own stack
|
||||
|
||||
ld hl,str_header
|
||||
call BIOS_PUTS
|
||||
|
||||
ld hl,SHARED_MEM_START+042h
|
||||
ld bc, ctc_interrupt ; install own ctc isr
|
||||
ld (hl), bc
|
||||
|
||||
di
|
||||
|
||||
call PSGInit ; Initialize psglib
|
||||
ld a,10100111b ; interrupts enabled
|
||||
; timer mode
|
||||
; prescaler 256
|
||||
; automatic trigger
|
||||
; time constant follows
|
||||
; reset
|
||||
; control word
|
||||
out (CTC_CHANNEL_1), a
|
||||
ld a,78 ; 50Hz
|
||||
out (CTC_CHANNEL_1), a
|
||||
|
||||
; music must be loaded from 8000
|
||||
ld hl, 0x8000
|
||||
call PSGPlayNoRepeat
|
||||
|
||||
ei
|
||||
|
||||
exit:
|
||||
ld hl, (SAVED_SP)
|
||||
ld sp, hl ; restore original stack
|
||||
|
||||
pop hl
|
||||
pop de
|
||||
pop bc
|
||||
ret
|
||||
|
||||
; -------------------------------------------------------
|
||||
; CTC CHAN 1 interrupt handler
|
||||
; -------------------------------------------------------
|
||||
ctc_interrupt:
|
||||
push af
|
||||
push bc
|
||||
push de
|
||||
push hl
|
||||
|
||||
call PSGFrame
|
||||
|
||||
pop hl
|
||||
pop de
|
||||
pop bc
|
||||
pop af
|
||||
reti
|
||||
|
||||
; -------------------------------------------------------
|
||||
; Strings
|
||||
; -------------------------------------------------------
|
||||
str_header: .db "SN76489 test",00dh,00ah,000h
|
||||
|
||||
#include "psglib_zasm.asm"
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user