Compare commits

...

3 Commits

Author SHA1 Message Date
Wayne Warthen
d3f5643791 CH Driver Tweaks 2023-09-24 16:47:36 -07:00
Wayne Warthen
5299d24379 Merge pull request #363 from skullandbones/Issue-362_RPI4_no_bios.bin_v1
zxcc: Fix for load bios.bin failure on a RPi4
2023-09-24 16:25:50 -07:00
Dean Jenkins
a229db96a6 zxcc: Fix for load bios.bin failure on a RPi4
Fix load_bios() when used on a Raspberry Pi4.

The defect was corrupting the path of the zxcc executable.

The fix is to NUL terminate the path string from the readlink()
call.
2023-09-24 17:04:35 +01:00
4 changed files with 15 additions and 7 deletions

View File

@@ -9,7 +9,7 @@
; his code in FUZIX (https://github.com/EtchedPixels/FUZIX).
;
; NOTES:
; - There seem to compatibility issues with older USB thumb drives.
; - There seem to be compatibility issues with older USB thumb drives.
; Such drives will complete DISK_INIT successfully, but then return
; an error attempting to do any I/O. The error is $17 indicating
; the CH37x encountered an overflow during communication with the
@@ -21,13 +21,13 @@
; will clear this, but the RESET_ALL command is very problematic on
; the CH376. On the CH376, the hardware reset takes a very long
; time (much longer than the documentation suggests). It seems to
; work find on the CH375, but since you don't know what chip you
; work fine on the CH375, but since you don't know what chip you
; are dealing with at that point, I have given up on using it.
;
; TODO:
; - Implement auto-recovery on error status.
;
CHUSB_FASTIO .EQU FALSE ; USE INIR/OTIR?
CHUSB_FASTIO .EQU TRUE ; USE INIR/OTIR?
;
; PORT OFFSETS FROM BASE PORT
;
@@ -324,7 +324,7 @@ CH_FLUSH1:
;
;
CH_DETECT:
PRTS("\r\nDETECT:$") ; *DEBUG*
;PRTS("\r\nDETECT:$") ; *DEBUG*
CH_DETECT1:
LD A,CH_CMD_EXIST ; LOAD COMMAND
CALL CH_CMD ; SEND COMMAND

View File

@@ -2,7 +2,7 @@
#DEFINE RMN 3
#DEFINE RUP 0
#DEFINE RTP 0
#DEFINE BIOSVER "3.3.0-dev.56"
#DEFINE BIOSVER "3.3.0-dev.57"
#define rmj RMJ
#define rmn RMN
#define rup RUP

View File

@@ -3,5 +3,5 @@ rmn equ 3
rup equ 0
rtp equ 0
biosver macro
db "3.3.0-dev.56"
db "3.3.0-dev.57"
endm

View File

@@ -127,7 +127,15 @@ void load_bios(void)
uint32_t size = CPM_MAXPATH - 8;
_NSGetExecutablePath(dir, &size);
#else
readlink("/proc/self/exe", dir, CPM_MAXPATH - 8); /* allow room for bios.bin */
ssize_t len;
len = readlink("/proc/self/exe", dir, CPM_MAXPATH - 8); /* allow room for bios.bin */
if (len < 0)
{
/* len of -1 indicates an error occurred */
len = 0;
}
/* Terminate the dir string with a NUL character */
dir[len] = 0;
#endif
q = strrchr(dir, DIRSEPCH);
*++q = 0;