Calculations time…
A teletype contains a AT32UC3B0512 MCU, it has 96kb of RAM and 512kb of flash. Pointers are 32bit. The flash can be split between ROM and storage, we are currently using approx. 80kb of ROM.
I’m going to ignore RAM usage, as it stands we have approx. 70kb free. Flash usage is what will constrain us.
Currently… a teletype contains:
- 32 scenes, containing:
- 10 scripts (
1-8, I, M), containing:
So a single scene contains 720 ops, and the entire teletype contains 23040 ops.
Each op is a defacto tagged union:
typedef enum { NUMBER, MOD, SEP, OP } tele_word_t;
typedef struct {
tele_word_t t;
int16_t v;
} tele_data_t;
sizeof(tele_word_t) == 1
sizeof(tele_data_t) == 4 // is 4 due to struct packing
So, 23040 ops * 4 bytes == 92160 bytes.
All the way at the back of the top of this thread we discussed how to store a reference to the op (or mod) in tele_data_t, currently it is an index of a table. If we were to switch to using a pointer to the op struct then sizeof(tele_data_t) == 8 (unless we can come up with some clever way of hiding the tag inside the pointer).
So I think I will keep the op and mod tables, and the new parser code will carry on returning an index for them rather than a pointer.