diff --git a/Makefile b/Makefile index bad64f2ab..9fa689e1c 100644 --- a/Makefile +++ b/Makefile @@ -27,16 +27,17 @@ dsk: md asm cp res/_FileInformation.txt build/ $(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "res/PRODOS" >/dev/null $(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "build/LAUNCHER.SYSTEM" >/dev/null + $(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "res/games.conf" >/dev/null $(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "res/COVER" >/dev/null $(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "res/COVER.A2FC" >/dev/null $(CADIUS) CREATEFOLDER build/"$(DISK)" "/${VOLUME}/X/" >/dev/null - bin/do2po.py res/dsk/ build/po/ - rsync -a res/dsk/*.po build/po/ - bin/extract.py build/po/ | sh - rm -f build/X/**/.DS_Store - rm -f build/X/**/PRODOS - rm -f build/X/**/LOADER.SYSTEM - $(CADIUS) ADDFOLDER build/"$(DISK)" "/${VOLUME}/X" "build/X" +# bin/do2po.py res/dsk/ build/po/ +# rsync -a res/dsk/*.po build/po/ +# bin/extract.py build/po/ | sh >/dev/null +# rm -f build/X/**/.DS_Store +# rm -f build/X/**/PRODOS +# rm -f build/X/**/LOADER.SYSTEM +# $(CADIUS) ADDFOLDER build/"$(DISK)" "/${VOLUME}/X" "build/X" >/dev/null artwork: dsk # $(CADIUS) ADDFOLDER build/"$(DISK)" "/${VOLUME}/ARTWORK" "res/artwork" diff --git a/res/COVER b/res/COVER index c416e5de5..d30c2245a 100644 Binary files a/res/COVER and b/res/COVER differ diff --git a/res/COVER.A2FC b/res/COVER.A2FC index 43a475b69..bcbf3e4cd 100644 Binary files a/res/COVER.A2FC and b/res/COVER.A2FC differ diff --git a/res/_FileInformation.txt b/res/_FileInformation.txt index 9d5ff241d..a30324116 100644 --- a/res/_FileInformation.txt +++ b/res/_FileInformation.txt @@ -1,4 +1,4 @@ PRODOS=Type(FF),AuxType(0000),Access(C3) LAUNCHER.SYSTEM=Type(FF),AuxType(2000),Access(C3) -COVER=Type(06),AuxType(4000),Access(C3) +COVER=Type(06),AuxType(2000),Access(C3) COVER.A2FC=Type(06),AuxType(2000),Access(C3) diff --git a/res/attic/COVER b/res/attic/COVER new file mode 100644 index 000000000..c416e5de5 Binary files /dev/null and b/res/attic/COVER differ diff --git a/res/attic/COVER.A2FC b/res/attic/COVER.A2FC new file mode 100644 index 000000000..43a475b69 Binary files /dev/null and b/res/attic/COVER.A2FC differ diff --git a/src/4cade.a b/src/4cade.a index 9cd78749e..d0ad995c3 100644 --- a/src/4cade.a +++ b/src/4cade.a @@ -2,63 +2,99 @@ !to "build/LAUNCHER.SYSTEM",plain *=$2000 - jmp Start - !source "src/constants.a" !source "src/macros.a" + + jsr DisableAccelerator ; set to 1 MHz + jsr Has128K ; check for 128K (64K is OK, we just filter out some games) + ror MachineStatus + jsr HasJoystick ; check for joystick (keyboard-only is OK, we just filter out some games) + ror MachineStatus + + lda LCBANK1WRITE ; read ROM / write LC bank 1 + lda LCBANK1WRITE + ldx #$00 +FM lda FirstMover,x + sta $D000,x + inx + bne FM +; inc FM+2 +; inc FM+5 +; lda FM+5 +; cmp #>LastMover +; bcc FM + + jsr init ; initialize ProRWTS2 (bye bye ProDOS) + lda LCBANK1 ; read/write LC bank 1 + lda LCBANK1 + jmp Start + !source "src/memcheck.a" !source "src/joystick.a" !source "src/normfast.a" + !source "src/prorwts2.a" -!zone { +FirstMover +!pseudopc $D000 { +!zone Start - jsr $FE89 - jsr $FE93 - jsr $FB2F - jsr $FC58 - jsr Has128K - bmi @found128K - ldy #9 -- lda @s_needs128K,y - sta $400,y - dey - bpl - -@hang bmi @hang -@s_needs128K - !text "NEEDS 128K" -@found128K - jsr DisableAccelerator - jsr HasJoystick - bcc @hang - ldy #10 -- lda @s_nojoystick,y - sta $400,y - dey - bpl - - bmi @hang -@s_nojoystick - !text "NO JOYSTICK" -} + lda #$00 ; read first $2000 bytes + sta sizelo + lda #$20 + sta sizehi + lda #0 ; 0 = read into main memory + sta auxreq + lda #cmdread ; read (instead of write) + sta reqcmd + bit MachineStatus + bvs @ShowCover128K + lda #cover64 + sta namhi + jsr hddopendir ; call ProRWTS2 + clc + bcc @Show +@ShowCover128K + inc auxreq ; 1 = read into aux memory + lda #cover128 + sta namhi + jsr hddopendir ; call ProRWTS2 + lda #$20 ; read next $2000 bytes + sta sizehi + dec auxreq ; 0 = read into main memory + jsr hddrdwrpart ; call ProRWTS2 -; jsr init ; initialize ProRWTS2 -; lda $C08B -; lda $C08B -; lda #cover -; sta namhi -; lda #0 -; sta sizelo -; lda #$20 -; sta sizehi -; jsr hddopendir -; bit $C055 -; bit $C052 -; bit $C057 -; bit $C050 -;cover !byte cover_e-cover_b -;cover_b !text "COVER" -;cover_e + sta $C000 ; display double hi-res page 1 + sta $C00D + sta $C05E + sta $C001 +@Show + sta $C057 + sta $C052 + sta $C054 + sta $C050 + + bit $C010 +- lda $C000 + bpl - + bit $C010 + brk + +cover64 + !byte cover64_e-cover64_b +cover64_b + !text "COVER" +cover64_e +cover128 + !byte cover128_e-cover128_b +cover128_b + !text "COVER.A2FC" +cover128_e +} +LastMover ;LoadDHGR ; sta $C000 diff --git a/src/constants.a b/src/constants.a index 01c201b07..ef957ee25 100644 --- a/src/constants.a +++ b/src/constants.a @@ -16,8 +16,10 @@ SLOT3STATUS = $C017 ; read high bit only LCBANK2READ = $C080 ; read once to R RAM bank 2 / no write ROMIN = $C081 ; read twice to R ROM / W RAM bank 2 -LCBANK2 = $C083 ; read twice to R/W RAM bank 2 +ROMONLY = $C082 ; read once to R ROM / no write +;LCBANK2 = $C083 ; read twice to R/W RAM bank 2 LCBANK1READ = $C088 ; read once to R RAM bank 1 / no write +LCBANK1WRITE = $C089 ; read twice to R ROM / W RAM bank 1 LCBANK1 = $C08B ; read twice to R/W RAM bank 1 ; ROM @@ -29,3 +31,5 @@ PTR = $02 SRC = $04 DEST = $06 SAVE = $08 +MachineStatus =$FF ; bit 7 = 1 if machine has joystick + ; bit 6 = 1 if machine has 128K diff --git a/src/joystick.a b/src/joystick.a index 89dc9b68e..2e895eb9a 100644 --- a/src/joystick.a +++ b/src/joystick.a @@ -3,8 +3,8 @@ ; Checks whether computer has joystick connected ; ; in: none -; out: C clear if joystick found -; C set if no joystick found +; out: C set if joystick found +; C clear if no joystick found ; other flags clobbered ; A,X clobbered ; Y preserved @@ -13,28 +13,30 @@ ; (c) 1989 Broderbund Software ; https://github.com/jmechner/Prince-of-Persia-Apple-II/blob/master/01%20POP%20Source/Source/GRAFIX.S#L1225 ;------------------------------------------------------------------------------ +!zone { HasJoystick lda #0 - sta joyX - sta joyY + sta @joyX + sta @joyY lda $C070 ; reset analog input timers @loop ldx #1 @1 lda $C064,x ; check timer input bpl @beat - inc joyX,x ; still high, increment counter + inc @joyX,x ; still high, increment counter @nextpdl dex bpl @1 lda $C064 ora $C065 - bpl @rts ; both inputs low, we're done - lda joyX - ora joyY + bpl @yes ; both inputs low, we're done + lda @joyX + ora @joyY bpl @loop ; do it again - sec +@no clc +HIDE_NEXT_BYTE -@rts clc +@yes sec rts @beat nop bpl @nextpdl ; kill time -joyX !byte 0 -joyY !byte 0 +@joyX !byte 0 +@joyY !byte 0 +} diff --git a/src/memcheck.a b/src/memcheck.a index 2c595a235..6f687d63f 100644 --- a/src/memcheck.a +++ b/src/memcheck.a @@ -1,121 +1,52 @@ -Has128KStatus =$FF ; [byte] set by Has128K - ;------------------------------------------------------------------------------ ; Has128K -; Checks whether computer has auxiliary memory (i.e. 128K) +; Checks whether computer has functioning auxiliary memory (128K) ; -; in: none -; out: zero page $FF has -; $00 = not a //e -; $20 = //e but no 80-col card -; $40 = 80-col card but no aux mem -; $80 = aux mem detected (yay!) -; all other flags clobbered -; all registers clobbered -; zero page $1A-$1D clobbered +; in: none +; out: C set if 128K detected +; C clear if 128K not detected +; all other flags and registers clobbered +; zp $80-$9F clobbered +; ROM in memory (not LC RAM bank) ; -; original was AUX.MEM.CHECK from "Extra K" -; (c) 1986 Beagle Bros -; written by Alan Bird and Mark Simonsen, 1986-03-28 +; adapted from "Prince of Persia" by Jordan Mechner +; (c) 1989 Broderbund Software +; https://github.com/jmechner/Prince-of-Persia-Apple-II/blob/master/01%20POP%20Source/Source/BOOT.S#L119 ;------------------------------------------------------------------------------ +!zone { Has128K - php - sei - lda $E000 ; store values from language card - sta $1A ; (used later to determine which - lda $D000 ; RAM bank is active and reset it) - sta $1B - lda $D400 - sta $1C - lda $D800 - sta $1D - lda ROMIN - lda ROMIN + sta ROMONLY ; need ROM for machine ID byte lda MACHINEID - cmp #$06 - bne @noiie + cmp #6 + bne @no ; earlier than //e -> no 128K lda SLOT3STATUS - bmi @no80col - lda AUXMEMSTATUS - bmi @yesauxmem - lda AUXZPSTATUS - bmi @yesauxmem - ldy #$28 -- ldx @checker,Y - lda $100,Y - sta @checker,Y - txa - sta $100,Y - dey + bmi @no ; no 80-column card -> no 128K + ldx #@checklen +- lda @checker,x + sta $80,x + dex bpl - - jmp $100 -@postcheck - ldy #$28 -- lda @checker,Y - sta $100,Y - dey - bpl - - bcs @noauxmem -@yesauxmem - lda #$80 - +HIDE_NEXT_2_BYTES -@noauxmem - lda #$40 - +HIDE_NEXT_2_BYTES -@no80col - lda #$20 - +HIDE_NEXT_2_BYTES -@noiie - lda #$00 - sta Has128KStatus - lda $E000 - cmp $1A - bne @tryRAMbank1 - lda $D000 - cmp $1B - bne @tryRAMbank1 - lda $D400 - cmp $1C - bne @tryRAMbank1 - lda $D800 - cmp $1D - beq @done -@tryRAMbank1 - lda LCBANK1READ - lda $E000 - cmp $1A - bne @tryRAMbank2 - lda $D000 - cmp $1B - bne @tryRAMbank2 - lda $D400 - cmp $1C - bne @tryRAMbank2 - lda $D800 - cmp $1D - beq @done -@tryRAMbank2 - lda LCBANK2READ -@done - plp - lda Has128KStatus - rts + jmp $80 ; check if auxmem actually works @checker lda #$EE sta WRITEAUXMEM sta READAUXMEM - sta $800 - lda $C00 + sta $0C00 + sta $0800 + lda $0C00 cmp #$EE - bne @auxworks - asl $C00 - lda $800 - cmp $C00 - bne @auxworks - sec + bne @no + asl $0C00 + asl + cmp $0C00 + bne @no + cmp $0800 + bne @yes +@no clc +HIDE_NEXT_BYTE -@auxworks - clc - sta WRITEMAINMEM +@yes sec +@finish sta WRITEMAINMEM sta READMAINMEM - jmp @postcheck + rts +@checklen=*-@checker +} diff --git a/src/prorwts2.a b/src/prorwts2.a index d6c298fe2..488158c7b 100644 --- a/src/prorwts2.a +++ b/src/prorwts2.a @@ -13,7 +13,7 @@ ver_02 = 1 ;place no code before init label below. ;user-defined options - verbose_info = 1 ;set to 1 to enable display of memory usage + verbose_info = 0 ;set to 1 to enable display of memory usage enable_floppy = 0 ;set to 1 to enable floppy drive support poll_drive = 0 ;set to 1 to check if disk is in drive, recommended if allow_multi is enabled override_adr = 0 ;set to 1 to require an explicit load address @@ -25,10 +25,10 @@ ver_02 = 1 ;seeking with aligned_read=1 requires non-zero offset allow_multi = 0 ;set to 1 to allow multiple floppies check_chksum = 0 ;set to 1 to enforce checksum verification for floppies - allow_subdir = 0 ;set to 1 to allow opening subdirectories to access files + allow_subdir = 1 ;set to 1 to allow opening subdirectories to access files might_exist = 0 ;set to 1 if file is not known to always exist already ;makes use of status to indicate success or failure - allow_aux = 0 ;set to 1 to allow read/write directly to/from aux memory + allow_aux = 1 ;set to 1 to allow read/write directly to/from aux memory ;requires load_high to be set for arbitrary memory access ;else driver must be running from same memory target ;i.e. running from main if accessing main, running from aux if accessing aux @@ -38,11 +38,11 @@ ver_02 = 1 always_trees = 0 ;set to 1 if the only file access involves tree files ;not compatible with allow_subdir, allow_saplings detect_treof = 0 ;detect EOF during read of tree files - allow_sparse = 0 ;enable support for reading sparse files - bounds_check = 0 ;set to 1 to prevent access beyond the end of the file + allow_sparse = 1 ;enable support for reading sparse files + bounds_check = 1 ;set to 1 to prevent access beyond the end of the file ;but limits file size to 64k-2 bytes. - no_interrupts= 1 ;set to 1 to disable interrupts across calls - detect_err = 1 ;set to 1 to to detect errors in no_interrupt mode + no_interrupts= 0 ;set to 1 to disable interrupts across calls + detect_err = 0 ;set to 1 to to detect errors in no_interrupt mode swap_zp = 0 ;set to 1 to include code to preserve zpage ;used only by rwts_mode rwts_mode = 0 ;set to 1 to enable emulation of DOS RWTS when running from hard disk @@ -2102,13 +2102,11 @@ hddfoundname iny !if (allow_subdir + allow_saplings + allow_trees) > 0 { sta hdddirbuf !if fast_trees = 0 { - sta treeblklo } ;fast_trees iny lda (bloklo), y sta hdddirbuf + 256 !if fast_trees = 0 { - sta treeblkhi } ;fast_trees !if (allow_trees and always_trees) = 0 { plp