From 0346e9aa84d1b3b33f833f1e32e8718052f1768a Mon Sep 17 00:00:00 2001 From: Philip Smart Date: Mon, 19 Apr 2021 00:38:35 +0100 Subject: [PATCH] directory cache bug fix --- buildall | 42 ++++++++++++++++-------------- common/tranzputer.c | 13 +++++---- include/tranzputer.h | 2 +- libraries/lib/libimath2-k64f.a | Bin 15012 -> 15012 bytes libraries/lib/libimath2-zpu.a | Bin 5072 -> 5072 bytes libraries/lib/libumansi-k64f.a | Bin 126938 -> 126938 bytes libraries/lib/libumansi-zpu.a | Bin 51150 -> 51150 bytes libraries/lib/libummath-k64f.a | Bin 2660 -> 2660 bytes libraries/lib/libummath-zpu.a | Bin 1352 -> 1352 bytes libraries/lib/libummathf-k64f.a | Bin 64036 -> 64036 bytes libraries/lib/libummathf-zpu.a | Bin 39292 -> 39292 bytes libraries/lib/libummisc-k64f.a | Bin 6222 -> 6222 bytes libraries/lib/libummisc-zpu.a | Bin 3374 -> 3374 bytes libraries/lib/libumstdio-k64f.a | Bin 80050 -> 80050 bytes libraries/lib/libumstdio-zpu.a | Bin 32528 -> 32528 bytes rtl/IOCP_zOS_BootROM.vhd | 8 +++--- rtl/TZSW_DualPort3264BootBRAM.vhd | 8 +++--- rtl/TZSW_DualPortBootBRAM.vhd | 8 +++--- rtl/TZSW_SinglePortBootBRAM.vhd | 8 +++--- rtl/zOS_BootROM.vhd | 8 +++--- rtl/zOS_DualPort3264BootBRAM.vhd | 8 +++--- rtl/zOS_DualPortBootBRAM.vhd | 8 +++--- rtl/zOS_SinglePortBootBRAM.vhd | 8 +++--- zOS/src/zOS.cpp | 26 +++++++++++++----- 24 files changed, 82 insertions(+), 65 deletions(-) diff --git a/buildall b/buildall index b3d53a8..d819036 100755 --- a/buildall +++ b/buildall @@ -1,7 +1,8 @@ #!/bin/bash # Target machine, used to select the right software for the SD card. -TARGET=MZ-700 +#TARGET=MZ-700 +TARGET=MZ-80A ZPU_SHARPMZ_BUILD=1 ZPU_SHARPMZ_APPADDR=0x100000 @@ -81,11 +82,11 @@ fi # Ensure the TZFS target directories exist k64fsddir=${ROOT_DIR}/zSoft/SD/K64F tzfsdir=${ROOT_DIR}/tranZPUter/software -mkdir -p $k64fsddir/TZFS/ -mkdir -p $k64fsddir/MZF/ -mkdir -p $k64fsddir/CPM/ -mkdir -p $k64fsddir/BAS -mkdir -p $k64fsddir/CAS +#mkdir -p $k64fsddir/TZFS/ +#mkdir -p $k64fsddir/MZF/ +#mkdir -p $k64fsddir/CPM/ +#mkdir -p $k64fsddir/BAS +#mkdir -p $k64fsddir/CAS ( cd $tzfsdir @@ -110,21 +111,22 @@ if [ $? != 0 ]; then exit 1 fi +# Use copytosd.sh to transfer files to an SD card. Still need to copy the k64F files manually. # Copy across all the Z80/TZFS software into the target, keep it in one place for placing onto an SD card! -cp $tzfsdir/roms/tzfs.rom $k64fsddir/TZFS/ -cp $tzfsdir/roms/monitor_SA1510.rom $k64fsddir/TZFS/SA1510.rom -cp $tzfsdir/roms/monitor_80c_SA1510.rom $k64fsddir/TZFS/SA1510-8.rom -cp $tzfsdir/roms/monitor_1Z-013A.rom $k64fsddir/TZFS/1Z-013A.rom -cp $tzfsdir/roms/monitor_80c_1Z-013A.rom $k64fsddir/TZFS/1Z-013A-8.rom -cp $tzfsdir/roms/monitor_1Z-013A-KM.rom $k64fsddir/TZFS/1Z-013A-KM.rom -cp $tzfsdir/roms/monitor_80c_1Z-013A-KM.rom $k64fsddir/TZFS/1Z-013A-KM-8.rom -cp $tzfsdir/roms/MZ80B_IPL.rom $k64fsddir/TZFS/MZ80B_IPL.rom -cp $tzfsdir/MZF/Common/CPM223.MZF $k64fsddir/MZF/ -cp $tzfsdir/roms/cpm22.bin $k64fsddir/CPM/ -cp $tzfsdir/CPM/SDC16M/RAW/* $k64fsddir/CPM/ -cp $tzfsdir/MZF/${TARGET}/* $k64fsddir/MZF/ -cp $tzfsdir/BAS/* $k64fsddir/BAS/ -cp $tzfsdir/CAS/* $k64fsddir/CAS/ +#cp $tzfsdir/roms/tzfs.rom $k64fsddir/TZFS/ +#cp $tzfsdir/roms/monitor_SA1510.rom $k64fsddir/TZFS/SA1510.rom +#cp $tzfsdir/roms/monitor_80c_SA1510.rom $k64fsddir/TZFS/SA1510-8.rom +#cp $tzfsdir/roms/monitor_1Z-013A.rom $k64fsddir/TZFS/1Z-013A.rom +#cp $tzfsdir/roms/monitor_80c_1Z-013A.rom $k64fsddir/TZFS/1Z-013A-8.rom +#cp $tzfsdir/roms/monitor_1Z-013A-KM.rom $k64fsddir/TZFS/1Z-013A-KM.rom +#cp $tzfsdir/roms/monitor_80c_1Z-013A-KM.rom $k64fsddir/TZFS/1Z-013A-KM-8.rom +#cp $tzfsdir/roms/MZ80B_IPL.rom $k64fsddir/TZFS/MZ80B_IPL.rom +#cp $tzfsdir/roms/cpm22.bin $k64fsddir/CPM/ +#cp $tzfsdir/CPM/SDC16M/RAW/* $k64fsddir/CPM/ +#cp $tzfsdir/MZF/Common/*.MZF $k64fsddir/MZF/ +#cp $tzfsdir/MZF/${TARGET}/* $k64fsddir/MZF/ +#cp $tzfsdir/BAS/* $k64fsddir/BAS/ +#cp $tzfsdir/CAS/* $k64fsddir/CAS/ ) if [ $? != 0 ]; then exit 1 diff --git a/common/tranzputer.c b/common/tranzputer.c index 05bf351..cbbc6dc 100644 --- a/common/tranzputer.c +++ b/common/tranzputer.c @@ -26,7 +26,7 @@ // this code but is suspended if zOS launches an application which will call this // functionality. // Credits: -// Copyright: (c) 2019-2020 Philip Smart +// Copyright: (c) 2019-2021 Philip Smart // // History: v1.0 May 2020 - Initial write of the TranZPUter software. // v1.1 July 2020 - Updated for v1.1 of the hardware, all pins have been routed on the PCB @@ -57,6 +57,9 @@ // Found and fixed a major bug introduced in v1.4. The Z80 direction // wasnt being set on occasion so an expected write wouldnt occur // which led to some interesting behaviour! +// v1.6 Apr 2021 - Fixed a SD directory cache bug when switching between directories. +// The bug occurs due to an interaction between the heap management +// and threads. // // Notes: See Makefile to enable/disable conditional components // @@ -2079,7 +2082,7 @@ FRESULT loadMZFZ80Memory(const char *src, uint32_t addr, uint32_t *bytesRead, en if(mzfHeader.attr >= 0xF8) { addr += ((mzfHeader.attr & 0x07) << 16); - printf("CPM: Addr=%08lx, Size=%08lx\n", addr, mzfHeader.fileSize); + //printf("CPM: Addr=%08lx, Size=%08lx\n", addr, mzfHeader.fileSize); } else { addr += addrOffset; @@ -3529,7 +3532,7 @@ uint8_t svcCacheDir(const char *directory, enum FILE_TYPE type, uint8_t force) // Open the file so we can read out the MZF header which is the information TZFS/CPM needs. // result = f_open(&File, fqfn, FA_OPEN_EXISTING | FA_READ); - + // If no error occurred, read in the header. // if(!result) result = f_read(&File, (char *)&dirEnt, TZSVC_CMPHDR_SIZE, &readSize); @@ -3543,7 +3546,8 @@ uint8_t svcCacheDir(const char *directory, enum FILE_TYPE type, uint8_t force) // Cache this entry. The SD filename is dynamically allocated as it's size can be upto 255 characters for LFN names. The Sharp name is // fixed at 17 characters as you cant reliably rely on terminators and the additional data makes it a constant 32 chars long. osControl.dirMap.mzfFile[fileNo] = (t_sharpToSDMap *)malloc(sizeof(t_sharpToSDMap)); - osControl.dirMap.mzfFile[fileNo]->sdFileName = (uint8_t *)malloc(strlen(fno.fname)+1); + if(osControl.dirMap.mzfFile[fileNo] != NULL) + osControl.dirMap.mzfFile[fileNo]->sdFileName = (uint8_t *)malloc(strlen(fno.fname)+1); if(osControl.dirMap.mzfFile[fileNo] == NULL || osControl.dirMap.mzfFile[fileNo]->sdFileName == NULL) { @@ -3799,7 +3803,6 @@ uint8_t svcLoadFile(enum FILE_TYPE type) { // Call method to load an MZF file. result = loadMZFZ80Memory(fqfn, 0xFFFFFFFF, 0, (svcControl.memTarget == 0 ? TRANZPUTER : MAINBOARD), 1); - // Store the filename, used in reload or immediate saves. // osControl.lastFile = (uint8_t *)realloc(osControl.lastFile, strlen(fqfn)+1); diff --git a/include/tranzputer.h b/include/tranzputer.h index 2c1b097..22eab29 100755 --- a/include/tranzputer.h +++ b/include/tranzputer.h @@ -452,7 +452,7 @@ //#define readCtrlLatch() ( ((GPIOB_PDIR & 0x00000200) >> 5) | (GPIOB_PDIR & 0x0000000f) ) #define readCtrlLatchDirect() ( inZ80IO(IO_TZ_CTRLLATCH) ) #define readCtrlLatch() ( readZ80IO(IO_TZ_CTRLLATCH, TRANZPUTER) ) -#define writeCtrlLatch(a) { printf("WL:%02x\n", a); setZ80Direction(WRITE); outZ80IO(IO_TZ_CTRLLATCH, a); } +#define writeCtrlLatch(a) { setZ80Direction(WRITE); outZ80IO(IO_TZ_CTRLLATCH, a); } //#define setZ80Direction(a) { for(uint8_t idx=Z80_D0; idx <= Z80_D7; idx++) { if(a == WRITE) { pinOutput(idx); } else { pinInput(idx); } }; z80Control.busDir = a; } #define setZ80Direction(a) {{ if(a == WRITE) { setZ80DataAsOutput(); } else { setZ80DataAsInput(); } }; z80Control.busDir = a; } #define reqZ80BusChange(a) { if(a == MAINBOARD_ACCESS && z80Control.ctrlMode == TRANZPUTER_ACCESS) \ diff --git a/libraries/lib/libimath2-k64f.a b/libraries/lib/libimath2-k64f.a index 15ac5267cce34c79a6abb7192cc0e879a4ea1d33..330b5596241155229bf686bbf76fe05ecd56719a 100644 GIT binary patch delta 93 zcmZ2dx} delta 93 zcmZ2dx}E1L?%y|Ah}u9SO%_f@&g`;%?UP0#yYrNM3xob ztRL_SF0ff4YA>7vwsf;giX+@YplM>87v+=-!0g+sQ2P?5-eR*rdnJN1VS*u?1NN!W zEVxfCCJVGnY+kY$NyP&m@y(ytJcDc5{9xNgn7tO04~R)@-msq&A$#Bi+?^I6KTc1` zX0)4}7a+9x&80-RGO)e-?jYF<@_^p6^Dqwp^=@<8?Djn$VHGIAuKeE$H)A_6=ocbM zZ%f!dLx?dDF0%cD6yrg-YM@)hx1U#Gw1Y*71vrwn>*zCE1L?%y|Ah}u9SO%_f@&g`;%?UP0#yYrNM3xob ztRL_SF0ff4YA>7vwsf;giX+TIGoWc=n-}Gj3qb8N+pJLg5~kj4vp{<#f-_-)A)EvD zsnIOBPt7I^v`cJWvKUFl10M0spVvHtYuWr@+eU=F2gD>cZ`jX?kUek$?oN=aB&H{1 zGulng3lQ4;=29YD8Q9)^caZD_c|h;kdAJ8AKiKB9+3kBi!YWXJUHQKiZpLObF!d?LcpDgzE!&cY9MQBf`I+D3sj(wT`g` z;ogRJ#=CGW5ZBdAWSj_h9mFc_IgEb1Fsrr$9V7_nfz!qIAKMra31hp%e#S_+q1zXn kU|b02O$S=&w7u&R<7~LlWMF)5ce%s(72zsiQl7;H0Bl?GVPVM>Nvky_LP(0%bi33N%yQ?0(Pn_C4o(ew_39KJA;H_Du&Z*1n(=5GASDb|L(|#eN_{ zjY%(5`-l@>Ei2WA6i~w+rSf&&)1)jDp?G@61&4cP@f z10Sft5JQ8H|6St4=mPeUBu-f-=VKe#Ao3h+MhYlM1S%N);tdE-=$X=R*mQBS!@#FU zy-agEks=&WnC-MxZxH{!Vfjp_h^kg{LvgiU513MD4y|iE2N8&DK{%l&m)GC)g(&>i z1?Hq1`7DFb)~A6&cZlx%SosbNkx1VlLeZvRd-vTSN-298wU$#@QlY~sq_FR+9OI>s zJ9$Qa*fRTe&$ekC}mHUcbNT6ur JSZJk2^DiHS?hpU~ delta 800 zcmX@t&wQ?*d4e>%nYpE@k*VcIrR7Xew)y4@OpMGh&SU`>@y+j9(+~mx%`+qx!Xzv< zJIGvwb0z~-ZPr)#hY+~Hl(>1S$^w{87L!3%PgRFo4HRG!+Z?AgnHy@g1=tLJGh{RJ zBsS|xbGi2_gn<{BfCl>gf(vYR z2!w|z$c5sY<3rSt^aDNhHXLCc*bl3s)H&gP07paeB7~L$hb1>}Oy_|GFeDsga}eRM z`9dBmOt~d6lz_os_z~tHpuiT1%`ByoF#VR`P_nN4#>@su5|hsZ9qCv5pB?H1h=T0a zO$aj!4uoy4>io=vtfQ-EG8bG2$kEo*!;p+j+Wd1C+?$r07tFngaFK(I>*l=+df?`7 z4p=f3;kUbNT*NoWGN$pt1>UWf*!+n9C|qFkI=N0x znCxadjfrs1(|13V>#JQ zLvr)(eI*FxAW!(6P(%pWX)M_+b?Ge!TtDA!U4*QhwbSO7C({uEpa8Ud_nI338%J+C delta 358 zcmZ4Tg?Y&r<_Xg5X6BZr#s=mam1G&AY_rM#T*NoWGN$pt1>UWf*!+n9C|qFkI=N0x znCxadjfrs1Hr({<-|*h3oqlR0!ux=DRJixi5hep>$s6L1bCU z&GqF1a9OYu*EW>#!wj1&XDzYWX~I&N3iHkHWBYe4wPNL7UmoC$#xo& xn|JRkK_~}#!taD4LcmUA$!4ibZ#m%l`EKhXWaX@#Hn%*Pjt~F^pyj*Q+yH35Z>0bL diff --git a/libraries/lib/libummathf-zpu.a b/libraries/lib/libummathf-zpu.a index 1611a848db789f61c50f15b611fc991c193960b7..bc3adefbb8ebff0b5f7bffedeac749e01e29a13c 100644 GIT binary patch delta 382 zcmeyfiRsTKrU}yQ7G_2UhDOF4m1G&AY@^BVWW+YdFy7}z5s2X3&4VIfAhn$dCb0RP zOfL(J1JXZvLu2aZzlv(i$by?4RA-|K{Ll#JLQ#=p%#JEB!S*oR7O=w#9MpMXS~kz~ zHAJy?^P9kIKDcaLf-EbH1J*ku^*X9yJsIj8C@L-#d`9)!38$+^?ig{3DGYzF@XaBP!38$+^?gLOQf6WT2LL}#cT4~P diff --git a/libraries/lib/libummisc-k64f.a b/libraries/lib/libummisc-k64f.a index b9111dbc3ebd5ad704635b08eab7415b16343ed2..7359d1bc4abb94d5c43b3dda9d317d847df1eb3c 100644 GIT binary patch delta 42 ncmX?SaL!^oJDC-jkwpC106x?V=Kufz delta 48 rcmZ1{wN7e+G`pF(rKypb@kAwmDAQ>312#wI%{!SDm|>DY5kEEnLdXpe diff --git a/libraries/lib/libumstdio-k64f.a b/libraries/lib/libumstdio-k64f.a index 4860e710a224afe6df0fcd8d4d7a41eeb6c2d678..64b6c69167b12a7cd2e9011e7f065a5c1efb8a98 100644 GIT binary patch delta 394 zcmdn=k!90ImI>1A7G_2UhGv!$WpTo@qnjyZ~*>xEoOv~mE!Dz~j63u1cvIVtsxnUfzUhU2_Wb2|P+sUwP{xS6^ zvY`0p+l#iL3anp$4B1iQnC!uBjnZfSjHGs0h`J|L=uRRp|c- nLJ`1AX6BZr#s=mam5Lc*?8zU3B{pwi^yEbn5Z^4#e~1T3Kw|SBX;owu zVw>$WpTo@qnjyZ~*>xEoOv~mE!Dz~j63u1cvIVtsxnUfzUhU2_Wb2|P+sUwP{xS6^ zvY`0p+l#iL3anp$4B1iQnC!uBjnZfSjHGs0h`J|L=uRRp|c- nLJ`n_)JXOa`eq9KH>%Vsk?jBeJZ-<^^#F;j&;C)+b(q`4Z$HvCVm@v*7}p w1v1aVIbi4h&UuE=FOccFS+}4AS%ui*82w6vf07wDypop?<1Ii(PWT* zRfuiAR2+#=0dk>7*>Z#%Kmt6~EGz*3TV|&K diff --git a/rtl/IOCP_zOS_BootROM.vhd b/rtl/IOCP_zOS_BootROM.vhd index 94f4912..527af64 100644 --- a/rtl/IOCP_zOS_BootROM.vhd +++ b/rtl/IOCP_zOS_BootROM.vhd @@ -16006,11 +16006,11 @@ shared variable ram : ram_type := 16968 => x"7a4f5300", 16969 => x"2a2a2025", 16970 => x"73202800", - 16971 => x"31312f30", - 16972 => x"332f3230", + 16971 => x"31372f30", + 16972 => x"342f3230", 16973 => x"32310000", - 16974 => x"76312e31", - 16975 => x"6b000000", + 16974 => x"76312e32", + 16975 => x"00000000", 16976 => x"205a5055", 16977 => x"2c207265", 16978 => x"76202530", diff --git a/rtl/TZSW_DualPort3264BootBRAM.vhd b/rtl/TZSW_DualPort3264BootBRAM.vhd index 38259ee..82b0bb6 100644 --- a/rtl/TZSW_DualPort3264BootBRAM.vhd +++ b/rtl/TZSW_DualPort3264BootBRAM.vhd @@ -7541,7 +7541,7 @@ architecture arch of DualPort3264BootBRAM is 7460 => x"00", 7461 => x"00", 7462 => x"30", - 7463 => x"31", + 7463 => x"32", 7464 => x"55", 7465 => x"30", 7466 => x"25", @@ -34858,7 +34858,7 @@ architecture arch of DualPort3264BootBRAM is 7459 => x"20", 7460 => x"7a", 7461 => x"73", - 7462 => x"33", + 7462 => x"34", 7463 => x"76", 7464 => x"20", 7465 => x"76", @@ -62175,7 +62175,7 @@ architecture arch of DualPort3264BootBRAM is 7458 => x"20", 7459 => x"00", 7460 => x"2a", - 7461 => x"31", + 7461 => x"37", 7462 => x"31", 7463 => x"00", 7464 => x"20", @@ -71283,7 +71283,7 @@ architecture arch of DualPort3264BootBRAM is 7460 => x"2a", 7461 => x"31", 7462 => x"32", - 7463 => x"6b", + 7463 => x"00", 7464 => x"2c", 7465 => x"32", 7466 => x"73", diff --git a/rtl/TZSW_DualPortBootBRAM.vhd b/rtl/TZSW_DualPortBootBRAM.vhd index baf667c..4d79fe7 100644 --- a/rtl/TZSW_DualPortBootBRAM.vhd +++ b/rtl/TZSW_DualPortBootBRAM.vhd @@ -14994,7 +14994,7 @@ architecture arch of DualPortBootBRAM is 14923 => x"30", 14924 => x"30", 14925 => x"00", - 14926 => x"31", + 14926 => x"32", 14927 => x"00", 14928 => x"55", 14929 => x"65", @@ -51403,7 +51403,7 @@ architecture arch of DualPortBootBRAM is 14920 => x"4f", 14921 => x"2a", 14922 => x"20", - 14923 => x"31", + 14923 => x"37", 14924 => x"2f", 14925 => x"31", 14926 => x"31", @@ -69610,10 +69610,10 @@ architecture arch of DualPortBootBRAM is 14921 => x"2a", 14922 => x"73", 14923 => x"31", - 14924 => x"33", + 14924 => x"34", 14925 => x"32", 14926 => x"76", - 14927 => x"6b", + 14927 => x"00", 14928 => x"20", 14929 => x"2c", 14930 => x"76", diff --git a/rtl/TZSW_SinglePortBootBRAM.vhd b/rtl/TZSW_SinglePortBootBRAM.vhd index d206624..9fbb703 100644 --- a/rtl/TZSW_SinglePortBootBRAM.vhd +++ b/rtl/TZSW_SinglePortBootBRAM.vhd @@ -14989,7 +14989,7 @@ architecture arch of SinglePortBootBRAM is 14923 => x"30", 14924 => x"30", 14925 => x"00", - 14926 => x"31", + 14926 => x"32", 14927 => x"00", 14928 => x"55", 14929 => x"65", @@ -51398,7 +51398,7 @@ architecture arch of SinglePortBootBRAM is 14920 => x"4f", 14921 => x"2a", 14922 => x"20", - 14923 => x"31", + 14923 => x"37", 14924 => x"2f", 14925 => x"31", 14926 => x"31", @@ -69605,10 +69605,10 @@ architecture arch of SinglePortBootBRAM is 14921 => x"2a", 14922 => x"73", 14923 => x"31", - 14924 => x"33", + 14924 => x"34", 14925 => x"32", 14926 => x"76", - 14927 => x"6b", + 14927 => x"00", 14928 => x"20", 14929 => x"2c", 14930 => x"76", diff --git a/rtl/zOS_BootROM.vhd b/rtl/zOS_BootROM.vhd index 5ed37ed..2236cd2 100644 --- a/rtl/zOS_BootROM.vhd +++ b/rtl/zOS_BootROM.vhd @@ -14985,11 +14985,11 @@ shared variable ram : ram_type := 14920 => x"7a4f5300", 14921 => x"2a2a2025", 14922 => x"73202800", - 14923 => x"31312f30", - 14924 => x"332f3230", + 14923 => x"31372f30", + 14924 => x"342f3230", 14925 => x"32310000", - 14926 => x"76312e31", - 14927 => x"6b000000", + 14926 => x"76312e32", + 14927 => x"00000000", 14928 => x"205a5055", 14929 => x"2c207265", 14930 => x"76202530", diff --git a/rtl/zOS_DualPort3264BootBRAM.vhd b/rtl/zOS_DualPort3264BootBRAM.vhd index 3b69df0..0250b55 100644 --- a/rtl/zOS_DualPort3264BootBRAM.vhd +++ b/rtl/zOS_DualPort3264BootBRAM.vhd @@ -7541,7 +7541,7 @@ architecture arch of DualPort3264BootBRAM is 7460 => x"00", 7461 => x"00", 7462 => x"30", - 7463 => x"31", + 7463 => x"32", 7464 => x"55", 7465 => x"30", 7466 => x"25", @@ -34858,7 +34858,7 @@ architecture arch of DualPort3264BootBRAM is 7459 => x"20", 7460 => x"7a", 7461 => x"73", - 7462 => x"33", + 7462 => x"34", 7463 => x"76", 7464 => x"20", 7465 => x"76", @@ -62175,7 +62175,7 @@ architecture arch of DualPort3264BootBRAM is 7458 => x"20", 7459 => x"00", 7460 => x"2a", - 7461 => x"31", + 7461 => x"37", 7462 => x"31", 7463 => x"00", 7464 => x"20", @@ -71283,7 +71283,7 @@ architecture arch of DualPort3264BootBRAM is 7460 => x"2a", 7461 => x"31", 7462 => x"32", - 7463 => x"6b", + 7463 => x"00", 7464 => x"2c", 7465 => x"32", 7466 => x"73", diff --git a/rtl/zOS_DualPortBootBRAM.vhd b/rtl/zOS_DualPortBootBRAM.vhd index 2a61521..5956293 100644 --- a/rtl/zOS_DualPortBootBRAM.vhd +++ b/rtl/zOS_DualPortBootBRAM.vhd @@ -14994,7 +14994,7 @@ architecture arch of DualPortBootBRAM is 14923 => x"30", 14924 => x"30", 14925 => x"00", - 14926 => x"31", + 14926 => x"32", 14927 => x"00", 14928 => x"55", 14929 => x"65", @@ -51403,7 +51403,7 @@ architecture arch of DualPortBootBRAM is 14920 => x"4f", 14921 => x"2a", 14922 => x"20", - 14923 => x"31", + 14923 => x"37", 14924 => x"2f", 14925 => x"31", 14926 => x"31", @@ -69610,10 +69610,10 @@ architecture arch of DualPortBootBRAM is 14921 => x"2a", 14922 => x"73", 14923 => x"31", - 14924 => x"33", + 14924 => x"34", 14925 => x"32", 14926 => x"76", - 14927 => x"6b", + 14927 => x"00", 14928 => x"20", 14929 => x"2c", 14930 => x"76", diff --git a/rtl/zOS_SinglePortBootBRAM.vhd b/rtl/zOS_SinglePortBootBRAM.vhd index 4191435..800b21f 100644 --- a/rtl/zOS_SinglePortBootBRAM.vhd +++ b/rtl/zOS_SinglePortBootBRAM.vhd @@ -14989,7 +14989,7 @@ architecture arch of SinglePortBootBRAM is 14923 => x"30", 14924 => x"30", 14925 => x"00", - 14926 => x"31", + 14926 => x"32", 14927 => x"00", 14928 => x"55", 14929 => x"65", @@ -51398,7 +51398,7 @@ architecture arch of SinglePortBootBRAM is 14920 => x"4f", 14921 => x"2a", 14922 => x"20", - 14923 => x"31", + 14923 => x"37", 14924 => x"2f", 14925 => x"31", 14926 => x"31", @@ -69605,10 +69605,10 @@ architecture arch of SinglePortBootBRAM is 14921 => x"2a", 14922 => x"73", 14923 => x"31", - 14924 => x"33", + 14924 => x"34", 14925 => x"32", 14926 => x"76", - 14927 => x"6b", + 14927 => x"00", 14928 => x"20", 14929 => x"2c", 14930 => x"76", diff --git a/zOS/src/zOS.cpp b/zOS/src/zOS.cpp index da7b5d5..8c2c342 100644 --- a/zOS/src/zOS.cpp +++ b/zOS/src/zOS.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////////////////////////////////// // // Name: zOS.cpp -// Created: January 2019 - April 2020 +// Created: January 2019 - April 2021 // Author(s): Philip Smart // Description: ZPU and Teensy 3.5 (Freescale K64F) OS and test application. // This program implements methods, tools, test mechanisms and performance analysers such @@ -9,7 +9,7 @@ // validated and rated in terms of performance. // // Credits: -// Copyright: (c) 2019-2020 Philip Smart +// Copyright: (c) 2019-2021 Philip Smart // (c) 2013 ChaN, framework for the SD Card testing. // // History: January 2019 - Initial script written for the STORM processor then changed to the ZPU. @@ -22,13 +22,17 @@ // July 2020 - Tweaks to accomodate v2.1 of the tranZPUter board. // December 2020 - Updates to allow soft CPU functionality on the v1.3 tranZPUter SW-700 // board. +// April 2021 - Bug fixes to the SD directory cache and better interoperability with +// the MZ-800. Bug found which was introduced in December where the +// Z80 direction wasnt always set correctly resulting in some strange +// and hard to debug behaviour. // // Notes: See Makefile to enable/disable conditional components // USELOADB - The Byte write command is implemented in hw/sw so use it. // USE_BOOT_ROM - The target is ROM so dont use initialised data. // MINIMUM_FUNTIONALITY - Minimise functionality to limit code size. // __ZPU__ - Target CPU is the ZPU -// __K64F__ - Target CPU is the K64F on the Teensy 3.5 +// __K64F__ - Target CPU is the K64F // __SD_CARD__ - Add the SDCard logic. // ///////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -106,8 +110,8 @@ #endif // Version info. -#define VERSION "v1.1k" -#define VERSION_DATE "11/03/2021" +#define VERSION "v1.2" +#define VERSION_DATE "17/04/2021" #define PROGRAM_NAME "zOS" // Utility functions. @@ -260,7 +264,7 @@ void tranZPUterControl(void) { // Locals. uint8_t ioAddr; -testTZFSAutoBoot(); + // Loop waiting on events and processing. // while(1) @@ -367,12 +371,20 @@ int cmdProcessor(void) // Setup memory on Z80 to default. loadTranZPUterDefaultROMS(CPUMODE_SET_Z80); + // Kludge logic. Threads interfere with the heap management and if sufficient space hasnt been allocated and the heap free pointer far enough advanced + // before the thread starts, svcCacheDir may fail on future cache operations of larger directories. + uint8_t *cache = (uint8_t *)malloc(32768); + // Cache initial directory. svcCacheDir(TZSVC_DEFAULT_MZF_DIR, MZF, 1); + // If memory allocated previously, free it. + if(cache != NULL) + free(cache); + // For the tranZPUter, once we know that an SD card is available, launch seperate thread to handle hardware and service functionality. // No SD card = no tranZPUter functionality. - G.ctrlThreadId = threads.addThread(tranZPUterControl, 0, 16384); + G.ctrlThreadId = threads.addThread(tranZPUterControl, 0, 8192); #endif } #endif