1
0
mirror of https://github.com/mist64/perfect6502.git synced 2024-12-27 20:29:43 +00:00

Add destroyChip.

This commit is contained in:
Tom Seddon 2019-09-08 13:36:11 +01:00 committed by Michael Steil
parent 224ac909ee
commit 350f4b27e0
4 changed files with 47 additions and 1 deletions

View File

@ -599,6 +599,44 @@ setupNodesAndTransistors(netlist_transdefs *transdefs, BOOL *node_is_pullup, nod
return state; return state;
} }
void
destroyNodesAndTransistors(state_t *state)
{
free(state->nodes_pullup);
free(state->nodes_pulldown);
free(state->nodes_value);
for (count_t i = 0; i < state->nodes; i++) {
free(state->nodes_gates[i]);
}
free(state->nodes_gates);
for (count_t i = 0; i < state->nodes; i++) {
free(state->nodes_c1c2s[i]);
}
free(state->nodes_c1c2s);
free(state->nodes_gatecount);
free(state->nodes_c1c2count);
free(state->nodes_dependants);
free(state->nodes_left_dependants);
for (count_t i = 0; i < state->nodes; i++) {
free(state->nodes_dependant[i]);
}
free(state->nodes_dependant);
for (count_t i = 0; i < state->nodes; i++) {
free(state->nodes_left_dependant[i]);
}
free(state->nodes_left_dependant);
free(state->transistors_gate);
free(state->transistors_c1);
free(state->transistors_c2);
free(state->transistors_on);
free(state->list1);
free(state->list2);
free(state->listout_bitmap);
free(state->group);
free(state->groupbitmap);
free(state);
}
void void
stabilizeChip(state_t *state) stabilizeChip(state_t *state)
{ {

View File

@ -3,6 +3,7 @@
#endif #endif
state_t *setupNodesAndTransistors(netlist_transdefs *transdefs, BOOL *node_is_pullup, nodenum_t nodes, nodenum_t transistors, nodenum_t vss, nodenum_t vcc); state_t *setupNodesAndTransistors(netlist_transdefs *transdefs, BOOL *node_is_pullup, nodenum_t nodes, nodenum_t transistors, nodenum_t vss, nodenum_t vcc);
void destroyNodesAndTransistors(state_t *state);
void setNode(state_t *state, nodenum_t nn, BOOL s); void setNode(state_t *state, nodenum_t nn, BOOL s);
BOOL isNodeHigh(state_t *state, nodenum_t nn); BOOL isNodeHigh(state_t *state, nodenum_t nn);
unsigned int readNodes(state_t *state, int count, nodenum_t *nodelist); unsigned int readNodes(state_t *state, int count, nodenum_t *nodelist);

View File

@ -198,6 +198,12 @@ initAndResetChip()
return state; return state;
} }
void
destroyChip(void *state)
{
destroyNodesAndTransistors(state);
}
/************************************************************ /************************************************************
* *
* Tracing/Debugging * Tracing/Debugging

View File

@ -3,6 +3,7 @@
#endif #endif
extern state_t *initAndResetChip(); extern state_t *initAndResetChip();
extern void destroyChip(state_t *state);
extern void step(state_t *state); extern void step(state_t *state);
extern void chipStatus(state_t *state); extern void chipStatus(state_t *state);
extern unsigned short readPC(state_t *state); extern unsigned short readPC(state_t *state);