Moar input

This commit is contained in:
jimmystones
2021-06-22 22:39:33 +01:00
parent 67cf451f71
commit e33072be2c
12 changed files with 1052 additions and 772 deletions

View File

@@ -192,8 +192,7 @@ localparam CONF_STR = {
"-;",
"O89,Aspect ratio,Original,Full Screen,[ARC1],[ARC2];",
"-;",
"-;",
"-;",
"J1,A,B,C,X,Y,Z,L,R,Select,Start;",
"V,v",`BUILD_DATE
};
@@ -214,7 +213,7 @@ wire [7:0] ioctl_din;
wire [7:0] ioctl_index;
wire ioctl_wait;
wire [15:0] joystick_0, joystick_1;
wire [31:0] joystick_0, joystick_1;
wire [21:0] gamma_bus;
@@ -293,22 +292,21 @@ wire reset = (RESET | status[0] | buttons[1] | rom_download);
assign LED_USER = rom_download;
soc soc(
.clk_sys(clk_sys),
.ce_pix(ce_pix),
.reset(reset | ioctl_download),
.VGA_HS(hs),
.VGA_VS(vs),
.VGA_R(r),
.VGA_G(g),
.VGA_B(b),
.VGA_HB(hblank),
.VGA_VB(vblank),
.dn_addr(ioctl_addr[13:0]),
.dn_data(ioctl_dout),
.dn_wr(ioctl_wr),
.dn_index(ioctl_index),
.inputs1(joystick_0[7:0]),
.inputs2(joystick_1[7:0])
.clk_sys(clk_sys),
.ce_pix(ce_pix),
.reset(reset | ioctl_download),
.VGA_HS(hs),
.VGA_VS(vs),
.VGA_R(r),
.VGA_G(g),
.VGA_B(b),
.VGA_HB(hblank),
.VGA_VB(vblank),
.dn_addr(ioctl_addr[13:0]),
.dn_data(ioctl_dout),
.dn_wr(ioctl_wr),
.dn_index(ioctl_index),
.joystick({joystick_5,joystick_4,joystick_3,joystick_2,joystick_1,joystick_0})
);
endmodule

View File

@@ -2,6 +2,9 @@
## Overview
A mini-system running an input test utility. Shows all possible MiSTer inputs simultaneously!
## System
@@ -14,6 +17,7 @@ Start|End|Length|Name
0x4000|0x47FF|0x0800|Char ROM
0x6000|0x6000|0x0001|System inputs (video timings etc)
0x7000|0x70BF|0x00C0|Joystick inputs
0x7100|0x71BF|0x00C0|Analog inputs
0x8000|0x87FF|0x0800|Char RAM
0x8800|0x8FFF|0x0800|Colour RAM
0xC000|0xFFFF|0x4000|Work RAM

View File

@@ -6,10 +6,9 @@
<mameversion>0225</mameversion>
<rbf>InputTest</rbf>
<about></about>
<rom index="0" md5="none">
<part crc="none">
C3 00 01 00 00 00 00 00 FB ED 4D FB 00 00 00 00 FB ED 4D 00 00 00 00 00 FB ED 4D 00 00 00 00 00 FB ED 4D 00 00 00 00 00 FB ED 4D 00 00 00 00 00 FB ED 4D 00 00 00 00 00 FB ED 4D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 31 00 00 CD EC 04 CD E9 03 C3 04 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3E 02 CF C9 3E 00 CF 76 18 FD 01 00 00 21 00 C0 79 96 78 23 9E D0 21 00 80 09 36 00 03 18 EE 40 20 DD E5 DD 21 00 00 DD 39 F5 21 1F 02 4E 06 00 C5 DD 6E 09 DD 66 0A E5 CD C3 04 F1 F1 4D 44 DD 6E 07 DD 66 08 09 EB DD 6E 04 DD 66 05 E5 CD DD 04 F1 4D 06 00 78 91 30 20 21 00 80 19 E3 DD 7E 04 80 6F DD 7E 05 CE 00 67 7E E1 E5 77 21 00 88 19 DD 7E 06 77 13 04 18 DC DD F9 DD E1 C9 DD E5 DD 21 00 00 DD 39 21 1F 02 4E 06 00 C5 DD 6E 08 DD 66 09 E5 CD C3 04 F1 F1 4D 44 DD 6E 06 DD 66 07 09 4D 44 21 00 80 09 DD 7E 04 77 21 00 88 09 DD 7E 05 77 DD E1 C9 DD E5 DD 21 00 00 DD 39 21 00 00 E5 2E 00 E5 DD 56 04 1E 80 D5 CD 7E 02 21 06 00 39 F9 21 00 00 E5 2E 27 E5 DD 56 04 1E 82 D5 CD 7E 02 21 06 00 39 F9 21 1D 00 E5 2E 00 E5 DD 56 04 1E 85 D5 CD 7E 02 21 06 00 39 F9 21 1D 00 E5 2E 27 E5 DD 56 04 1E 84 D5 CD 7E 02 21 06 00 39 F9 0E 01 79 D6 27 30 30 59 16 00 C5 D5 21 00 00 E5 D5 DD 56 04 1E 81 D5 CD 7E 02 21 06 00 39 F9 D1 21 1D 00 E5 D5 DD 56 04 1E 81 D5 CD 7E 02 21 06 00 39 F9 C1 0C 18 CB 0E 01 79 D6 1D 30 2E 59 16 00 C5 D5 D5 21 00 00 E5 DD 56 04 1E 83 D5 CD 7E 02 21 06 00 39 F9 21 27 00 E5 DD 56 04 1E 83 D5 CD 7E 02 21 06 00 39 F9 C1 0C 18 CD DD E1 C9 CD 0A 02 3E 07 F5 33 CD B7 02 33 21 03 00 E5 2E 09 E5 3E FF F5 33 21 D3 03 E5 CD 21 02 21 07 00 39 F9 21 04 00 E5 2E 02 E5 3E F0 F5 33 21 DB 03 E5 CD 21 02 21 07 00 39 F9 21 05 00 E5 2E 02 E5 3E E0 F5 33 21 E2 03 E5 CD 21 02 21 07 00 39 F9 C9 55 20 44 20 4C 20 52 00 4A 4F 59 20 31 29 00 4A 4F 59 20 32 29 00 DD E5 DD 21 00 00 DD 39 F5 3B 21 20 02 5E 21 1F 02 66 2E 00 55 06 08 29 30 01 19 10 FA 22 00 C0 CD 82 03 DD 36 FD AB 3A 00 60 E6 80 32 02 C0 3A 00 60 E6 40 FD 21 04 C0 FD 77 00 FD 7E 00 B7 28 6A 3A 05 C0 B7 20 64 DD 34 FD 21 01 00 E5 2E 06 E5 DD 7E FD F5 33 21 A3 04 E5 CD 21 02 21 07 00 39 F9 DD 36 FF 01 DD 36 FE 00 DD 7E FE D6 07 30 3A DD 6E FE 26 00 29 01 09 00 09 EB 3A 01 60 DD A6 FF B7 28 05 01 BF 04 18 03 01 C1 04 21 04 00 E5 D5 3E FF F5 33 C5 CD 21 02 21 07 00 39 F9 DD 7E FF 87 DD 77 FF DD 34 FE 18 BF 3A 02 C0 32 03 C0 3A 04 C0 32 05 C0 C3 10 04 2D 2D 2D 20 4D 69 53 54 65 72 20 49 6E 70 75 74 20 54 65 73 74 65 72 20 2D 2D 2D 00 31 00 30 00 F1 C1 D1 D5 C5 F5 AF 6F B0 06 10 20 04 06 08 79 29 CB 11 17 30 01 19 10 F7 C9 C1 E1 E5 C5 AF 47 4F ED B1 21 FF FF ED 42 C9 01 00 00 78 B1 28 08 11 06 C0 21 EC 04 ED B0 C9
C3 00 01 00 00 00 00 00 FB ED 4D FB 00 00 00 00 FB ED 4D 00 00 00 00 00 FB ED 4D 00 00 00 00 00 FB ED 4D 00 00 00 00 00 FB ED 4D 00 00 00 00 00 FB ED 4D 00 00 00 00 00 FB ED 4D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 31 00 00 CD 4D 05 CD E6 03 C3 04 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3E 02 CF C9 3E 00 CF 76 18 FD 01 00 00 21 00 C0 79 96 78 23 9E D0 21 00 80 09 36 00 03 18 EE 40 20 DD E5 DD 21 00 00 DD 39 F5 21 1F 02 4E 06 00 C5 DD 6E 09 DD 66 0A E5 CD 22 05 F1 F1 4D 44 DD 6E 07 DD 66 08 09 EB DD 6E 04 DD 66 05 E5 CD 3C 05 F1 4D 06 00 78 91 30 20 21 00 80 19 E3 DD 7E 04 80 6F DD 7E 05 CE 00 67 7E E1 E5 77 21 00 88 19 DD 7E 06 77 13 04 18 DC DD F9 DD E1 C9 DD E5 DD 21 00 00 DD 39 21 1F 02 4E 06 00 C5 DD 6E 08 DD 66 09 E5 CD 22 05 F1 F1 4D 44 DD 6E 06 DD 66 07 09 4D 44 21 00 80 09 DD 7E 04 77 21 00 88 09 DD 7E 05 77 DD E1 C9 DD E5 DD 21 00 00 DD 39 21 00 00 E5 2E 00 E5 DD 56 04 1E 80 D5 CD 7E 02 21 06 00 39 F9 21 00 00 E5 2E 27 E5 DD 56 04 1E 82 D5 CD 7E 02 21 06 00 39 F9 21 1D 00 E5 2E 00 E5 DD 56 04 1E 85 D5 CD 7E 02 21 06 00 39 F9 21 1D 00 E5 2E 27 E5 DD 56 04 1E 84 D5 CD 7E 02 21 06 00 39 F9 0E 01 79 D6 27 30 30 59 16 00 C5 D5 21 00 00 E5 D5 DD 56 04 1E 81 D5 CD 7E 02 21 06 00 39 F9 D1 21 1D 00 E5 D5 DD 56 04 1E 81 D5 CD 7E 02 21 06 00 39 F9 C1 0C 18 CB 0E 01 79 D6 1D 30 2E 59 16 00 C5 D5 D5 21 00 00 E5 DD 56 04 1E 83 D5 CD 7E 02 21 06 00 39 F9 21 27 00 E5 DD 56 04 1E 83 D5 CD 7E 02 21 06 00 39 F9 C1 0C 18 CD DD E1 C9 CD 0A 02 3E 07 F5 33 CD B7 02 33 21 03 00 E5 2E 09 E5 3E FF F5 33 21 D3 03 E5 CD 21 02 21 07 00 39 F9 21 04 00 E5 2E 02 E5 3E F0 F5 33 21 D8 03 E5 CD 21 02 21 07 00 39 F9 21 05 00 E5 2E 02 E5 3E E0 F5 33 21 DF 03 E5 CD 21 02 21 07 00 39 F9 C9 55 44 4C 52 00 4A 4F 59 20 31 29 00 4A 4F 59 20 32 29 00 DD E5 DD 21 00 00 DD 39 21 F8 FF 39 F9 21 20 02 5E 21 1F 02 66 2E 00 55 06 08 29 30 01 19 10 FA 22 00 C0 CD 82 03 06 AB 3A 00 60 E6 80 32 02 C0 3A 00 60 E6 40 FD 21 04 C0 FD 77 00 FD 7E 00 B7 CA F7 04 3A 05 C0 B7 C2 F7 04 04 C5 21 01 00 E5 2E 06 E5 C5 33 21 06 05 E5 CD 21 02 21 07 00 39 F9 C1 0E 00 79 D6 02 D2 F7 04 1E 01 DD 36 FE 00 DD 7E FE D6 08 D2 F3 04 DD 7E FE C6 09 DD 77 FA 51 D5 7A 5F 87 87 83 87 D1 DD 86 FA DD 77 FD 7A 87 87 87 DD 77 FA DD 36 FF 00 DD 7E FF D6 03 30 64 DD 7E FF 2E 00 C6 04 DD 77 F8 7D CE 00 DD 77 F9 DD 7E FD DD 77 FB DD 36 FC 00 DD 7E FF 0F 0F 0F E6 E0 DD 86 FA 57 17 9F 67 3E 00 82 6F 3E 70 8C 67 7E A3 28 06 21 07 C0 56 18 04 21 06 C0 56 C5 D5 DD 6E F8 DD 66 F9 E5 DD 6E FB DD 66 FC E5 3E FF F5 33 D5 33 CD 7E 02 21 06 00 39 F9 D1 C1 DD 34 FF 18 95 CB 23 DD 34 FE C3 56 04 0C C3 4A 04 3A 02 C0 32 03 C0 3A 04 C0 32 05 C0 C3 0E 04 2D 2D 2D 20 4D 69 53 54 65 72 20 49 6E 70 75 74 20 54 65 73 74 65 72 20 2D 2D 2D 00 F1 C1 D1 D5 C5 F5 AF 6F B0 06 10 20 04 06 08 79 29 CB 11 17 30 01 19 10 F7 C9 C1 E1 E5 C5 AF 47 4F ED B1 21 FF FF ED 42 C9 30 31 01 02 00 78 B1 28 08 11 06 C0 21 4B 05 ED B0 C9
</part>
</rom>
<rom index="1" md5="none">

View File

@@ -9,7 +9,10 @@ module soc (
input [7:0] dn_index,
// 6 joysticks, 32 buttons each
input [191:0] joystick,
input [191:0] joystick,
// 6 joysticks, 16 bits each - -127..+127, Y: [15:8], X: [7:0]
input [95:0] analog,
output VGA_HS,
output VGA_VS,
@@ -108,10 +111,11 @@ wire [7:0] colram_data_out;
wire [7:0] in0_data_out = {VGA_HS, VGA_VS, 6'b101000};
wire [7:0] joystick_bit = cpu_addr[7:0];
//wire [7:0] joystick_low_bit = joystick_high_bit - 8'd8;
//[8*(0) +: 8]
wire [7:0] joystick_data_out = joystick[joystick_bit +: 8];
wire [6:0] analog_bit = cpu_addr[6:0];
wire [7:0] analog_data_out = analog[analog_bit +: 8];
// CPU address decodes
wire pgrom_cs = cpu_addr[15:14] == 2'b00;
wire chrom_cs = cpu_addr[15:12] == 4'b0100;
@@ -119,19 +123,17 @@ wire chram_cs = cpu_addr[15:11] == 5'b10000;
wire colram_cs = cpu_addr[15:11] == 5'b10001;
wire wkram_cs = cpu_addr[15:14] == 2'b11;
wire in0_cs = cpu_addr == 16'h6000;
wire joystick_cs = cpu_addr[15:11] == 5'b01110;
wire joystick_cs = cpu_addr[15:7] == 9'b011100000;
wire analog_cs = cpu_addr[15:7] == 9'b011100001;
always @(posedge clk_sys) begin
if(joystick_cs) $display("%b %b", joystick_bit, joystick_data_out);
// always @(posedge clk_sys) begin
// if(pgrom_cs) $display("%x pgrom o %x", cpu_addr, pgrom_data_out);
// if(wkram_cs) $display("%x wkram i %x o %x w %b", cpu_addr, cpu_dout, wkram_data_out, wkram_wr);
// if(chram_cs) $display("%x chram i %x o %x w %b", cpu_addr, cpu_dout, chram_data_out, chram_wr);
// if(colram_cs) $display("%x colram i %x o %x w %b", cpu_addr, cpu_dout, colram_data_out, colram_wr);
// if(in0_cs) $display("%x in0 i %x o %x", cpu_addr, cpu_dout, in0_data_out);
// if(in1_cs) $display("%x in1 i %x o %x", cpu_addr, cpu_dout, inputs);
// if(!pgrom_cs && !wkram_cs && !chram_cs && !in0_cs && !in1_cs) $display("%x ??? i %x", cpu_addr, cpu_dout);
end
// if(joystick_cs) $display("%b %b", joystick_bit, joystick_data_out);
// end
// CPU data mux
assign cpu_din = pgrom_cs ? pgrom_data_out :
@@ -140,7 +142,7 @@ assign cpu_din = pgrom_cs ? pgrom_data_out :
colram_cs ? colram_data_out :
in0_cs ? in0_data_out :
joystick_cs ? joystick_data_out :
// in2_cs ? inputs2 :
analog_cs ? analog_data_out :
8'b00000000;
// Rom upload write enables

View File

@@ -15,6 +15,7 @@
.globl _write_string
.globl _clear_chars
.globl _strlen
.globl _sprintf
.globl _asc_1
.globl _asc_0
.globl _vsync_last
@@ -24,6 +25,7 @@
.globl _chram_size
.globl _colram
.globl _chram
.globl _analog
.globl _joystick
.globl _input0
.globl _chram_rows
@@ -37,6 +39,7 @@
.area _DATA
_input0 = 0x6000
_joystick = 0x7000
_analog = 0x7100
_chram = 0x8000
_colram = 0x8800
_chram_size::
@@ -77,12 +80,12 @@ _asc_1::
; code
;--------------------------------------------------------
.area _CODE
;boot_rom.c:21: void clear_chars()
;boot_rom.c:22: void clear_chars()
; ---------------------------------
; Function clear_chars
; ---------------------------------
_clear_chars::
;boot_rom.c:23: for (unsigned int p = 0; p < chram_size; p++)
;boot_rom.c:24: for (unsigned int p = 0; p < chram_size; p++)
ld bc, #0x0000
00103$:
ld hl, #_chram_size
@@ -92,19 +95,19 @@ _clear_chars::
inc hl
sbc a, (hl)
ret NC
;boot_rom.c:25: chram[p] = 0;
;boot_rom.c:26: chram[p] = 0;
ld hl, #_chram+0
add hl, bc
ld (hl), #0x00
;boot_rom.c:23: for (unsigned int p = 0; p < chram_size; p++)
;boot_rom.c:24: for (unsigned int p = 0; p < chram_size; p++)
inc bc
;boot_rom.c:27: }
;boot_rom.c:28: }
jr 00103$
_chram_cols:
.db #0x40 ; 64
_chram_rows:
.db #0x20 ; 32
;boot_rom.c:29: void write_string(const char *string, char color, unsigned int x, unsigned int y)
;boot_rom.c:30: void write_string(const char *string, char color, unsigned int x, unsigned int y)
; ---------------------------------
; Function write_string
; ---------------------------------
@@ -113,7 +116,7 @@ _write_string::
ld ix,#0
add ix,sp
push af
;boot_rom.c:31: unsigned int p = (y * chram_cols) + x;
;boot_rom.c:32: unsigned int p = (y * chram_cols) + x;
ld hl,#_chram_cols + 0
ld c, (hl)
ld b, #0x00
@@ -130,20 +133,20 @@ _write_string::
ld h, 8 (ix)
add hl, bc
ex de,hl
;boot_rom.c:32: unsigned char l = strlen(string);
;boot_rom.c:33: unsigned char l = strlen(string);
ld l, 4 (ix)
ld h, 5 (ix)
push hl
call _strlen
pop af
ld c, l
;boot_rom.c:33: for (char c = 0; c < l; c++)
;boot_rom.c:34: for (char c = 0; c < l; c++)
ld b, #0x00
00103$:
ld a, b
sub a, c
jr NC,00105$
;boot_rom.c:35: chram[p] = string[c];
;boot_rom.c:36: chram[p] = string[c];
ld hl, #_chram
add hl, de
ex (sp), hl
@@ -157,22 +160,22 @@ _write_string::
pop hl
push hl
ld (hl), a
;boot_rom.c:36: colram[p] = color;
;boot_rom.c:37: colram[p] = color;
ld hl, #_colram
add hl, de
ld a, 6 (ix)
ld (hl), a
;boot_rom.c:37: p++;
;boot_rom.c:38: p++;
inc de
;boot_rom.c:33: for (char c = 0; c < l; c++)
;boot_rom.c:34: for (char c = 0; c < l; c++)
inc b
jr 00103$
00105$:
;boot_rom.c:39: }
;boot_rom.c:40: }
ld sp, ix
pop ix
ret
;boot_rom.c:41: void write_char(unsigned char c, char color, unsigned int x, unsigned int y)
;boot_rom.c:42: void write_char(unsigned char c, char color, unsigned int x, unsigned int y)
; ---------------------------------
; Function write_char
; ---------------------------------
@@ -180,7 +183,7 @@ _write_char::
push ix
ld ix,#0
add ix,sp
;boot_rom.c:43: unsigned int p = (y * chram_cols) + x;
;boot_rom.c:44: unsigned int p = (y * chram_cols) + x;
ld hl,#_chram_cols + 0
ld c, (hl)
ld b, #0x00
@@ -198,20 +201,20 @@ _write_char::
add hl, bc
ld c, l
ld b, h
;boot_rom.c:44: chram[p] = c;
;boot_rom.c:45: chram[p] = c;
ld hl, #_chram+0
add hl, bc
ld a, 4 (ix)
ld (hl), a
;boot_rom.c:45: colram[p] = color;
;boot_rom.c:46: colram[p] = color;
ld hl, #_colram+0
add hl, bc
ld a, 5 (ix)
ld (hl), a
;boot_rom.c:46: }
;boot_rom.c:47: }
pop ix
ret
;boot_rom.c:48: void page_border(char color)
;boot_rom.c:49: void page_border(char color)
; ---------------------------------
; Function page_border
; ---------------------------------
@@ -219,7 +222,7 @@ _page_border::
push ix
ld ix,#0
add ix,sp
;boot_rom.c:50: write_char(128, color, 0, 0);
;boot_rom.c:51: write_char(128, color, 0, 0);
ld hl, #0x0000
push hl
ld l, #0x00
@@ -231,7 +234,7 @@ _page_border::
ld hl, #6
add hl, sp
ld sp, hl
;boot_rom.c:51: write_char(130, color, 39, 0);
;boot_rom.c:52: write_char(130, color, 39, 0);
ld hl, #0x0000
push hl
ld l, #0x27
@@ -243,7 +246,7 @@ _page_border::
ld hl, #6
add hl, sp
ld sp, hl
;boot_rom.c:52: write_char(133, color, 0, 29);
;boot_rom.c:53: write_char(133, color, 0, 29);
ld hl, #0x001d
push hl
ld l, #0x00
@@ -255,7 +258,7 @@ _page_border::
ld hl, #6
add hl, sp
ld sp, hl
;boot_rom.c:53: write_char(132, color, 39, 29);
;boot_rom.c:54: write_char(132, color, 39, 29);
ld hl, #0x001d
push hl
ld l, #0x27
@@ -267,13 +270,13 @@ _page_border::
ld hl, #6
add hl, sp
ld sp, hl
;boot_rom.c:54: for (char x = 1; x < 39; x++)
;boot_rom.c:55: for (char x = 1; x < 39; x++)
ld c, #0x01
00104$:
ld a, c
sub a, #0x27
jr NC,00101$
;boot_rom.c:56: write_char(129, color, x, 0);
;boot_rom.c:57: write_char(129, color, x, 0);
ld e, c
ld d, #0x00
push bc
@@ -300,17 +303,17 @@ _page_border::
add hl, sp
ld sp, hl
pop bc
;boot_rom.c:54: for (char x = 1; x < 39; x++)
;boot_rom.c:55: for (char x = 1; x < 39; x++)
inc c
jr 00104$
00101$:
;boot_rom.c:59: for (char y = 1; y < 29; y++)
;boot_rom.c:60: for (char y = 1; y < 29; y++)
ld c, #0x01
00107$:
ld a, c
sub a, #0x1d
jr NC,00109$
;boot_rom.c:61: write_char(131, color, 0, y);
;boot_rom.c:62: write_char(131, color, 0, y);
ld e, c
ld d, #0x00
push bc
@@ -335,27 +338,27 @@ _page_border::
add hl, sp
ld sp, hl
pop bc
;boot_rom.c:59: for (char y = 1; y < 29; y++)
;boot_rom.c:60: for (char y = 1; y < 29; y++)
inc c
jr 00107$
00109$:
;boot_rom.c:64: }
;boot_rom.c:65: }
pop ix
ret
;boot_rom.c:66: void page_inputs()
;boot_rom.c:67: void page_inputs()
; ---------------------------------
; Function page_inputs
; ---------------------------------
_page_inputs::
;boot_rom.c:68: clear_chars();
;boot_rom.c:69: clear_chars();
call _clear_chars
;boot_rom.c:69: page_border(0b00000111);
;boot_rom.c:70: page_border(0b00000111);
ld a, #0x07
push af
inc sp
call _page_border
inc sp
;boot_rom.c:70: write_string("UDLR", 0xFF, 9, 3);
;boot_rom.c:71: write_string("UDLR", 0xFF, 9, 3);
ld hl, #0x0003
push hl
ld l, #0x09
@@ -369,7 +372,7 @@ _page_inputs::
ld hl, #7
add hl, sp
ld sp, hl
;boot_rom.c:71: write_string("JOY 1)", 0xF0, 2, 4);
;boot_rom.c:72: write_string("JOY 1)", 0xF0, 2, 4);
ld hl, #0x0004
push hl
ld l, #0x02
@@ -383,7 +386,7 @@ _page_inputs::
ld hl, #7
add hl, sp
ld sp, hl
;boot_rom.c:72: write_string("JOY 2)", 0xE0, 2, 5);
;boot_rom.c:73: write_string("JOY 2)", 0xE0, 2, 5);
ld hl, #0x0005
push hl
ld l, #0x02
@@ -397,7 +400,21 @@ _page_inputs::
ld hl, #7
add hl, sp
ld sp, hl
;boot_rom.c:73: }
;boot_rom.c:74: write_string("JOY 3)", 0xD0, 2, 6);
ld hl, #0x0006
push hl
ld l, #0x02
push hl
ld a, #0xd0
push af
inc sp
ld hl, #___str_3
push hl
call _write_string
ld hl, #7
add hl, sp
ld sp, hl
;boot_rom.c:75: }
ret
___str_0:
.ascii "UDLR"
@@ -408,7 +425,10 @@ ___str_1:
___str_2:
.ascii "JOY 2)"
.db 0x00
;boot_rom.c:78: void main()
___str_3:
.ascii "JOY 3)"
.db 0x00
;boot_rom.c:80: void main()
; ---------------------------------
; Function main
; ---------------------------------
@@ -416,10 +436,10 @@ _main::
push ix
ld ix,#0
add ix,sp
ld hl, #-7
ld hl, #-24
add hl, sp
ld sp, hl
;boot_rom.c:80: chram_size = chram_cols * chram_rows;
;boot_rom.c:82: chram_size = chram_cols * chram_rows;
ld hl,#_chram_rows + 0
ld e, (hl)
ld hl,#_chram_cols + 0
@@ -427,130 +447,137 @@ _main::
ld l, #0x00
ld d, l
ld b, #0x08
00176$:
00191$:
add hl, hl
jr NC,00177$
jr NC,00192$
add hl, de
00177$:
djnz 00176$
00192$:
djnz 00191$
ld (_chram_size), hl
;boot_rom.c:82: page_inputs();
;boot_rom.c:84: page_inputs();
call _page_inputs
;boot_rom.c:84: while (1)
ld b, #0xab
00108$:
;boot_rom.c:86: hsync = input0 & 0x80;
;boot_rom.c:86: while (1)
ld -15 (ix), #0xab
00109$:
;boot_rom.c:88: hsync = input0 & 0x80;
ld a,(#_input0 + 0)
and a, #0x80
ld (#_hsync + 0),a
;boot_rom.c:87: vsync = input0 & 0x40;
;boot_rom.c:89: vsync = input0 & 0x40;
ld a,(#_input0 + 0)
and a, #0x40
ld iy, #_vsync
ld 0 (iy), a
;boot_rom.c:92: if (vsync && !vsync_last)
;boot_rom.c:94: if (vsync && !vsync_last)
ld a, 0 (iy)
or a, a
jp Z, 00105$
jp Z, 00106$
ld a,(#_vsync_last + 0)
or a, a
jp NZ, 00105$
;boot_rom.c:94: color++;
inc b
;boot_rom.c:95: write_string("--- MiSTer Input Tester ---", color, 6, 1);
push bc
jp NZ, 00106$
;boot_rom.c:96: color++;
inc -15 (ix)
;boot_rom.c:97: write_string("--- MiSTer Input Tester ---", color, 6, 1);
ld hl, #0x0001
push hl
ld l, #0x06
push hl
push bc
ld a, -15 (ix)
push af
inc sp
ld hl, #___str_3
ld hl, #___str_4
push hl
call _write_string
ld hl, #7
add hl, sp
ld sp, hl
pop bc
;boot_rom.c:97: for (char b = 0; b < 2; b++)
ld c, #0x00
00117$:
ld a, c
;boot_rom.c:98: int y = 4;
ld bc, #0x0004
;boot_rom.c:99: for (char b = 0; b < 2; b++)
ld e, #0x00
00118$:
ld a, e
sub a, #0x02
jp NC, 00105$
;boot_rom.c:99: char m = 0b00000001;
ld e, #0x01
;boot_rom.c:100: for (char i = 0; i < 8; i++)
ld -2 (ix), #0x00
00114$:
ld a, -2 (ix)
jp NC, 00103$
;boot_rom.c:101: char m = 0b00000001;
ld -5 (ix), #0x01
;boot_rom.c:102: for (char i = 0; i < 8; i++)
ld -6 (ix), #0x00
00115$:
ld a, -6 (ix)
sub a, #0x08
jp NC, 00118$
;boot_rom.c:102: char x = 9 + i + (b * 10);
ld a, -2 (ix)
jp NC, 00119$
;boot_rom.c:104: char x = 9 + i + (b * 10);
ld a, -6 (ix)
add a, #0x09
ld d, a
ld a, c
ld -8 (ix), a
ld d, e
push de
ld a, d
ld e, a
add a, a
add a, a
add a, e
add a, a
pop de
add a, d
ld -3 (ix), a
;boot_rom.c:103: for (char j = 0; j < 3; j++)
ld -1 (ix), #0x00
00111$:
ld a, -1 (ix)
add a, -8 (ix)
ld -7 (ix), a
;boot_rom.c:105: for (char j = 0; j < 3; j++)
ld a, d
add a, a
add a, a
add a, a
ld -8 (ix), a
ld -2 (ix), #0x00
00112$:
ld a, -2 (ix)
sub a, #0x03
jr NC,00101$
;boot_rom.c:105: write_char((joystick[b + (j * 32)] & m) ? asc_1 : asc_0, 0xFF, x, 4 + j);
ld a, -1 (ix)
;boot_rom.c:107: write_char((joystick[(b * 8) + (j * 32)] & m) ? asc_1 : asc_0, 0xFF, x, 4 + j);
ld a, -2 (ix)
ld l, #0x00
add a, #0x04
ld -7 (ix), a
ld -14 (ix), a
ld a, l
adc a, #0x00
ld -6 (ix), a
ld a, -3 (ix)
ld -5 (ix), a
ld -4 (ix), #0x00
ld a, -1 (ix)
ld -13 (ix), a
ld a, -7 (ix)
ld -10 (ix), a
ld -9 (ix), #0x00
ld a, -2 (ix)
rrca
rrca
rrca
and a, #0xe0
ld d, c
add a, d
ld l, a
add a, -8 (ix)
ld d, a
rla
sbc a, a
ld d, a
ld h, a
ld a, #<(_joystick)
add a, l
add a, d
ld l, a
ld a, #>(_joystick)
adc a, d
adc a, h
ld h, a
ld a, (hl)
and a,e
jr Z,00121$
and a, -5 (ix)
or a, a
jr Z,00125$
ld hl,#_asc_1 + 0
ld d, (hl)
jr 00122$
00121$:
jr 00126$
00125$:
ld hl,#_asc_0 + 0
ld d, (hl)
00122$:
00126$:
push bc
push de
ld l, -7 (ix)
ld h, -6 (ix)
ld l, -14 (ix)
ld h, -13 (ix)
push hl
ld l, -5 (ix)
ld h, -4 (ix)
ld l, -10 (ix)
ld h, -9 (ix)
push hl
ld a, #0xff
push af
@@ -563,31 +590,126 @@ _main::
ld sp, hl
pop de
pop bc
;boot_rom.c:103: for (char j = 0; j < 3; j++)
inc -1 (ix)
jr 00111$
00101$:
;boot_rom.c:107: m <<= 1;
sla e
;boot_rom.c:100: for (char i = 0; i < 8; i++)
;boot_rom.c:105: for (char j = 0; j < 3; j++)
inc -2 (ix)
jp 00114$
00118$:
;boot_rom.c:97: for (char b = 0; b < 2; b++)
inc c
jp 00117$
00105$:
;boot_rom.c:111: hsync_last = hsync;
jr 00112$
00101$:
;boot_rom.c:109: m <<= 1;
ld a, -5 (ix)
add a, a
ld -5 (ix), a
;boot_rom.c:102: for (char i = 0; i < 8; i++)
inc -6 (ix)
jp 00115$
00119$:
;boot_rom.c:99: for (char b = 0; b < 2; b++)
inc e
jp 00118$
00103$:
;boot_rom.c:113: y += 6;
ld hl, #0x0006
add hl, bc
ld -4 (ix), l
ld -3 (ix), h
;boot_rom.c:115: char m = 0b00000001;
ld -10 (ix), #0x01
;boot_rom.c:117: for (char j = 0; j < 8; j++)
ld hl, #0x0000
add hl, sp
ld -14 (ix), l
ld -13 (ix), h
ld a, -14 (ix)
ld -12 (ix), a
ld a, -13 (ix)
ld -11 (ix), a
ld -1 (ix), #0x00
00121$:
ld a, -1 (ix)
sub a, #0x08
jr NC,00106$
;boot_rom.c:119: signed char jx = analog[(j * 16)];
ld l, -1 (ix)
ld h, #0x00
add hl, hl
add hl, hl
add hl, hl
add hl, hl
ld de, #_analog
add hl, de
ld c, (hl)
;boot_rom.c:120: signed char jy = analog[(j * 16) + 8];
ld a, -1 (ix)
rlca
rlca
rlca
rlca
and a, #0xf0
add a, #0x08
ld e, a
rla
sbc a, a
ld d, a
ld hl, #_analog
add hl, de
ld a, (hl)
;boot_rom.c:121: sprintf(str, "%d,%d", jx, jy);
ld e, a
rla
sbc a, a
ld d, a
ld a, c
rla
sbc a, a
ld b, a
ld l, -14 (ix)
ld h, -13 (ix)
push de
push bc
ld bc, #___str_5
push bc
push hl
call _sprintf
ld hl, #8
add hl, sp
ld sp, hl
;boot_rom.c:122: write_string(str, 0xFF, 5, y);
ld c, -12 (ix)
ld b, -11 (ix)
ld l, -4 (ix)
ld h, -3 (ix)
push hl
ld hl, #0x0005
push hl
ld a, #0xff
push af
inc sp
push bc
call _write_string
ld hl, #7
add hl, sp
ld sp, hl
;boot_rom.c:123: m <<= 1;
ld a, -10 (ix)
add a, a
ld -10 (ix), a
;boot_rom.c:117: for (char j = 0; j < 8; j++)
inc -1 (ix)
jr 00121$
00106$:
;boot_rom.c:126: hsync_last = hsync;
ld a,(#_hsync + 0)
ld (#_hsync_last + 0),a
;boot_rom.c:112: vsync_last = vsync;
;boot_rom.c:127: vsync_last = vsync;
ld a,(#_vsync + 0)
ld (#_vsync_last + 0),a
;boot_rom.c:114: }
jp 00108$
___str_3:
;boot_rom.c:129: }
jp 00109$
___str_4:
.ascii "--- MiSTer Input Tester ---"
.db 0x00
___str_5:
.ascii "%d,%d"
.db 0x00
.area _CODE
.area _INITIALIZER
__xinit__asc_0:

Binary file not shown.

View File

@@ -5,6 +5,7 @@
// Memory maps
unsigned char __at(0x6000) input0;
unsigned char __at(0x7000) joystick[24];
unsigned char __at(0x7100) analog[24];
unsigned char __at(0x8000) chram[2048];
unsigned char __at(0x8800) colram[2048];
@@ -70,6 +71,7 @@ void page_inputs()
write_string("UDLR", 0xFF, 9, 3);
write_string("JOY 1)", 0xF0, 2, 4);
write_string("JOY 2)", 0xE0, 2, 5);
write_string("JOY 3)", 0xD0, 2, 6);
}
char asc_0 = 48;
@@ -93,7 +95,7 @@ void main()
{
color++;
write_string("--- MiSTer Input Tester ---", color, 6, 1);
int y = 4;
for (char b = 0; b < 2; b++)
{
char m = 0b00000001;
@@ -102,11 +104,24 @@ void main()
char x = 9 + i + (b * 10);
for (char j = 0; j < 3; j++)
{
write_char((joystick[b + (j * 32)] & m) ? asc_1 : asc_0, 0xFF, x, 4 + j);
write_char((joystick[(b * 8) + (j * 32)] & m) ? asc_1 : asc_0, 0xFF, x, 4 + j);
}
m <<= 1;
}
}
y += 6;
char m = 0b00000001;
char str[9];
for (char j = 0; j < 8; j++)
{
signed char jx = analog[(j * 16)];
signed char jy = analog[(j * 16) + 8];
sprintf(str, "%d,%d", jx, jy);
write_string(str, 0xFF, 5, y);
m <<= 1;
}
}
hsync_last = hsync;
vsync_last = vsync;

File diff suppressed because it is too large Load Diff

View File

@@ -42,13 +42,14 @@ Area Addr Size Decimal Bytes (A
0000000C l__HEADER8
0000000F l__GSINIT
00000200 s__CODE
0000033E l__CODE
0000053E s__HOME
0000053E s__INITIALIZER
00000540 s__GSINIT
0000054F s__GSFINAL
00001023 l__CODE
00001223 s__HOME
00001223 s__INITIALIZER
00001225 s__GSINIT
00001234 s__GSFINAL
00006000 _input0 boot_rom
00007000 _joystick boot_rom
00007100 _analog boot_rom
00008000 _chram boot_rom
00008800 _colram boot_rom
0000C000 s__DATA
@@ -62,7 +63,7 @@ Hexadecimal [32-Bits]
Area Addr Size Decimal Bytes (Attributes)
-------------------------------- ---- ---- ------- ----- ------------
_CODE 00000200 0000033E = 830. bytes (REL,CON)
_CODE 00000200 00001023 = 4131. bytes (REL,CON)
Value Global Global Defined In Module
----- -------------------------------- ------------------------
@@ -75,10 +76,14 @@ _CODE 00000200 0000033E = 830. bytes (R
0000027E _write_char boot_rom
000002B7 _page_border boot_rom
00000382 _page_inputs boot_rom
000003E6 _main boot_rom
00000515 __mulint
0000051B __mul16
0000052F _strlen
00000404 _main boot_rom
000005F0 __mulint
000005F6 __mul16
0000062A _vsprintf sprintf
0000065F _sprintf sprintf
00000693 _strlen
000007BD __print_format printf_large
00001222 ___sdcc_call_hl
ASxxxx Linker V03.00 + NoICE + sdld, page 3.
Hexadecimal [32-Bits]
@@ -166,7 +171,7 @@ Hexadecimal [32-Bits]
Area Addr Size Decimal Bytes (Attributes)
-------------------------------- ---- ---- ------- ----- ------------
_INITIALIZER 0000053E 00000002 = 2. bytes (REL,CON)
_INITIALIZER 00001223 00000002 = 2. bytes (REL,CON)
Value Global Global Defined In Module
----- -------------------------------- ------------------------
@@ -175,18 +180,18 @@ Hexadecimal [32-Bits]
Area Addr Size Decimal Bytes (Attributes)
-------------------------------- ---- ---- ------- ----- ------------
_GSINIT 00000540 0000000F = 15. bytes (REL,CON)
_GSINIT 00001225 0000000F = 15. bytes (REL,CON)
Value Global Global Defined In Module
----- -------------------------------- ------------------------
00000540 gsinit crt0
00001225 gsinit crt0
ASxxxx Linker V03.00 + NoICE + sdld, page 14.
Hexadecimal [32-Bits]
Area Addr Size Decimal Bytes (Attributes)
-------------------------------- ---- ---- ------- ----- ------------
_GSFINAL 0000054F 00000001 = 1. bytes (REL,CON)
_GSFINAL 00001234 00000001 = 1. bytes (REL,CON)
Value Global Global Defined In Module
----- -------------------------------- ------------------------
@@ -228,7 +233,10 @@ boot_rom.rel [ boot_rom ]
Libraries Linked [ object file ]
/usr/bin/../share/sdcc/lib/z80/z80.lib [ mul.rel ]
/usr/bin/../share/sdcc/lib/z80/z80.lib [ sprintf.rel ]
/usr/bin/../share/sdcc/lib/z80/z80.lib [ strlen.rel ]
/usr/bin/../share/sdcc/lib/z80/z80.lib [ printf_large.rel ]
/usr/bin/../share/sdcc/lib/z80/z80.lib [ __sdcc_call_hl.rel ]
ASxxxx Linker V03.00 + NoICE + sdld, page 18.

View File

@@ -33,13 +33,14 @@ DEF l__DATA 0x6
DEF l__HEADER8 0xC
DEF l__GSINIT 0xF
DEF s__CODE 0x200
DEF l__CODE 0x33E
DEF s__HOME 0x53E
DEF s__INITIALIZER 0x53E
DEF s__GSINIT 0x540
DEF s__GSFINAL 0x54F
DEF l__CODE 0x1023
DEF s__HOME 0x1223
DEF s__INITIALIZER 0x1223
DEF s__GSINIT 0x1225
DEF s__GSFINAL 0x1234
DEF _input0 0x6000
DEF _joystick 0x7000
DEF _analog 0x7100
DEF _chram 0x8000
DEF _colram 0x8800
DEF s__DATA 0xC000
@@ -56,11 +57,15 @@ DEF _write_string 0x221
DEF _write_char 0x27E
DEF _page_border 0x2B7
DEF _page_inputs 0x382
DEF _main 0x3E6
DEF __mulint 0x515
DEF __mul16 0x51B
DEF _strlen 0x52F
DEF gsinit 0x540
DEF _main 0x404
DEF __mulint 0x5F0
DEF __mul16 0x5F6
DEF _vsprintf 0x62A
DEF _sprintf 0x65F
DEF _strlen 0x693
DEF __print_format 0x7BD
DEF ___sdcc_call_hl 0x1222
DEF gsinit 0x1225
DEF _chram_size 0xC000
DEF _hsync 0xC002
DEF _hsync_last 0xC003

View File

@@ -7,13 +7,16 @@ Symbol Table
.__.ABS. = 0000 G
.__.CPU. = 0000 L
.__.H$L. = 0000 L
0 ___str_0 01C9 R
0 ___str_1 01CE R
0 ___str_2 01D5 R
0 ___str_3 02EF R
0 ___str_0 01E0 R
0 ___str_1 01E5 R
0 ___str_2 01EC R
0 ___str_3 01F3 R
0 ___str_4 03C4 R
0 ___str_5 03E0 R
__mulint **** GX
7 __xinit__asc_0 0000 R
7 __xinit__asc_1 0001 R
_analog = 7100 G
2 _asc_0 0000 GR
2 _asc_1 0001 GR
_chram = 8000 G
@@ -26,9 +29,10 @@ Symbol Table
1 _hsync_last 0003 GR
_input0 = 6000 G
_joystick = 7000 G
0 _main 01DC GR
0 _main 01FA GR
0 _page_border 00AD GR
0 _page_inputs 0178 GR
_sprintf **** GX
_strlen **** GX
1 _vsync 0004 GR
1 _vsync_last 0005 GR
@@ -41,7 +45,7 @@ Hexadecimal [16-Bits]
Area Table
0 _CODE size 30B flags 0
0 _CODE size 3E6 flags 0
1 _DATA size 6 flags 0
2 _INITIALIZED size 2 flags 0
3 _DABS size 0 flags 8

View File

@@ -22,12 +22,12 @@ module top(
input [31:0] joystick_5,
// analog -127..+127, Y: [15:8], X: [7:0]
// input [15:0] joystick_analog_0;
// input [15:0] joystick_analog_1;
// input [15:0] joystick_analog_2;
// input [15:0] joystick_analog_3;
// input [15:0] joystick_analog_4;
// input [15:0] joystick_analog_5;
input [15:0] joystick_analog_0,
input [15:0] joystick_analog_1,
input [15:0] joystick_analog_2,
input [15:0] joystick_analog_3,
input [15:0] joystick_analog_4,
input [15:0] joystick_analog_5,
output [7:0] VGA_R/*verilator public_flat*/,
output [7:0] VGA_G/*verilator public_flat*/,
@@ -62,7 +62,8 @@ soc soc(
.dn_wr(ioctl_wr),
.dn_index(ioctl_index),
.joystick({joystick_5,joystick_4,joystick_3,joystick_2,joystick_1,joystick_0})
.joystick({joystick_5,joystick_4,joystick_3,joystick_2,joystick_1,joystick_0}),
.analog({joystick_analog_5,joystick_analog_4,joystick_analog_3,joystick_analog_2,joystick_analog_1,joystick_analog_0})
);
endmodule