All those documented BIOS functions are based from the SRAM Map; In case of an updated version, I'll put it with the original.
Function names are based on nocash's doc:
1059A4 init_port_2199_registers
SRAM_1059A4:
JML $80C36D //init_port_2199_registers
//----
init_port_2199_registers:
PHB
PHK
PLB
LDA #$41
STA $2199
LDA #$00
XBA
LDA #$08
JSR $1059B0
LDX #$0000
Loop:
LDA _Array,x
XBA
TXA
JSL $1059B0
INX
CPX #$0007
BCC Loop
PLB
RTL
_Array:
db $88, $80, $04, $00, $08, $00, $70
1059A8 send_array_to_port_2199
SRAM_1059A8:
JML $80C399 //send_array_to_port_2199
//----
send_array_to_port_2199:
LDY #$0000
Loop:
LDA $0000,x
XBA
TXA
PHY
JSL $1059B0
PLY
INX
INY
CPY #$0007
BCC Loop
RTL
1059AC recv_3x8bit_from_port_2199
SRAM_1059AC:
JML $80C3AF //recv_3x8bit_from_port_2199
//----
recv_3x8bit_from_port_2199:
LDA #$01
STA $2199
LDA #$40
STA $2199
JSL $1059B4
STA $00,x
JSL $1059B4
STA $01,x
JSL $1059B4
STA $02,x
LDA #$01
STA $2199
LDA #$41
STA $2199
RTL
1059B0 send_16bit_to_port_2199
SRAM_1059B0:
JML $80C3D6 //to send_16bit_to_port_2199
//----
//16-bit data have to be in A, in 8-bit Mode.
send_16bit_to_port_2199:
LDY #$0008
Loop1:
PHA
AND #$80
STA $2199
ORA #$01
STA $2199
PLA
ASL A
DEY
BNE Loop1
XBA
LDY #$0008
Loop2:
PHA
AND #$80
STA $2199
ORA #$01
STA $2199
PLA
ASL A
DEY
BNE $Loop2
LDA #$41
STA $2199
RTL
1059B4 recv_8bit_from_port_2199
SRAM_1059B4:
JML $80C403 //recv_8bit_from_port_2199
//----
recv_8bit_from_port_2199:
LDY #$0008
Loop:
LDA #$81
STA $2199
LDA $2199
ASL A
XBA
ROL A
XBA
LDA #$80
STA $2199
DEY
BNE Loop
XBA
RTL