From 99f9f9f35cd5af18866ef3d31cf4e51f6ff48600 Mon Sep 17 00:00:00 2001 From: Martin Haye Date: Wed, 11 Jan 2017 19:02:31 -0800 Subject: [PATCH] Now supporting multi-floppy mode. --- .../src/org/badvision/A2PackPartitions.groovy | 4 +- Platform/Apple/tools/ProRWTS/PRORWTS2#4000 | Bin 1776 -> 1778 bytes Platform/Apple/tools/ProRWTS/prorwts2.s | 54 +++++++++++------- Platform/Apple/virtual/src/core/mem.s | 33 +++++++---- 4 files changed, 58 insertions(+), 33 deletions(-) diff --git a/Platform/Apple/tools/PackPartitions/src/org/badvision/A2PackPartitions.groovy b/Platform/Apple/tools/PackPartitions/src/org/badvision/A2PackPartitions.groovy index 0a834cf0..4b5db8c3 100644 --- a/Platform/Apple/tools/PackPartitions/src/org/badvision/A2PackPartitions.groovy +++ b/Platform/Apple/tools/PackPartitions/src/org/badvision/A2PackPartitions.groovy @@ -2623,6 +2623,9 @@ end def dst = new File("game.2mg") Files.copy(new GZIPInputStream(new FileInputStream(jitCopy(new File("build/data/disks/base_800k.2mg.gz")))), dst.toPath()) + // Now put the files into the image + String[] args = ["-put", "game.2mg", "/", "build/root"] + new a2copy.A2Copy().main(args) } def createFloppyImages() @@ -2650,7 +2653,6 @@ end // Now put the files into the image String[] args = ["-put", "game${i}.dsk", "/", "build/root${i}"] - println args.join(" ") new a2copy.A2Copy().main(args) } } diff --git a/Platform/Apple/tools/ProRWTS/PRORWTS2#4000 b/Platform/Apple/tools/ProRWTS/PRORWTS2#4000 index cb26849099f0c8da2cccc7d290968d3f2a86c488..823f0c68f5b0d5ab7442fe3fa76b5a4609ebd4b1 100644 GIT binary patch delta 699 zcmZ9JZ%7ky7{~8!+qKR4H#S#u?uV?}hA&1zAVhfE?WUJ3dleF-)SDp$zUxIqi+0Bx z-l6>xDKg=(n>41-;WThsjZtWu#rb3?4qu_xpU`eIK>)OXCFq zcft5>!M`A!qJ%ZZJ0@JGg*jSSriJfxpD8As3z`zbO-gtj$k)VA!J7CcSgVQmg5uMl z=%7U}Egq*+IB%)(jR0GC6{d<9vBH!7E1HY3RBmf3>a%QQ!W(^)mBJ=d{5*BnGjx^` zhbX}m5*tE7gc46v84__(mSyv-Nq*M4AeUzF+rmz-u)!3@Wo-nLoT8+`!roh<#u!z7 zDkK^BaGXi$C2W?N#!w0UsD`&%p$k9OQfCNkAd8;xeJLV`fiXCY+nrrzGv{zSjI)fl zIbZ9ZWy%({+p}axrflCGIECAfyetxxg02GM3M!UX&KiGtM;VY$Om3vm3i#F z5lldtNL&Mo5s~&x=L?U*TfI78o_!vZQ~OuY?}*(N266IdW`!$ZqVuM80$XV z<Kq51Q_;CeV(gTddC)RzU`4^e6N) zf5p1K%OatF4=I)F^*U@ZL~sQT8=Uw8ylQZ_y(|A$X$;O8dhkiDQYSQ%4E_@>38Iv)Y|= zc!%o;QBZJZe zBRuyAIgijr3ocsNN5^o^Q09yPn|pbPn#PDcM|NMXP9sOC)Mu7SF|1F-vP_>7Eh1#d zGS2#RE_$iSu%7UJ?3*ZNHkj#8(OZs&Q+dT|I366b8AvLlcVuyla+#;ql5L@{#iS*$pN zz0rbEC=uaci>yVYHPJrXDRU;L%9Zv%9g$*9dGu?+gevzxIF!ACk_|n=yB&7WZfhIv z+TGbvML^4oH_@i3VlCjP>|#yTzRMIw%21Uo7SU!6(&*b{W?X9cIV55snj|Lh97DW~ zNFmkKm^4)r240OzNLNy!N+8g`ABn|~SHwf^s_c)P_xst7h*PE2J6x<8xa6c|twYg( zr9x^OWaW~%WKM0z-4dbr=grlI3R~ zHL|Ae)ZP92j`;#?)Evf_;aQChe*%LVdt;&SPoP)eLrpKvR|B;{1IgG{3;zpMp21eM KU=>~ 0 { nodisk + !if poll_drive = 1 { + ldx retstk + txs + } ;poll_drive unrdrvoff1=unrelocdsk+(*-reloc) lda MOTOROFF inc status @@ -1000,6 +1009,10 @@ step1 !byte 1, $30, $28, $24, $20, $1e, $1d, $1c step2 !byte $70, $2c, $26, $22, $1f, $1e, $1d, $1c readadr + !if poll_drive { + lda #0 + sta failcthi + } ;poll_drive - jsr readd5aa cmp #$96 bne - @@ -1015,7 +1028,19 @@ readadr seekret rts readd5aa + !if poll_drive { +unrread0 = unrelocdsk + (* - reloc) +-- lda Q6L + bmi + + inc failctlo + bne -- + inc failcthi + bne -- + jmp nodisk ++ + } else { -- jsr readnib + } - cmp #$d5 bne -- jsr readnib @@ -1042,19 +1067,8 @@ unrdrvsel = unrelocdsk + (* - reloc) } ;allow_multi !if poll_drive = 1 { sty status -unrdrvon1 = unrelocdsk + (* - reloc) - ldy MOTORON -unrread2 = unrelocdsk + (* - reloc) -- ldy Q6L - bpl - -unrread3 = unrelocdsk + (* - reloc) -- cpy Q6L - bne readdirsec - inc status - bne - - pla - pla - jmp nodisk + sty failctlo + sty failcthi } ;poll_drive readdirsec diff --git a/Platform/Apple/virtual/src/core/mem.s b/Platform/Apple/virtual/src/core/mem.s index 5dbbaf13..c43ff625 100644 --- a/Platform/Apple/virtual/src/core/mem.s +++ b/Platform/Apple/virtual/src/core/mem.s @@ -27,8 +27,8 @@ ; Constants MAX_SEGS = 96 -DEBUG = 1 -SANITY_CHECK = 1 ; also prints out request data +DEBUG = 0 +SANITY_CHECK = 0 ; also prints out request data ; Zero page temporary variables tmp = $2 ; len 2 @@ -144,16 +144,15 @@ relocate: lda #>brkHandler sta $FFFF ; Place the bulk of the memory manager code into the LC - ldx #>hiMemBegin -.cpmm stx .ld4+2 + ldx #>(hiMemEnd-hiMemBegin+$FF) .ld4 lda hiMemBegin,y .st4 sta $D000,y iny bne .ld4 + inc .ld4+2 inc .st4+2 - inx - cpx #>(hiMemEnd+$100) - bne .cpmm + dex + bne .ld4 ; fall through into init... ;------------------------------------------------------------------------------ @@ -1115,6 +1114,7 @@ setMarkPos: !fill 3 nSegsQueued: !byte 0 bufferDigest: !fill 4 diskActState: !byte 0 +floppyDrive: !byte 0 ;------------------------------------------------------------------------------ ; Heap management variables @@ -1947,8 +1947,10 @@ openPartition: !zone ; Make sure to read header into main mem, even if outer cmd is aux lda isAuxCmd pha - lda #0 +.retry lda #0 sta isAuxCmd ; header buf always in main mem + lda floppyDrive + sta .origFloppy ; complete the partition file name, changing "1" to "2" if opening partition 2. .mkname lda curPartition bne + @@ -1969,11 +1971,12 @@ openPartition: !zone sta reqLen lda #0 sta reqLen+1 - lda #cmdread ; no hi bit => go to drive 1 + lda #cmdread + ora floppyDrive ; $80 for drive 2 sta tmp clc jsr callProRWTS ; opendir - bne .insert ; status: zero=ok, 1=err + bne .flip ; status: zero=ok, 1=err sta curMarkPos+1 ; by opening we did an implicit seek to zero sta curMarkPos+2 lda #2 ; and then we read 2 bytes @@ -1996,6 +1999,11 @@ openPartition: !zone pla sta isAuxCmd ; back to aux if that's what outer was using rts +.flip lda floppyDrive + eor #$80 + sta floppyDrive + cmp .origFloppy + bne .open ; ask user to insert the disk ; TODO: handle dual drive configuration .insert +safeHome @@ -2008,7 +2016,8 @@ openPartition: !zone +waitKey +safeHome bit $c050 - jmp .open ; try again + jmp .retry ; try again +.origFloppy: !byte 0 ;------------------------------------------------------------------------------ sequenceError: !zone @@ -2903,4 +2912,4 @@ tableEnd = * } } ; end of !pseudopc $D000 -hiMemEnd = * \ No newline at end of file +hiMemEnd = *