On 9/2/2020 at 1:03 AM, SerErris said:
So you would need to reduce the viewport massively. Full Screen DOOM or Wolfenstein is not realistic. (I know you did not mention Full Screen).
Though AFAIU, full screen DOOM and full screen Wolfenstein are two distinct levels of difficulty, since Wolfenstein only requires vertical scaling. If you prescale Wolfenstein assets so that only (16*8)/8 scaling is required for intermediate scales between the pre-scaled levels, and work in low-res video mode, it seems like it could be done. 16x8/8 can be done as with intermediate step tables that fit into single 8K high RAM segments: eg, unsigned 8x4->12 fits into two 4K tables, one for the low byte and one for the high nybble of the result. Rather than shifting the "d4-d15" result, simply have a second 8x4->(12 lshift 4). So:
1] Bring in low 12 bit table High RAM segment
1] low byte of the 16, low nybble of the 8, store in the first two bytes of result, zero third
2] High byte of the 16, low nybble of the 8, add into the second and third bytes of result
3] Bring in high 12bit table High RAM segment
4] low byte of the 16, high nybble of the 8, add into the first two bytes of result, increment third byte on carry set
5] High byte of the 16, high nybble of the 8, add into the second and third bytes of result
6] RTS
And the division doesn't really need to be perfectly precise, so perhaps 4bitx(1/8bit)->4bit.12bit is enough precision ... that would involve two operaitons into result0 and two operations into result1, then shift the result0 down four bits before summing result1 in. ... And of course, that still leaves room for 4K of more tables.
So 16x8/8->16 in a total of 4 table set-ups and 16 LDA (TBLx),Y or ADC (TBLx),Y operations, one 24bit shift right by 4 bits and supporting glue.
You always use the same nybble twice not only because it is the same low or hygh nybble base of the resulting value, but also because the table reading heart is:
; Nybble in low bits of A, Table BANK in X, Y used, returns with previous BANK on top of stack.
SETTBL: LDY BANK : STX BANK : ORA #$A0 : STZ TBL0
: STA TBL0+1 : #ORA $B0 : STZ TBL1 : STA TBL1+1
L1: PLA : PLX : PHY : PHX : PHA : RTS
_____________________________
Note we don't have to mask the $A0+nybble page address for the $B0 table because $A0 is $10100000 and $B0 is %10110000 and we are looking for the pages corresponding to the same nybble in both cases.