pt3: make the lib tester a bit simpler

This commit is contained in:
Vince Weaver 2019-09-11 16:56:48 -04:00
parent 283279506e
commit eb5ea2c796
5 changed files with 42 additions and 229 deletions

View File

@ -4,7 +4,7 @@ MEMORY {
} }
SEGMENTS { SEGMENTS {
CODE: load = RAM, type = ro; CODE: load = RAM, type = ro, align=$100;
RODATA: load = RAM, type = ro; RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw; DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes; BSS: load = RAM, type = bss, define = yes;

View File

@ -1,5 +0,0 @@
gr_offsets:
.word $400,$480,$500,$580,$600,$680,$700,$780
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0

View File

@ -3,7 +3,6 @@
;================= ;=================
; template for using the pt3_lib ; template for using the pt3_lib
; zero page definitions ; zero page definitions
.include "zp.inc" .include "zp.inc"
@ -15,6 +14,12 @@
PT3_LOC = song PT3_LOC = song
; the below will make for more compact code, at the expense
; of using $80 - $ff by our routines. You'll also need to
; grab the zp.inc file from the pt3_player code
; PT3_USE_ZERO_PAGE = 1
;============================= ;=============================
; Setup ; Setup
@ -24,16 +29,14 @@ pt3_setup:
jsr TEXT jsr TEXT
;=========================== ;===========================
; Check for Apple II/II+/IIc ; Check for Apple IIc
;=========================== ;===========================
; this is used to see if we have lowecase support ; it does interrupts differently
lda $FBB3 ; IIe and newer is $06 lda $FBB3 ; IIe and newer is $06
cmp #6 cmp #6
beq apple_iie_or_newer beq apple_iie_or_newer
;lda #$d0 ; set if older than a IIe
;sta apple_ii_smc
jmp done_apple_detect jmp done_apple_detect
apple_iie_or_newer: apple_iie_or_newer:
lda $FBC0 ; 0 on a IIc lda $FBC0 ; 0 on a IIc
@ -69,7 +72,6 @@ done_apple_detect:
;=============== ;===============
lda #0 lda #0
sta DRAW_PAGE
sta DONE_PLAYING sta DONE_PLAYING
sta LOOP sta LOOP
@ -78,39 +80,42 @@ done_apple_detect:
; Detect mockingboard ; Detect mockingboard
;======================== ;========================
; Note, we do this, but then ignore it, as sometimes
; the test fails and then you don't get music.
; In theory this could do bad things if you had something
; easily confused in slot4, but that's probably not an issue.
; print detection message ; print detection message
ldy #0
lda #<mocking_message ; load loading message print_mocking_message:
sta OUTL lda mocking_message,Y ; load loading message
lda #>mocking_message beq done_mocking_message
sta OUTH ora #$80
jsr move_and_print ; print it jsr COUT
iny
jmp print_mocking_message
done_mocking_message:
jsr CROUT1
jsr mockingboard_detect_slot4 ; call detection routine jsr mockingboard_detect_slot4 ; call detection routine
cpx #$1 cpx #$1
beq mockingboard_found beq mockingboard_found
lda #<not_message ; if not found, print that ldy #0
sta OUTL print_not_message:
lda #>not_message lda not_message,Y ; load loading message
sta OUTH beq forever_loop
inc CV ora #$80
jsr move_and_print jsr COUT
iny
jmp print_not_message
jmp forever_loop ; and wait forever
mockingboard_found: mockingboard_found:
lda #<found_message ; print found message ldy #0
sta OUTL print_found_message:
lda #>found_message lda found_message,Y ; load loading message
sta OUTH beq done_found_message
inc CV ora #$80
jsr move_and_print jsr COUT
iny
jmp print_found_message
done_found_message:
;============================ ;============================
; Init the Mockingboard ; Init the Mockingboard
@ -173,11 +178,10 @@ start_interrupts:
; Loop forever ; Loop forever
;============================ ;============================
forever_loop: forever_loop:
main_loop: jmp forever_loop
jmp main_loop
;==============================-========= ;========================================
;======================================== ;========================================
; Helper routines below ; Helper routines below
@ -197,18 +201,12 @@ main_loop:
.include "pt3_lib_core.s" .include "pt3_lib_core.s"
.include "pt3_lib_init.s" .include "pt3_lib_init.s"
.include "text_print.s"
.include "gr_offsets.s"
;========= ;=========
; strings ; strings
;========= ;=========
mocking_message: .byte $0,$0 mocking_message: .asciiz "LOOKING FOR MOCKINGBOARD IN SLOT #4"
.asciiz "LOOKING FOR MOCKINGBOARD IN SLOT #4" not_message: .byte "NOT "
not_message: .byte $0,$1 found_message: .asciiz "FOUND"
.asciiz "+ NOT FOUND"
found_message: .byte $0,$1
.asciiz "+ FOUND"
;============= ;=============
; include song ; include song

View File

@ -1,142 +0,0 @@
;================================
; move_and_print
;================================
; get X,Y from OUTL/OUTH
; then print following string to that address
; stop at NUL
; convert to APPLE ASCII (or with 0x80)
; leave OUTL/OUTH pointing to next string
move_and_print:
ldy #0
lda (OUTL),Y
sta CH
iny
lda (OUTL),Y
asl
tay
lda gr_offsets,Y ; lookup low-res memory address
clc
adc CH ; add in xpos
sta BASL ; store out low byte of addy
lda gr_offsets+1,Y ; look up high byte
adc DRAW_PAGE ;
sta BASH ; and store it out
; BASH:BASL now points at right place
clc
lda OUTL
adc #2
sta OUTL
lda OUTH
adc #0
sta OUTH
;================================
; print_string
;================================
print_string:
ldy #0
print_string_loop:
lda (OUTL),Y
beq done_print_string
eor #$80 ; flip from ASCII to text char
sta (BASL),Y
iny
bne print_string_loop
done_print_string:
iny
clc
tya
adc OUTL
sta OUTL
lda OUTH
adc #0
sta OUTH
rts
;================================
; move and print a list of lines
;================================
move_and_print_list:
jsr move_and_print
ldy #0
lda (OUTL),Y
bpl move_and_print_list
rts
;================================
; move and print a list of lines
;================================
move_and_print_list_both_pages:
lda DRAW_PAGE
pha
lda OUTL
pha
lda OUTH
pha
lda #0
sta DRAW_PAGE
jsr move_and_print_list
pla
sta OUTH
pla
sta OUTL
lda #4
sta DRAW_PAGE
jsr move_and_print_list
pla
sta DRAW_PAGE
rts
;=======================
; print to both pages
;=======================
print_both_pages:
lda DRAW_PAGE
pha
lda OUTL
pha
lda OUTH
pha
lda #0
sta DRAW_PAGE
jsr move_and_print
pla
sta OUTH
pla
sta OUTL
lda #4
sta DRAW_PAGE
jsr move_and_print
pla
sta DRAW_PAGE
rts

View File

@ -1,42 +1,4 @@
;; Zero page monitor routines addresses ;; Zero page addresses
WNDLFT = $20
WNDWDTH = $21
WNDTOP = $22
WNDBTM = $23
CH = $24
CV = $25
GBASL = $26
GBASH = $27
BASL = $28
BASH = $29
BAS2L = $2A
BAS2H = $2B
H2 = $2C
V2 = $2D
MASK = $2E
LASTIN = $3F
COLOR = $30
MODE = $31
INVFLG = $32
PROMPT = $33
YSAV = $34
YSAV1 = $35
CSWL = $36 ; address of COUT1 routine
CSWH = $37
KSWL = $38 ; key in routine
KSWH = $39
SEEDL = $4E
SEEDH = $4F
; dos33 zero page = 26-2f, 35-38, 3e 3f 40-4d
; overlap applesoft 67-6a,6f,70,af,b0,ca-cd,d8
DRAW_PAGE = $6D
OUTL = $6E
OUTH = $6F
AY_REGISTERS = $70 AY_REGISTERS = $70
A_FINE_TONE = $70 A_FINE_TONE = $70