mirror of
https://github.com/KarolS/millfork.git
synced 2024-08-28 20:29:01 +00:00
56 lines
2.2 KiB
Plaintext
56 lines
2.2 KiB
Plaintext
// Routines from C64 KERNAL ROM
|
|
|
|
// CHROUT. Write byte to default output. (If not screen, must call OPEN and CHKOUT beforehands.)
|
|
// Input: A = Byte to write.
|
|
asm void putchar(byte a) @$FFD2 extern
|
|
|
|
// CHRIN. Read byte from default input (for keyboard, read a line from the screen). (If not keyboard, must call OPEN and CHKIN beforehands.)
|
|
// Output: A = Byte read.
|
|
asm byte getchar() @$FFCF extern
|
|
|
|
// CHKIN. Define file as default input. (Must call OPEN beforehands.)
|
|
// Input: X = Logical number.
|
|
asm void chkin(byte x) @$FFC6 extern
|
|
|
|
// CHKOUT. Define file as default output. (Must call OPEN beforehands.)
|
|
// Input: X = Logical number.
|
|
asm void chkout(byte x) @$FFC9 extern
|
|
|
|
// CLRCHN. Close default input/output files (for serial bus, send UNTALK and/or UNLISTEN); restore default input/output to keyboard/screen.
|
|
asm void clrchn() @$FFCC extern
|
|
|
|
// READST. Fetch status of current input/output device, value of ST variable. (For RS232, status is cleared.)
|
|
// Output: A = Device status.
|
|
asm byte readst() @$FFB7 extern
|
|
|
|
inline void new_line() {
|
|
putchar(13)
|
|
}
|
|
|
|
// OPEN. Open file. (Must call SETLFS and SETNAM beforehands.)
|
|
asm void open() @$FFC0 extern
|
|
|
|
// CLOSE. Close file.
|
|
// Input: A = Logical number.
|
|
asm void close(byte a) @$FFC3 extern
|
|
|
|
// SETLFS. Set file parameters.
|
|
// Input: A = Logical number; X = Device number; Y = Secondary address.
|
|
asm void setlfs(byte a, byte x, byte y) @$FFBA extern
|
|
|
|
// SETNAM. Set file name parameters.
|
|
// Input: A = File name length; X/Y = Pointer to file name.
|
|
asm void setnam(word xy, byte a) @$FFBD extern
|
|
|
|
// LOAD. Load or verify file. (Must call SETLFS and SETNAM beforehands.)
|
|
// Input: A: 0 = Load, 1-255 = Verify; X/Y = Load address (if secondary address = 0).
|
|
// Output: Carry: 0 = No errors, 1 = Error; A = KERNAL error code (if Carry = 1); X/Y = Address of last byte loaded/verified (if Carry = 0).
|
|
asm clear_carry load(byte a, word xy) @$FFD5 extern
|
|
|
|
// SAVE. Save file. (Must call SETLFS and SETNAM beforehands.)
|
|
// Input: A = Address of zero page register holding start address of memory area to save; X/Y = End address of memory area plus 1.
|
|
// Output: Carry: 0 = No errors, 1 = Error; A = KERNAL error code (if Carry = 1).
|
|
asm clear_carry save(byte a, word xy) @$FFD8 extern
|
|
|
|
word irq_pointer @$314
|