The platform APIs define how the hardware is accessed on a particular platform. They only need to be written once, and then all games on that hardware architecture can be supported.
If you are developing code for a WPC machine, you do not need to understand the platform APIs in detail, because they are already written for you. If you plan to port FreeWPC to a different hardware architecture, then you will need to write these functions first before you can create any game code.
Every platform must define a header file in
include/
platform/
platform.h
.
This file defines a number of inline functions, all of which begin with
pinio
. It also defines a handful of constants, which begin
with PINIO
.
Platform APIs are the functions that perform the physical I/O. On WPC,
these functions read and write the WPC ASIC registers. All reads and writes
to I/O registers should use the readb
and writeb
macros.
How these work depends on the platform. For most platforms, these turn into
memory-mapped operations. However, they could also use a parallel port or
USB.
Platform APIs are not suitable for game code to call directly, as they are too low-level. Instead, game code uses the core APIs to access a device driver; the device driver then uses the platform APIs.
pinio_write_switch_column
pinio_read_switch_rows
pinio_read_dedicated_switches
pinio_read_flippers
pinio_read_flipper_buttons
pinio_read_flipper_eos
pinio_read_locale
pinio_write_lamp_strobe
pinio_write_lamp_data
pinio_write_solenoid_set (
bank,
value)
pinio_read_ac_zerocross (CONFIG_AC)
pinio_reset_sound
pinio_write_sound
pinio_sound_ready_p
pinio_read_sound
pinio_write_gi (CONFIG_GI)
pinio_read_triac (CONFIG_TRIAC)
pinio_write_triac (CONFIG_TRIAC)
pinio_watchdog_reset (CONFIG_WATCHDOG)
pinio_active_led_toggle (CONFIG_DIAG_LED)
pinio_dmd_window_set (CONFIG_DMD)
pinio_dmd_window_get (CONFIG_DMD)
pinio_dmd_window_ptr (CONFIG_DMD)
pinio_dmd_set_visible (CONFIG_DMD)
pinio_dmd_request_interrupt (CONFIG_DMD)
pinio_parport_write (CONFIG_PARALLEL_PORT)
pinio_set_bank (CONFIG_BANK_SWITCH)
pinio_get_bank (CONFIG_BANK_SWITCH)
pinio_read_timer (CONFIG_HIGHRES_TIMER)
pinio_write_timer (CONFIG_HIGHRES_TIMER)