Start the screen at 132x64

The terminal comes up (and resets with ESC c) in DECCOLM's 132x64 mode;
term_ctrl's WIDE_BOOT parameter selects 80x32 instead. Port 0 bit 2 tells
software which width is showing: BASIC's line editor wraps at it, and
the games, which play at 80 columns, put 132 back when they end.

scripts/sim.sh wide checks the start-up; the other checks still start
at 80x32. Manual, README and terminfo updated. send-hex.py is executable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
brad ArantandClaude Opus 5.5 committed 2026-11-30 19:34:12 -08:00
1 parent 5930b958b4
commit 19278d1d74
23 files changed
+4183 -4102

No files matched your search

+5 -3
View File
@@ -30,6 +30,7 @@ module basys3_terminal #(
parameter MEM_FILE = "basic.mem",
parameter MEM_HI_FILE = "basic-hi.mem",
parameter MON_FILE = "monitor.mem",
parameter WIDE_BOOT = 1, // the screen starts at 132x64 (0: 80x32)
parameter CLK_HZ = 100_000_000,
parameter real CPU_MULT = 9.0, // CPU clock = 100 MHz * CPU_MULT / CPU_DIV
parameter real CPU_DIV = 10.0,
@@ -343,10 +344,11 @@ module basys3_terminal #(
(* ASYNC_REG = "TRUE" *) reg [2:0] brk_s = 3'd0;
always @(posedge cpu_clk) brk_s <= {brk_s[1:0], brk_t};
wire wide; // DECCOLM from the terminal (term_ctrl below)
rv32_system #(.MEM_FILE(MEM_FILE), .MEM_HI_FILE(MEM_HI_FILE), .MON_FILE(MON_FILE), .CPU_HZ(CPU_HZ), .ROM_TOP(ROM_TOP)) sys (
.clk(cpu_clk), .rst(cpu_rst_s[2]),
.rx_req(zrx_req), .rx_data(zrx_data), .rx_ack(zrx_ack),
.tx_req(ztx_req), .tx_data(ztx_data), .tx_ack(ztx_ack),
.tx_req(ztx_req), .tx_data(ztx_data), .tx_ack(ztx_ack), .wide(wide),
.seg_val(rv_seg), .halted(), .brk_key(brk_s[2] ^ brk_s[1]),
.vclk(pix_clk), .gfx_vaddr(gfx_addr), .gfx_vpix(gfx_pix),
.scroll_x(scroll_x), .scroll_y(scroll_y), .g_border(g_border),
@@ -425,7 +427,7 @@ module basys3_terminal #(
// ------------------------------------------------------------- terminal
wire [13:0] t_addr;
wire alt_scr, wide;
wire alt_scr;
wire t_we;
wire [17:0] t_wdata, t_rdata;
wire [5:0] cur_row, stop, sbot;
@@ -443,7 +445,7 @@ module basys3_terminal #(
always @(posedge clk) frame_s <= {frame_s[1:0], frame_t};
assign frame_tick = frame_s[2] ^ frame_s[1];
term_ctrl term (
term_ctrl #(.WIDE_BOOT(WIDE_BOOT)) term (
.clk(clk), .rst(rst), .in_byte(tq), .in_empty(tq_empty), .in_rd(tq_rd),
.lf_cr(sw_r[3]), .clear_req(clr_sync[1]), .def_fg(def_fg),
.smooth_sw(sw_r[8]), .smooth_fast(sw_r[9]), .frame_tick(frame_tick),
+5 -1
View File
@@ -78,6 +78,7 @@ module rv32_system #(
output reg tx_req,
output reg [7:0] tx_data,
input tx_ack,
input wide, // the screen is 132x64 (terminal clock: synchronised here)
output reg [15:0] seg_val,
output halted,
input brk_key, // pulse: the Pause key, enter the monitor
@@ -427,9 +428,12 @@ module rv32_system #(
end
end
(* ASYNC_REG = "TRUE" *) reg [1:0] wide_s = 2'b00;
always @(posedge clk) wide_s <= {wide_s[0], wide};
// -------------------------------------------------------- port reads
always @* case (io_addr)
8'h00: io_din = {6'd0, tx_ready, rx_avail};
8'h00: io_din = {5'd0, wide_s[1], tx_ready, rx_avail};
8'h01: io_din = rx_data;
8'h10: io_din = ms[7:0]; // sampled on the same edge that fills ms_latch
8'h11: io_din = ms_latch[15:8];
+8 -4
View File
@@ -1,7 +1,8 @@
`timescale 1ns / 1ps
// VT220 terminal engine with ANSI colour. Consumes received bytes and keeps
// the character buffer up to date: 80x32, or 132x64 after DECCOLM (CSI ?3h).
// the character buffer up to date: 132x64 (DECCOLM, CSI ?3h; the start-up
// mode unless WIDE_BOOT = 0) or 80x32 (CSI ?3l).
// The buffer is row-major with a 132-cell stride in both (address = row*132 +
// col), so scrolling copies whole 132-cell rows either way.
//
@@ -21,7 +22,9 @@
// Scrolling copies rows in memory. With smooth scroll on, a line feed at the
// bottom margin first slides the region up a few pixels per frame.
module term_ctrl (
module term_ctrl #(
parameter WIDE_BOOT = 1 // start (and ESC c) in 132x64; 0 for 80x32
) (
input clk,
input rst,
input [7:0] in_byte,
@@ -343,8 +346,9 @@ module term_ctrl (
begin
soft_reset;
{row, col} <= 0;
{sclm, lnm, wide, colm_clr} <= 4'b0;
sbot <= 6'd31;
{sclm, lnm, colm_clr} <= 3'b0;
wide <= WIDE_BOOT != 0;
sbot <= WIDE_BOOT != 0 ? 6'd63 : 6'd31;
dec_leds <= 4'd0;
sm_on <= 1'b0;
sm_off <= 5'd0;