### BU Command 59h (Prepare File Execution with Dir_index, and Parameter) Source: https://psx-spx.consoledev.net/psx-spx.pdf Sends command 59h to prepare file execution with a directory index and execution parameter. The new dir_index can be 0000h (start GUI), 0001h-000Fh (start file), FFFEh (destroy RTC and start GUI), or FFFFh (do nothing). ```APIDOC ## BU Command 59h (Prepare File Execution with Dir_index, and Parameter) ### Description Sends command 59h to prepare file execution with a directory index and execution parameter. The new dir_index can be 0000h (start GUI), 0001h-000Fh (start file), FFFEh (destroy RTC and start GUI), or FFFFh (do nothing). ### Method BU Command ### Endpoint Memory Card Access ### Parameters #### Request Body - **Command** (byte) - Required - Command code 59h - **Dir_index** (word) - Required - New directory index (8-15 and 0-7) - **Exec_parameter** (dword) - Required - Execution parameter (4 bytes) ### Request Example ``` Send: 81h, 59h, 06h, NEW_HI, NEW_LO, PAR0, PAR1, PAR2, PAR3 ``` ### Response #### Success Response - **Length** (byte) - Length of following data (06h) - **Old_dir_index** (word) - Old directory index (8-15 and 0-7) - **Dummy** (4 bytes) - Dummy/zero bytes #### Response Example ``` Receive: 81h, 59h, 06h, OLD_HI, OLD_LO, 00h, 00h, 00h, 00h ``` ``` -------------------------------- ### TTY Initialization Routine Source: https://psx-spx.consoledev.net/psx-spx.pdf Initializes the TTY handler based on the entrypoint parameter. If the parameter is 'TTY+', it sets up the FUNC3 handler via GetPtrToFunc3addr; otherwise it installs a dummy undef handler that just returns. ```assembly ;------------------ init_tty: ;in: r0=param (from entrypoint) ldr r1,=2B595454h ;"TTY+" ;\check if xboo-cable present cmp r1,r0 ; (r0=incoming param from beq @@tty_by_xboo_cable ;/executable's entrypoint) ;- - - mov r1,0 ;\dummy und_handler ldr r2,=0e1b0f00eh ;=movs r15,r14 ; (just return from exception, str r2,[r1,04h] ;und_handler ;/for normal cable-less mode) b @@finish ;--- @@tty_by_xboo_cable: swi 17h ;GetPtrToFunc3addr() ;\ ldr r1,=(tty_func3_handler AND 0ffffh) ; init FUNC3 aka TTY handler strh r1,[r0] ;/ ldr r1,=func3_info ;\ mov r0,0 ;\ ; mark TTY as len=empty str r0,[r1,4] ;func3_buf_len ;/ ; and add r0,r1,0ch ;=func3_buffer ;\ ; init func3 base str r0,[r1,0] ;func3_buf_base ;/ ;/ mov r1,0 ;\ ``` -------------------------------- ### B(49h) - PrintInstalledDevices() Source: https://psx-spx.consoledev.net/psx-spx.pdf Uses printf to display the long and short names from the DCB of the currently installed devices. Does nothing else and has no return value. ```APIDOC ## B(49h) - PrintInstalledDevices() ### Description Uses printf to display the long and short names from the DCB of the currently installed devices. Doesn't do anything else. There's no return value. ### Method BIOS Function Call ### Endpoint B(49h) ### Parameters None ### Return Value None ``` -------------------------------- ### BRK(101h) - PCInit() Source: https://psx-spx.consoledev.net/dev/ps1/kernelbios/pc-file-server/ Initializes the fileserver. No parameters. ```APIDOC ## BRK(101h) - PCInit() ### Description Initializes the fileserver. ### Method BRK (Break) ### Endpoint BRK(101h) ### Parameters None. ### Response No return values specified. ``` -------------------------------- ### GetTD - Command 14h Source: https://psx-spx.consoledev.net/dev/ps1/cdr/cdromdrive/ Get the start time of a specified track or the end of the last track. Returns error code 10h for invalid track numbers or non-BCD parameter values. ```APIDOC ## GetTD - Command 14h ### Description For a disk with NN tracks, parameter values 01h..NNh return the start of the specified track, parameter value 00h returns the end of the last track, and parameter values bigger than NNh return error code 10h. Non-BCD parameter values also return error code 10h. ### Method Command ### Endpoint Command 14h ### Parameters #### Command Parameters - **track** (byte) - Track number (01h..NNh for start of track, 00h for end of last track) #### Return Values (acknowledge) - **stat** (byte) - Status - **mm** (byte) - Minute (BCD) - **ss** (byte) - Second (BCD) ### Notes - The GetTD values are relative to Index=1 and are rounded down to second boundaries (eg. if track=N Index=0 starts at 12:34:56, and Track=N Index=1 starts at 12:36:56, then GetTD(N) will return 12:36, ie. the sector number is truncated, and the Index=0 region is skipped). ``` -------------------------------- ### B(12h) - InitPAD2(buf1, siz1, buf2, siz2) Source: https://psx-spx.consoledev.net/dev/ps1/kernelbios/joypad-functions/ Initializes joypad buffers and sets up the pad enable flag. Must be followed by StartPAD2 to enqueue the IRQ handler. ```APIDOC ## B(12h) - InitPAD2(buf1, siz1, buf2, siz2) ### Description Memorizes the desired buf1/buf2 addresses, zerofills the buffers using the siz1/siz2 buffer size values (which should be 22h bytes each). Does some initialization on the PadCardIrq element (but doesn't enqueue it, that must be done by a following call to StartPAD2), and sets the "pad_enable_flag". That flag can also be set/cleared via InitCARD2(pad_enable), where it selects if the Pads are kept handled together with Memory Cards. ### Method BIOS Function ### Endpoint B(12h) ### Parameters #### Function Parameters - **buf1** (pointer) - Required - Address of the first pad buffer. - **siz1** (integer) - Required - Size of the first buffer (should be 22h). - **buf2** (pointer) - Required - Address of the second pad buffer. - **siz2** (integer) - Required - Size of the second buffer (should be 22h). ### Buffer Format ``` 00h Status (00h=okay, FFh=timeout/wrong ID2) 01h ID1 (eg. 41h=digital_pad, 73h=analogue_pad, 12h=mouse, etc.) 02h..21h Data (max 16 halfwords, depending on lower 4bit of ID1) ``` ### Notes - InitPAD2 does initially zerofill the buffers, so until the first IRQ is processed, the initial status is 00h=okay, with buttons=0000h (all buttons pressed). To fix that situation, change the two status bytes to FFh after calling InitPAD2 (or alternately, reject ID1=00h). - Once PadCardIrq is enqueued via StartPAD2 and while "pad_enable_flag" is set, data for both Pad1 and Pad2 is read on Vblank interrupts and stored in the buffers. The IRQ handler stores up to 22h bytes in the buffer (regardless of siz1/siz2 values). ```