From 3db3fc270d517ca76518b47950f5240990e84cc5 Mon Sep 17 00:00:00 2001 From: Joshua Wise Date: Thu, 8 May 2008 02:07:15 -0400 Subject: [PATCH 1/1] Diag rom now runs from bootloader! --- Makefile | 2 +- System.v | 10 +++++----- binwire.c | 9 +++++---- diag.asm | 6 +++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index fe10ee8..5e50da8 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ VLOGS_ALL = $(VLOGS) insn_call-callcc.v insn_incdec16.v insn_jr-jrcc.v \ insn_ldm8_a.v insn_ldm16_a.v insn_ldbcde_a.v insn_alu_ext.v \ insn_bit.v insn_two_byte.v insn_incdec_reg8.v -all: CoreTop.svf CoreTop.twr +all: CoreTop.svf sim: CoreTop_isim.exe diff --git a/System.v b/System.v index 8f9ef08..55dda1c 100644 --- a/System.v +++ b/System.v @@ -107,9 +107,9 @@ module CellularRAM( assign cr_nWE = decode ? ~wrlatch : 1; assign cr_DQ = (~cr_nOE) ? 16'bzzzzzzzzzzzzzzzz : {8'b0, datalatch}; - assign cr_A = (addrlatch[15:14] == 2'b00) ? /* extrom */ {9'b0,addrlatch[13:0]} : - (addrlatch[15:13] == 3'b101) ? {1'b1, 9'b0, addrlatch[12:0]} : - (addrlatch == ADDR_PROGDATA) ? progaddr : + assign cr_A = (address[15:14] == 2'b00) ? /* extrom */ {9'b0,address[13:0]} : + (address[15:13] == 3'b101) ? {1'b1, 9'b0, address[12:0]} : + (address == ADDR_PROGDATA) ? progaddr : 23'b0; reg [7:0] regbuf; @@ -120,8 +120,8 @@ module CellularRAM( ADDR_PROGADDRM: if (wr) progaddrm <= data; ADDR_PROGADDRL: if (wr) progaddrl <= data; ADDR_PROGDATA: if (rd || wr) begin - progaddr <= {progaddrh[6:0], progaddrm[7:0], progaddr[7:0]}; - {progaddrh[6:0], progaddrm[7:0], progaddr[7:0]} <= {progaddrh[6:0], progaddrm[7:0], progaddr[7:0]} + 23'b1; + progaddr <= {progaddrh[6:0], progaddrm[7:0], progaddrl[7:0]}; + {progaddrh[6:0], progaddrm[7:0], progaddrl[7:0]} <= {progaddrh[6:0], progaddrm[7:0], progaddrl[7:0]} + 23'b1; end endcase rdlatch <= rd; diff --git a/binwire.c b/binwire.c index ed6b98c..a878a5d 100644 --- a/binwire.c +++ b/binwire.c @@ -45,7 +45,7 @@ void expect_no_chars() { int cs = 0; - while (waitchar(10) == 1) + while (waitchar(100) == 1) { char c; if (read(0, &c, 1) == 0) @@ -77,10 +77,11 @@ void main(int argc, char **argv) exit(1); } - dowrite("\x1B" "A\x00\x00\x00...", 8); + dowrite("\x1B" "A\x00\x00\x00", 5); fprintf(stderr, "Address sent\n"); - expect("A...", 4); - while ((sz = read(rfd, buf+3, 128)) > 0) + expect("A", 1); + expect_no_chars(); + while ((sz = read(rfd, buf+3, 255)) > 0) { buf[0] = 0x1B; buf[1] = 'D'; diff --git a/diag.asm b/diag.asm index 780f5c2..b30faf3 100644 --- a/diag.asm +++ b/diag.asm @@ -475,14 +475,14 @@ insntest: ; Serial port manipulation functions. putc: - ld c, $50 + ld c, $53 push af .waitport: ld a,[c] - cp $00 + and $01 jr nz,.waitport pop af - ld [c],a + ld [$FF52],a ret puts: -- 2.43.0