RodrigoDornelles / 3bc-lang

Low-level language, tiny virtual machine, minimal runtime, intermediate representation, embeddable, easy for beginners. (Friendly Punched cards)
https://3bc-lang.org
GNU General Public License v3.0
242 stars 27 forks source link

need to reduce occupied size for compact mode #192

Open RodrigoDornelles opened 3 years ago

RodrigoDornelles commented 3 years ago

It is already very efficient in ram issues, but it is important to reduce the disk/rom space occupied for smaller processors and microcontrollers.

Sketch uses 21816 bytes (67%) of program storage space. Maximum is 32256 bytes.
Global variables use 326 bytes (15%) of dynamic memory, leaving 1722 bytes for local variables. Maximum is 2048 bytes.
RodrigoDornelles commented 3 years ago

151 this can resolve somewhere. it can still be improved by using a conditional branch beforehand for mode and null, which ends up saving good resources for each cpu mode.

if (reg == 0) {
 return &cpu_common_null;
}
else if (reg == 7) {
 return &cpu_commo_mode;
}