Subversion Repositories Spectranet

[/] [trunk/] [modules/] [basext/] [commands.asm] - Diff between revs 250 and 255

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 250 Rev 255
Line 399... Line 399...
        jp nc, EXIT_SUCCESS             ; No carry = FS change OK
        jp nc, EXIT_SUCCESS             ; No carry = FS change OK
        ld a, EBADFS
        ld a, EBADFS
        jp J_tbas_error
        jp J_tbas_error
 
 
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
 
; F_loadsnap
 
; Loads a snapshot file.
 
F_loadsnap
 
        rst CALLBAS
 
        defw ZX_EXPT_EXP                ; filename string
 
        call STATEMENT_END
 
 
 
        ;---------- runtime -----------
 
        rst CALLBAS
 
        defw ZX_STK_FETCH               ; get the filename
 
        ld hl, INTERPWKSPC
 
        call F_basstrcpy                ; copy filename as a C string
 
        ld hl, INTERPWKSPC
 
        call F_detectsnap               ; Detect type and load snapshot
 
        jp J_tbas_error                 ; If we get here, an error occurred
 
 
 
;----------------------------------------------------------------------------
; F_tbas_zxprint
; F_tbas_zxprint
; Prints a C string to the current ZX channel
; Prints a C string to the current ZX channel
; HL = pointer to string
; HL = pointer to string
F_tbas_zxprint
F_tbas_zxprint
        ld a, (hl)
        ld a, (hl)
Line 425... Line 442...
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
; F_tnfs_geterrstr
; F_tnfs_geterrstr
; Enter with A=error number
; Enter with A=error number
; Exits with HL=pointer to null terminated error string
; Exits with HL=pointer to null terminated error string
F_geterrstr
F_geterrstr
        ld hl, STR_SUCCESS      ; pointer at start of table
        ld h, 0xFC              ; ID of messages module
        and a                   ; code 0 (success?)
        ld l, a                 ; Set the message ID to fetch
        ret z                   ; return now.
        ld de, 0x3000           ; buffer
        ld d, a                 ; set counter
        xor a
        xor a                   ; reset A to search for terminator
        ld (de), a              ; initialize with a NULL
        ld bc, ERR_TABLE_END - STR_SUCCESS
        rst MODULECALL_NOPAGE
.findloop
        ld hl, 0x3000           ; address of the message
        cpir                    ; find next null
        ret
        ret po                  ; cpir ran out of data?
 
        dec d                   ; decrement loop counter
 
        jr nz, .findloop        ; if Z is not set go for another run
 
        ret z                   ; HL now points at error string
 
 
 
STR_proto       defb    "tnfs",0
STR_proto       defb    "tnfs",0
 
 
STR_SUCCESS     defb    "Success",0                             ; 0x00
 
STR_EPERM       defb    "Operation not permitted",0             ; 0x01
 
STR_ENOENT      defb    "No such file or directory",0           ; 0x02
 
STR_EIO         defb    "I/O error",0                           ; 0x03
 
STR_ENXIO       defb    "No such device or address",0           ; 0x04
 
STR_E2BIG       defb    "Too many arguments",0                  ; 0x05
 
STR_EBADF       defb    "Bad file descriptor",0                 ; 0x06
 
STR_EAGAIN      defb    "Operation would block",0               ; 0x07
 
STR_ENOMEM      defb    "Out of memory",0                       ; 0x08
 
STR_EACCES      defb    "Permission denied",0                   ; 0x09
 
STR_EBUSY       defb    "Device or resource busy",0             ; 0x0A
 
STR_EEXIST      defb    "File exists",0                         ; 0x0B
 
STR_ENOTDIR     defb    "Not a directory",0                     ; 0x0C
 
STR_EISDIR      defb    "Is a directory",0                      ; 0x0D
 
STR_EINVAL      defb    "Invalid argument",0                    ; 0x0E
 
STR_ENFILE      defb    "File table overflow",0                 ; 0x0F
 
STR_EMFILE      defb    "Too many open files",0                 ; 0x10
 
STR_EFBIG       defb    "File too large",0                      ; 0x11
 
STR_ENOSPC      defb    "Filesystem full",0                     ; 0x12
 
STR_ESPIPE      defb    "Attempt to seek on a pipe",0           ; 0x13
 
STR_EROFS       defb    "Read only filesystem",0                ; 0x14
 
STR_ENAMETOOLONG defb   "Filename too long",0                   ; 0x15
 
STR_ENOSYS      defb    "Not implemented",0                     ; 0x16
 
STR_ENOTEMPTY   defb    "Directory not empty",0                 ; 0x17
 
STR_ELOOP       defb    "Too many links",0                      ; 0x18
 
STR_ENODATA     defb    "No data available",0                   ; 0x19
 
STR_ENOSTR      defb    "Out of streams",0                      ; 0x1A
 
STR_EPROTO      defb    "Protocol error",0                      ; 0x1B
 
STR_EBADFD      defb    "File descriptor state bad",0           ; 0x1C
 
STR_EUSERS      defb    "Too many users",0                      ; 0x1D
 
STR_ENOBUFS     defb    "No buffer space available",0           ; 0x1E
 
STR_EALREADY    defb    "Operation already running",0           ; 0x1F
 
STR_ESTALE      defb    "Stale TNFS handle",0                   ; 0x20
 
STR_EOF         defb    "End of file",0                         ; 0x21
 
 
 
; Non-protocol error messages
 
STR_TIMEOUT     defb    "Operation timed out",0                 ; 0x22
 
STR_NOTMOUNTED  defb    "Filesystem not mounted",0              ; 0x23
 
STR_BADLENGTH   defb    "Incorrect header length",0             ; 0x24
 
STR_BADTYPE     defb    "Incorrect block type",0                ; 0x25
 
STR_UNKTYPE     defb    "Unknown file type",0                   ; 0x26
 
STR_MISMCHLEN   defb    "Data block length mismatch",0          ; 0x27
 
STR_EBADURL     defb    "Bad URL",0                             ; 0x28
 
STR_EBADFS      defb    "Bad filesystem number",0               ; 0x29
 
 
 
ERR_TABLE_END
 
STR_UNKNOWN     defb    "Unknown error",0
 
 
 
EBADURL         equ     0x28
EBADURL         equ     0x28
EBADFS          equ     0x29
EBADFS          equ     0x29