I'll upload full "report" once I'm finished implementation.
Here is summary what I've used:
* FPGA board - Terasic DE10-Lite
#
https://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&No=1021 # Intel MAX 10 series: 10M50DAF484C7G
# VGA connector
# Arduino Shield connector
* Addon board - Arduino USB Host Shield
#
https://store.arduino.cc/usa/arduino-usb-host-shield # USB Controler: MAX3421E
# One USB-A female connector
* Keyboard - Happy Hacking Keyboard Lite 2 USB (Black)
#
https://www.amazon.com/Happy-Hacking-Keyboard-Lite2-Black/dp/B0000U1DJ2 # Contains 2-port USB hub
* Monitor - Samsung Samtron 73S
#
https://www.amazon.co.uk/SAMTRON-73V-display-0-264-ivory/dp/B0006B177S # Above link is not exact match, but the most similar product I could found.
* Development tool - Intel Quartus Prime Lite v18.1
#
https://www.intel.com/content/www/us/en/software/programmable/quartus-prime/overview.html # Supports Verilog and VHDL; using both in one project is also possible.
# I used VHDL for keyboard controller, and Verilog for other parts.
Regarding keyboard controller, I know that USB keyboard is *harder* to establish connection than PS/2. Unfortunely, I don't have any PS/2 Keyboard. For now, I implemented minimum USB protocol that would works only on one particular cofiguration - HHKL2 is connected directly (without any additional hubs) on Shield.
Regarding screen controller, the board provides simple connection between FPGA and VGA connector; hsync and vsync is connected directly, and RGB signals is connected via 4-bit resistor array DAC. As FPGA provides true 2-port RAM blocks, implementation was rather simple - read/write from HACK cpu to screen buffer uses port A, and from screen buffer to physical monitor uses port B.
Now optimization.
The most big concern is that the whole program should fit in 32K-word ROM. Therefore, let's assume that optimization means "code size reduction" on here.
I'm currently working on VMTranslator for more compact code generation template. After some works, I could reduce size of "blank project" from 35241 words to 30384 words. Still, I need more works. For example, current size of KeyboardTest is 48028 words.
Here is current score board:
push constant: 6
push local / argument / this / that: 9
push pointer / temp / static: 6
pop local / argument / this / that 0: 6 (was 12)
pop local / argument / this / that 1: 7 (was 12)
pop local / argument / this / that n: 12
pop pointer / temp / static: 5
add, sub, and, or: 5 (was 7)
neg, not: 3
eq, gt, lt: 11
goto: 2
if-goto: 5
call: 35 (current candidate of extracting)
function [name] 0: 0
function [name] n: 4 + 2*n
return: 2 (extracted as "subroutine", was 39)
bootstrap + subroutine: 53