x68000:doscall
This is an old revision of the document!
Table of Contents
DOS CALL MANUAL
DOS Call list
Code | Name | Description |
---|---|---|
$FF00 | _EXIT | Program end |
$FF01 | _GETCHAR | Get keyboard input (with echo) |
$FF02 | _PUTCHAR | Put character |
$FF03 | _COMINP | RS-232C 1 byte input |
$FF04 | _COMOUT | RS-232C 1 byte output |
$FF05 | _PRNOUT | Printer 1 character output |
$FF06 | _INPOUT | Character I/O |
$FF07 | _INKEY | Get one character from the keyboard (no break check) |
$FF08 | _GETC | Get one character from the keyboard (with break check) |
$FF09 | _PRINT | Print string |
$FF0A | _GETS | Get character string (with break check) |
$FF0B | _KEYSNS | Key input state check |
$FF0C | _KFLUSH | Keyboard input after buffer flush |
$FF0D | _FFLUSH | Disk reset |
$FF0E | _CHGDRV | Current drive setting |
$FF0F | _DRVCTRL | Drive status check/setting |
Code | Name | Description |
---|---|---|
$FF10 | _CONSNS | Screen output check |
$FF11 | _PRNSNS | Printer output check |
$FF12 | _CINSNS | RS-232C input check |
$FF13 | _COUTSNS | RS-232C output check |
$FF17 | _FATCHK | File concatenation state check |
$FF18 | _HENDSP | Kanji conversion control |
$FF19 | _CURDRV | Get current drive |
$FF1A | _GETSS | Get character string (no break check) |
$FF1B | _FGETC | Get character from file |
$FF1C | _FGETS | Get string from file |
$FF1D | _FPUTC | Write one character to file |
$FF1E | _FPUTS | Write string to file |
$FF1F | _ALLCLOSE | Close all files |
Code | Name | Description |
---|---|---|
$FF20 | _SUPER | Supervisor/user mode setting |
$FF21 | _FNCKEY | Get/set redefinable key |
$FF22 | _KNJCTRL | Kana-to-kanji conversion |
$FF23 | _CONCTRL | Console control/direct output |
$FF24 | _KEYCTRL | Console state check/direct input |
$FF25 | _INTVCS | Set vector processing address |
$FF26 | _PSPSET | Create process management pointer |
$FF27 | _GETTIM2 | Get time (longword) |
$FF28 | _SETTIM2 | Set time (longword) |
$FF29 | _NAMESTS | Filename expansion |
$FF2A | _GETDATE | Get date |
$FF2B | _SETDATE | Set date |
$FF2C | _GETTIME | Get time |
$FF2D | _SETTIME | Set time |
$FF2E | _VERIFY | Set verify flag |
$FF2F | _DUP0 | Force file handle copy |
Code | Name | Description |
---|---|---|
$FF30 | _VERNUM | Get OS version |
$FF31 | _KEEPPR | Terminate and stay resident |
$FF32 | _GETDPB | Get drive parameter block |
$FF33 | _BREAKCK | Set break check |
$FF34 | _DRVXCHG | Replace drive |
$FF35 | _INTVCG | Get vector processing address |
$FF36 | _DSKFRE | Get disk space remaining |
$FF37 | _NAMECK | Filename expansion |
$FF39 | _MKDIR | Create subdirectory |
$FF3A | _RMDIR | Remove subdirectory |
$FF3B | _CHDIR | Change current directory |
$FF3C | _CREATE | Create file |
$FF3D | _OPEN | Open file |
$FF3E | _CLOSE | Close file |
$FF3F | _READ | Read file |
Code | Name | Description |
---|---|---|
$FF40 | _WRITE | Write file |
$FF41 | _DELETE | Delete file |
$FF42 | _SEEK | Seek file |
$FF43 | _CHMOD | Set/get file modes |
$FF44 | _IOCTRL | Device driver ioctrl direct I/O |
$FF45 | _DUP | Copy file handle |
$FF46 | _DUP2 | Force copy file handle |
$FF47 | _CURDIR | Get current directory |
$FF48 | _MALLOC | Allocate memory |
$FF49 | _MFREE | Free memory |
$FF4A | _SETBLOCK | Change memory block |
$FF4B | _EXEC | Load/execute program |
$FF4C | _EXIT2 | Exit with return code |
$FF4D | _WAIT | Get process end return code |
$FF4E | _FILES | Search files |
$FF4F | _NFILES | Search next files |
Code | Name | Description |
---|---|---|
$FF80 | _SETPDB | Change process information |
$FF81 | _GETPDB | Get process information |
$FF82 | _SETENV | Set environment variable |
$FF83 | _GETENV | Get environment variable |
$FF84 | _VERIFYG | Get verify flag |
$FF85 | _COMMON | COMMON area control |
$FF86 | _RENAME | Rename/move file |
$FF87 | _FILEDATE | Get/set file date |
$FF88 | _MALLOC2 | Alloc memory |
$FF8A | _MAKETMP | Create temporary file |
$FF8B | _NEWFILE | Create new file |
$FF8C | _LOCK | Lock file |
$FF8F | _ASSIGN | Get/set/cancel virtual drive/directory assignment |
Code | Name | Description |
---|---|---|
$FFAA | FFLUSH | Set FFLUSH mode (undocumented) |
$FFAB | _OS_PATCH | Hook OS internal function (undocumented) |
$FFAC | _GETFCB | Get FCB pointer (undocumented) |
$FFAD | _S_MALLOC | Alloc memory using main memory management |
$FFAE | _S_MFREE | Free memory using main memory management |
$FFAF | _S_PROCESS | Sub memory management setting |
Code | Name | Description |
---|---|---|
$FFF0 | _EXITVC | (program end execution address) |
$FFF1 | _CTRLVC | (CTRL+C execution address at abort) |
$FFF2 | _ERRJVC | (Error abort execution address) |
$FFF3 | _DISKRED | Block device direct input |
$FFF4 | _DISKWRT | Block device direct output |
$FFF5 | _INDOSFLG | Get OS work pointer |
$FFF6 | _SUPER_JSR | Supervisor subroutine call |
$FFF7 | _BUS_ERR | Check for bus error |
$FFF8 | _OPEN_PR | Register background task |
$FFF9 | _KILL_PR | Remove background task |
$FFFA | _GET_PR | Get thread management information |
$FFFB | _SUSPEND_PR | Force thread to sleep |
$FFFC | _SLEEP_PR | Sleep thread |
$FFFD | _SEND_PR | Transmit thread command/data |
$FFFE | _TIME_PR | Get timer counter value |
$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) $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 |
---|---|---|
$FFFFFFFF | -1 | Invalid function code executed |
$FFFFFFFE | -2 | File not found |
$FFFFFFFD | -3 | Directory not found |
$FFFFFFFC | -4 | Too many open files |
$FFFFFFFB | -5 | Directory and volume label inaccessible |
$FFFFFFFA | -6 | The specified handle is not open |
$FFFFFFF9 | -7 | The memory management area was destroyed |
$FFFFFFF8 | -8 | Not enough memory for execution |
$FFFFFFF7 | -9 | Invalid memory management pointer specified |
$FFFFFFF6 | -10 | Illegal environment specified |
$FFFFFFF5 | -11 | Abnormal executable file format |
$FFFFFFF4 | -12 | Abnormal open access mode |
$FFFFFFF3 | -13 | Invalid file name |
$FFFFFFF2 | -14 | Called with invalid parameter |
$FFFFFFF1 | -15 | Invalid drive specified |
$FFFFFFF0 | -16 | Current directory can't be deleted |
$FFFFFFEF | -17 | ioctrl can not be used |
$FFFFFFEE | -18 | No more files found |
$FFFFFFED | -19 | The file can't be written |
$FFFFFFEC | -20 | The directory already exists |
$FFFFFFEB | -21 | File can't be deleted |
$FFFFFFEA | -22 | File can't be renamed |
$FFFFFFE9 | -23 | File can't be created because disk is full |
$FFFFFFE8 | -24 | File can't be created because folder is full |
$FFFFFFE7 | -25 | Can't seek to the specified position |
$FFFFFFE6 | -26 | Supervisor mode require while in supervisor mode |
$FFFFFFE5 | -27 | Thread name exists |
$FFFFFFE4 | -28 | IPC buffer is write protected |
$FFFFFFE3 | -29 | Can't start any more background processes |
$FFFFFFE0 | -32 | InsuFFicient lock space |
$FFFFFFDF | -33 | File is locked and can't be accessed |
$FFFFFFDE | -34 | The drive has a handler open |
$FFFFFFDD | -35 | Symbolic link nest exceeded 16 links(lndrv) |
$FFFFFFB0 | -80 | File exists |
Detailed Descriptions
$FF00 | <BOOKMARK:EXIT>_EXIT | Terminate program |
---|---|---|
End the program. Open file handles are closed. |
—
$FF01 | <BOOKMARK:GETCHAR>_GETCHAR | Wait for keyboard input(with echo) |
---|---|---|
Arg | none | |
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 |
—
$FF02 | <BOOKMARK:PUTCHAR>_PUTCHAR | Display character |
---|---|---|
Arg | CODE.w | Single-byte character |
Return | Always 0 | |
Outputs the character specified by CODE to stdout. It checks whether the key is ^C, ^S, ^P, or ^N. |
Usage:
move CODE,-(sp) DOS _PUTCHAR addq.l #2,sp
—
$FF07 | <BOOKMARK:inkey>_INKEY | Enter one character from the keyboard (no break check) |
---|---|---|
Arg | none | |
Return | 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) |
---|---|---|
Arg | none | |
Return | Key code | |
Wait until a key is pressed and return the key code. Checks for ^C, ^S, ^P, or ^N. |
—
$FF09 | <BOOKMARK:print>_PRINT | Print string |
---|---|---|
Arg | MESPTR.l | Pointer to string |
Return | Always 0 | |
Display the character string specified by MESPTR. Checks for ^C, ^S, ^P, or ^N. |
Usage:
pea (MESPTR) DOS _PRINT addq,l #4,sp
—
$FF0A | <BOOKMARK:gets>_GETS | Input string |
---|---|---|
Arg | BUFFER.l | Input buffer pointer |
Return | Number of characters input. | |
Write a string of input characters up to the line feed to the input buffer specified by BUFFER. The newline character is replaced with the NULL character. Checks for ^C, ^S, ^P, or ^N. If the string exceeds the maximum number of input characters a warning is issued but it doesn't error out. Set the maximum number of input characters before calling this. If you execute it continuously with the same buffer, you can use the template function unless you clear the number of input characters obtained from the previous execution. The content of the input buffer is as follows. |
Offset | Size | Description |
---|---|---|
0 | 1.b | Maximum number of input characters: n |
1 | 1.b | Number of actually entered characters |
2 | n+1.b | Input string |
Usage:
pea (BUFFER) DOS _GETS addq.l #4,sp
—
$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. |
Usage:
pea (FILE) DOS _MKDIR addq.l #4,sp
—
$FF39 | <BOOKMARK:mkdir>_MKDIR | Create subdirectory |
---|---|---|
Arg | FILE.l | Pointer to directory name |
Return | Error code | |
Create the subdirectory 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. |
Usage:
pea (FILE) DOS _MKDIR addq.l #4,sp
—
$FF3A | <BOOKMARK:rmdir>_RMDIR | Delete subdirectory |
---|---|---|
Arg | FILE.l | Pointer to directory name |
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. |
Usage:
pea (FILE) DOS _RMDIR 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 |
---|---|---|
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 the specified file specified by FILE with the attributes specified in ATR. If ATR is 0, it is interpreted as the Archive attribute. If the file already exists the contents of that file will be lost. Directories, volume labels, and files with the System attribute are read-only and will not be deleted. When the MSB of ATR is set, even if the file already exists, it will not be deleted. |
Usage:
move ATR,-(sp) pea (FILE) DOS _CREATE addq.l #6,sp
—
$FF3D | <BOOKMARK:open>_OPEN | Open file |
---|---|---|
Arg 1 | FILE.l | Pointer to file name |
Arg 2 | MODE.w | Access mode |
Return | The file handle of the opened file. If negative, an error occured. | |
Open the file specified by FILE in the access mode specified by MODE. If the file has the read-only attribute it will not open with write or read/write mode. Valid values for mode: bit 8 - Dictionary access mode * %1 - A special file handle is used for dictionary. (Use is prohibited) * %0 - normal bit 6~4 - Sharing mode * %100 always set * %011 - Write only allowed * %010 Read only allowed * %001 Prohibited * %000 Compatibility mode bit 1 to 0 - Read/write mode * %10 Read/write mode * %01 Write mode * %00 read mode The sharing mode specified by bits 6~4 regulates sharing files between multiple processes. When multiple processes are running, each process can read and write the same file at the same time. This is potentially risky behavior and you should always specify an appropriate sharing mode to maintain exclusive control of file access. |
Usage:
move MODE,-(sp) pea (FILE) DOS _OPEN addq.l #6,sp
—
$FF3E | <BOOKMARK:close>_CLOSE | Close file |
---|---|---|
Arg | FILENO.w | File handle |
Return | Error code | |
Close the file handle specified by FILENO. |
Usage:
move FILENO,-(sp) DOS _CLOSE addq.l #2,sp
—
$FF3F | <BOOKMARK:read>_READ | Read file |
---|---|---|
Arg 1 | FILENO.w | File handle |
Arg 2 | BUFFER.l | Pointer to read buffer |
Arg 3 | LEN.l | Number of bytes to read |
Return | Number of bytes actually read. If negative, an error occured. | |
Read the number of bytes speficied in LEN to the buffer specified in BUFFER from the file handle FILENO. After execution the file pointer moves backward(?) by the number of bytes read. If LEN=0, read from the current file pointer to the end of the file. If the return value is less than the specified number of bytes it means that the file has been read to the end. |
Usage:
move.l LEN,-(sp) pea (BUFFER) move FILENO,-(sp) DOS _READ lea (10,sp),sp
—
$FF40 | <BOOKMARK:write>_WRITE | Write file |
---|---|---|
Arg 1 | FILENO.w | File handle |
Arg 2 | BUFFER.l | Write buffer pointer |
Arg 2 | LEN.l | Number of bytes to write |
Return | Number of bytes actually written. If negative, an error occured. | |
Write the number of bytes specified in LEN to the buffer specified in BUFFER from the file handle FILENO. After execution the file pointer moves backward(??) by the number of bytes writte. When the return value is less than the bytes specified this means the disk is full. |
Usage:
move.l LEN,-(sp) pea (BUFFER) move FILENO,-(sp) DOS _WRITE lea (10,sp),sp
—
$FF41 | <BOOKMARK:delete>_DELETE | Delete file |
---|---|---|
Arg | FILE.l | Pointer to file name |
Return | Error code | |
Delete the file specified by FILE. You can not use wildcards, delete directories or volume labels, or files with the system or read-only attributes. |
Usage:
pea (FILE) DOS _DELETE addq.l #4,sp
—
$FF42 | <BOOKMARK:seek>_SEEK | Move file pointer |
---|---|---|
Arg 1 | FILENO.w | File handle |
Arg 2 | MODE.w | Movement mode |
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.) |
Usage:
move MODE,-(sp) move.l OFFSET,-(sp) move FILENO,-(sp) DOS _SEEK 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
x68000/doscall.1505008030.txt.gz · Last modified: 2019/08/27 20:44 (external edit)