User Tools

Site Tools


x68000:doscall

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
x68000:doscall [2017/09/10 07:38] – added _RMDIR neko68kx68000:doscall [2020/01/26 15:54] (current) – [Detailed Descriptions] sigvec
Line 1: Line 1:
 ====== DOS CALL MANUAL ====== ====== DOS CALL MANUAL ======
-===DOS Call list===+===== DOS Call List ===== 
 + 
 +Caution: Calls to $FF00~$FF7F in Human68k Version 2 have been moved 
 + to $FF80~$FFAF in Version 3 and later 
 + 
 + Processing address calls at $FFF5~$FFF7 and $FFFA~$FFFE can not be changed(ignored) 
 + $FFF8,$FFFF is executed after the original processing is normally completed. 
 + $FFF8 is called every time a thread is deleted.
  
 ^Code^Name^Description^ ^Code^Name^Description^
Line 6: Line 13:
 |$FF01|[[doscall#GETCHAR|_GETCHAR]]|Get keyboard input (with echo)| |$FF01|[[doscall#GETCHAR|_GETCHAR]]|Get keyboard input (with echo)|
 |$FF02|[[doscall#PUTCHAR|_PUTCHAR]]|Put character| |$FF02|[[doscall#PUTCHAR|_PUTCHAR]]|Put character|
-|$FF03|_COMINP|RS-232C 1 byte input| +|$FF03|[[doscall#cominp|_COMINP]]|RS-232C 1 byte input| 
-|$FF04|_COMOUT|RS-232C 1 byte output| +|$FF04|[[doscall#comout|_COMOUT]]|RS-232C 1 byte output| 
-|$FF05|_PRNOUT|Printer 1 character output| +|$FF05|[[doscall#prnout|_PRNOUT]]|Printer 1 character output| 
-|$FF06|_INPOUT|Character I/O|+|$FF06|[[doscall#inpout|_INPOUT]]|Character I/O|
 |$FF07|[[doscall#inkey|_INKEY]]|Get one character from the keyboard (no break check)| |$FF07|[[doscall#inkey|_INKEY]]|Get one character from the keyboard (no break check)|
 |$FF08|[[doscall#getc|_GETC]]|Get one character from the keyboard (with break check)| |$FF08|[[doscall#getc|_GETC]]|Get one character from the keyboard (with break check)|
 |$FF09|[[doscall#print|_PRINT]]|Print string| |$FF09|[[doscall#print|_PRINT]]|Print string|
 |$FF0A|[[doscall#gets|_GETS]]|Get character string (with break check)| |$FF0A|[[doscall#gets|_GETS]]|Get character string (with break check)|
-|$FF0B|_KEYSNS|Key input state check|+|$FF0B|[[doscall#keysns|_KEYSNS]]|Key input state check|
 |$FF0C|_KFLUSH|Keyboard input after buffer flush| |$FF0C|_KFLUSH|Keyboard input after buffer flush|
-|$FF0D|_FFLUSH|Disk reset| +|$FF0D|[[doscall#fflush|_FFLUSH]]|Disk reset| 
-|$FF0E|_CHGDRV|Current drive setting|+|$FF0E|[[doscall#chgdrv|_CHGDRV]]|Current drive setting|
 |$FF0F|_DRVCTRL|Drive status check/setting| |$FF0F|_DRVCTRL|Drive status check/setting|
  
 ^Code^Name^Description^ ^Code^Name^Description^
-|$FF10|_CONSNS|Screen output check| +|$FF10|[[doscall#consns|_CONSNS]]|Screen output check| 
-|$FF11|_PRNSNS|Printer output check| +|$FF11|[[doscall#prnsns|_PRNSNS]]|Printer output check| 
-|$FF12|_CINSNS|RS-232C input check| +|$FF12|[[doscall#cinsns|_CINSNS]]|RS-232C input check| 
-|$FF13|_COUTSNS|RS-232C output check|+|$FF13|[[doscall#coutsns|_COUTSNS]]|RS-232C output check|
 |$FF17|_FATCHK|File concatenation state check| |$FF17|_FATCHK|File concatenation state check|
 |$FF18|_HENDSP|Kanji conversion control| |$FF18|_HENDSP|Kanji conversion control|
-|$FF19|_CURDRV|Get current drive| +|$FF19|[[[doscall#curdrv|_CURDRV]]|Get current drive| 
-|$FF1A|_GETSS|Get character string (no break check)| +|$FF1A|[[doscall#getss|_GETSS]]|Get character string (no break check)| 
-|$FF1B|_FGETC|Get character from file| +|$FF1B|[[doscall#fgetc|_FGETC]]|Get character from file| 
-|$FF1C|_FGETS|Get string from file| +|$FF1C|[[doscall#fgets|_FGETS]]|Get string from file| 
-|$FF1D|_FPUTC|Write one character to file| +|$FF1D|[[doscall#fputc|_FPUTC]]|Write one character to file| 
-|$FF1E|_FPUTS|Write string to file| +|$FF1E|[[doscall#fputs|_FPUTS]]|Write string to file| 
-|$FF1F|_ALLCLOSE|Close all files|+|$FF1F|[[doscall#allclose|_ALLCLOSE]]|Close all files|
  
 ^Code^Name^Description^ ^Code^Name^Description^
-|$FF20|_SUPER|Supervisor/user mode setting|+|$FF20|[[doscall#super|_SUPER]]|Supervisor/user mode setting|
 |$FF21|_FNCKEY|Get/set redefinable key| |$FF21|_FNCKEY|Get/set redefinable key|
 |$FF22|_KNJCTRL|Kana-to-kanji conversion| |$FF22|_KNJCTRL|Kana-to-kanji conversion|
Line 54: Line 61:
  
 ^Code^Name^Description^ ^Code^Name^Description^
-|$FF30|_VERNUM|Get OS version|+|$FF30|[[doscall#vernum|_VERNUM]]|Get OS version|
 |$FF31|_KEEPPR|Terminate and stay resident| |$FF31|_KEEPPR|Terminate and stay resident|
 |$FF32|_GETDPB|Get drive parameter block| |$FF32|_GETDPB|Get drive parameter block|
Line 60: Line 67:
 |$FF34|_DRVXCHG|Replace drive| |$FF34|_DRVXCHG|Replace drive|
 |$FF35|_INTVCG|Get vector processing address| |$FF35|_INTVCG|Get vector processing address|
-|$FF36|_DSKFRE|Get disk space remaining|+|$FF36|[[doscall#dskfre|_DSKFRE]]|Get disk space remaining|
 |$FF37|_NAMECK|Filename expansion| |$FF37|_NAMECK|Filename expansion|
 |$FF39|[[doscall#mkdir|_MKDIR]]|Create subdirectory| |$FF39|[[doscall#mkdir|_MKDIR]]|Create subdirectory|
 |$FF3A|[[doscall#rmdir|_RMDIR]]|Remove subdirectory| |$FF3A|[[doscall#rmdir|_RMDIR]]|Remove subdirectory|
-|$FF3B|_CHDIR|Change current directory|+|$FF3B|[[doscall#chdir|_CHDIR]]|Change current directory|
 |$FF3C|[[doscall#create|_CREATE]]|Create file| |$FF3C|[[doscall#create|_CREATE]]|Create file|
 |$FF3D|[[doscall#open|_OPEN]]|Open file| |$FF3D|[[doscall#open|_OPEN]]|Open file|
Line 78: Line 85:
 |$FF45|_DUP|Copy file handle| |$FF45|_DUP|Copy file handle|
 |$FF46|_DUP2|Force copy file handle| |$FF46|_DUP2|Force copy file handle|
-|$FF47|_CURDIR|Get current directory| +|$FF47|[[doscall#curdir|_CURDIR]]|Get current directory| 
-|$FF48|_MALLOC|Allocate memory| +|$FF48|[[doscall#malloc|_MALLOC]]|Allocate memory| 
-|$FF49|_MFREE|Free memory| +|$FF49|[[doscall#mfree|_MFREE]]|Free memory| 
-|$FF4A|_SETBLOCK|Change memory block|+|$FF4A|[[doscall#setblock|_SETBLOCK]]|Change memory block|
 |$FF4B|_EXEC|Load/execute program| |$FF4B|_EXEC|Load/execute program|
-|$FF4C|_EXIT2|Exit with return code| +|$FF4C|[[doscall#exit2|_EXIT2]]|Exit with return code| 
-|$FF4D|_WAIT|Get process end return code|+|$FF4D|[[doscall#wait|_WAIT]]|Get process end return code|
 |$FF4E|_FILES|Search files| |$FF4E|_FILES|Search files|
 |$FF4F|_NFILES|Search next files| |$FF4F|_NFILES|Search next files|
Line 98: Line 105:
 |$FF87|_FILEDATE|Get/set file date| |$FF87|_FILEDATE|Get/set file date|
 |$FF88|_MALLOC2|Alloc memory| |$FF88|_MALLOC2|Alloc memory|
-|$FF8A|_MAKETMP|Create temporary file| +|$FF8A|[[doscall#maketmp|_MAKETMP]]|Create temporary file| 
-|$FF8B|_NEWFILE|Create new file|+|$FF8B|[[doscall#newfile|_NEWFILE]]|Create new file|
 |$FF8C|_LOCK|Lock file| |$FF8C|_LOCK|Lock file|
 |$FF8F|_ASSIGN|Get/set/cancel virtual drive/directory assignment| |$FF8F|_ASSIGN|Get/set/cancel virtual drive/directory assignment|
Line 129: Line 136:
 |$FFFF|_CHANGE_PR|Execution right abandonment(?) 実行権放棄| |$FFFF|_CHANGE_PR|Execution right abandonment(?) 実行権放棄|
  
- Caution: Calls to $FF00~$FF7F in Human68k Version 2 have been moved +==============================================================================
- to $FF80~$FFAF in Version 3 and later+
  
- Processing address calls at $FFF5~$FFF7 and $FFFA~$FFfE can not be changed(ignored) +===== Error code list =====
- $FFF8,$FFFF is executed after the original processing is normally completed. +
- $FFF8 is called every time a thread is deleted. +
- +
-==============================================================================+
  
-===Error code list=== 
 ^Hex code^Byte code^Description^ ^Hex code^Byte code^Description^
 |$FFFFFFFF| -1|Invalid function code executed| |$FFFFFFFF| -1|Invalid function code executed|
Line 147: Line 148:
 |$FFFFFFFA| -6|The specified handle is not open| |$FFFFFFFA| -6|The specified handle is not open|
 |$FFFFFFF9| -7|The memory management area was destroyed| |$FFFFFFF9| -7|The memory management area was destroyed|
-|$FFFFFFF8| -8|実行に必要なメモリがない+|$FFFFFFF8| -8|Not enough memory for execution|
 |$FFFFFFF7| -9|Invalid memory management pointer specified| |$FFFFFFF7| -9|Invalid memory management pointer specified|
 |$FFFFFFF6|-10|Illegal environment specified| |$FFFFFFF6|-10|Illegal environment specified|
Line 175: Line 176:
 |$FFFFFFB0|-80|File exists| |$FFFFFFB0|-80|File exists|
  
-===Detailed Descriptions===+===== Detailed Descriptions ===== 
  
 ^$FF00^<BOOKMARK:EXIT>_EXIT^Terminate program^ ^$FF00^<BOOKMARK:EXIT>_EXIT^Terminate program^
 |End the program. Open file handles are closed.||| |End the program. Open file handles are closed.|||
 +---
 ^$FF01^<BOOKMARK:GETCHAR>_GETCHAR^Wait for keyboard input(with echo)^ ^$FF01^<BOOKMARK:GETCHAR>_GETCHAR^Wait for keyboard input(with echo)^
 |Arg|none| | |Arg|none| |
 |Return|key code|| |Return|key code||
 |Wait for key input and output the character to stdout. \\ %%^%%C - Return to the parent process \\ %%^%%P - Toggle output stdout to the printer also \\ %%^%%N - Check the printer output state||| |Wait for key input and output the character to stdout. \\ %%^%%C - Return to the parent process \\ %%^%%P - Toggle output stdout to the printer also \\ %%^%%N - Check the printer output state|||
 +---
 ^$FF02^<BOOKMARK:PUTCHAR>_PUTCHAR^Display character^ ^$FF02^<BOOKMARK:PUTCHAR>_PUTCHAR^Display character^
 |Arg|CODE.w|Single-byte character| |Arg|CODE.w|Single-byte character|
Line 194: Line 196:
  DOS _PUTCHAR  DOS _PUTCHAR
  addq.l #2,sp  addq.l #2,sp
 +---
 +^$FF03^<BOOKMARK:cominp>_COMINP^Get 1 byte from RS-232C port^
 +|Arg|None||
 +|Return|1 byte received||
 +|Receive 1 byte from the RS-232C port (with break check)|||
 +---
 +^$FF04^<BOOKMARK:comout>_COMOUT^Send 1 byte to the RS-232C port^
 +|Arg|CODE.w|Byte code|
 +|Return|None||
 +|Send 1 byte to the RS-232C port (with break check)|||
  
 +Usage:
 + move CODE,-(sp)
 + DOS _COMOUT
 + addq.l #2,sp
 +---
 +^$FF05^<BOOKMARK:prnout>_PRNOUT^Output 1 character to the printer^
 +|Arg|CODE.w|Single-byte character code|
 +|Return|None||
 +|Output one character specified by CODE to the printer (with break check). Because the high-order byte of CODE must be 0, kanji is output by sending two bytes in a row in the order of high byte first, then low byte.|||
 +
 +Usage:
 + move CODE,-(sp)
 + DOS _PRNOUT
 + addq.l #2,sp
 +
 +---
 +^$FF06^<BOOKMARK:INPOUT>_INPOUT^Key input/output^
 +|Arg|CODE.w|Single-byte character code|
 +|Return|CODE=0xFF,0xFE, Input key code (no input if d0.l =0) \\ CODE=other, d0.l=0||
 +|If the CODE value is 0xFF if the key is not pressed it returns 0 immediately. If CODE=0xFE the key is read and the value stays in the buffer. If CODE is any other value it is regarded as a character code and displayed.|||
 +
 +Usage:
 + move CODE,-(sp)
 + DOS _INPOUT
 + addq.l #2,sp
 +---
 ^$FF07^<BOOKMARK:inkey>_INKEY^Enter one character from the keyboard (no break check)^ ^$FF07^<BOOKMARK:inkey>_INKEY^Enter one character from the keyboard (no break check)^
 |Arg|none|| |Arg|none||
 |Return|Key code|| |Return|Key code||
 |Wait until a key is pressed and return the key code.||| |Wait until a key is pressed and return the key code.|||
 +---
 ^$FF08^<BOOKMARK:getc>_GETC^Enter one character from the keyboard (with break check)^ ^$FF08^<BOOKMARK:getc>_GETC^Enter one character from the keyboard (with break check)^
 |Arg|none|| |Arg|none||
 |Return|Key code|| |Return|Key code||
 |Wait until a key is pressed and return the key code. Checks for  %%^%%C, %%^%%S, %%^%%P, or %%^%%N.||| |Wait until a key is pressed and return the key code. Checks for  %%^%%C, %%^%%S, %%^%%P, or %%^%%N.|||
 +---
 ^$FF09^<BOOKMARK:print>_PRINT^Print string^ ^$FF09^<BOOKMARK:print>_PRINT^Print string^
 |Arg|MESPTR.l|Pointer to string| |Arg|MESPTR.l|Pointer to string|
Line 214: Line 252:
  DOS _PRINT  DOS _PRINT
  addq,l #4,sp  addq,l #4,sp
 +---
 ^$FF0A^<BOOKMARK:gets>_GETS^Input string^ ^$FF0A^<BOOKMARK:gets>_GETS^Input string^
 |Arg|BUFFER.l|Input buffer pointer| |Arg|BUFFER.l|Input buffer pointer|
Line 229: Line 267:
  DOS _GETS  DOS _GETS
  addq.l #4,sp  addq.l #4,sp
 +---
 +^$FF0B^<BOOKMARK:keysns>_KEYSNS^Check key input state^
 +|Arg|None||
 +|Return|Input state (0: no input, -1: input)||
 +|Examine the key input state. Checks for %%^%%C, %%^%%S, %%^%%P, or %%^%%N. |||
  
 +---
 +^$FF0D^<BOOKMARK:fflush>_FFLUSH^Disk reset^
 +|Arg|None||
 +|Return|Always 0||
 +|Initialize the contents of the disk buffer and the line input buffer from standard input. Does not close the file. Do nothing if //fflush=off//|||
 +---
 +^$FF0E^<BOOKMARK:chgdrv>_CHGDRV^Set current drive^
 +|Arg|DRIVE.w|Drive number (0: A 1: B ... 25: Z)|
 +|Return|Number of drives available||
 +|Change the current drive. Fail if the return value is less than the specified drive number.|||
 +
 +Usage:
 + move DRIVE,-(sp)
 + DOS _CHGDRV
 + addq.l #2,sp
 +---
 +^$FF10^<BOOKMARK:consns>_CONSNS^Check if screen output is possible^
 +|Arg|none||
 +|Return|Output status (0: output impossible, nonzero: output possible)||
 +|Check if screen output is possible.|||
 +---
 +^$FF11^<BOOKMARK:prnsns>_PRNSNS^Check if printer output is possible^
 +|Arg|none||
 +|Return|Output status (0: output impossible, nonzero: output possible)||
 +|Check if printer output is possible.|||
 +---
 +^$FF12^<BOOKMARK:cinsns>_CINSNS^Check if RS-232C input is possible^
 +|Arg|none||
 +|Return|Output status (0: input impossible, nonzero: input possible)||
 +|Check if RS-232C input is possible.|||
 +---
 +^$FF13^<BOOKMARK:coutsns>_COUTSNS^Check if RS-232C output is possible^
 +|Arg|none||
 +|Return|Output status (0: output impossible, nonzero: output possible)||
 +|Check if RS-232C output is possible.|||
 +---
 +^$FF19^<BOOKMARK:curdrv>_CURDRV^Get the current drive^
 +|Arg|None||
 +|Return|Number of the current drive (0: A 1: B ... 25: Z)||
 +|Get the current drive number.|||
 +
 +---
 +^$FF1A^<BOOKMARK:getss>_GETSS^Input string (no break check)^
 +|Arg|BUFFER.l|Input buffer pointer|
 +|Return|Writes the input character string up to the line feed to the input buffer specified by BUFFER. Newline characters are replaced with NULL characters. Does not perform break check(do not break at VOID/NEWLINE) If the length exceeds the maximum number of input characters allowed a warning is issued but execution does not stop. The contents of the input buffer are as follows.||
 +|Get the current drive number.|||
 +
 +^Offset^Size^Desciption^
 +|0|1.b|Maximum input characters allowed: n|
 +|1|1.b|Number of characters actually entered|
 +|2|n+1.b|Input string|
 +---
 +
 +
 +^$FF1B^<BOOKMARK:fgetc>_FGETC^Get one byte from file^
 +|Arg|FILENO.w|File handle|
 +|Return|One byte read from file||
 +|Wait until there is input from the file handle specified by FILENO and return the code if there is input.|||
 +---
 +^$FF1C^<BOOKMARK:fgets>_FGETS^Get string input from file handle^
 +|Arg 1|BUFFER.l|Input buffer pointer|
 +|Arg 2|FILENO.w|File handle|
 +|Return|Number of characters read||
 +|Get a character string from the file handle specified by FILENO up to the line feed and write it to the input buffer specified by BUFFER. Newline characters are replaced with null characters, no break check is done (do not break at VOID/NEWLINE). If it exceeds the maximum number of input characters it terminates early, truncating the string to the maximum number of input characters allowed. The contents of the input buffer are as follows.|||
 +
 +^Offset^Size^Description^
 +|0|1.b|Maximum input characters: n|
 +|1|1.b|Number of actually entered characters|
 +|2|n+1.b|Input string|
 +
 +Usage:
 + move FILENO,-(sp)
 + pea (BUFFER)
 + DOS _FGETS
 + addq.l #6,sp
 +---
 +^$FF1D^<BOOKMARK:fputc>_FPUTC^Output one byte to file handle^
 +|Arg 1|CODE.w|Byte code|
 +|Arg 2|FILENO.w|File handle|
 +|Return|None||
 +|Write 1 byte from CODE to the file specified by FILENO.|||
 +
 + move FILENO,-(sp)
 + move CODE,-(sp)
 + DOS _FPUTC
 + addq.l #4,sp
 +---
 +^$FF1E^<BOOKMARK:fputc>_FPUTS^Output string to file handle^
 +|Arg 1|MESPTR.l|Pointer to string|
 +|Arg 2|FILENO.w|File handle|
 +|Return|None||
 +|Write the string pointed to by MESPTR to the file specified in FILENO. Does not output the NULL character at the end of the string.|||
 +
 +Usage:
 + move FILENO,-(sp)
 + pea (MESPTR)
 + DOS _FPUTS
 + addq.l #6,sp
 +---
 +^$FF1F^<BOOKMARK:allclose>_ALLCLOSE^Close all files^
 +|Arg|None||
 +|Return|None||
 +|Close all open files|||
 +---
 +^$FF20^<BOOKMARK:super>_SUPER^Supervisor/User mode switching^
 +|Arg|STACK.l|Switching mode (0 or address set in SSP)|
 +|Return|STACK=0 Value of the previous SSP (error code if negative) \\ Switch the supervisor/user mode according to the value of STACK \\ \\ STACK=other Set STACK to SSP and switch to user mode.||
 +|Close all open files|||
 +
 +Usage:
 + pea (STACK)
 + DOS _SUPER
 + addq.l #4,sp
 +---
 +^$FF30^<BOOKMARK:vernum>_VERNUM^OS version check^
 +|Arg|None||
 +|Return|Version number||
 +|Check the verion number of Human68k \\ \\ bit 31~24 '6' (0x36) \\ bit 23~16 '8' (0x38) \\ 15~8 integer part of version number \\ bit 7~0 Decimal part of version number.|||
 +---
 +^$FF36^<BOOKMARK:dskfre>_DSKFRE^Get the available space on the disk^
 +|Arg|DRIVE.w|Drive number|
 +|Return|Number of free bytes (2GB maximum, error code if negative)||
 +|Get the remaining free space of the drive specified by DRIVE and write it to the following 8 bytes to BUFFER.|||
 +
 +^Offset^Size^Description^
 +|0|1.w|Number of free clusters|
 +|2|1.w|Total number of clusters|
 +|4|1.w|Number of sectors per cluster|
 +|6|1.w|Number of bytes per sector|
 +
 +Usage:
 + pea (BUFFER)
 + move DRIVE,-(sp)
 + DOS _DSKFRE
 + addq.l #6,sp
 +---
 ^$FF39^<BOOKMARK:mkdir>_MKDIR^Create subdirectory^ ^$FF39^<BOOKMARK:mkdir>_MKDIR^Create subdirectory^
 |Arg|FILE.l|Pointer to directory name| |Arg|FILE.l|Pointer to directory name|
Line 239: Line 418:
  DOS _MKDIR  DOS _MKDIR
  addq.l #4,sp  addq.l #4,sp
 +---
 ^$FF3A^<BOOKMARK:rmdir>_RMDIR^Delete subdirectory^ ^$FF3A^<BOOKMARK:rmdir>_RMDIR^Delete subdirectory^
 |Arg|FILE.l|Pointer to directory name| |Arg|FILE.l|Pointer to directory name|
 |Return|Error code|| |Return|Error code||
-|Delete the subdirectory specified by FILE. The directory must be empty and you can't delete the current directory, the root directory, directories with the //system// or //read-only// attribute. When the call is successful the return value is usually 0, but when a special device driver is targeted, a positive integer may be returned. |||+|Delete the subdirectory specified by FILE. The directory must be empty and you can't delete the current directory, the root directory, directories with the //system// or //read-only// attribute. When the call is successful the return value is usually 0, but when a special device driver is targeted, a positive integer may be returned.|||
  
 Usage: Usage:
Line 249: Line 428:
  DOS _RMDIR  DOS _RMDIR
  addq.l #4,sp  addq.l #4,sp
 +---
 +^$FF3B^<BOOKMARK:chdir>_CHDIR^Change current directory^
 +|Arg|FILE.l|Pointer to directory name|
 +|Return|Error code||
 +|Change the current directory to the directory specified by FILE. When the call is successful the return value is usually 0, but when a special device driver is targeted, a positive integer may be returned. It does not work properly with Human68k version 3.02, change to a subdirectory with length of 22 characters fails.|||
  
 +Usage:
 + pea (FILE)
 + DOS _RM==CHDIR
 + addq.l #4,sp
 +---
 ^$FF3C^<BOOKMARK:create>_CREATE^Create file^ ^$FF3C^<BOOKMARK:create>_CREATE^Create file^
 |Arg 1|FILE.l|Pointer to file name| |Arg 1|FILE.l|Pointer to file name|
Line 261: Line 450:
  DOS _CREATE  DOS _CREATE
  addq.l #6,sp  addq.l #6,sp
 +---
 ^$FF3D^<BOOKMARK:open>_OPEN^Open file^ ^$FF3D^<BOOKMARK:open>_OPEN^Open file^
 |Arg 1|FILE.l|Pointer to file name| |Arg 1|FILE.l|Pointer to file name|
Line 273: Line 462:
  DOS _OPEN  DOS _OPEN
  addq.l #6,sp  addq.l #6,sp
 +---
 ^$FF3E^<BOOKMARK:close>_CLOSE^Close file^ ^$FF3E^<BOOKMARK:close>_CLOSE^Close file^
 |Arg|FILENO.w|File handle| |Arg|FILENO.w|File handle|
Line 283: Line 472:
  DOS _CLOSE  DOS _CLOSE
  addq.l #2,sp  addq.l #2,sp
 +---
 ^$FF3F^<BOOKMARK:read>_READ^Read file^ ^$FF3F^<BOOKMARK:read>_READ^Read file^
 |Arg 1|FILENO.w|File handle| |Arg 1|FILENO.w|File handle|
Line 297: Line 486:
  DOS _READ  DOS _READ
  lea (10,sp),sp  lea (10,sp),sp
 +---
 ^$FF40^<BOOKMARK:write>_WRITE^Write file^ ^$FF40^<BOOKMARK:write>_WRITE^Write file^
 |Arg 1|FILENO.w|File handle| |Arg 1|FILENO.w|File handle|
Line 311: Line 500:
  DOS _WRITE  DOS _WRITE
  lea (10,sp),sp  lea (10,sp),sp
 +---
 ^$FF41^<BOOKMARK:delete>_DELETE^Delete file^ ^$FF41^<BOOKMARK:delete>_DELETE^Delete file^
 |Arg|FILE.l|Pointer to file name| |Arg|FILE.l|Pointer to file name|
Line 321: Line 510:
  DOS _DELETE  DOS _DELETE
  addq.l #4,sp  addq.l #4,sp
 +---
 ^$FF42^<BOOKMARK:seek>_SEEK^Move file pointer^ ^$FF42^<BOOKMARK:seek>_SEEK^Move file pointer^
 |Arg 1|FILENO.w|File handle| |Arg 1|FILENO.w|File handle|
-|Arg 2|MODE.w|Movement mode|+|Arg 2|OFFSET.l|File offset| 
 +|Arg 3|MODE.w|Movement mode|
 |Return|Offset from the beginning of the file.|| |Return|Offset from the beginning of the file.||
 |The pointer of the file specified by FILENO is moved based on the specified MODE and OFFSET. Attempts to move past the beginning or end of the file results in an error. The character device can't seek and the current position will always return 0. \\ \\ MODE = 0 - Start \\ MODE = 1 - Current position (Negative offsets will move the pointer forward) \\ MODE = 2 - EOF (offset must be less than or equal to 0.)||| |The pointer of the file specified by FILENO is moved based on the specified MODE and OFFSET. Attempts to move past the beginning or end of the file results in an error. The character device can't seek and the current position will always return 0. \\ \\ MODE = 0 - Start \\ MODE = 1 - Current position (Negative offsets will move the pointer forward) \\ MODE = 2 - EOF (offset must be less than or equal to 0.)|||
Line 334: Line 524:
  DOS _SEEK  DOS _SEEK
  addq.l #8,sp  addq.l #8,sp
 +---
 +^$FF47^<BOOKMARK:curdir>_CURDIR^Get the current directory^
 +|Arg 1|DRIVE.w|Drive number (0: current 1: A 2: B ... 26: Z)|
 +|Arg 2|BUFFER.l|Buffer pointer|
 +|Return|Error code||
 +|Write the current directory of the drive specified by DRIVE into the 65 byte buffer specified by BUFFER. Does not add '\' to the root directory or '\' to the end of the string.|||
 +
 +Usage:
 + pea (BUFFER)
 + move DRIVE,-(sp)
 + DOS _CURDIR
 + addq.l #6,sp
 +---
 +^$FF48^<BOOKMARK:malloc>_MALLOC^Reserve memory^
 +|Arg|LEN.l|Number of bytes to reserve|
 +|Return|Pointer of allocated memory block (MSP+0x10) \\ d0.l = 0x81?????? the specified amount can't be reserved (0x?????? is the number of bytes that can be reserved). \\ d0.l = 0x8200000? Impossible to completely reserve (0x? is indeterminate).||
 +|Reserve memory with the number of bytes specified by LEN. If LEN is greater than 0x1000000 it is always an error and it is possible to check the maximum number of bytes that can be reserved.|||
 +
 +Usage:
 + move.l LEN,-(sp)
 + DOS _MALLOC
 + addq.l #4,sp
 +---
 +^$FF49^<BOOKMARK:mfree>_MFREE^Release reserved memory^
 +|Arg|MEMPTR.l|Pointer to memory block|
 +|Return|Error code||
 +|Releases the memory block specified by MEMPTR. When MEMPTR=0, release all memory reserved by you.|||
 +
 +Usage:
 + pea (MEMPTR)
 + DOS _MFREE
 + addq.l #4,sp
 +---
 +^$FF4A^<BOOKMARK:setblock>_SETBLOCK^Resize memory block^
 +|Arg 1|MEMPTR.l|Pointer to memory block|
 +|Arg 2|LEN.l|Number of bytes to reserve|
 +|Return|Error code \\ d0.l=0x81?????? Unmodifiable (0x?????? is the number of changeable bytes) \\ d0.l=0x8200000? Completely unmodifyable (0x? is indeterminate)||
 +|Change the memory block specified by MEMPTR to the size specified by LEN. If LEN is greater than 0x1000000 it is always an error and it is possible to check the maximum number of bytes that can be changed.|||
 +
 +Usage:
 +
 + move.l LEN,-(sp)
 + pea (MEMPTR)
 + DOS _SETBLOCK
 + addq.l #8,sp
 +
 +---
 +^$FF4C^<BOOKMARK:exit2>_EXIT2^Exit with return code^
 +|Arg|CODE.w|Exit code|
 +|Return|None||
 +|Quit the program with the exit code specified by CODE. The opened file handles are closed.|||
 +
 +---
 +^$FF4D^<BOOKMARK:wait>_WAIT^Get process exit code^
 +|Arg|None||
 +|Return|Exit code||
 +|Examine the exit code of the executed process. It is the same as the return value of //DOS _EXEC(MODE=0,4)//|||
 +---
 +^$FF8A^<BOOKMARK:maketmp>_MAKETMP^Create temporary file^
 +|Arg 1|FILE.l|Pointer to file name|
 +|Arg 2|ATR.w|File attribute (%XLAD_VSHR)|
 +|Return|The file handle of the created file. If negative, an error occured.||
 +|Create a temporary file specified by FILE with attributes ATR. The file name can contain '?', it is replaced by a number when created. It increments until it becomes a file name that does not exist then creates it. Note that the file name specified by FILE can be rewritten by this DOS call.|||
 +
 +Usage:
 + move ATR,-(sp)
 + pea (FILE)
 + DOS _MAKETMP
 + addq.l #6,sp
 +---
 +^$FF8B^<BOOKMARK:newfile>_NEWFILE^Create new file^
 +|Arg 1|FILE.l|Pointer to file name|
 +|Arg 2|ATR.w|File attribute (%XLAD_VSHR)|
 +|Return|The file handle of the created file. If negative, an error occured.||
 +|Create a temporary file specified by FILE with attributes ATR. If ATR is 0 it is equivalent to the //archive// attribute. If the file already exists it returns an error (-80).|||
 +
 +Usage:
 + move ATR,-(sp)
 + pea (FILE)
 + DOS _MAKETMP
 + addq.l #6,sp
 +
x68000/doscall.1504993124.txt.gz · Last modified: 2019/08/27 20:44 (external edit)