From f33ba08c7c02661f425dd33354d57cfc18bf6fc2 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Sun, 29 Sep 2019 08:08:57 -0700 Subject: [PATCH] support MicroDrive --- res/history.md | 74 +-------------------------------------- src/4cade.init.a | 15 +------- src/constants.a | 2 +- src/hw.diskcheck.a | 86 ---------------------------------------------- src/prodos.impl.a | 46 ++++++++++++------------- src/prorwts2.a | 45 ++++++++++++------------ 6 files changed, 49 insertions(+), 219 deletions(-) delete mode 100644 src/hw.diskcheck.a diff --git a/res/history.md b/res/history.md index ceff4a9cc..4f1653113 100644 --- a/res/history.md +++ b/res/history.md @@ -1,73 +1 @@ -# Revision 3 / unreleased - -## Enhancements & bug fixes - - - Cheat system (press Ctrl-C in search or browse mode to toggle) - - 42 games offer cheats - - Fixed corrupted graphics in Asteroid Blaster - - Fixed corrupted graphics in Sneakers game, demo, and screenshots, and now we are entirely done with this I promise - - Added missing levels in Out Of This World - - Removed latent copy protection in Sea Dragon (sneaky sneaky) - - Prevent flashes of other game screenshots while loading the game you actually want - - Fixed freeze on startup with certain accelerators - - Fixed launching from partition 3 or 4 - - Fixed crashes on II+ - -# Revision 2 / serial number 190914 - -## New games - - - Asteroid Blaster - - Aztec - - Beyond Castle Wolfenstein - - Buck Rogers: Planet of Zoom - - Diamond Mine - - Free Fall - - Hyper Head-On - - Indiana Jones - - Out Of This World - - Sea Dragon - - Seafox - - Situation Critical - - Star Thief - - The Spy Strikes Back - -## New demos - - - Alien Munchies - - Alien Typhoon - - Axis Assassin - - Battlezone - - Beer Run - - Bellhop - - Brainteaser Blvd - - Cyclod - - Dig Dug - - Falcons - - Labyrinth - - Space Eggs - - Star Blazer - -## Enhancements & bug fixes - - - Pressing Space will now show a game's screenshots, as well as Tab - - Pressing right arrow will now progress through a slideshow without waiting - - Startup is noticeably faster - - Castle Wolfenstein has been upgraded to the 1984 re-release with updated graphics - - Mr. Do now shows its own in-game attract mode - - Mr. Do no longer crashes on level 8 - - Prince of Persia no longer crashes on startup - - Zaxxon no longer crashes after a game ends - - Several games no longer crash on the //c - - Sneakers demo has corrected graphics - - Plasmania demo has corrected graphics - - Properly detect VidHD in slot 3 - - Properly set alternate display mode on IIgs (fixes Centipede, Mr. Do) - - No longer crashes after loading a double hi-res screenshot from a SCSI hard drive - - Small high score files are saved (fixes Apple Cider Spider, Lancaster) - - Some double hi-res screenshots were being skipped even if the game was available - - Disk image is now exactly 32 MB - -# Revision 1 / serial number 190720 - -Initial release +# Revision 3 / unreleased ## Enhancements & bug fixes - Cheat system (press Ctrl-C in search or browse mode to toggle) - 42 games offer cheats - Fixed corrupted graphics in Asteroid Blaster - Fixed corrupted graphics in Sneakers game, demo, and screenshots, and now we are entirely done with this I promise - Added missing levels in Out Of This World - Removed latent copy protection in Sea Dragon (sneaky sneaky) - Prevent flashes of other game screenshots while loading the game you actually want - Fixed freeze on startup with certain accelerators - Fixed launching from partition 3 or 4 - Fixed crashes on II+ - Fixed launching from MicroDrive and ProDOS 2.5 # Revision 2 / serial number 190914 ## New games - Asteroid Blaster - Aztec - Beyond Castle Wolfenstein - Buck Rogers: Planet of Zoom - Diamond Mine - Free Fall - Hyper Head-On - Indiana Jones - Out Of This World - Sea Dragon - Seafox - Situation Critical - Star Thief - The Spy Strikes Back ## New demos - Alien Munchies - Alien Typhoon - Axis Assassin - Battlezone - Beer Run - Bellhop - Brainteaser Blvd - Cyclod - Dig Dug - Falcons - Labyrinth - Space Eggs - Star Blazer ## Enhancements & bug fixes - Pressing Space will now show a game's screenshots, as well as Tab - Pressing right arrow will now progress through a slideshow without waiting - Startup is noticeably faster - Castle Wolfenstein has been upgraded to the 1984 re-release with updated graphics - Mr. Do now shows its own in-game attract mode - Mr. Do no longer crashes on level 8 - Prince of Persia no longer crashes on startup - Zaxxon no longer crashes after a game ends - Several games no longer crash on the //c - Sneakers demo has corrected graphics - Plasmania demo has corrected graphics - Properly detect VidHD in slot 3 - Properly set alternate display mode on IIgs (fixes Centipede, Mr. Do) - No longer crashes after loading a double hi-res screenshot from a SCSI hard drive - Small high score files are saved (fixes Apple Cider Spider, Lancaster) - Some double hi-res screenshots were being skipped even if the game was available - Disk image is now exactly 32 MB # Revision 1 / serial number 190720 Initial release \ No newline at end of file diff --git a/src/4cade.init.a b/src/4cade.init.a index 3ed4973e7..2f30a17f7 100644 --- a/src/4cade.init.a +++ b/src/4cade.init.a @@ -15,19 +15,7 @@ sta WRITEMAINMEM jsr ROM_TEXT jsr ROM_HOME - jsr IsLowPartition ; check if running from partition 1-4 (required) - bcc + - - ldy #@noHighPartlen -- lda @s_noHighPart,y - sta $6B1,y - dey - bpl - - bmi @hang -@s_noHighPart !scrxor $80,"RUN FROM PARTITION 1-4" -@noHighPartlen=(*-@s_noHighPart)-1 - -+ jsr Has64K ; check for 64K (required) + jsr Has64K ; check for 64K (required) bcc + ldy #@no64Klen @@ -149,7 +137,6 @@ NotGS clc !source "src/prorwts2.a" ProRWTSBuffer ; these routines will only be called once, from main memory, before relocating to language card - !source "src/hw.diskcheck.a" !source "src/hw.vidhd.a" !source "src/hw.memcheck.a" !source "src/hw.joystick.a" diff --git a/src/constants.a b/src/constants.a index 32b971528..8cbb60172 100644 --- a/src/constants.a +++ b/src/constants.a @@ -9,7 +9,7 @@ ; D000..E5F4 - persistent data structures (per-game cheat categories, ; gGlobalPrefsStore, gGamesListStore) ; ...unused... -; ECDC..FFF9 - main program code +; EC9F..FFF9 - main program code ; FFFA..FFFF - NMI, reset, IRQ vectors ; ; LC RAM BANK 2 diff --git a/src/hw.diskcheck.a b/src/hw.diskcheck.a deleted file mode 100644 index 7f393e723..000000000 --- a/src/hw.diskcheck.a +++ /dev/null @@ -1,86 +0,0 @@ -;------------------------------------------------------------------------------ -; IsLowPartition -; Checks whether image was run from partition 1-4 -; -; in: none -; out: C clear if partition is acceptable -; C set if partition is not acceptable -; all other flags and registers clobbered -;------------------------------------------------------------------------------ - -DEVADR01HI = $bf11 ;ProDOS constant -DEVNUM = $bf30 ;ProDOS constant - -IsLowPartition - lda DEVNUM - sta x80_parms + 1 - sta unit - and #$70 - lsr - lsr - lsr - tay - lda DEVADR01HI, y - cmp #$c8 - bcc @GoodPartition - - ;find the SmartPort device - - ldx #$c8 -- dex - stx ldrhi - ldy #0 - sty ldrlo - iny - lda (ldrlo), y - cmp #$20 - bne - - iny - iny - lda (ldrlo), y - bne - - iny - iny - lda (ldrlo), y - cmp #3 - bne - - ldy #$ff - lda (ldrlo), y - beq - - sta ldrlo - - ;detect extended remapping - - lda #<(readbuff + $200) - sta adrlo - lda #>(readbuff + $200) - sta adrhi - lda #2 - sta x80_parms + 4 - sta bloklo - lda #0 - sta x80_parms + 5 - sta blokhi - lda #cmdread - sta command - jsr @dispatch - jsr MLI - !byte $80 - !word x80_parms - ldy #$0f -- lda readbuff + 4, y - cmp readbuff + $204, y - bne @BadPartition - dey - bpl - - clc - - !byte $24 -@BadPartition - sec - -@GoodPartition - rts - -@dispatch - jmp (ldrlo) diff --git a/src/prodos.impl.a b/src/prodos.impl.a index e60083967..21df48f9a 100644 --- a/src/prodos.impl.a +++ b/src/prodos.impl.a @@ -14,7 +14,7 @@ ; A=0, X and Y preserved ; stack set to next instruction after parameters ;------------------------------------------------------------------------------ -packet = first_zp ;word +ipacket = first_zp ;word buffer = first_zp+2 ;word ProDOS_enter @@ -31,9 +31,9 @@ ProDOS_enter jsr @fetchbyte sta @request+1 jsr @fetchbyte - sta packet + sta ipacket jsr @fetchbyte - sta packet+1 + sta ipacket+1 lda @fetchaddr+2 pha lda @fetchaddr+1 @@ -98,19 +98,19 @@ ProDOS_enter ldy #2 jsr @setbuffer iny - lda (packet), y + lda (ipacket), y tax iny - lda (packet), y + lda (ipacket), y @rdwrop ldy #$d1 ; SMC jsr hddseekrd+2 bcc @jmp_zp2 ;always @imp_getattrib - lda packet+1 + lda ipacket+1 pha - lda packet + lda ipacket pha ldx #namlo jsr @setbuffer1 @@ -120,25 +120,25 @@ ProDOS_enter lda #$10 sta attribpatch pla - sta packet + sta ipacket pla - sta packet+1 + sta ipacket+1 ldy #5 lda ldrlo2 - sta (packet), y + sta (ipacket), y iny lda ldrlo2+1 - sta (packet), y + sta (ipacket), y ldy #$13 lda (bloklo), y tax iny lda (bloklo), y ldy #9 - sta (packet), y + sta (ipacket), y txa dey - sta (packet), y + sta (ipacket), y @jmp_zp2 jmp @restore_zp @@ -173,12 +173,12 @@ ProDOS_enter @handles ldx #0 iny - lda (packet), y + lda (ipacket), y sta @handle-1, x jsr @patch_buffer iny lda #1 - sta (packet), y + sta (ipacket), y lda #0 sta reqcmd sta sizehi @@ -252,20 +252,20 @@ ProDOS_enter jsr hddrdwrpart ldy #6 lda sizelo2 - sta (packet), y + sta (ipacket), y iny lda sizehi2 - sta (packet), y + sta (ipacket), y @jmp_zp jmp @restore_zp @imp_eof ldy #2 lda bleftlo - sta (packet), y + sta (ipacket), y iny lda blefthi - sta (packet), y + sta (ipacket), y bcs @restore_zp ;always @imp_close @@ -305,7 +305,7 @@ ProDOS_enter @set_rdwrbuff ldy #1 - lda (packet), y + lda (ipacket), y tax lda @handle-1, x jsr @patch_buffer @@ -319,10 +319,10 @@ ProDOS_enter ldy #1 @setbuffer - lda (packet), y + lda (ipacket), y sta $0,x iny - lda (packet), y + lda (ipacket), y sta $1,x rts @@ -628,7 +628,7 @@ SaveSmallFileInternal sta ldrhi lda #cmdwrite ; write (instead of read) sta reqcmd - sta sizelo ; non-zero + sta sizehi ; 512 bytes jmp hddopendir ; exit via ProRWTS2 (must re-open the file after query) LaunchInternal diff --git a/src/prorwts2.a b/src/prorwts2.a index fb2db26cf..3f1c98429 100644 --- a/src/prorwts2.a +++ b/src/prorwts2.a @@ -16,7 +16,7 @@ ver_02 = 1 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 - allow_extend = 0 ;enable support for more than four partitions (note: it has overhead) + allow_extend = 1 ;enable support for more than two MicroDrive (or more than four CFFA) partitions override_adr = 1 ;set to 1 to require an explicit load address aligned_read = 0 ;set to 1 if all reads can be a multiple of block size enable_readseq=0 ;set to 1 to enable reading multiple sequential times from the same file without seek @@ -372,7 +372,7 @@ adjpath tya bne readblock pla - ;unit to slot for SmartPort interface + ;unit to slot for ProDOS interface +++ pla lsr @@ -380,8 +380,19 @@ adjpath tya lsr tay ldx DEVADR01HI, y +!if (enable_floppy + allow_extend) > 0 { cpx #$c8 bcc set_slot + !if enable_floppy = 1 { + php + lsr + ora #$c0 + tax + plp + } else { ;enable_floppy = 0 + + ;find SmartPort device for basic MicroDrive support + ldx #$c8 - dex stx blokhi @@ -403,6 +414,8 @@ adjpath tya ldy #$ff lda (bloklo), y beq - + } ;enable_floppy +} ;enable_floppy or allow_extend set_slot stx slot + 2 !if allow_extend = 1 { @@ -419,7 +432,9 @@ slot ldx $cfff } ;enable_floppy stx unrentry2 + 1 !if allow_extend = 1 { - ;use ProDOS entrypoint instead + bcc bankram + + ;use SmartPort entrypoint instead inx inx @@ -441,9 +456,9 @@ slot ldx $cfff !byte $80 !word x80_parms bcc + ;always -iterunit inc iterunit + 1 +iterunit inc unrunit2 - ;enable use of ProDOS SmartPort entrypoint + ;enable use of SmartPort entrypoint lda #$2c sta unrentry2 @@ -2075,10 +2090,8 @@ hddnextent ldy #0 and #$0f tax inx -- cmp (namlo), y - beq hddfoundname - ora #$80 - cmp (namlo), y +- eor (namlo), y + asl beq hddfoundname ;match failed, check if any directory entries remain @@ -2135,20 +2148,8 @@ hddfoundname iny ldy reqcmd cpy #cmdwrite ;control carry instead of zero bne + - - ;round requested size up to nearest block if writing - - lda sizelo - adc #$fe - lda sizehi - adc #1 - and #$fe - sta sizehi !if aligned_read = 0 { stx sizelo - !if bounds_check = 1 { - sec - } ;bounds_check } ;aligned_read + } ;enable_write @@ -2851,7 +2852,7 @@ packet !byte 3 unrunit2 = unrelochdd + (* - reloc) !byte 0 !word readbuff + $200 - !word 2 + !byte 2, 0, 0 } ;allow_extend !if rwts_mode = 1 {