News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_OffseT

UniDOS, the new multi-device AMSDOS replacement

Started by OffseT, 15:51, 24 January 21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

OffseT

Quote from: gms0012 on 07:38, 21 October 22but when I want to start another ROM like m4fe...I got the message "no m4 board detected"...
M4FE relies exclusively on M4 board built-in ROM custom commands to operate. For compatibility reason, these commands are disabled when using UniDOS, that's why M4FE fails to detect M4 Board (actually, it does not seem to detect the M4 Board itself but only the RSX provided by its built-in ROM).

As-is, it is a no go to make it work with UniDOS, some adaptations in M4FE would be required.

gms0012

ok. thanks for the information and help :)

OffseT

#252
UniDOS 1.50 was released! 8)

This is a major release with a lot of visible and invisible modifications.
All DOS nodes were also updated.

For the end user, the most notable update is the full time and date support as well as new RSX.
For the developers, new BIOS and node API came up.

More details on https://unidos.cpcscene.net

zhulien

I have been playing with UniDOS 1.5, it seems to fix quite a few bugs from 1.3x...  However, I cannot use the new UNITOOLS because it locks up scanning, it took a long time to find, but i think it is because i don't have a floppy drive but a floppy emulator - likely the behaviour is why you mention some 3.5" drives make it incompatible.

Any chance for 2 builds of UNITOOLS?  one for scanning boot devices, and one that does not?

zhulien

@OffseT I think I found a couple of UniDOS bugs, possibly with the M4 driver.  That is sometimes getting duplicate entries when performing a CAT and sometimes getting file sizes in G instead of K.  Performing a CAT again, may or may not show the same error or be correct.  I tested on M4 and X-MASS but could only reproduce it (without any obvious pattern) on the M4.

zhulien

Quote from: zhulien on 21:26, 18 June 23@OffseT I think I found a couple of UniDOS bugs, possibly with the M4 driver.  That is sometimes getting duplicate entries when performing a CAT and sometimes getting file sizes in G instead of K.  Performing a CAT again, may or may not show the same error or be correct.  I tested on M4 and X-MASS but could only reproduce it (without any obvious pattern) on the M4.
Very often also when saving a BASIC program over the top of an existing one, it might fail with filenames stuck as MYPROG.$$$ which for some reason cannot be deleted with the era command.

OffseT

Quote from: zhulien on 23:47, 18 June 23
Quote from: zhulien on 21:26, 18 June 23@OffseT I think I found a couple of UniDOS bugs, possibly with the M4 driver.  That is sometimes getting duplicate entries when performing a CAT and sometimes getting file sizes in G instead of K.  Performing a CAT again, may or may not show the same error or be correct.  I tested on M4 and X-MASS but could only reproduce it (without any obvious pattern) on the M4.
Very often also when saving a BASIC program over the top of an existing one, it might fail with filenames stuck as MYPROG.$$$ which for some reason cannot be deleted with the era command.
I'm not aware of this kind of issue. AFAIK, M4 node is stable with latest M4 Board firmware version. For now, the only known issue is related to the sockets which are not working are expected when dealing with FTP: drive (M4 firmware freezes on reading files from FTP:).

You should check:
  • microSD card filesystem (may be corrupted).
  • power supply (random results often happen on low power).
  • M4 firmware version (only latest one is supported by M4 node).

zhulien

Thanks for the tips, I will remove the 2nd Mx4 board to see if power may be the issue, however I am using an external PSU on the 2nd Mx4 board.  I just formatted the sdcard again to see if that fixes things also.


zhulien

@OffseT When i.e. RUN"/ABC" if not at the root, ABC will run, but if at the root, then ABC will fail with a message saying we are already at the root.  What that means is a BASIC program cannot run something always with the same code, sometimes it would need to be RUN"ABC" and sometimes RUN"/ABC".  I am thinking that RUN"/ABC" even if already at the root, should just run ABC.

OffseT

Quote from: zhulien on 17:59, 19 June 23@OffseT When i.e. RUN"/ABC" if not at the root, ABC will run, but if at the root, then ABC will fail with a message saying we are already at the root.  What that means is a BASIC program cannot run something always with the same code, sometimes it would need to be RUN"ABC" and sometimes RUN"/ABC".  I am thinking that RUN"/ABC" even if already at the root, should just run ABC.

I'm not sure I understood your use case.

To sum-up everything:
  • RUN"ABC" will always start ABC from the current directory.
  • RUN"/ABC" will always start ABC from the parent directory; if you are already at the root, it will fail since there is no parent.
  • RUN":ABC" will always start ABC from the root directory of the current drive (whatever the current directory is).

zhulien

Quote from: OffseT on 18:31, 19 June 23
Quote from: zhulien on 17:59, 19 June 23@OffseT When i.e. RUN"/ABC" if not at the root, ABC will run, but if at the root, then ABC will fail with a message saying we are already at the root.  What that means is a BASIC program cannot run something always with the same code, sometimes it would need to be RUN"ABC" and sometimes RUN"/ABC".  I am thinking that RUN"/ABC" even if already at the root, should just run ABC.

I'm not sure I understood your use case.

To sum-up everything:
  • RUN"ABC" will always start ABC from the current directory.
  • RUN"/ABC" will always start ABC from the parent directory; if you are already at the root, it will fail since there is no parent.
  • RUN":ABC" will always start ABC from the root directory of the current drive (whatever the current directory is).

Thanks, I didn't know about :ABC, I was thinking more Unix or MSDOS with the / thinking / meant root, not parent

OffseT

Quote from: zhulien on 21:41, 19 June 23Thanks, I didn't know about :ABC, I was thinking more Unix or MSDOS with the / thinking / meant root, not parent
Nope, in fact '/' is only used for directories while ':' is used for root, making everything generic.
I never thought Unix or MS-DOS ways were good ones (actually I'm quite convinced they are bad ways :P).

DRIVE:PATH/FILE can then be read as "FILE from directory ( / ) PATH at root ( : ) of DRIVE".

UniDOS path handling scheme is explained here:
https://unidos.cpcscene.net/doku.php?id=en:manuel#paths_handling

zhulien

actually i patched protext to instead of run"DISC" to run":EMS" because the autoexec locks up as I have no physical floppy drive, I can at least control+enter whereever I am to launch it. 

zhulien

@OffseT 

Here is my first cut at coding the simplest DOS Node I can think of, it however doesn't appear to initialise - I am not ruling out bugs in the Node, but given the simplicity of it, perhaps you will know right away why it might not initialise as a node when performing a |drive function?  I am assembling direct to ROM space within Maxam within WinAPE.

The streamer is a write-only streamer with a single writer.  hmm, I will check my strcompare in CheckDrive - maybe something to do with me not ignoring Bit 7.

Org &c000

write direct -1,2,#C0

ROMType db 2; 1 (secondary ROM) or 2 (expansion ROM)

ROMMark db 1; It is customary that the version of a ROM
ROMVer db 4; is displayed in the form M VR
ROMRev db 1; (i.e. 1.00 here)

ROMRSX dw RSXTable

jp InitROM
jp DOSNode_Init ; implemented
jp DOSNode_CheckDrive ; implemented
jp DOSNode_GetStatus ; implemented
jp DOSNode_GetName ; implemented
jp DOSNode_GetDesc ; implemented
jp DOSNode_GetFreeSpace ; implemented
jp DOSNode_InOpenStream
jp DOSNode_InReadStream
jp DOSNode_InCloseStream
jp DOSNode_InSeekStream
jp DOSNode_OutOpenStream ; implemented
jp DOSNode_OutWriteStream ; implemented
jp DOSNode_OutCloseStream ; implemented
jp DOSNode_OutSeekStream
jp DOSNode_Examine
jp DOSNode_ExamineNext
jp DOSNode_Rename
jp DOSNode_Delete
jp DOSNode_CreateDir
jp DOSNode_SetProtection
jp DOSNode_Format
jp DOSNode_SetFileDate
jp DOSNode_Void
jp DOSNode_Void
jp DOSNode_Void
jp DOSNode_ReadRTC
jp DOSNode_WriteRTC
jp DOSNode_OpenNVRAM
jp DOSNode_CloseNVRAM
jp DOSNode_ReadNVRAM
jp DOSNode_WriteNVRAM
jp DOSNode_SeekNVRAM
; You can add your personal RSX here (if ROM type 1)

RSXTable
str "SCREEN STREAMER"
str "DOS Node"

db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80

; You can add your personal RSX here (if ROM type 1)
db 0; End of the RSX table

        ; Actual ROM code starts here
InitROM: cp a
ret

BYTES_FREE_HW equ #ffff ; high word
BYTES_FREE_LW equ #ffff ; low word
READER_COUNT equ 1 ; number of readers
TXT_OUT_CHAR equ #bb5a

DriveName: text "SCR"
db 0
DriveNameStr: text "SC"
db "R" + #80, 0
DriveNameDsc: text "Vorax Screen Streame"
db "r" + #80, 0

;
; Initialize the noeud DOS
;
; Input   - A = initialization status (see flags Init_*)
;               Bit0 = 1 if the CPC is doing a cold boot
;               Other bits are unused
; Output  - If Carry = 1 then the node was intialized
;               If Z then a non volatile memory handler is available in this node (2K mini)
;               If NZ then non voltile memory handler is not available
;                   A = error code
;           If Carry = 0 then the node could not be initialized
; Altered - AF

DOSNode_Init: jp DOSNode_Success

;
; Check if a drive name is handled by the DOS node
;
; Input   - HL = pointer to the drive name
;                (bit 7 could be set on some character and mush be ignored)
;           C = length of the drive name
; Output - If Carry = 1 a drive was found in the node
;                A = physical drive number
;           If Carry = 0 the drive was not found in the node
; Altered - AF

DOSNode_CheckDrive:
push de
push hl
ld de, DriveName
ex de, hl
call StrCompare
pop hl
pop de
jp nz, DOSNode_Fail

ld a, READER_COUNT
jp DOSNode_Success

;
; Return a drive status
;
; Input   - A = drive number
; Output  - If Carry = 1 a status was returned
;                A = status of the drive (see flags flags Media_*)
;                    Bit0 = 1 if a media is inserted in the drive
;                    Bit1 = 1 if the media support directories
;                    Bit2 = 1 if the media is write protected
;                    Bit3 = 1 if the media is removable
;                    Bit4 = 1 if the media is a stream (linear read/write only)
;                        $$$ and BAK filesis then disabled
;                    Bit5 = 1 if the media can be reached by the new UniDOS API
;                    Other bits are unused
;           If Carry = 0 then the drive is unknown and no status was returned
; Alteted - AF

DOSNode_GetStatus:
call ValidateReader
ret nc

ld a, %000010001
jp DOSNode_Success

;
; Return the name corresponding to a physical drive
;
; Input   - A = drive number
;           DE = address of a buffer of 8 bytes when to store the name
; Output  - If Carry = 1 the name was found
;                DE points to the first character after the end of the copied string
;                (the string is stored with the bit 7 of its last character set)
;          If Carry = 0 not description was found and the buffer is left unchanged.
; Altered - AF,DE

DOSNode_GetName:
call ValidateReader
ret nc

push hl
ld hl, DriveNameStr
call StrCopy
pop hl
jp DOSNode_Success

;
; Return the description corresponding to a physical drive
;
; Input  - A = drive number
;          DE = addess of the 32 bytes buffer where to store the description
; Ouput  - If Carry = 1 a description was found
;                DE points to the first character after the end of the copied string
;                (the string is stored with the bit 7 of its last character set)
;          If Carry = 0 not description was found and the buffer is left unchanged.
; Altered - AF,DE

DOSNode_GetDesc:
call ValidateReader
ret nc

push hl
ld hl, DriveNameDsc
call StrCopy
pop hl
jp DOSNode_Success

;
; Return the free space on a physical drive
;
; Input   - A = drive number
; Output  - If Carry = 1 the routine is supported for this drive
;                If Z then the free space could be obtained
;                    BCDE = free space in kilo-bytes
;                If NZ then an error occured
;                    A = error code
;           If Carry = 0 then the routines is invalid for this drive
; Altered - AF,BC,DE

DOSNode_GetFreeSpace:
call ValidateReader
ret nc

ld bc, BYTES_FREE_HW
ld de, BYTES_FREE_LW
xor a
jp DOSNode_Success

;
; Open the input stream
;
; Input   - A = drive number
;           HL = pointer to the normalized name
;               note, if the drive is of type stream then this name can
;               contain 11x&ff in case where no file name was provided
;               by the user (when he uses the anonymous reference ".");
;               the routine should then just open the just encountered
;               file on the stream and can optionally update the name
;               if it could be obtained from the stream itself
;          DE = pointer the normalized path
;          The pointed memory is always located in the current ROM/RAM space area
; Ouput  - If Carry = 1 the routine is supported for the provided drive
;                If Z then a file was opened
;                If NZ then no file could be opened
;                    A = error code
;               In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_InOpenStream:
jp DOSNode_Fail

;
; Read from the input stream
;
; Input  - A = drive number
;           HL = address where to stored the read data
;           DE = number of bytes to read
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then data could be read
;                    DE = number of bytes read
;                If NZ then a error occured
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF,DE

DOSNode_InReadStream:
jp DOSNode_Fail

;
; Close the input stream
;
; Input   - A = drive number
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the stream was properly closed
;                If NZ then the stream was closed with an error
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_InCloseStream:
jp DOSNode_Fail

;
; Change the position into the input stream
;
; Input   - A = drive number
;           DEHL = new position in the input stream
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the new position could be reached
;                If NZ then an error occured
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_InSeekStream:
jp DOSNode_Fail

;
; Open the output stream
;
; Input   - A = drive number
;           HL = pointer to the normalized name
;           DE = pointer to the normalized path
;          The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then a file was created
;                If NZ then no file was created
;                    A = error code
;               In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_OutOpenStream:
call ValidateReader
ret nc

jp DOSNode_Success

;
; Write into the ouput stream
;
; Input   - A = drive number
;           HL = address where are located the data to write
;           DE = number of bytes to write
; Sortie - If Carry = 1 the routine is supported for the provided drive
;                If Z then data could be written
;                    DE = nomber of written bytes
;                If NZ then an error occured
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF,DE

DOSNode_OutWriteStream:
call ValidateReader
ret nc

push hl

DOSNode_OutWriteStreamLoop:
ld a, (hl)
call ValidateChar
jr nc, DOSNode_OutWriteStreamSkip

call TXT_OUT_CHAR

DOSNode_OutWriteStreamSkip:
inc hl
dec de

ld a,(de)
or e
jr nz, DOSNode_OutWriteStreamLoop

DOSNode_OutWriteStreamEnd:
pop hl
jp DOSNode_Success

;
; Close the output stream
;
; Input   - A = drive number
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the stream was properly closed
;                If NZ then the stream was closed with an error
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_OutCloseStream:
call ValidateReader
ret nc

jp DOSNode_Success

;
; Change the position into the output stream
;
; Input   - A = drive number
;           DEHL = new position in the ouput stream
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the new position could be reached
;                If NZ then an error occured
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_OutSeekStream:
jp DOSNode_Fail

;
; Check that a file or directory exists and return associated information
;
; Input   - A = drive number
;           HL = pointer to the normalized name
;               If HL = 0 then it is the contents of the directory which has to be analyzed
;               and ExamineNext will be called next to retrieve each entry
;           DE = pointer to the normalized path
;           IX = buffer where to store last modification time and date
;           The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;
;                If HL was not 0 in input
;                    If Z then the file or directory exists
;                        A = protection bits of the file
;                            Bit 0 - Read-only
;                            Bit 1 - Hidden
;                            Bit 2 - System
;                            Bit 4 = Directory
;                            Bit 5 = Archived
;                        BCDE = Length of the file
;                        IX = buffer where last modification time and date of the entry were stored
;                            One 16-bit word with year (1978..9999)
;                            One byte with number of month (1..12)
;                            One byte with number of day in the month (1..28,29,30 or 31)
;                            One byte with hours (0..23)
;                            One byte with minutes (0..59)
;                            One byte with seconds (0..59)
;                    If NZ then the file or directory was not found
;                        A = error code
;
;                If HL was 0 in input
;                    If Z then the directory is ready to be examined through ExamineNext
;                    If NZ then an error occurred
;                        A = error code
;
;                In any case, the routine might truncate the provided normalized path to match the nearest parent
;
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_Examine:
jp DOSNode_Fail

;
; Get the next entry from a directory being examined
;
; Input   - A = drive number
;           HL = pointer to the memory where to store the normalize name
;           IX = buffer where to store last modification time and date
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then an entry was found
;                    HL = pointer to the memory updated with the found normalized name
;                        A = protection bits of the file
;                            Bit 0 - Read-only
;                            Bit 1 - Hidden
;                            Bit 2 - System
;                            Bit 4 = Directory
;                            Bit 5 = Archived
;                        BCDE = Length of the file
;                        IX = buffer where last modification time and date of the entry were stored
;                            One 16-bit word with year (1978..9999)
;                            One byte with number of month (1..12)
;                            One byte with number of day in the month (1..28,29,30 or 31)
;                            One byte with hours (0..23)
;                            One byte with minutes (0..59)
;                            One byte with seconds (0..59)
;                If NZ then an error occurred
;                    A = error code (dsk_err_file_not_found indicates that all entries were examined)
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_ExamineNext:
jp DOSNode_Fail

;
; Rename a file or a directory
;
; Input   - A = drive number
;           HL = pointer to the normalized name
;           DE = pointer to the normalized path
;           IX = pointer to the new normalized name
;           BC = pointer to the new normalized path
;           The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the file or directory was renamed
;                If NZ then the file or directory could not be renamed
;                    A = error code
;                In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_Rename: jp DOSNode_Fail

;
; Delete a file or a directory
;
; Input  - A = drive number
;           HL = pointer to the normalized name
;           DE = pointer to the normalized path
;           The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the file or directory was deleted
;                If NZ then the file or directory could not be deleted
;                    A = error code
;                In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_Delete: jp DOSNode_Fail

;
; Create a directory
;
; Input  - A = drive number
;           HL = pointer to the normalized name
;           DE = pointer to the normalized path
;           The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the directory was created
;                If NZ then the directory could not be created
;                    A = error code
;                In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_CreateDir:
jp DOSNode_Fail

;
; Change the protection bits of a file
;
; Input  - A = drive number
;           HL = pointer to the normalized name
;           DE = pointer to the normalized path
;           B = Protections to modify
;           C = New protections
;                Bit 0 - Read-only
;                Bit 1 - Hidden
;                Bit 5 = Archived
;           Other bits are ignored
;           The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the protections were modified
;                If NZ then the protections could not be modified
;                    A = error code
;                In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_SetProtection:
jp DOSNode_Fail

;
; Change last modification time and date of a file or a directory
;
; Input  - A = drive number
;           HL = pointer to the normalized name
;           DE = pointer to the normalized path
;           IX = buffer where last modification time and date to use for the entry are stored
;               One 16-bit word with year (1978..9999)
;               One byte with number of month (1..12)
;               One byte with number of day in the month (1..28,29,30 or 31)
;               One byte with hours (0..23)
;               One byte with minutes (0..59)
;               One byte with seconds (0..59)
;           The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the time and date were modified
;                If NZ then the time and date could not be modified
;                    A = error code
;                In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_SetFileDate:
jp DOSNode_Fail

;
; Format a drive
;
; Input  - A = drive number
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the drive was formatted
;                If NZ then format failed
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_Format: jp DOSNode_Fail

;
; Read the contents of the real time clock
;
; Input   - IX = buffer where to store current time and date (7 octets)
; Output  - If Carry = 1 the the DOS node handles a relax time clock
;                IX = buffer where current time and date were stored
;                    One 16-bit word with year (1978..9999)
;                    One byte with number of the month (1..12)
;                    One byte with the number of the day in the month (1..28,29,30 or 31)
;                    One byte with hours (0..23)
;                    One byte with minutes (0..59)
;                    One byte with seconds (0..59)
;                 A = number of the day in the week (1..7, from Monday to Sunday)
;           If Carry = 0 the the DOS node do not handle a real time clock
; Altered - AF

DOSNode_ReadRTC:
jp DOSNode_Fail

;
; Write into the real time clock
;
; Input   - IX = buffer containing time and date to write into real time clock (7 bytes)
;               One 16-bit word with year (1978..9999)
;               One byte with number of the month (1..12)
;               One byte with the number of the day in the month (1..28,29,30 or 31)
;               One byte with hours (0..23)
;               One byte with minutes (0..59)
;               One byte with seconds (0..59)
; Output  - If Carry = 1 then the DOS node handles a real time clock
;               If Z then the contents of the real time clock was updated
;               If NZ then an error occurred
;                   A = error code
;          If Carry = 1 then the DOS node do not handle a real time clock
; Altered - AF

DOSNode_WriteRTC:
jp DOSNode_Fail

;
; Open the non volatile memory
;
; Input  - C = opening mode
;                If 0 then the non volatile memory shall be opened with its current contents
;                If 1 then the non volatile memory shall be opened with its contents reset
; Output  - If Carry = 1 then the DOS node provides non volatile memory
;                If Z then the non volatile memory has been opened and is ready for usage
;                If NZ then a error occured
;                    A = error code
;           If Carry = 0 then the DOS node do not provide non volatile memory
; Altered - AF

DOSNode_OpenNVRAM:
jp DOSNode_Fail

;
; Close and update the non volatile memory memory contents
;
; Input  - None
; Output  - If Carry = 1 then the DOS node provides non volatile memory
;                If Z then the non volatile memory was properly updated
;                If NZ then an error occured
;           If Carry = 0 then the DOS node do not provide non volatile memory
; Altered - AF

DOSNode_CloseNVRAM:
jp DOSNode_Fail

;
; Read data from the non volatile memory
;
; Input  - HL = address where to write read data
;           DE = number of bytes to read
; Output  - If Carry = 1 then the DOS node provides non volatile memory
;                If Z then data were read
;                    DE = number of bytes read
;                If NZ then a error occured
;                    A = error code
;           If Carry = 0 then the DOS node do not provide non volatile memory
; Altered - AF,DE

DOSNode_ReadNVRAM:
jp DOSNode_Fail

;
; Write data to the non volatile memory
;
; Input  - HL = address where a located data to write
;           DE = number of bytes to write
; Output  - If Carry = 1 then the DOS node provides non volatile memory
;                If Z then data were written
;                    DE = number of bytes written
;                If NZ then a error occured
;                    A = error code
;           If Carry = 0 then the DOS node do not provide non volatile memory
; Altered - AF,DE

DOSNode_WriteNVRAM:
jp DOSNode_Fail

;
; Change the position in the non volatile memory
;
; Input  - DEHL = new position
; Output  - If Carry = 1 then the DOS node provides non volatile memory
;                If Z then the new position was reached
;                If NZ then a error occured
;                    A = error code
;           If Carry = 0 then the DOS node do not provide non volatile memory
; Altered - AF,DE

DOSNode_SeekNVRAM:
jp DOSNode_Fail

DOSNode_Void: ret

DOSNode_Fail: ccf
ret

DOSNode_Success:
scf
ret

; ------------------------- StrCompare
; -- parameters:
; -- HL = zero terminated string source of truth
; -- DE = string to compare
; --
; -- return:
; -- Z if equal, NZ if not
; -- all other registers unknown

StrCompare:
ex de, hl

StrCompareLoop:
ld a, (de)
cp (hl)
ret nz ; false match return
or a
ret z ; end of string return
inc hl
inc de
jr StrCompareLoop

; ------------------------- StrCopy
; -- parameters:
; -- HL = source string address
; -- DE = destination string address
; --
; -- return:
; -- HL = the address of the source string terminator
; -- DE = the address of the destination string terminator
; -- all other registers unknown

StrCopy:
ld a,(hl)
ld (de), a
or a
ret z ; end of string return
inc hl
inc de
jr StrCopy

; ------------------------- ValidateReader
; -- parameters:
; -- A = reader to validate
; --
; -- return:
; -- C if valid, NC if not
; -- all other registers unknown

ValidateReader: push bc
ld b, a ; validate reader
ld a, READER_COUNT
cp b
jp c, ValidateReaderFail
pop bc
jp DOSNode_Success

ValidateReaderFail:
pop bc
jp DOSNode_Fail

; ------------------------- ValidateChar
; -- parameters:
; -- A = character to validate
; --
; -- return:
; -- C if valid, NC if not
; -- all other registers preserved

ValidateChar:
cp '0'
jr c, DOSNode_Fail

cp 'z'
jr nc, DOSNode_Fail

jp DOSNode_Success


zhulien

#264
not relevant

zhulien

#265
not relevant

zhulien

Modified to treat drives as zero-based assuming we will never have a zero drive node

Org &c000

write direct -1,2,#C0

ROMType db 2; 1 (secondary ROM) or 2 (expansion ROM)

ROMMark db 1; It is customary that the version of a ROM
ROMVer db 4; is displayed in the form M VR
ROMRev db 1; (i.e. 1.00 here)

ROMRSX dw RSXTable

jp InitROM
jp DOSNode_Init ; implemented
jp DOSNode_CheckDrive ; implemented
jp DOSNode_GetStatus ; implemented
jp DOSNode_GetName ; implemented
jp DOSNode_GetDesc ; implemented
jp DOSNode_GetFreeSpace ; implemented
jp DOSNode_InOpenStream
jp DOSNode_InReadStream
jp DOSNode_InCloseStream
jp DOSNode_InSeekStream
jp DOSNode_OutOpenStream ; implemented
jp DOSNode_OutWriteStream ; implemented
jp DOSNode_OutCloseStream ; implemented
jp DOSNode_OutSeekStream
jp DOSNode_Examine
jp DOSNode_ExamineNext
jp DOSNode_Rename
jp DOSNode_Delete
jp DOSNode_CreateDir
jp DOSNode_SetProtection
jp DOSNode_Format
jp DOSNode_SetFileDate
jp DOSNode_Void
jp DOSNode_Void
jp DOSNode_Void
jp DOSNode_ReadRTC
jp DOSNode_WriteRTC
jp DOSNode_OpenNVRAM
jp DOSNode_CloseNVRAM
jp DOSNode_ReadNVRAM
jp DOSNode_WriteNVRAM
jp DOSNode_SeekNVRAM
; You can add your personal RSX here (if ROM type 1)

RSXTable
str "SCREEN STREAMER"
str "DOS Node"

db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80
db #80

; You can add your personal RSX here (if ROM type 1)
db 0; End of the RSX table

        ; Actual ROM code starts here
InitROM: cp a
ret

BYTES_FREE_HW equ #ffff ; high word
BYTES_FREE_LW equ #ffff ; low word
READER_COUNT equ 1 ; number of readers
TXT_OUT_CHAR equ #bb5a

DriveName: text "SCR"
db 0
DriveNameNbr: db 0
DriveNameStr: text "SC"
db "R" + #80, 0
DriveNameDsc: text "Vorax Screen Streame"
db "r" + #80, 0

;
; Initialize the noeud DOS
;
; Input   - A = initialization status (see flags Init_*)
;               Bit0 = 1 if the CPC is doing a cold boot
;               Other bits are unused
; Output  - If Carry = 1 then the node was intialized
;               If Z then a non volatile memory handler is available in this node (2K mini)
;               If NZ then non voltile memory handler is not available
;                   A = error code
;           If Carry = 0 then the node could not be initialized
; Altered - AF

DOSNode_Init: ld a, 1
or a
jp DOSNode_Success

;
; Check if a drive name is handled by the DOS node
;
; Input   - HL = pointer to the drive name
;                (bit 7 could be set on some character and mush be ignored)
;           C = length of the drive name
; Output - If Carry = 1 a drive was found in the node
;                A = physical drive number
;           If Carry = 0 the drive was not found in the node
; Altered - AF

DOSNode_CheckDrive:
push de
push hl
ld de, DriveName
ex de, hl
call StrCompare
pop hl
pop de
jp nz, DOSNode_Fail

ld a, (DriveNameNbr)
jp DOSNode_Success

;
; Return a drive status
;
; Input   - A = drive number
; Output  - If Carry = 1 a status was returned
;                A = status of the drive (see flags flags Media_*)
;                    Bit0 = 1 if a media is inserted in the drive
;                    Bit1 = 1 if the media support directories
;                    Bit2 = 1 if the media is write protected
;                    Bit3 = 1 if the media is removable
;                    Bit4 = 1 if the media is a stream (linear read/write only)
;                        $$$ and BAK filesis then disabled
;                    Bit5 = 1 if the media can be reached by the new UniDOS API
;                    Other bits are unused
;           If Carry = 0 then the drive is unknown and no status was returned
; Alteted - AF

DOSNode_GetStatus:
call ValidateReader
ret nc

ld a, %000110001
jp DOSNode_Success

;
; Return the name corresponding to a physical drive
;
; Input   - A = drive number
;           DE = address of a buffer of 8 bytes when to store the name
; Output  - If Carry = 1 the name was found
;                DE points to the first character after the end of the copied string
;                (the string is stored with the bit 7 of its last character set)
;          If Carry = 0 not description was found and the buffer is left unchanged.
; Altered - AF,DE

DOSNode_GetName:
call ValidateReader
ret nc

push hl
ld hl, DriveNameStr
call StrCopy
pop hl
jp DOSNode_Success

;
; Return the description corresponding to a physical drive
;
; Input  - A = drive number
;          DE = addess of the 32 bytes buffer where to store the description
; Ouput  - If Carry = 1 a description was found
;                DE points to the first character after the end of the copied string
;                (the string is stored with the bit 7 of its last character set)
;          If Carry = 0 not description was found and the buffer is left unchanged.
; Altered - AF,DE

DOSNode_GetDesc:
call ValidateReader
ret nc

push hl
ld hl, DriveNameDsc
call StrCopy
pop hl
jp DOSNode_Success

;
; Return the free space on a physical drive
;
; Input   - A = drive number
; Output  - If Carry = 1 the routine is supported for this drive
;                If Z then the free space could be obtained
;                    BCDE = free space in kilo-bytes
;                If NZ then an error occured
;                    A = error code
;           If Carry = 0 then the routines is invalid for this drive
; Altered - AF,BC,DE

DOSNode_GetFreeSpace:
call ValidateReader
ret nc

ld bc, BYTES_FREE_HW
ld de, BYTES_FREE_LW
xor a
jp DOSNode_Success

;
; Open the input stream
;
; Input   - A = drive number
;           HL = pointer to the normalized name
;               note, if the drive is of type stream then this name can
;               contain 11x&ff in case where no file name was provided
;               by the user (when he uses the anonymous reference ".");
;               the routine should then just open the just encountered
;               file on the stream and can optionally update the name
;               if it could be obtained from the stream itself
;          DE = pointer the normalized path
;          The pointed memory is always located in the current ROM/RAM space area
; Ouput  - If Carry = 1 the routine is supported for the provided drive
;                If Z then a file was opened
;                If NZ then no file could be opened
;                    A = error code
;               In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_InOpenStream:
jp DOSNode_Fail

;
; Read from the input stream
;
; Input  - A = drive number
;           HL = address where to stored the read data
;           DE = number of bytes to read
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then data could be read
;                    DE = number of bytes read
;                If NZ then a error occured
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF,DE

DOSNode_InReadStream:
jp DOSNode_Fail

;
; Close the input stream
;
; Input   - A = drive number
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the stream was properly closed
;                If NZ then the stream was closed with an error
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_InCloseStream:
jp DOSNode_Fail

;
; Change the position into the input stream
;
; Input   - A = drive number
;           DEHL = new position in the input stream
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the new position could be reached
;                If NZ then an error occured
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_InSeekStream:
jp DOSNode_Fail

;
; Open the output stream
;
; Input   - A = drive number
;           HL = pointer to the normalized name
;           DE = pointer to the normalized path
;          The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then a file was created
;                If NZ then no file was created
;                    A = error code
;               In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_OutOpenStream:
call ValidateReader
ret nc

jp DOSNode_Success

;
; Write into the ouput stream
;
; Input   - A = drive number
;           HL = address where are located the data to write
;           DE = number of bytes to write
; Sortie - If Carry = 1 the routine is supported for the provided drive
;                If Z then data could be written
;                    DE = nomber of written bytes
;                If NZ then an error occured
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF,DE

DOSNode_OutWriteStream:
call ValidateReader
ret nc

push hl

DOSNode_OutWriteStreamLoop:
ld a, (hl)
call ValidateChar
jr nc, DOSNode_OutWriteStreamSkip

call TXT_OUT_CHAR

DOSNode_OutWriteStreamSkip:
inc hl
dec de

ld a,(de)
or e
jr nz, DOSNode_OutWriteStreamLoop

DOSNode_OutWriteStreamEnd:
pop hl
jp DOSNode_Success

;
; Close the output stream
;
; Input   - A = drive number
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the stream was properly closed
;                If NZ then the stream was closed with an error
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_OutCloseStream:
call ValidateReader
ret nc

jp DOSNode_Success

;
; Change the position into the output stream
;
; Input   - A = drive number
;           DEHL = new position in the ouput stream
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the new position could be reached
;                If NZ then an error occured
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_OutSeekStream:
jp DOSNode_Fail

;
; Check that a file or directory exists and return associated information
;
; Input   - A = drive number
;           HL = pointer to the normalized name
;               If HL = 0 then it is the contents of the directory which has to be analyzed
;               and ExamineNext will be called next to retrieve each entry
;           DE = pointer to the normalized path
;           IX = buffer where to store last modification time and date
;           The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;
;                If HL was not 0 in input
;                    If Z then the file or directory exists
;                        A = protection bits of the file
;                            Bit 0 - Read-only
;                            Bit 1 - Hidden
;                            Bit 2 - System
;                            Bit 4 = Directory
;                            Bit 5 = Archived
;                        BCDE = Length of the file
;                        IX = buffer where last modification time and date of the entry were stored
;                            One 16-bit word with year (1978..9999)
;                            One byte with number of month (1..12)
;                            One byte with number of day in the month (1..28,29,30 or 31)
;                            One byte with hours (0..23)
;                            One byte with minutes (0..59)
;                            One byte with seconds (0..59)
;                    If NZ then the file or directory was not found
;                        A = error code
;
;                If HL was 0 in input
;                    If Z then the directory is ready to be examined through ExamineNext
;                    If NZ then an error occurred
;                        A = error code
;
;                In any case, the routine might truncate the provided normalized path to match the nearest parent
;
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_Examine:
jp DOSNode_Fail

;
; Get the next entry from a directory being examined
;
; Input   - A = drive number
;           HL = pointer to the memory where to store the normalize name
;           IX = buffer where to store last modification time and date
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then an entry was found
;                    HL = pointer to the memory updated with the found normalized name
;                        A = protection bits of the file
;                            Bit 0 - Read-only
;                            Bit 1 - Hidden
;                            Bit 2 - System
;                            Bit 4 = Directory
;                            Bit 5 = Archived
;                        BCDE = Length of the file
;                        IX = buffer where last modification time and date of the entry were stored
;                            One 16-bit word with year (1978..9999)
;                            One byte with number of month (1..12)
;                            One byte with number of day in the month (1..28,29,30 or 31)
;                            One byte with hours (0..23)
;                            One byte with minutes (0..59)
;                            One byte with seconds (0..59)
;                If NZ then an error occurred
;                    A = error code (dsk_err_file_not_found indicates that all entries were examined)
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_ExamineNext:
jp DOSNode_Fail

;
; Rename a file or a directory
;
; Input   - A = drive number
;           HL = pointer to the normalized name
;           DE = pointer to the normalized path
;           IX = pointer to the new normalized name
;           BC = pointer to the new normalized path
;           The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the file or directory was renamed
;                If NZ then the file or directory could not be renamed
;                    A = error code
;                In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_Rename: jp DOSNode_Fail

;
; Delete a file or a directory
;
; Input  - A = drive number
;           HL = pointer to the normalized name
;           DE = pointer to the normalized path
;           The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the file or directory was deleted
;                If NZ then the file or directory could not be deleted
;                    A = error code
;                In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_Delete: jp DOSNode_Fail

;
; Create a directory
;
; Input  - A = drive number
;           HL = pointer to the normalized name
;           DE = pointer to the normalized path
;           The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the directory was created
;                If NZ then the directory could not be created
;                    A = error code
;                In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_CreateDir:
jp DOSNode_Fail

;
; Change the protection bits of a file
;
; Input  - A = drive number
;           HL = pointer to the normalized name
;           DE = pointer to the normalized path
;           B = Protections to modify
;           C = New protections
;                Bit 0 - Read-only
;                Bit 1 - Hidden
;                Bit 5 = Archived
;           Other bits are ignored
;           The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the protections were modified
;                If NZ then the protections could not be modified
;                    A = error code
;                In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_SetProtection:
jp DOSNode_Fail

;
; Change last modification time and date of a file or a directory
;
; Input  - A = drive number
;           HL = pointer to the normalized name
;           DE = pointer to the normalized path
;           IX = buffer where last modification time and date to use for the entry are stored
;               One 16-bit word with year (1978..9999)
;               One byte with number of month (1..12)
;               One byte with number of day in the month (1..28,29,30 or 31)
;               One byte with hours (0..23)
;               One byte with minutes (0..59)
;               One byte with seconds (0..59)
;           The pointed memory is always located in the current ROM/RAM space area
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the time and date were modified
;                If NZ then the time and date could not be modified
;                    A = error code
;                In any case, the routine might truncate the provided normalized path to match the nearest parent
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_SetFileDate:
jp DOSNode_Fail

;
; Format a drive
;
; Input  - A = drive number
; Output  - If Carry = 1 the routine is supported for the provided drive
;                If Z then the drive was formatted
;                If NZ then format failed
;                    A = error code
;           If Carry = 0 then the routine is invalid for the provided drive
; Altered - AF

DOSNode_Format: jp DOSNode_Fail

;
; Read the contents of the real time clock
;
; Input   - IX = buffer where to store current time and date (7 octets)
; Output  - If Carry = 1 the the DOS node handles a relax time clock
;                IX = buffer where current time and date were stored
;                    One 16-bit word with year (1978..9999)
;                    One byte with number of the month (1..12)
;                    One byte with the number of the day in the month (1..28,29,30 or 31)
;                    One byte with hours (0..23)
;                    One byte with minutes (0..59)
;                    One byte with seconds (0..59)
;                 A = number of the day in the week (1..7, from Monday to Sunday)
;           If Carry = 0 the the DOS node do not handle a real time clock
; Altered - AF

DOSNode_ReadRTC:
jp DOSNode_Fail

;
; Write into the real time clock
;
; Input   - IX = buffer containing time and date to write into real time clock (7 bytes)
;               One 16-bit word with year (1978..9999)
;               One byte with number of the month (1..12)
;               One byte with the number of the day in the month (1..28,29,30 or 31)
;               One byte with hours (0..23)
;               One byte with minutes (0..59)
;               One byte with seconds (0..59)
; Output  - If Carry = 1 then the DOS node handles a real time clock
;               If Z then the contents of the real time clock was updated
;               If NZ then an error occurred
;                   A = error code
;          If Carry = 1 then the DOS node do not handle a real time clock
; Altered - AF

DOSNode_WriteRTC:
jp DOSNode_Fail

;
; Open the non volatile memory
;
; Input  - C = opening mode
;                If 0 then the non volatile memory shall be opened with its current contents
;                If 1 then the non volatile memory shall be opened with its contents reset
; Output  - If Carry = 1 then the DOS node provides non volatile memory
;                If Z then the non volatile memory has been opened and is ready for usage
;                If NZ then a error occured
;                    A = error code
;           If Carry = 0 then the DOS node do not provide non volatile memory
; Altered - AF

DOSNode_OpenNVRAM:
jp DOSNode_Fail

;
; Close and update the non volatile memory memory contents
;
; Input  - None
; Output  - If Carry = 1 then the DOS node provides non volatile memory
;                If Z then the non volatile memory was properly updated
;                If NZ then an error occured
;           If Carry = 0 then the DOS node do not provide non volatile memory
; Altered - AF

DOSNode_CloseNVRAM:
jp DOSNode_Fail

;
; Read data from the non volatile memory
;
; Input  - HL = address where to write read data
;           DE = number of bytes to read
; Output  - If Carry = 1 then the DOS node provides non volatile memory
;                If Z then data were read
;                    DE = number of bytes read
;                If NZ then a error occured
;                    A = error code
;           If Carry = 0 then the DOS node do not provide non volatile memory
; Altered - AF,DE

DOSNode_ReadNVRAM:
jp DOSNode_Fail

;
; Write data to the non volatile memory
;
; Input  - HL = address where a located data to write
;           DE = number of bytes to write
; Output  - If Carry = 1 then the DOS node provides non volatile memory
;                If Z then data were written
;                    DE = number of bytes written
;                If NZ then a error occured
;                    A = error code
;           If Carry = 0 then the DOS node do not provide non volatile memory
; Altered - AF,DE

DOSNode_WriteNVRAM:
jp DOSNode_Fail

;
; Change the position in the non volatile memory
;
; Input  - DEHL = new position
; Output  - If Carry = 1 then the DOS node provides non volatile memory
;                If Z then the new position was reached
;                If NZ then a error occured
;                    A = error code
;           If Carry = 0 then the DOS node do not provide non volatile memory
; Altered - AF,DE

DOSNode_SeekNVRAM:
jp DOSNode_Fail

DOSNode_Void: ret

DOSNode_Fail: ccf
ret

DOSNode_Success:
scf
ret

; ------------------------- StrCompare
; -- parameters:
; -- HL = zero terminated string source of truth
; -- DE = string to compare
; --
; -- return:
; -- Z if equal, NZ if not
; -- all other registers unknown

StrCompare:
ex de, hl

StrCompareLoop:
ld a, (de)
and #7f

push af
ld a, (hl)
and #7f
ld b, a
pop af

cp b
ret nz ; false match return
or a
ret z ; end of string return
inc hl
inc de
jr StrCompareLoop

; ------------------------- StrCopy
; -- parameters:
; -- HL = source string address
; -- DE = destination string address
; --
; -- return:
; -- HL = the address of the source string terminator
; -- DE = the address of the destination string terminator
; -- all other registers unknown

StrCopy:
ld a,(hl)
ld (de), a
or a
ret z ; end of string return
inc hl
inc de
jr StrCopy

; ------------------------- ValidateReader
; -- parameters:
; -- A = reader to validate
; --
; -- return:
; -- C if valid, NC if not
; -- all other registers unknown

ValidateReader: push bc
ld b, a ; validate reader
ld a, READER_COUNT - 1
cp b
jp c, ValidateReaderFail
pop bc
jp DOSNode_Success

ValidateReaderFail:
pop bc
jp DOSNode_Fail

; ------------------------- ValidateChar
; -- parameters:
; -- A = character to validate
; --
; -- return:
; -- C if valid, NC if not
; -- all other registers preserved

ValidateChar:
cp '0'
jr c, DOSNode_Fail

cp 'z'
jr nc, DOSNode_Fail

jp DOSNode_Success

OffseT

Quote from: zhulien on 04:33, 20 June 23actually i patched protext to instead of run"DISC" to run":EMS" because the autoexec locks up as I have no physical floppy drive, I can at least control+enter whereever I am to launch it.
I guess you should be able to configure your HxC/Gotek firmware to conform with legacy Amstrad drives, so that it won't lock. I don't use HxC anymore, but AFAIK mine did not lock when accessed empty. It might be a matter of "Ready" (Amstrad/Amiga) vs "DiscChange" (PC) signal configuration.

OffseT

Quote from: zhulien on 19:22, 21 June 23Modified to treat drives as zero-based assuming we will never have a zero drive node
By reading your code, I noticed that English documentation of Init was wrong. I just fixed the web site, sorry for that.

Here is the correct prototype:

;
; Initialize the DOS node
;
; Input  - A = initialization options (see input flags Init_*)
; Output - If Carry = 1 then the node was initialized
;              A = information about existing features (see output flags Init_*)
;          If Carry = 0 then the node could not be initialized
; Altered - AF

Does it help?

zhulien

Thanks, what are the input and output flags for init_*

I couldn't find them anywhere

https://unidos.cpcscene.net/doku.php?id=en:n%C5%93ud_dos

OffseT

Quote from: zhulien on 18:03, 22 June 23Thanks, what are the input and output flags for init_*

I couldn't find them anywhere

https://unidos.cpcscene.net/doku.php?id=en:n%C5%93ud_dos
All UniDOS definitions are in SystemData.i file from UniDOS source code archive.

Here is an abstract:
;
; Flags for DOS nodes API
;

; Init bits
Init_ColdBoot_B     Equ 0   ; Input flag: DOS node is being initialized during a cold boot
Init_HaveNVRAM_B    Equ 5   ; Output flag: DOS node is providing non volatile memory
Init_HaveRTC_B      Equ 7   ; Output flag: DOS node is providing real time clock
; Init flags
Init_ColdBoot_F     Equ 1 << init_coldboot_b
Init_HaveNVRAM_F    Equ 1 << init_havenvram_b
Init_HaveRTC_F      Equ 1 << init_havertc_b

; Media bits
Media_Available_B   Equ 0
Media_HandleDir_B   Equ 1
Media_ReadOnly_B    Equ 2
Media_Removable_B   Equ 3
Media_StreamOnly_B  Equ 4
Media_NewAPI_B      Equ 5
Media_Formatable_B  Equ 6
; Media flags
Media_Available_F   Equ 1 << media_available_b
Media_HandleDir_F   Equ 1 << media_handledir_b
Media_ReadOnly_F    Equ 1 << media_readonly_b
Media_Removable_F   Equ 1 << media_removable_b
Media_StreamOnly_F  Equ 1 << media_streamonly_b
Media_NewAPI_F      Equ 1 << media_newapi_b
Media_Formatable_F  Equ 1 << media_formatable_b

zhulien

changing init to xor a; ret; had no difference at my end, still it shows as a dosnode when I |help, but doesn't show up in |drive

are there any other preconditions such as a node must be readable?  this is a write-only node.

zhulien

debugging it appears something to do with drive numbers - what is that?  If my node e.g. has 8 drives, is that number referring to the drive in there?  Or is the drive number actually the node number?  i.e. I might be the 3rd node?  Which call is made to my node to find out how many drives I have anyway?

zhulien

#273
nope: it was my compare function... thanks for your help

The number to the right of implemented is the order of being called for future reference to others.  It seems it uses GetName to work out what device names are avaialble within the node and then it can focus future calls based on the results of the original iteration of GetName.

            jp DOSNode_Init            ; implemented, 1: called once, A = 1
            jp DOSNode_CheckDrive      ; implemented, 3: called once, HL = Streamer, Return 0
            jp DOSNode_GetStatus              ; implemented, 4: called once, A = 0
            jp DOSNode_GetName         ; implemented, 2: called 8 times, A = 0 to 7
            jp DOSNode_GetDesc         ; implemented, 6: called once, A = 0
            jp DOSNode_GetFreeSpace      ; implemented, 5: called once, A = 0

Another Note: if we don't compare string with case insensitivity, we get a bad command with the wrong case.

I now have a (mostly) working DOSNODE and can continue on with it.
If I do a cat on a write only DOS node, I get a Bad Command.

zhulien

Here is an oddity...

I have added 4 devices to my node.  The names and descriptions search correctly and I believe return the flags correctly.  However when I |Drive, my DOSNode_GetDesc is called 7 times, first... 1, 2, 3, 4 (which are for my Node Names), then... 3 more times with 0, 0, 0 for DFA, DFB and TAPE.

Am I supposed to eliminate other devices from calling my node's GetDesc or is there some other thing that is supposed to stop My Description from showing against those 3 nodes?

Powered by SMFPacks Menu Editor Mod