diff --git a/perfect6502.c b/perfect6502.c index 9bed919..9db9b9f 100644 --- a/perfect6502.c +++ b/perfect6502.c @@ -296,6 +296,40 @@ group_count() return groupcount; } +/************************************************************ + * + * Node State + * + ************************************************************/ + +void recalcNodeList(const nodenum_t *source, count_t count); + +static inline void +setNode(nodenum_t nn, BOOL state) +{ + set_nodes_pullup(nn, state); + set_nodes_pulldown(nn, !state); + recalcNodeList(&nn, 1); +} + +static inline void +setLow(nodenum_t nn) +{ + setNode(nn, 0); +} + +static inline void +setHigh(nodenum_t nn) +{ + setNode(nn, 1); +} + +static inline BOOL +isNodeHigh(nodenum_t nn) +{ + return get_nodes_state_value(nn); +} + /************************************************************ * * Node and Transistor Emulation @@ -401,8 +435,6 @@ floatnode(nodenum_t nn) set_nodes_state_floating(nn, 1); } -static inline BOOL isNodeHigh(nodenum_t nn); - void recalcTransistor(transnum_t tn) { @@ -502,38 +534,6 @@ recalcAllNodes() recalcNodeList(temp, NODES); } -/************************************************************ - * - * Node State - * - ************************************************************/ - -static inline void -setNode(nodenum_t nn, BOOL state) -{ - set_nodes_pullup(nn, state); - set_nodes_pulldown(nn, !state); - recalcNodeList(&nn, 1); -} - -void -setLow(nodenum_t nn) -{ - setNode(nn, 0); -} - -void -setHigh(nodenum_t nn) -{ - setNode(nn, 1); -} - -static inline BOOL -isNodeHigh(nodenum_t nn) -{ - return get_nodes_state_value(nn); -} - /************************************************************ * * Address Bus and Data Bus Interface