os-z80/libs/syscalls.z80
2023-01-29 11:03:53 -06:00

91 lines
1.7 KiB
Z80 Assembly

; Prints a string
; Arguments: Takes a pointer in HL to a null-terminated string
; Clobbers: A, BC, HL
.global print
print:
ld a, 0
jp 0xdffd
; Gets a free frame of memory
; Returns: Frame card in C, frame number in HL
; Clobbers: A, B, DE, IX, IY
.global get_free_frame
get_free_frame:
ld a, 1
jp 0xdffd
; Maps a RAM frame into memory
; Arguments: Page to map in C, card # in B, bank # in DE
; Clobbers: A, IX, and C
.global set_frame
set_frame:
ld a, 2
jp 0xdffd
; Creates a new process
; Arguments: Entry point in HL, page mapping in IY
; Clobbers: unknown
.global new_process
new_process:
ld a, 3
jp 0xdffd
; Yields to the next process
.global yield
yield:
ld a, 4
jp 0xdffd
; Sends a message to the given mailbox
; Arguments: Mailbox ID in HL, message pointer in C:DE:IX
; Returns: 0 in B if message was sent, or 1 if the box was full
.global mb_send
mb_send:
ld a, 5
jp 0xdffd
; Reads a message from the given mailbox
; Arguments: Mailbox ID in HL
; Returns: 0 in B if there was a message, or 1 in B if there wasn't
; message pointer in C:DE:HL
.global mb_read
mb_read:
ld a, 6
jp 0xdffd
; Gets a free mailbox
; Returns: ID in HL
.global get_free_mailbox
get_free_mailbox:
ld a, 7
jp 0xdffd
; Sets the given type ID to the given PID
; Arguments: Type ID in DE, PID in HL
.global proc_map_set
proc_map_set:
ld a, 8
jp 0xdffd
; Gets the value of the given type ID
; Arguments: Type ID in DE
; Returns: PID in HL
.global proc_map_get
proc_map_get:
ld a, 9
jp 0xdffd
; Finds the first card with a given type
; Arguments: Card type in B
; Returns: Zero in A if a card was found, or nonzero otherwise
; The ID of the card in L if a card was found,
; or zero otherwise
; Clobbers: A and H
.global find_first_card
find_first_card:
ld a, 10
jp 0xdffd