From 83866fced33977844d7f4e08ec921ca88310300a Mon Sep 17 00:00:00 2001 From: Philip Smart Date: Tue, 10 Nov 2020 22:40:33 +0000 Subject: [PATCH] Updates to tzreset and reset mechanism --- apps/tzreset/tzreset.c | 27 +++++++++++++++++++-------- common/tranzputer.c | 21 +++++++++++---------- include/tranzputer.h | 4 ++-- libraries/lib/libimath2-k64f.a | Bin 12504 -> 12504 bytes libraries/lib/libumansi-k64f.a | Bin 124218 -> 124218 bytes libraries/lib/libummath-k64f.a | Bin 2660 -> 2660 bytes libraries/lib/libummathf-k64f.a | Bin 63972 -> 63972 bytes libraries/lib/libummisc-k64f.a | Bin 6222 -> 6222 bytes libraries/lib/libumstdio-k64f.a | Bin 80138 -> 80138 bytes zOS/src/zOS.cpp | 3 --- 10 files changed, 32 insertions(+), 23 deletions(-) diff --git a/apps/tzreset/tzreset.c b/apps/tzreset/tzreset.c index 4e6dddb..a175dd2 100644 --- a/apps/tzreset/tzreset.c +++ b/apps/tzreset/tzreset.c @@ -87,6 +87,7 @@ void usage(void) printf(" -h | --help This help text.\n"); printf(" -r | --reset Perform a hardware reset.\n"); printf(" -l | --load Reload the default ROMS.\n"); + printf(" -m | --memorymode Set the startup memory mode.\n"); printf("\nOptions:-\n"); printf(" -v | --verbose Output more messages.\n"); @@ -111,6 +112,7 @@ uint32_t app(uint32_t param1, uint32_t param2) int verbose_flag = 0; int opt; int option_index = 0; + uint8_t memoryMode = TZMM_ORIG; long val = 0; char *argv[20]; char *ptr = strtok((char *)param1, " "); @@ -137,6 +139,7 @@ uint32_t app(uint32_t param1, uint32_t param2) { {"help", no_argument, 0, 'h'}, {"load", no_argument, 0, 'l'}, + {"memorymode", required_argument, 0, 'm'}, {"reset", no_argument, 0, 'r'}, {"verbose", no_argument, 0, 'v'}, {0, 0, 0, 0} @@ -144,7 +147,7 @@ uint32_t app(uint32_t param1, uint32_t param2) // Parse the command line options. // - while((opt = getopt_long(argc, argv, ":hlrv", long_options, &option_index)) != -1) + while((opt = getopt_long(argc, argv, ":hlm:rv", long_options, &option_index)) != -1) { switch(opt) { @@ -156,6 +159,15 @@ uint32_t app(uint32_t param1, uint32_t param2) load_flag = 1; break; + case 'm': + if(xatoi(&argv[optind-1], &val) == 0 || val >= 0x20) + { + printf("Illegal numeric:%s\n", argv[optind-1]); + return(1); + } + memoryMode = (uint8_t)val; + break; + case 'r': reset_flag = 1; break; @@ -180,17 +192,16 @@ uint32_t app(uint32_t param1, uint32_t param2) return(0); } - // Initialise the IO. - //setupZ80Pins(1, G->millis); - - // Call the reset method to do the hard work. + // Reload the memory on the tranZPUter to boot default if load flag set. // - resetZ80(); - - // Reload the memory on the tranZPUter to boot default. if(load_flag) { loadTranZPUterDefaultROMS(); + } else + { + // Call the reset method to do the hard work. + // + resetZ80(memoryMode); } return(0); diff --git a/common/tranzputer.c b/common/tranzputer.c index bf52e94..55cc234 100644 --- a/common/tranzputer.c +++ b/common/tranzputer.c @@ -532,7 +532,7 @@ void setupZ80Pins(uint8_t initK64F, volatile uint32_t *millisecondTick) // Method to reset the Z80 CPU. // -void resetZ80(void) +void resetZ80(uint8_t memoryMode) { // Locals. // @@ -548,6 +548,13 @@ void resetZ80(void) pinInput(Z80_RESET); __enable_irq(); + // Set the memory mode to the one provided. + // + if(memoryMode != TZMM_ORIG) + { + setCtrlLatch(memoryMode); + } + // Wait a futher settling period before reinstating the interrupt. // while((*ms - startTime) < 400); @@ -2083,14 +2090,11 @@ void loadTranZPUterDefaultROMS(void) // if(!result) { - // Set the memory model to BOOT so we can bootstrap TZFS. - setCtrlLatch(TZMM_BOOT); - // If autoboot flag set, force a restart to the ROM which will call User ROM startup code. if(osControl.tzAutoBoot) { - delay(100); - fillZ80Memory(MZ_MROM_STACK_ADDR, MZ_MROM_STACK_SIZE, 0x00, 1); + // Set the memory model to BOOT so we can bootstrap TZFS. + resetZ80(TZMM_BOOT); } // No longer need refresh on the mainboard as all operations are in static RAM. @@ -3722,7 +3726,7 @@ void processServiceRequest(void) z80Control.disableRefresh = 0; // Now reset the machine so everything starts as power on. - resetZ80(); + resetZ80(TZMM_ORIG); // Disable the interrupts so no further service processing. disableIRQ(); @@ -3855,9 +3859,6 @@ void setupTranZPUter(void) // Check to see if autoboot is needed. osControl.tzAutoBoot = testTZFSAutoBoot(); - - // Ensure the machine is ready by performing a RESET. - resetZ80(); } ////////////////////////////////////////////////////////////// diff --git a/include/tranzputer.h b/include/tranzputer.h index 3b12993..29da0ae 100755 --- a/include/tranzputer.h +++ b/include/tranzputer.h @@ -41,7 +41,7 @@ #define RFSH_BYTE_CNT 256 // Number of bytes we can write before needing a full refresh for the DRAM. #define HOST_MON_TEST_VECTOR 0x4 // Address in the host monitor to test to identify host type. #define DEFAULT_BUSREQ_TIMEOUT 5000 // Timeout for a Z80 Bus request operation in milliseconds. -#define DEFAULT_RESET_PULSE_WIDTH 1000 // Pulse width of a reset signal in |K4F clock ticks. +#define DEFAULT_RESET_PULSE_WIDTH 80000 // Pulse width of a reset signal in K64F clock ticks. // tranZPUter Memory Modes - select one of the 32 possible memory models using these constants. // @@ -642,7 +642,7 @@ extern uint8_t pinMap[MAX_TRANZPUTER_PINS]; void yield(void); #endif void setupZ80Pins(uint8_t, volatile uint32_t *); -void resetZ80(void); +void resetZ80(uint8_t); uint8_t reqZ80Bus(uint32_t); uint8_t reqMainboardBus(uint32_t); uint8_t reqTranZPUterBus(uint32_t); diff --git a/libraries/lib/libimath2-k64f.a b/libraries/lib/libimath2-k64f.a index a5e750c9c72c97110353f4c2f5d327243deae493..5c9b1ab06b21ce6f793c997781098f05a8296a17 100644 GIT binary patch delta 71 zcmcbScq4Iw44Z|ysj0EaM5Q_?Yw|it@r`?D^Fg_rkBw0unl1EXpnq)Oe7M5r>SSW_On3~Wuvr@BQ zemOM@A|(`;r6fs0iruUj=bHPU8N2`cAK&BL8^5r}FYNyE9Cv$bD`R_AuUVl9LO~nt#Nd|V}Woa^(b`4jU>OklYRP@(-^Q~cwwPoC?IMR9d5BK-RB{rfO)(*W% ztk}G`Fg_x&;qst+vYWKfH?^u{dTgA(rQHptV)^n!8fv)Z*9eM4UaSjBX7ok+Xog1g zhict$sk)MA2uv44h2C75jcz_b@`A*Pk)r~+Y?4--OHzF|sp0zV-oJV5K0WtMIkEcX zT1F6Js3d~KkGsh$c`Ksx=RAqn3>K0p;iH&A8FWj6X)Kgn|vH%5>1#j;6SaUn?c-K2t{ySy3!O#ZXE_h#z;8*W#8(XD@jmvXe8$olVmPccieNGT2F-#bkC?1D*EQP)*Ow(*#%f z*1M_fyB(hGbv69732ye)4bB34Y;{V8V718Zn5o!_A1Ibdsj+7bD3{8uDQsj07HnH8 zdzytup<(_Y>|qhs$dje99D;#DGR1uq6X0}yHX0MrRkn2iV?=j&1lv@HxlR}RIEQuW P{Kt*nLPA*K>Jir;Xt3n| diff --git a/libraries/lib/libummath-k64f.a b/libraries/lib/libummath-k64f.a index d96e7c63a1e6313d199c50dc04ab7c583b10c8c8..a46cc14763e4d9911024d970328ed655ddd22532 100644 GIT binary patch delta 27 dcmaDN@N|!(;M>xqq^qhUDhzeWh@< rAb0bfP=fRAG?r|>b@3esOz*i{dT=>8Yp2aFPiDaRps@P+_BA&EpCD_| delta 335 zcmaFznfb|Q<_R)vMrLN_mX;fp(;M>xqq^qhUDhzeWh@< rAb0bfP=fRAG?r|>b@3esOz*i{dT=>8Yp2aFPiDaRps@P+_BA&E7PM@M diff --git a/libraries/lib/libummisc-k64f.a b/libraries/lib/libummisc-k64f.a index b6737875ec122dde288ebac533c912171d1e860b..2383c970d0ee7365760fe0c0f1c373ce111ad0ff 100644 GIT binary patch delta 39 kcmX?SaL!IYh#5R50tri4$mfT0O6$y=>Px# delta 39 kcmX?SaL!IYh#5R50tri4$mfT0N-5-%K!iX diff --git a/libraries/lib/libumstdio-k64f.a b/libraries/lib/libumstdio-k64f.a index 09ba09d11fdcec748a9605c0224586eb46e4e371..6a77f488ba7e86b9be74b3490550ca8b0f8036ca 100644 GIT binary patch delta 391 zcmeDB#M1SNWr7Twg}JGzvB^fI5=IEqc=`ivMv2W^82xyma?>wxFp6)M=ReK^69B7V zkuNrj09cDmh!C2VL>rh3K(>f&UR2w|4buWP!@DyZ#oEa- zAx@jcrd@ywf>kju-i<17d;Mu-o5VLC-g_Qdh1lkGr)D7AB(XW=nijGO@y)9rl_Q%G wzPbLxb!08#n~VR1!?bJ%xkju-i<17d;Mu-o5VLC-g_Qdh1lkGr)D7AB(XW=nijGO@y)9r zl_Q%GzPbLxb!08#n~VR1!?bJ%x