By generalization, the protocol needs to break out the gfx mode command to include the target system and pertinent mode information for that system.
Example(s):
gfx atari antic 8
gfx atari antic 9
gfx atari vbxe 320x240@256
gfx apple hgr
ymmv
This will require a breaking out of the graphics handling routines, mainly the conversion routines. Grouping into there respective systems and then they should handle the post parameters on their own. Keep the "knowledge" of what the param's mean outside of the the main().