\. The operation of the "spread" display feature has been altered. When "spread" is enabled, we now produce 2x2 blocks of 4-bit pixels. We continue to use "smap" (deferred) as the colormap while spread, but its default definition is now: : mono-blockmap nibble-out 16 * >gray ; The fields that you may want to use in defining your own colormap are: 0 3 == nibble-out \ 4bit nibble data 4 5 == nibnum-out \ nibble # within block (0, 1, 2, or 3) 6 6 == hblock-out \ horizontal parity of block position 7 7 == vblock-out \ vertical parity of block position .\ \* For detailed comments, see analogous routines in "step-xvds.fth". *\ 4 7 == lo-nibinfo 4 5 == lo-nibnum 4 4 == lo-hnib 5 5 == lo-vnib 6 6 == lo-hblock 7 7 == lo-vblock 12 15 == hi-nibinfo 12 13 == hi-nibnum 12 12 == hi-hnib 13 13 == hi-vnib 14 14 == hi-hblock 15 15 == hi-vblock 0 3 == nibble0 4 7 == nibble1 8 11 == nibble2 12 15 == nibble3 0 3 == nibble-out 4 7 == nibinfo-out 4 5 == nibnum-out 6 6 == hblock-out 7 7 == vblock-out 64 K create-buffer block-hi 64 K create-buffer block-lo : block-hi-rule 0 -> cell lo-hnib {{ nibble2 nibble3 }} -> nibble-out lo-nibinfo -> nibinfo-out ( this is identity ) ; : block-lo-rule 0 -> cell hi-hnib {{ nibble0 nibble1 }} -> nibble-out hi-nibinfo -> nibinfo-out ; : fill-block-hi block-hi 64 K 0 do i h# 0f0 and ( lo-nibinfo ) i i 4 >> 1 and ( lo-nibinfo cell lo-hnib ) 4 * 8 + >> f and ( lo-info nibble-out ) or ( cell.updated ) buffer i /w* + w! loop ; : fill-block-lo block-lo 64 K 0 do i flip h# 0f0 and ( hi-nibinfo ) i flip dup 4 >> 1 and ( hi-nibinfo cell hi-hnib ) 4 * 8 + >> f and ( hi-info nibble-out ) or ( cell.updated ) buffer i /w* + w! loop ; : lut-addr-lo lut-src site lo-nibinfo field address ; : lut-addr-hi lut-src site hi-nibinfo field address ; \* Note that in the line-loop, we schedule the run *before* we change the lut-src. This is done so that if there is some delay and we don't have time to do both, we simply have a few wrong bits at the beginning of the display, rather than miss starting a whole line. Of course this means that we are always sending the lut-src for the line that we just scheduled, rather than the line we are about to schedule. *\ : nib-zoom cell-zoom 2/ ; \ each cell becomes 2x2 bits, so \ nib-zoom is 1/2 of cell-zoom : sector-zoom (s max.dim actual.dim -- n ) / 1 max cell-zoom min po2 ; : video-sector-width-zoom (s -- n ) video-max-width U sector-zoom ; : video-sector-height-zoom (s -- n ) video-max-height V sector-zoom ; : X-sector-width-zoom (s -- n ) X-max-width U sector-zoom ; : X-sector-height-zoom (s -- n ) X-max-height V sector-zoom ; : begin-2x2spread (s magnification -- ) 2 max is cell-zoom \ can't spread if not at least 2. save-select/sector select 0 module lut-data read display-save-table switch-luts lut-data read display-save-table' select *select-buf lut-data block-hi switch-luts lut-data block-lo site-src site display lut scan-index kick ; : spread2x2-vds (s magnification -- ) begin-2x2spread U video-sector-width-zoom * video-max-width po2 min cell-zoom / V video-sector-height-zoom * video-max-height po2 min cell-zoom / UVsubsector sa-bit nib-zoom log lo-hnib field dup reg! hi-hnib field reg! cell-zoom log lo-hblock field dup reg! hi-hblock field reg! U' cell-zoom * nib-zoom * log lo-vnib field dup reg! hi-vnib field reg! U' cell-zoom * cell-zoom * log lo-vblock field dup reg! hi-vblock field reg! #dim @ 0 ?do 0 loop select-subsector cell-zoom log magnify scan-format U' cell-zoom * log esc! V' cell-zoom * 0 ?do run i cell-zoom 2/ mod 0= if new-table then i 0= if frame else line then i cell-zoom 2/ mod 0= if i cell-zoom 2/ / 2 mod {{ lut-addr-hi lut-addr-lo }} no-cam-wait then loop end-spread ; : spread2x2-xds (s magnification -- ) begin-2x2spread U X-sector-width-zoom * X-max-width po2 min cell-zoom / V X-sector-height-zoom * X-max-height po2 min cell-zoom / UVsubsector sa-bit nib-zoom log lo-hnib field dup reg! hi-hnib field reg! cell-zoom log lo-hblock field dup reg! hi-hblock field reg! U' cell-zoom * nib-zoom * log lo-vnib field dup reg! hi-vnib field reg! U' cell-zoom * cell-zoom * log lo-vblock field dup reg! hi-vblock field reg! #dim @ 0 ?do 0 loop select-subsector cell-zoom log magnify scan-format U' cell-zoom * cell-zoom * 2/ log esc! select 0 module V' 2* 0 ?do i 2 mod {{ lut-addr-hi lut-addr-lo }} run free no-scan new-table scan-io byte-read Xbuf i limit part length 2* reglen ! loop end-spread ; define-step 2bvds 2 spread2x2-vds end-step define-step 16bvds 16 spread2x2-vds end-step define-step 2bxds 2 spread2x2-xds end-step define-step 16bxds 16 spread2x2-xds end-step : (bxvds) display? not if exit then show-spread-mode if X-display? if show-zoom-mode {{ 2bxds 16bxds }} image>xmon then cam-display? if show-zoom-mode {{ 2bvds 16bvds }} then else show-function-mode if begin-fn else display site then X-display? if show-zoom-mode {{ xds mxds }} image>xmon then cam-display? if show-zoom-mode {{ vds mvds }} then show-function-mode if end-fn then then ; this is xvds : set-2x2display-mode undo-display-shift step show-zoom-mode if 16 else 2 then is cell-zoom X video-sector-width-zoom * X-max-width min is X-width Y video-sector-height-zoom * X-max-height min is X-height X video-sector-width-zoom * X-width - cell-zoom / 2/ negate Y video-sector-height-zoom * X-height - cell-zoom / 2/ negate xy-display-offset shift-for-display step ; : set-2x2spread (s n -- ) 1 and show-spread-mode over is show-spread-mode <> if show-spread-mode if colormap smap set-2x2display-mode else previous-map set-display-mode then then ; : mono-blockmap nibble-out 16 * >gray ; : init-2x2display reset-xmon zero-display-offset fill-block-hi \ optimized fill-block-lo \ optimized spread-mask on centering-hd off ['] mono-blockmap is smap 0 is show-spread-mode 0 is show-zoom-mode set-2x2display-mode ; init-2x2display DISPLAY-KEYS key-bindings : Toggle-spread show-spread-mode not set-2x2spread xvds ; press s "Show 2x2 blocks of 4-bit pixels." EXPERIMENT-KEYS key-bindings