diff --git a/linker_scripts/apple2_1000.inc b/linker_scripts/apple2_1000.inc index e22976de..2be5dcb5 100644 --- a/linker_scripts/apple2_1000.inc +++ b/linker_scripts/apple2_1000.inc @@ -4,7 +4,7 @@ MEMORY { } SEGMENTS { -CODE: load = RAM, type = ro; +CODE: load = RAM, type = ro, align=$100; RODATA: load = RAM, type = ro; DATA: load = RAM, type = rw; BSS: load = RAM, type = bss, define = yes; diff --git a/pt3_lib/gr_offsets.s b/pt3_lib/gr_offsets.s deleted file mode 100644 index d3af91f7..00000000 --- a/pt3_lib/gr_offsets.s +++ /dev/null @@ -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 - diff --git a/pt3_lib/pt3_test.s b/pt3_lib/pt3_test.s index e2216d02..6178e0a9 100644 --- a/pt3_lib/pt3_test.s +++ b/pt3_lib/pt3_test.s @@ -3,7 +3,6 @@ ;================= ; template for using the pt3_lib - ; zero page definitions .include "zp.inc" @@ -15,6 +14,12 @@ 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 @@ -24,16 +29,14 @@ pt3_setup: 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 cmp #6 beq apple_iie_or_newer - ;lda #$d0 ; set if older than a IIe - ;sta apple_ii_smc jmp done_apple_detect apple_iie_or_newer: lda $FBC0 ; 0 on a IIc @@ -69,7 +72,6 @@ done_apple_detect: ;=============== lda #0 - sta DRAW_PAGE sta DONE_PLAYING sta LOOP @@ -78,39 +80,42 @@ done_apple_detect: ; 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 - - lda #mocking_message - sta OUTH - jsr move_and_print ; print it + ldy #0 +print_mocking_message: + lda mocking_message,Y ; load loading message + beq done_mocking_message + ora #$80 + jsr COUT + iny + jmp print_mocking_message +done_mocking_message: + jsr CROUT1 jsr mockingboard_detect_slot4 ; call detection routine cpx #$1 beq mockingboard_found - lda #not_message - sta OUTH - inc CV - jsr move_and_print + ldy #0 +print_not_message: + lda not_message,Y ; load loading message + beq forever_loop + ora #$80 + jsr COUT + iny + jmp print_not_message - jmp forever_loop ; and wait forever mockingboard_found: - lda #found_message - sta OUTH - inc CV - jsr move_and_print + ldy #0 +print_found_message: + lda found_message,Y ; load loading message + beq done_found_message + ora #$80 + jsr COUT + iny + jmp print_found_message +done_found_message: ;============================ ; Init the Mockingboard @@ -173,11 +178,10 @@ start_interrupts: ; Loop forever ;============================ forever_loop: -main_loop: - jmp main_loop + jmp forever_loop -;==============================-========= +;======================================== ;======================================== ; Helper routines below @@ -197,18 +201,12 @@ main_loop: .include "pt3_lib_core.s" .include "pt3_lib_init.s" -.include "text_print.s" -.include "gr_offsets.s" - ;========= ; strings ;========= -mocking_message: .byte $0,$0 - .asciiz "LOOKING FOR MOCKINGBOARD IN SLOT #4" -not_message: .byte $0,$1 - .asciiz "+ NOT FOUND" -found_message: .byte $0,$1 - .asciiz "+ FOUND" +mocking_message: .asciiz "LOOKING FOR MOCKINGBOARD IN SLOT #4" +not_message: .byte "NOT " +found_message: .asciiz "FOUND" ;============= ; include song diff --git a/pt3_lib/text_print.s b/pt3_lib/text_print.s deleted file mode 100644 index 2a090799..00000000 --- a/pt3_lib/text_print.s +++ /dev/null @@ -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 diff --git a/pt3_lib/zp.inc b/pt3_lib/zp.inc index 06d21117..d4bf1606 100644 --- a/pt3_lib/zp.inc +++ b/pt3_lib/zp.inc @@ -1,42 +1,4 @@ -;; Zero page monitor routines 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 +;; Zero page addresses AY_REGISTERS = $70 A_FINE_TONE = $70