From 3771101d3edbb4791e9f5e53825a2b0d7e39ac84 Mon Sep 17 00:00:00 2001 From: MockbaTheBorg Date: Tue, 7 May 2024 14:30:32 -0400 Subject: [PATCH] Fix loop when running SUBMIT and autoexec together --- RunCPM/ccp.h | 6 +++--- RunCPM/main.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/RunCPM/ccp.h b/RunCPM/ccp.h index b7bf295..88137ca 100644 --- a/RunCPM/ccp.h +++ b/RunCPM/ccp.h @@ -688,10 +688,10 @@ void _ccp(void) { for (i = 0; i < 36; ++i) { _RamWrite(BatchFCB + i, _RamRead(tmpFCB + i)); } - + // Loads an autoexec file if it exists and this is the first boot // The file contents are loaded at ccpAddr+8 up to 126 bytes then the size loaded is stored at ccpAddr+7 - if (firstBoot) { + if (firstBoot && !sFlag) { uint8 dmabuf[128]; uint16 cmd = inBuf + 1; if (_sys_exists((uint8*)AUTOEXEC)) { @@ -718,7 +718,7 @@ void _ccp(void) { _RamWrite(inBuf + 1, 0); // Clears the buffer blen = 0; } - + while (TRUE) { curDrive = (uint8)_ccp_bdos(DRV_GET, 0x0000); // Get current drive curUser = (uint8)_ccp_bdos(F_USERNUM, 0x00FF); // Get current user diff --git a/RunCPM/main.c b/RunCPM/main.c index 6cd61aa..33bbadd 100644 --- a/RunCPM/main.c +++ b/RunCPM/main.c @@ -99,7 +99,7 @@ int main(int argc, char* argv[]) { // Loads an autoexec file if it exists and this is the first boot // The file contents are loaded at ccpAddr+8 up to 126 bytes then the size loaded is stored at ccpAddr+7 - if (firstBoot) { + if (firstBoot an not sFlag) { uint8 dmabuf[128]; uint8 bytesread; uint16 cmd = CCPaddr + 7; @@ -123,6 +123,7 @@ int main(int argc, char* argv[]) { if (BOOTONLY) firstBoot = FALSE; } + Z80reset(); // Resets the Z80 CPU SET_LOW_REGISTER(BC, _RamRead(DSKByte)); // Sets C to the current drive/user PC = CCPaddr; // Sets CP/M application jump point