User Tools

Site Tools


sd:appendix_7_kernal_functions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
sd:appendix_7_kernal_functions [2026/04/21 12:10] appledogsd:appendix_7_kernal_functions [2026/04/21 12:12] (current) appledog
Line 289: Line 289:
 ; ;
 ; ============================================================================ ; ============================================================================
 +</code>
 +
 +== INT 15h - Filesystem Services
 +<code>
 +; ============================================================================
 +; INT 15h - FILE SERVICES
 +; Stream-oriented file I/O for the SD-8516 / VC-3
 +; ============================================================================
 +;
 +; Provides file and directory operations for programs.
 +;
 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 +; NOTE: INT $15 uses a JZ-style calltable.
 +;       This means you cannot CALL into these functions by name.
 +;       You must use INT 0x15 to call them (even from the kernal).
 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 +;
 +; Function dispatch:
 +;
 +; Group A: File Handle Operations ($00–$0F)
 +;   AH=$00: FOPEN    - Open a file (returns handle)
 +;   AH=$01: FCLOSE   - Close a file handle
 +;   AH=$02: FREAD    - Read bytes from a file
 +;   AH=$04: FWRITE   - Write bytes to a file
 +;
 +; Group B: Directory Listing ($10–$1F)
 +;   AH=$12: FLIST    - List directory contents to buffer
 +;
 +; Group C: Directory Navigation ($20–$2F)
 +;   AH=$20: FGETCWD  - Get current working directory
 +;   AH=$21: FCHDIR   - Change directory
 +;   AH=$22: FMKDIR   - Create directory
 +;   AH=$23: FRMDIR   - Remove directory
 +;
 +; ============================================================================
 +
 +; --- File Command Block (FCB) ---
 +; A shared memory region used to pass parameters to/from JavaScript.
 +; Located in bank 0 scratch space. 16 bytes.
 +;
 +.equ FS_CMD_BLOCK      $00FD00     ; Base address of command block
 +
 +.equ FS_CMD            $00FD00     ; +0: Command code (1 byte)
 +.equ FS_HANDLE         $00FD01     ; +1: File handle (1 byte, 0-7)
 +.equ FS_MODE           $00FD02     ; +2: Mode (1 byte, for fopen: 0=read, 1=write)
 +.equ FS_STATUS         $00FD03     ; +3: Result status (1 byte)
 +                                   ;     $00=ok, $01=error, $02=eof
 +.equ FS_COUNT          $00FD04     ; +4: Byte count (2 bytes, requested/returned)
 +.equ FS_ADDR           $00FD06     ; +6: 24-bit address (buffer or filename ptr)
 +.equ FS_DONE           $00FD09     ; +9: Completion flag (1 byte, 0=pending, 1=done)
 +.equ FS_EXTRA          $00FD0A     ; +10: Reserved (3 bytes) and alias for:
 +.equ FS_ADDR2          $00FD0A;    ;  +A: second 24-bit address (3 bytes)
 +
 +; --- Constants ---
 +.equ FS_MAX_HANDLES    8           ; Maximum simultaneous open files
 +
 +.equ FS_MODE_READ      0
 +.equ FS_MODE_WRITE     1
 +
 +.equ FS_OK             0
 +.equ FS_ERR            1
 +.equ FS_EOF            2
 </code> </code>
  
sd/appendix_7_kernal_functions.txt · Last modified: by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki