samiam95124 / Pascal-P6

6th version of Niklaus Wirth's original Pascal language compiler system
Other
28 stars 9 forks source link

Compress unused instruction space in pint/pmach/cmach #145

Open samiam95124 opened 6 months ago

samiam95124 commented 6 months ago

Remove redundant/null instructions in pint/pmach/cmach

The present

The Pascal-P machine is reaching its end at opcode 255, there is in fact no need for it to overrun that space. There are many, perhaps 30 or more, instructions that are duplicates or no-ops. All of the input instructions are given codes according to the instruction names in the intermediate file.

The proposal

A new table is created that has an instruction number field. The existing table is allowed to grow beyond 255, but the actual machine instructions will be limited to 0-255. In this way, all of the duplicate and no-ops can be removed. The existing numbers can be maintained, and the instructions will be backfilled into the newly freed slots.