forge Documentation

os-equates

OS Equates

Operating system constants, status codes, and device names for the Atari 8-bit computers.

Device Names

NameValueDescription
SCREDT"E"Screen Editor
KBD"K"Keyboard
DISPLY"S"Display
PRINTR"P"Printer
CASSET"C"Cassette
DISK"D"Disk Drive
RS232"R"RS-232 Serial Port

Status Codes

CIO status codes returned in ICSTA or ERR().

Success

CodeHexNameDescription
1$01SUCCESSuccess

Non-Fatal Errors

CodeHexNameDescription
136$88EOFERREnd of File
137$89TRNRCDTruncated Record

Fatal Errors

CodeHexNameDescription
128$80BRKABTBreak Key Abort
130$82PRVOPNIOCB Already Open
130$82NONDEVNonexistent Device
131$83WRONLYOpened for Write Only
132$84NVALIDInvalid Command
133$85NOTOPNDevice or File Not Open
134$86BADIOCInvalid IOCB Number
135$87RDONLYOpened for Read Only
138$8ATIMOUTPeripheral Time Out
139$8BDNACKDevice Does Not Acknowledge
140$8CFRMERRSerial Bus Framing Error
141$8DCRSRORCursor Out of Range
142$8EOVRRUNSerial Bus Data Overrun
143$8FCHKERRSerial Bus Checksum Error
144$90DERRORPeripheral Device Error
145$91BADMODNon Existent Screen Mode
146$92FNCNOTFunction Not Implemented
147$93SCRMEMNot Enough Memory for Screen Mode

CIO Command Codes

CodeHexNameDescription
3$03OPENOpen channel
4$04OPREADOpen for input
5$05GETRECGet record
6$06OPDIROpen to disk directory
7$07GETCHRGet byte
8$08OWRITEOpen for output
9$09PUTRECWrite record
9$09APPENDOpen to append to end of disk file
11$0BPUTCHRPut byte
12$0CCLOSEClose channel
12$0COUPDATOpen for input and output
13$0DSTATUSStatus request
14$0ESPECILBeginning of special commands
17$11DRAWLNScreen draw
18$12FILLINScreen fill
32$20RENAMERename file
32$20INSCLROpen to screen but don't erase
33$21DELETEDelete file
33$21DFRMATFormat disk (RDH)
35$23LOCKLock file
36$24UNLOCKUnlock file
37$25POINTSet file position
38$26NOTEGet file position
40$28LOAD BINARY FILELoad binary file
41$29SAVE BINARY FILESave binary file
80$50PTSECTRDH Put Sector
82$52GTSECTRDH Get Sector
83$53DSTATRDH Get Status
87$57PSECTVRDH Put Sector and Verify
128$80NOIRGNo gap cassette mode

IOCB Constants

NameValueDescription
IOCBSZ$10IOCB size (16 bytes)
MAXIOC$80Max IOCB block size
IOCBF$FFIOCB free

Screen Margins

NameValueDescription
LEDGE$02Default left margin (2)
REDGE$27Default right margin (39)

Special Characters

NameValueDescription
CR$9BCarriage Return (EOL)

Usage Examples

Checking Status

OPEN #1, 4, 0, "D:FILE.TXT"
IF ERR() <> 1 THEN
  ? "Error: "; ERR()
  IF ERR() = 136 THEN ? "End of file"
  IF ERR() = 133 THEN ? "File not open"
ENDIF

Using Device Names

OPEN #1, 4, 0, "K:"  ' Keyboard
OPEN #2, 8, 0, "P:"  ' Printer
OPEN #3, 4, 0, "D:FILE.TXT"  ' Disk file

CIO Command Codes

' These are used internally by FORGE statements
' OPEN uses command 3
' CLOSE uses command 12
' STATUS uses command 13
' XIO can use any command code

Related Topics