From e33072be2c10dfe070c57a9148e1927daf6e57ba Mon Sep 17 00:00:00 2001 From: jimmystones Date: Tue, 22 Jun 2021 22:39:33 +0100 Subject: [PATCH] Moar input --- InputTest.sv | 36 +- README.MD | 4 + release/InputTest.mra | 3 +- rtl/soc.v | 24 +- src/boot_rom.asm | 370 ++++++++---- src/boot_rom.bin | Bin 1360 -> 4661 bytes src/boot_rom.c | 19 +- src/boot_rom.lst | 1276 ++++++++++++++++++++++------------------- src/boot_rom.map | 36 +- src/boot_rom.noi | 25 +- src/boot_rom.sym | 16 +- verilator/sim.v | 15 +- 12 files changed, 1052 insertions(+), 772 deletions(-) diff --git a/InputTest.sv b/InputTest.sv index 323f44a..baab5bb 100644 --- a/InputTest.sv +++ b/InputTest.sv @@ -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 diff --git a/README.MD b/README.MD index b667f72..913ac44 100644 --- a/README.MD +++ b/README.MD @@ -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 diff --git a/release/InputTest.mra b/release/InputTest.mra index 61abc32..87bcf47 100644 --- a/release/InputTest.mra +++ b/release/InputTest.mra @@ -6,10 +6,9 @@ 0225 InputTest - -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 diff --git a/rtl/soc.v b/rtl/soc.v index 6588382..fa7dc99 100644 --- a/rtl/soc.v +++ b/rtl/soc.v @@ -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 diff --git a/src/boot_rom.asm b/src/boot_rom.asm index d29264e..8169376 100644 --- a/src/boot_rom.asm +++ b/src/boot_rom.asm @@ -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: diff --git a/src/boot_rom.bin b/src/boot_rom.bin index cdfbdf217cd0edc2476981ed7b302d9472a75e4e..6ca0f886b5ed6d465eb899d7b89c438a60f10304 100644 GIT binary patch literal 4661 zcmdT{U2GHC6~1Y1OFe!y>J;?L!}6i&{Ta)jC9uioIqN7H7%Nm!Ed+KtciuNgzLtd+vncs#7Er>;47Rbm8Q}Oe8iY+)qgS zc!}7oiw8(Ny+mx$#qA_cEsAd+*}MNuw(r1kaa)--Y}bd1GM1~tgEVa>8tbSWzH)ZN zVl8tT)~%d3+VNjkzoq;k9`59lZV#SK&0BIgwd+n5)T|VQk zzj8{&ALfD%i&Pl$3MR=C@`mH^Pr&yy0sl07&$ML6E3(k(Xn|`%_%+ly+ISAG*;du` zt=4+dWJS0zk3b6Yw1H4ji3<}5(EbxpCZRrsG6gwJUZgv%&eQOxUuR|XTgA?XFZ7hqfTFZ<4EZ2+ho8hx0YVDrE;|Eutx1XcdGZIcEBdbhN z9#WO5T9)z{!g((V$!1B!{$4mvznZ-rgNeAzPM^#fr@6TIf@ zrKeBQMlFMh@b&5gqaRD@^ynUKU$xCy?XG;^xw4_Hu$sE0GU{=d8rsBa-tVg2cP0_8 z;H|)BQGsR&k*=}s%1J9oP)(Ttsy)P%dljZk}_^q#3H zD=R9a`S;q|q4WgBE99r4m1^&w$eWtrGBQ&xzRLA)(VINMGQuD2{D%7?w@q_M_H%#b zS%YBGISZX)q(k#|OC+L=TOAjSU4_hsJq zJC5?{1Ci(2@`I7@YvZ9vxsA&YXOD}cRq)&3E2fg#5GdZ_5we1;WQ!-0`tb6+SC#O*SC!~E>Oz1jsoBb@5?$!UJ!`KI zYo7sHRSIx+g7EGUcQvB9$0<{hu2!Qi3GYyYIp|o=*;wmGx0qM#j+WIzAI>LnZV2@~ z@J#4B8T?R}6NY+&j(tBiU;pht|6v=uG*MKXvjw$xxv@n>^0*Iyeq8{yPq9PoSA>r; zn~|@PsuJ$(T?(4KJ<#|{FtV*AXZ$6Of~SQ(fnLZ+W9jOK(rkdvJfBdTglDLLKBx5X z8}epb3OJj2v$L76E25F93OcLq>zvh6Pyqh}_#S?Rb!U^P9}@OcpVGPe)F$kqyH(hw zJP~isP z8zi{V;iNy)5oN0mMu-*kTrNXzALp5Vsx*`&l^V*B@HaZJH3jucC<9OvPzH&OJ(1tP zqVJpyhuHY#;b=Uzg@X{vFys+px<_=4vP>YGvNRn{dv1O7>Y`LXDxePkcfD59iKaY` zW4b@X2#i2aFQq|CuO1Plmm;F{_VM)6Tt825e`de3#q1+Z{vTF}G{v z-spB|AM%atj%ap=+ZMFB5pGwXqm?vAcprvugiOI;uK$FSmIe%{;+wh7Y)_d?bG!@p1G;zc{b+^J~(8 z+5vb5A&)W1#wum1W;?tcVS)=aUTkaOcts1MlOBFX-G%RSRsXCzvGi@l%@ekp#$t}f zd+^0oBV1!pC&vg%lkm60*HLHp+U@EV|6l%mQ~Vvy4x^ruHwJ~4(RoF_^cWDG@rZRA zaURpaPaq}m4{B!|Rhd@z!qrPehvq(K_QYI9O>hlx=nrB?pYSQv0S*6ygnz9UsDINQ zM^1I?3++y-L)g(Hcxk(!;~=8Xmn`4%AD3@N^qI#YWqB>1);W!2>}tW$u}7VqA6#u8 zIZS(Ab-u~d;IKjNB68|xlv24%rysf@&!uOy2_oulIJ5okNEcvxjhAysyB_=UVbDA*6iu9tnBm;W{UeZ4RuN@`821z zPjkfHxx93XUse7jd_&ro<*wQTqG$hs?;duuht6#VBWw8BVO?bjN%qpw8@K-r6&6L? delta 371 zcmX|+y-Pw-7{<>z_dQpOP#P+c3Jx{6RF)y=aETCtAo>_=YzS=AHgm|J2%)Vmv^Mky zlti>%6N88weW0|wRKsyFBpVv8nz!51^c$Y%_rP;G`p|t2)IGz^s!{}|_tMY9C4R&r zzCQl-wGhLk3lr|H4@?3kxHKoYzRY5@@8Xy#)c34NQ!wEo5laA(<4kIe?~r)W^GZK` z)nAq2Zj>kp!HBSQ4-8UO9|QkR4Wit*x~>6~1a&-BmO{dU|FMFHWGd{b2E!D?9fH|T z#r;$Thc{iTnetjLx0id|#qp(@o6&V7i6j_Fuv4^;X}O zcT)o=s~Xu~Noku08`;x(_joystick) - 029F 8A [ 4] 535 adc a, d - 02A0 67 [ 4] 536 ld h, a - 02A1 7E [ 7] 537 ld a, (hl) - 02A2 A3 [ 4] 538 and a,e - 02A3 28 06 [12] 539 jr Z,00121$ - 02A5 21r01r00 [10] 540 ld hl,#_asc_1 + 0 - 02A8 56 [ 7] 541 ld d, (hl) - 02A9 18 04 [12] 542 jr 00122$ - 02AB 543 00121$: - 02AB 21r00r00 [10] 544 ld hl,#_asc_0 + 0 - 02AE 56 [ 7] 545 ld d, (hl) - 02AF 546 00122$: - 02AF C5 [11] 547 push bc - 02B0 D5 [11] 548 push de - 02B1 DD 6E F9 [19] 549 ld l, -7 (ix) - 02B4 DD 66 FA [19] 550 ld h, -6 (ix) - 02B7 E5 [11] 551 push hl - 02B8 DD 6E FB [19] 552 ld l, -5 (ix) - 02BB DD 66 FC [19] 553 ld h, -4 (ix) - 02BE E5 [11] 554 push hl - 02BF 3E FF [ 7] 555 ld a, #0xff - 02C1 F5 [11] 556 push af - 02C2 33 [ 6] 557 inc sp - 02C3 D5 [11] 558 push de - 02C4 33 [ 6] 559 inc sp - 02C5 CDr74r00 [17] 560 call _write_char - 02C8 21 06 00 [10] 561 ld hl, #6 - 02CB 39 [11] 562 add hl, sp - 02CC F9 [ 6] 563 ld sp, hl - 02CD D1 [10] 564 pop de - 02CE C1 [10] 565 pop bc - 566 ;boot_rom.c:103: for (char j = 0; j < 3; j++) - 02CF DD 34 FF [23] 567 inc -1 (ix) - 02D2 18 96 [12] 568 jr 00111$ - 02D4 569 00101$: - 570 ;boot_rom.c:107: m <<= 1; - 02D4 CB 23 [ 8] 571 sla e - 572 ;boot_rom.c:100: for (char i = 0; i < 8; i++) - 02D6 DD 34 FE [23] 573 inc -2 (ix) - 02D9 C3r4Cr02 [10] 574 jp 00114$ - 02DC 575 00118$: - 576 ;boot_rom.c:97: for (char b = 0; b < 2; b++) - 02DC 0C [ 4] 577 inc c - 02DD C3r40r02 [10] 578 jp 00117$ - 02E0 579 00105$: - 580 ;boot_rom.c:111: hsync_last = hsync; - 02E0 3Ar02r00 [13] 581 ld a,(#_hsync + 0) - 02E3 32r03r00 [13] 582 ld (#_hsync_last + 0),a - 583 ;boot_rom.c:112: vsync_last = vsync; - 02E6 3Ar04r00 [13] 584 ld a,(#_vsync + 0) - 02E9 32r05r00 [13] 585 ld (#_vsync_last + 0),a - 586 ;boot_rom.c:114: } - 02EC C3r04r02 [10] 587 jp 00108$ - 02EF 588 ___str_3: - 02EF 2D 2D 2D 20 4D 69 589 .ascii "--- MiSTer Input Tester ---" + 77 .area _HOME + 78 .area _HOME + 79 ;-------------------------------------------------------- + 80 ; code + 81 ;-------------------------------------------------------- + 82 .area _CODE + 83 ;boot_rom.c:22: void clear_chars() + 84 ; --------------------------------- + 85 ; Function clear_chars + 86 ; --------------------------------- + 0000 87 _clear_chars:: + 88 ;boot_rom.c:24: for (unsigned int p = 0; p < chram_size; p++) + 0000 01 00 00 [10] 89 ld bc, #0x0000 + 0003 90 00103$: + 0003 21r00r00 [10] 91 ld hl, #_chram_size + 0006 79 [ 4] 92 ld a, c + 0007 96 [ 7] 93 sub a, (hl) + 0008 78 [ 4] 94 ld a, b + 0009 23 [ 6] 95 inc hl + 000A 9E [ 7] 96 sbc a, (hl) + 000B D0 [11] 97 ret NC + 98 ;boot_rom.c:26: chram[p] = 0; + 000C 21 00 80 [10] 99 ld hl, #_chram+0 + 000F 09 [11] 100 add hl, bc + 0010 36 00 [10] 101 ld (hl), #0x00 + 102 ;boot_rom.c:24: for (unsigned int p = 0; p < chram_size; p++) + 0012 03 [ 6] 103 inc bc + 104 ;boot_rom.c:28: } + 0013 18 EE [12] 105 jr 00103$ + 0015 106 _chram_cols: + 0015 40 107 .db #0x40 ; 64 + 0016 108 _chram_rows: + 0016 20 109 .db #0x20 ; 32 + 110 ;boot_rom.c:30: void write_string(const char *string, char color, unsigned int x, unsigned int y) + 111 ; --------------------------------- + 112 ; Function write_string + 113 ; --------------------------------- + 0017 114 _write_string:: + 0017 DD E5 [15] 115 push ix + 0019 DD 21 00 00 [14] 116 ld ix,#0 + 001D DD 39 [15] 117 add ix,sp + 001F F5 [11] 118 push af + 119 ;boot_rom.c:32: unsigned int p = (y * chram_cols) + x; + 0020 21r15r00 [10] 120 ld hl,#_chram_cols + 0 + 0023 4E [ 7] 121 ld c, (hl) + 0024 06 00 [ 7] 122 ld b, #0x00 + 0026 C5 [11] 123 push bc + 0027 DD 6E 09 [19] 124 ld l, 9 (ix) + 002A DD 66 0A [19] 125 ld h, 10 (ix) + 002D E5 [11] 126 push hl + 002E CDr00r00 [17] 127 call __mulint + 0031 F1 [10] 128 pop af + 0032 F1 [10] 129 pop af + 0033 4D [ 4] 130 ld c, l + 0034 44 [ 4] 131 ld b, h + 0035 DD 6E 07 [19] 132 ld l, 7 (ix) + 0038 DD 66 08 [19] 133 ld h, 8 (ix) + 003B 09 [11] 134 add hl, bc + 003C EB [ 4] 135 ex de,hl + 136 ;boot_rom.c:33: unsigned char l = strlen(string); + 003D DD 6E 04 [19] 137 ld l, 4 (ix) + 0040 DD 66 05 [19] 138 ld h, 5 (ix) + 0043 E5 [11] 139 push hl + 0044 CDr00r00 [17] 140 call _strlen + 0047 F1 [10] 141 pop af + 0048 4D [ 4] 142 ld c, l + 143 ;boot_rom.c:34: for (char c = 0; c < l; c++) + 0049 06 00 [ 7] 144 ld b, #0x00 + 004B 145 00103$: + 004B 78 [ 4] 146 ld a, b + 004C 91 [ 4] 147 sub a, c + 004D 30 20 [12] 148 jr NC,00105$ + 149 ;boot_rom.c:36: chram[p] = string[c]; + 004F 21 00 80 [10] 150 ld hl, #_chram + 0052 19 [11] 151 add hl, de + 0053 E3 [19] 152 ex (sp), hl + 0054 DD 7E 04 [19] 153 ld a, 4 (ix) + 0057 80 [ 4] 154 add a, b + 0058 6F [ 4] 155 ld l, a + 0059 DD 7E 05 [19] 156 ld a, 5 (ix) + 005C CE 00 [ 7] 157 adc a, #0x00 + 005E 67 [ 4] 158 ld h, a + 005F 7E [ 7] 159 ld a, (hl) + 0060 E1 [10] 160 pop hl + 0061 E5 [11] 161 push hl + 0062 77 [ 7] 162 ld (hl), a + 163 ;boot_rom.c:37: colram[p] = color; + 0063 21 00 88 [10] 164 ld hl, #_colram + 0066 19 [11] 165 add hl, de + 0067 DD 7E 06 [19] 166 ld a, 6 (ix) + 006A 77 [ 7] 167 ld (hl), a + 168 ;boot_rom.c:38: p++; + 006B 13 [ 6] 169 inc de + 170 ;boot_rom.c:34: for (char c = 0; c < l; c++) + 006C 04 [ 4] 171 inc b + 006D 18 DC [12] 172 jr 00103$ + 006F 173 00105$: + 174 ;boot_rom.c:40: } + 006F DD F9 [10] 175 ld sp, ix + 0071 DD E1 [14] 176 pop ix + 0073 C9 [10] 177 ret + 178 ;boot_rom.c:42: void write_char(unsigned char c, char color, unsigned int x, unsigned int y) + 179 ; --------------------------------- + 180 ; Function write_char + 181 ; --------------------------------- + 0074 182 _write_char:: + 0074 DD E5 [15] 183 push ix + 0076 DD 21 00 00 [14] 184 ld ix,#0 + 007A DD 39 [15] 185 add ix,sp + 186 ;boot_rom.c:44: unsigned int p = (y * chram_cols) + x; + 007C 21r15r00 [10] 187 ld hl,#_chram_cols + 0 + 007F 4E [ 7] 188 ld c, (hl) + 0080 06 00 [ 7] 189 ld b, #0x00 + 0082 C5 [11] 190 push bc + 0083 DD 6E 08 [19] 191 ld l, 8 (ix) + 0086 DD 66 09 [19] 192 ld h, 9 (ix) + 0089 E5 [11] 193 push hl + 008A CDr00r00 [17] 194 call __mulint + 008D F1 [10] 195 pop af + 008E F1 [10] 196 pop af + 008F 4D [ 4] 197 ld c, l + 0090 44 [ 4] 198 ld b, h + 0091 DD 6E 06 [19] 199 ld l, 6 (ix) + 0094 DD 66 07 [19] 200 ld h, 7 (ix) + 0097 09 [11] 201 add hl, bc + 0098 4D [ 4] 202 ld c, l + 0099 44 [ 4] 203 ld b, h + 204 ;boot_rom.c:45: chram[p] = c; + 009A 21 00 80 [10] 205 ld hl, #_chram+0 + 009D 09 [11] 206 add hl, bc + 009E DD 7E 04 [19] 207 ld a, 4 (ix) + 00A1 77 [ 7] 208 ld (hl), a + 209 ;boot_rom.c:46: colram[p] = color; + 00A2 21 00 88 [10] 210 ld hl, #_colram+0 + 00A5 09 [11] 211 add hl, bc + 00A6 DD 7E 05 [19] 212 ld a, 5 (ix) + 00A9 77 [ 7] 213 ld (hl), a + 214 ;boot_rom.c:47: } + 00AA DD E1 [14] 215 pop ix + 00AC C9 [10] 216 ret + 217 ;boot_rom.c:49: void page_border(char color) + 218 ; --------------------------------- + 219 ; Function page_border + 220 ; --------------------------------- + 00AD 221 _page_border:: + 00AD DD E5 [15] 222 push ix + 00AF DD 21 00 00 [14] 223 ld ix,#0 + 00B3 DD 39 [15] 224 add ix,sp + 225 ;boot_rom.c:51: write_char(128, color, 0, 0); + 00B5 21 00 00 [10] 226 ld hl, #0x0000 + 00B8 E5 [11] 227 push hl + 00B9 2E 00 [ 7] 228 ld l, #0x00 + 00BB E5 [11] 229 push hl + 00BC DD 56 04 [19] 230 ld d, 4 (ix) + 00BF 1E 80 [ 7] 231 ld e,#0x80 + 00C1 D5 [11] 232 push de + 00C2 CDr74r00 [17] 233 call _write_char + 00C5 21 06 00 [10] 234 ld hl, #6 + 00C8 39 [11] 235 add hl, sp + 00C9 F9 [ 6] 236 ld sp, hl + 237 ;boot_rom.c:52: write_char(130, color, 39, 0); + 00CA 21 00 00 [10] 238 ld hl, #0x0000 + 00CD E5 [11] 239 push hl + 00CE 2E 27 [ 7] 240 ld l, #0x27 + 00D0 E5 [11] 241 push hl + 00D1 DD 56 04 [19] 242 ld d, 4 (ix) + 00D4 1E 82 [ 7] 243 ld e,#0x82 + 00D6 D5 [11] 244 push de + 00D7 CDr74r00 [17] 245 call _write_char + 00DA 21 06 00 [10] 246 ld hl, #6 + 00DD 39 [11] 247 add hl, sp + 00DE F9 [ 6] 248 ld sp, hl + 249 ;boot_rom.c:53: write_char(133, color, 0, 29); + 00DF 21 1D 00 [10] 250 ld hl, #0x001d + 00E2 E5 [11] 251 push hl + 00E3 2E 00 [ 7] 252 ld l, #0x00 + 00E5 E5 [11] 253 push hl + 00E6 DD 56 04 [19] 254 ld d, 4 (ix) + 00E9 1E 85 [ 7] 255 ld e,#0x85 + 00EB D5 [11] 256 push de + 00EC CDr74r00 [17] 257 call _write_char + 00EF 21 06 00 [10] 258 ld hl, #6 + 00F2 39 [11] 259 add hl, sp + 00F3 F9 [ 6] 260 ld sp, hl + 261 ;boot_rom.c:54: write_char(132, color, 39, 29); + 00F4 21 1D 00 [10] 262 ld hl, #0x001d + 00F7 E5 [11] 263 push hl + 00F8 2E 27 [ 7] 264 ld l, #0x27 + 00FA E5 [11] 265 push hl + 00FB DD 56 04 [19] 266 ld d, 4 (ix) + 00FE 1E 84 [ 7] 267 ld e,#0x84 + 0100 D5 [11] 268 push de + 0101 CDr74r00 [17] 269 call _write_char + 0104 21 06 00 [10] 270 ld hl, #6 + 0107 39 [11] 271 add hl, sp + 0108 F9 [ 6] 272 ld sp, hl + 273 ;boot_rom.c:55: for (char x = 1; x < 39; x++) + 0109 0E 01 [ 7] 274 ld c, #0x01 + 010B 275 00104$: + 010B 79 [ 4] 276 ld a, c + 010C D6 27 [ 7] 277 sub a, #0x27 + 010E 30 30 [12] 278 jr NC,00101$ + 279 ;boot_rom.c:57: write_char(129, color, x, 0); + 0110 59 [ 4] 280 ld e, c + 0111 16 00 [ 7] 281 ld d, #0x00 + 0113 C5 [11] 282 push bc + 0114 D5 [11] 283 push de + 0115 21 00 00 [10] 284 ld hl, #0x0000 + 0118 E5 [11] 285 push hl + 0119 D5 [11] 286 push de + 011A DD 56 04 [19] 287 ld d, 4 (ix) + 011D 1E 81 [ 7] 288 ld e,#0x81 + 011F D5 [11] 289 push de + 0120 CDr74r00 [17] 290 call _write_char + 0123 21 06 00 [10] 291 ld hl, #6 + 0126 39 [11] 292 add hl, sp + 0127 F9 [ 6] 293 ld sp, hl + 0128 D1 [10] 294 pop de + 0129 21 1D 00 [10] 295 ld hl, #0x001d + 012C E5 [11] 296 push hl + 012D D5 [11] 297 push de + 012E DD 56 04 [19] 298 ld d, 4 (ix) + 0131 1E 81 [ 7] 299 ld e,#0x81 + 0133 D5 [11] 300 push de + 0134 CDr74r00 [17] 301 call _write_char + 0137 21 06 00 [10] 302 ld hl, #6 + 013A 39 [11] 303 add hl, sp + 013B F9 [ 6] 304 ld sp, hl + 013C C1 [10] 305 pop bc + 306 ;boot_rom.c:55: for (char x = 1; x < 39; x++) + 013D 0C [ 4] 307 inc c + 013E 18 CB [12] 308 jr 00104$ + 0140 309 00101$: + 310 ;boot_rom.c:60: for (char y = 1; y < 29; y++) + 0140 0E 01 [ 7] 311 ld c, #0x01 + 0142 312 00107$: + 0142 79 [ 4] 313 ld a, c + 0143 D6 1D [ 7] 314 sub a, #0x1d + 0145 30 2E [12] 315 jr NC,00109$ + 316 ;boot_rom.c:62: write_char(131, color, 0, y); + 0147 59 [ 4] 317 ld e, c + 0148 16 00 [ 7] 318 ld d, #0x00 + 014A C5 [11] 319 push bc + 014B D5 [11] 320 push de + 014C D5 [11] 321 push de + 014D 21 00 00 [10] 322 ld hl, #0x0000 + 0150 E5 [11] 323 push hl + 0151 DD 56 04 [19] 324 ld d, 4 (ix) + 0154 1E 83 [ 7] 325 ld e,#0x83 + 0156 D5 [11] 326 push de + 0157 CDr74r00 [17] 327 call _write_char + 015A 21 06 00 [10] 328 ld hl, #6 + 015D 39 [11] 329 add hl, sp + 015E F9 [ 6] 330 ld sp, hl + 015F 21 27 00 [10] 331 ld hl, #0x0027 + 0162 E5 [11] 332 push hl + 0163 DD 56 04 [19] 333 ld d, 4 (ix) + 0166 1E 83 [ 7] 334 ld e,#0x83 + 0168 D5 [11] 335 push de + 0169 CDr74r00 [17] 336 call _write_char + 016C 21 06 00 [10] 337 ld hl, #6 + 016F 39 [11] 338 add hl, sp + 0170 F9 [ 6] 339 ld sp, hl + 0171 C1 [10] 340 pop bc + 341 ;boot_rom.c:60: for (char y = 1; y < 29; y++) + 0172 0C [ 4] 342 inc c + 0173 18 CD [12] 343 jr 00107$ + 0175 344 00109$: + 345 ;boot_rom.c:65: } + 0175 DD E1 [14] 346 pop ix + 0177 C9 [10] 347 ret + 348 ;boot_rom.c:67: void page_inputs() + 349 ; --------------------------------- + 350 ; Function page_inputs + 351 ; --------------------------------- + 0178 352 _page_inputs:: + 353 ;boot_rom.c:69: clear_chars(); + 0178 CDr00r00 [17] 354 call _clear_chars + 355 ;boot_rom.c:70: page_border(0b00000111); + 017B 3E 07 [ 7] 356 ld a, #0x07 + 017D F5 [11] 357 push af + 017E 33 [ 6] 358 inc sp + 017F CDrADr00 [17] 359 call _page_border + 0182 33 [ 6] 360 inc sp + 361 ;boot_rom.c:71: write_string("UDLR", 0xFF, 9, 3); + 0183 21 03 00 [10] 362 ld hl, #0x0003 + 0186 E5 [11] 363 push hl + 0187 2E 09 [ 7] 364 ld l, #0x09 + 0189 E5 [11] 365 push hl + 018A 3E FF [ 7] 366 ld a, #0xff + 018C F5 [11] 367 push af + 018D 33 [ 6] 368 inc sp + 018E 21rE0r01 [10] 369 ld hl, #___str_0 + 0191 E5 [11] 370 push hl + 0192 CDr17r00 [17] 371 call _write_string + 0195 21 07 00 [10] 372 ld hl, #7 + 0198 39 [11] 373 add hl, sp + 0199 F9 [ 6] 374 ld sp, hl + 375 ;boot_rom.c:72: write_string("JOY 1)", 0xF0, 2, 4); + 019A 21 04 00 [10] 376 ld hl, #0x0004 + 019D E5 [11] 377 push hl + 019E 2E 02 [ 7] 378 ld l, #0x02 + 01A0 E5 [11] 379 push hl + 01A1 3E F0 [ 7] 380 ld a, #0xf0 + 01A3 F5 [11] 381 push af + 01A4 33 [ 6] 382 inc sp + 01A5 21rE5r01 [10] 383 ld hl, #___str_1 + 01A8 E5 [11] 384 push hl + 01A9 CDr17r00 [17] 385 call _write_string + 01AC 21 07 00 [10] 386 ld hl, #7 + 01AF 39 [11] 387 add hl, sp + 01B0 F9 [ 6] 388 ld sp, hl + 389 ;boot_rom.c:73: write_string("JOY 2)", 0xE0, 2, 5); + 01B1 21 05 00 [10] 390 ld hl, #0x0005 + 01B4 E5 [11] 391 push hl + 01B5 2E 02 [ 7] 392 ld l, #0x02 + 01B7 E5 [11] 393 push hl + 01B8 3E E0 [ 7] 394 ld a, #0xe0 + 01BA F5 [11] 395 push af + 01BB 33 [ 6] 396 inc sp + 01BC 21rECr01 [10] 397 ld hl, #___str_2 + 01BF E5 [11] 398 push hl + 01C0 CDr17r00 [17] 399 call _write_string + 01C3 21 07 00 [10] 400 ld hl, #7 + 01C6 39 [11] 401 add hl, sp + 01C7 F9 [ 6] 402 ld sp, hl + 403 ;boot_rom.c:74: write_string("JOY 3)", 0xD0, 2, 6); + 01C8 21 06 00 [10] 404 ld hl, #0x0006 + 01CB E5 [11] 405 push hl + 01CC 2E 02 [ 7] 406 ld l, #0x02 + 01CE E5 [11] 407 push hl + 01CF 3E D0 [ 7] 408 ld a, #0xd0 + 01D1 F5 [11] 409 push af + 01D2 33 [ 6] 410 inc sp + 01D3 21rF3r01 [10] 411 ld hl, #___str_3 + 01D6 E5 [11] 412 push hl + 01D7 CDr17r00 [17] 413 call _write_string + 01DA 21 07 00 [10] 414 ld hl, #7 + 01DD 39 [11] 415 add hl, sp + 01DE F9 [ 6] 416 ld sp, hl + 417 ;boot_rom.c:75: } + 01DF C9 [10] 418 ret + 01E0 419 ___str_0: + 01E0 55 44 4C 52 420 .ascii "UDLR" + 01E4 00 421 .db 0x00 + 01E5 422 ___str_1: + 01E5 4A 4F 59 20 31 29 423 .ascii "JOY 1)" + 01EB 00 424 .db 0x00 + 01EC 425 ___str_2: + 01EC 4A 4F 59 20 32 29 426 .ascii "JOY 2)" + 01F2 00 427 .db 0x00 + 01F3 428 ___str_3: + 01F3 4A 4F 59 20 33 29 429 .ascii "JOY 3)" + 01F9 00 430 .db 0x00 + 431 ;boot_rom.c:80: void main() + 432 ; --------------------------------- + 433 ; Function main + 434 ; --------------------------------- + 01FA 435 _main:: + 01FA DD E5 [15] 436 push ix + 01FC DD 21 00 00 [14] 437 ld ix,#0 + 0200 DD 39 [15] 438 add ix,sp + 0202 21 E8 FF [10] 439 ld hl, #-24 + 0205 39 [11] 440 add hl, sp + 0206 F9 [ 6] 441 ld sp, hl + 442 ;boot_rom.c:82: chram_size = chram_cols * chram_rows; + 0207 21r16r00 [10] 443 ld hl,#_chram_rows + 0 + 020A 5E [ 7] 444 ld e, (hl) + 020B 21r15r00 [10] 445 ld hl,#_chram_cols + 0 + 020E 66 [ 7] 446 ld h, (hl) + 020F 2E 00 [ 7] 447 ld l, #0x00 + 0211 55 [ 4] 448 ld d, l + 0212 06 08 [ 7] 449 ld b, #0x08 + 0214 450 00191$: + 0214 29 [11] 451 add hl, hl + 0215 30 01 [12] 452 jr NC,00192$ + 0217 19 [11] 453 add hl, de + 0218 454 00192$: + 0218 10 FA [13] 455 djnz 00191$ + 021A 22r00r00 [16] 456 ld (_chram_size), hl + 457 ;boot_rom.c:84: page_inputs(); + 021D CDr78r01 [17] 458 call _page_inputs + 459 ;boot_rom.c:86: while (1) + 0220 DD 36 F1 AB [19] 460 ld -15 (ix), #0xab + 0224 461 00109$: + 462 ;boot_rom.c:88: hsync = input0 & 0x80; + 0224 3A 00 60 [13] 463 ld a,(#_input0 + 0) + 0227 E6 80 [ 7] 464 and a, #0x80 + 0229 32r02r00 [13] 465 ld (#_hsync + 0),a + 466 ;boot_rom.c:89: vsync = input0 & 0x40; + 022C 3A 00 60 [13] 467 ld a,(#_input0 + 0) + 022F E6 40 [ 7] 468 and a, #0x40 + 0231 FD 21r04r00 [14] 469 ld iy, #_vsync + 0235 FD 77 00 [19] 470 ld 0 (iy), a + 471 ;boot_rom.c:94: if (vsync && !vsync_last) + 0238 FD 7E 00 [19] 472 ld a, 0 (iy) + 023B B7 [ 4] 473 or a, a + 023C CArB5r03 [10] 474 jp Z, 00106$ + 023F 3Ar05r00 [13] 475 ld a,(#_vsync_last + 0) + 0242 B7 [ 4] 476 or a, a + 0243 C2rB5r03 [10] 477 jp NZ, 00106$ + 478 ;boot_rom.c:96: color++; + 0246 DD 34 F1 [23] 479 inc -15 (ix) + 480 ;boot_rom.c:97: write_string("--- MiSTer Input Tester ---", color, 6, 1); + 0249 21 01 00 [10] 481 ld hl, #0x0001 + 024C E5 [11] 482 push hl + 024D 2E 06 [ 7] 483 ld l, #0x06 + 024F E5 [11] 484 push hl + 0250 DD 7E F1 [19] 485 ld a, -15 (ix) + 0253 F5 [11] 486 push af + 0254 33 [ 6] 487 inc sp + 0255 21rC4r03 [10] 488 ld hl, #___str_4 + 0258 E5 [11] 489 push hl + 0259 CDr17r00 [17] 490 call _write_string + 025C 21 07 00 [10] 491 ld hl, #7 + 025F 39 [11] 492 add hl, sp + 0260 F9 [ 6] 493 ld sp, hl + 494 ;boot_rom.c:98: int y = 4; + 0261 01 04 00 [10] 495 ld bc, #0x0004 + 496 ;boot_rom.c:99: for (char b = 0; b < 2; b++) + 0264 1E 00 [ 7] 497 ld e, #0x00 + 0266 498 00118$: + 0266 7B [ 4] 499 ld a, e + 0267 D6 02 [ 7] 500 sub a, #0x02 + 0269 D2r1Dr03 [10] 501 jp NC, 00103$ + 502 ;boot_rom.c:101: char m = 0b00000001; + 026C DD 36 FB 01 [19] 503 ld -5 (ix), #0x01 + 504 ;boot_rom.c:102: for (char i = 0; i < 8; i++) + 0270 DD 36 FA 00 [19] 505 ld -6 (ix), #0x00 + 0274 506 00115$: + 0274 DD 7E FA [19] 507 ld a, -6 (ix) + 0277 D6 08 [ 7] 508 sub a, #0x08 + 0279 D2r19r03 [10] 509 jp NC, 00119$ + 510 ;boot_rom.c:104: char x = 9 + i + (b * 10); + 027C DD 7E FA [19] 511 ld a, -6 (ix) + 027F C6 09 [ 7] 512 add a, #0x09 + 0281 DD 77 F8 [19] 513 ld -8 (ix), a + 0284 53 [ 4] 514 ld d, e + 0285 D5 [11] 515 push de + 0286 7A [ 4] 516 ld a, d + 0287 5F [ 4] 517 ld e, a + 0288 87 [ 4] 518 add a, a + 0289 87 [ 4] 519 add a, a + 028A 83 [ 4] 520 add a, e + 028B 87 [ 4] 521 add a, a + 028C D1 [10] 522 pop de + 028D DD 86 F8 [19] 523 add a, -8 (ix) + 0290 DD 77 F9 [19] 524 ld -7 (ix), a + 525 ;boot_rom.c:105: for (char j = 0; j < 3; j++) + 0293 7A [ 4] 526 ld a, d + 0294 87 [ 4] 527 add a, a + 0295 87 [ 4] 528 add a, a + 0296 87 [ 4] 529 add a, a + 0297 DD 77 F8 [19] 530 ld -8 (ix), a + 029A DD 36 FE 00 [19] 531 ld -2 (ix), #0x00 + 029E 532 00112$: + 029E DD 7E FE [19] 533 ld a, -2 (ix) + 02A1 D6 03 [ 7] 534 sub a, #0x03 + 02A3 30 67 [12] 535 jr NC,00101$ + 536 ;boot_rom.c:107: write_char((joystick[(b * 8) + (j * 32)] & m) ? asc_1 : asc_0, 0xFF, x, 4 + j); + 02A5 DD 7E FE [19] 537 ld a, -2 (ix) + 02A8 2E 00 [ 7] 538 ld l, #0x00 + 02AA C6 04 [ 7] 539 add a, #0x04 + 02AC DD 77 F2 [19] 540 ld -14 (ix), a + 02AF 7D [ 4] 541 ld a, l + 02B0 CE 00 [ 7] 542 adc a, #0x00 + 02B2 DD 77 F3 [19] 543 ld -13 (ix), a + 02B5 DD 7E F9 [19] 544 ld a, -7 (ix) + 02B8 DD 77 F6 [19] 545 ld -10 (ix), a + 02BB DD 36 F7 00 [19] 546 ld -9 (ix), #0x00 + 02BF DD 7E FE [19] 547 ld a, -2 (ix) + 02C2 0F [ 4] 548 rrca + 02C3 0F [ 4] 549 rrca + 02C4 0F [ 4] 550 rrca + 02C5 E6 E0 [ 7] 551 and a, #0xe0 + 02C7 DD 86 F8 [19] 552 add a, -8 (ix) + 02CA 57 [ 4] 553 ld d, a + 02CB 17 [ 4] 554 rla + 02CC 9F [ 4] 555 sbc a, a + 02CD 67 [ 4] 556 ld h, a + 02CE 3E 00 [ 7] 557 ld a, #<(_joystick) + 02D0 82 [ 4] 558 add a, d + 02D1 6F [ 4] 559 ld l, a + 02D2 3E 70 [ 7] 560 ld a, #>(_joystick) + 02D4 8C [ 4] 561 adc a, h + 02D5 67 [ 4] 562 ld h, a + 02D6 7E [ 7] 563 ld a, (hl) + 02D7 DD A6 FB [19] 564 and a, -5 (ix) + 02DA B7 [ 4] 565 or a, a + 02DB 28 06 [12] 566 jr Z,00125$ + 02DD 21r01r00 [10] 567 ld hl,#_asc_1 + 0 + 02E0 56 [ 7] 568 ld d, (hl) + 02E1 18 04 [12] 569 jr 00126$ + 02E3 570 00125$: + 02E3 21r00r00 [10] 571 ld hl,#_asc_0 + 0 + 02E6 56 [ 7] 572 ld d, (hl) + 02E7 573 00126$: + 02E7 C5 [11] 574 push bc + 02E8 D5 [11] 575 push de + 02E9 DD 6E F2 [19] 576 ld l, -14 (ix) + 02EC DD 66 F3 [19] 577 ld h, -13 (ix) + 02EF E5 [11] 578 push hl + 02F0 DD 6E F6 [19] 579 ld l, -10 (ix) + 02F3 DD 66 F7 [19] 580 ld h, -9 (ix) + 02F6 E5 [11] 581 push hl + 02F7 3E FF [ 7] 582 ld a, #0xff + 02F9 F5 [11] 583 push af + 02FA 33 [ 6] 584 inc sp + 02FB D5 [11] 585 push de + 02FC 33 [ 6] 586 inc sp + 02FD CDr74r00 [17] 587 call _write_char + 0300 21 06 00 [10] 588 ld hl, #6 + 0303 39 [11] 589 add hl, sp + 0304 F9 [ 6] 590 ld sp, hl + 0305 D1 [10] 591 pop de + 0306 C1 [10] 592 pop bc + 593 ;boot_rom.c:105: for (char j = 0; j < 3; j++) + 0307 DD 34 FE [23] 594 inc -2 (ix) + 030A 18 92 [12] 595 jr 00112$ + 030C 596 00101$: + 597 ;boot_rom.c:109: m <<= 1; + 030C DD 7E FB [19] 598 ld a, -5 (ix) + 030F 87 [ 4] 599 add a, a + 0310 DD 77 FB [19] 600 ld -5 (ix), a + 601 ;boot_rom.c:102: for (char i = 0; i < 8; i++) + 0313 DD 34 FA [23] 602 inc -6 (ix) + 0316 C3r74r02 [10] 603 jp 00115$ + 0319 604 00119$: + 605 ;boot_rom.c:99: for (char b = 0; b < 2; b++) + 0319 1C [ 4] 606 inc e + 031A C3r66r02 [10] 607 jp 00118$ + 031D 608 00103$: + 609 ;boot_rom.c:113: y += 6; + 031D 21 06 00 [10] 610 ld hl, #0x0006 + 0320 09 [11] 611 add hl, bc + 0321 DD 75 FC [19] 612 ld -4 (ix), l + 0324 DD 74 FD [19] 613 ld -3 (ix), h + 614 ;boot_rom.c:115: char m = 0b00000001; + 0327 DD 36 F6 01 [19] 615 ld -10 (ix), #0x01 + 616 ;boot_rom.c:117: for (char j = 0; j < 8; j++) + 032B 21 00 00 [10] 617 ld hl, #0x0000 + 032E 39 [11] 618 add hl, sp + 032F DD 75 F2 [19] 619 ld -14 (ix), l + 0332 DD 74 F3 [19] 620 ld -13 (ix), h + 0335 DD 7E F2 [19] 621 ld a, -14 (ix) + 0338 DD 77 F4 [19] 622 ld -12 (ix), a + 033B DD 7E F3 [19] 623 ld a, -13 (ix) + 033E DD 77 F5 [19] 624 ld -11 (ix), a + 0341 DD 36 FF 00 [19] 625 ld -1 (ix), #0x00 + 0345 626 00121$: + 0345 DD 7E FF [19] 627 ld a, -1 (ix) + 0348 D6 08 [ 7] 628 sub a, #0x08 + 034A 30 69 [12] 629 jr NC,00106$ + 630 ;boot_rom.c:119: signed char jx = analog[(j * 16)]; + 034C DD 6E FF [19] 631 ld l, -1 (ix) + 034F 26 00 [ 7] 632 ld h, #0x00 + 0351 29 [11] 633 add hl, hl + 0352 29 [11] 634 add hl, hl + 0353 29 [11] 635 add hl, hl + 0354 29 [11] 636 add hl, hl + 0355 11 00 71 [10] 637 ld de, #_analog + 0358 19 [11] 638 add hl, de + 0359 4E [ 7] 639 ld c, (hl) + 640 ;boot_rom.c:120: signed char jy = analog[(j * 16) + 8]; + 035A DD 7E FF [19] 641 ld a, -1 (ix) + 035D 07 [ 4] 642 rlca + 035E 07 [ 4] 643 rlca + 035F 07 [ 4] 644 rlca + 0360 07 [ 4] 645 rlca + 0361 E6 F0 [ 7] 646 and a, #0xf0 + 0363 C6 08 [ 7] 647 add a, #0x08 + 0365 5F [ 4] 648 ld e, a + 0366 17 [ 4] 649 rla + 0367 9F [ 4] 650 sbc a, a + 0368 57 [ 4] 651 ld d, a + 0369 21 00 71 [10] 652 ld hl, #_analog + 036C 19 [11] 653 add hl, de + 036D 7E [ 7] 654 ld a, (hl) + 655 ;boot_rom.c:121: sprintf(str, "%d,%d", jx, jy); + 036E 5F [ 4] 656 ld e, a + 036F 17 [ 4] 657 rla + 0370 9F [ 4] 658 sbc a, a + 0371 57 [ 4] 659 ld d, a + 0372 79 [ 4] 660 ld a, c + 0373 17 [ 4] 661 rla + 0374 9F [ 4] 662 sbc a, a + 0375 47 [ 4] 663 ld b, a + 0376 DD 6E F2 [19] 664 ld l, -14 (ix) + 0379 DD 66 F3 [19] 665 ld h, -13 (ix) + 037C D5 [11] 666 push de + 037D C5 [11] 667 push bc + 037E 01rE0r03 [10] 668 ld bc, #___str_5 + 0381 C5 [11] 669 push bc + 0382 E5 [11] 670 push hl + 0383 CDr00r00 [17] 671 call _sprintf + 0386 21 08 00 [10] 672 ld hl, #8 + 0389 39 [11] 673 add hl, sp + 038A F9 [ 6] 674 ld sp, hl + 675 ;boot_rom.c:122: write_string(str, 0xFF, 5, y); + 038B DD 4E F4 [19] 676 ld c, -12 (ix) + 038E DD 46 F5 [19] 677 ld b, -11 (ix) + 0391 DD 6E FC [19] 678 ld l, -4 (ix) + 0394 DD 66 FD [19] 679 ld h, -3 (ix) + 0397 E5 [11] 680 push hl + 0398 21 05 00 [10] 681 ld hl, #0x0005 + 039B E5 [11] 682 push hl + 039C 3E FF [ 7] 683 ld a, #0xff + 039E F5 [11] 684 push af + 039F 33 [ 6] 685 inc sp + 03A0 C5 [11] 686 push bc + 03A1 CDr17r00 [17] 687 call _write_string + 03A4 21 07 00 [10] 688 ld hl, #7 + 03A7 39 [11] 689 add hl, sp + 03A8 F9 [ 6] 690 ld sp, hl + 691 ;boot_rom.c:123: m <<= 1; + 03A9 DD 7E F6 [19] 692 ld a, -10 (ix) + 03AC 87 [ 4] 693 add a, a + 03AD DD 77 F6 [19] 694 ld -10 (ix), a + 695 ;boot_rom.c:117: for (char j = 0; j < 8; j++) + 03B0 DD 34 FF [23] 696 inc -1 (ix) + 03B3 18 90 [12] 697 jr 00121$ + 03B5 698 00106$: + 699 ;boot_rom.c:126: hsync_last = hsync; + 03B5 3Ar02r00 [13] 700 ld a,(#_hsync + 0) + 03B8 32r03r00 [13] 701 ld (#_hsync_last + 0),a + 702 ;boot_rom.c:127: vsync_last = vsync; + 03BB 3Ar04r00 [13] 703 ld a,(#_vsync + 0) + 03BE 32r05r00 [13] 704 ld (#_vsync_last + 0),a + 705 ;boot_rom.c:129: } + 03C1 C3r24r02 [10] 706 jp 00109$ + 03C4 707 ___str_4: + 03C4 2D 2D 2D 20 4D 69 708 .ascii "--- MiSTer Input Tester ---" 53 54 65 72 20 49 6E 70 75 74 20 54 65 73 74 65 72 20 2D 2D 2D - 030A 00 590 .db 0x00 - 591 .area _CODE - 592 .area _INITIALIZER - 0000 593 __xinit__asc_0: - 0000 30 594 .db #0x30 ; 48 '0' - 0001 595 __xinit__asc_1: - 0001 31 596 .db #0x31 ; 49 '1' - 597 .area _CABS (ABS) + 03DF 00 709 .db 0x00 + 03E0 710 ___str_5: + 03E0 25 64 2C 25 64 711 .ascii "%d,%d" + 03E5 00 712 .db 0x00 + 713 .area _CODE + 714 .area _INITIALIZER + 0000 715 __xinit__asc_0: + 0000 30 716 .db #0x30 ; 48 '0' + 0001 717 __xinit__asc_1: + 0001 31 718 .db #0x31 ; 49 '1' + 719 .area _CABS (ABS) diff --git a/src/boot_rom.map b/src/boot_rom.map index e6519e7..58c68a5 100644 --- a/src/boot_rom.map +++ b/src/boot_rom.map @@ -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. diff --git a/src/boot_rom.noi b/src/boot_rom.noi index 3fc95f0..5fea9b5 100644 --- a/src/boot_rom.noi +++ b/src/boot_rom.noi @@ -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 diff --git a/src/boot_rom.sym b/src/boot_rom.sym index 0409b8a..3fd9e43 100644 --- a/src/boot_rom.sym +++ b/src/boot_rom.sym @@ -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 diff --git a/verilator/sim.v b/verilator/sim.v index 423f8b1..99fd39a 100644 --- a/verilator/sim.v +++ b/verilator/sim.v @@ -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