Skip to content

Commit b14319a

Browse files
author
Scrap Computing
committed
Increase EGA max offset to 16
1 parent 47eb433 commit b14319a

File tree

309 files changed

+8607
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

309 files changed

+8607
-9
lines changed

firmware/src/Common.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
#define __COMMON_H__
88

99
#include <cstdint>
10+
static constexpr const int PXL_CLK_SMALL_STEP = 1000;
11+
static constexpr const int PXL_CLK_STEP = 10000;
12+
13+
// Tolerate this much error in vertical Hz when auto-detecting the video mode.
14+
static constexpr int AUTO_DETECT_MODE_V_HZ_ERROR = 1;
1015

1116
static constexpr const uint32_t VGA_RGB_GPIO = 14; // 14-19, 2 bits per color
1217
static constexpr const uint32_t VGA_MDA_GPIO = 18;

firmware/src/EGAPio.cmake

Lines changed: 312 additions & 0 deletions
Large diffs are not rendered by default.

firmware/src/EGAPio.h

Lines changed: 312 additions & 0 deletions
Large diffs are not rendered by default.

firmware/src/EGASwitchCase_NegHSync_config_cpp

Lines changed: 156 additions & 0 deletions
Large diffs are not rendered by default.

firmware/src/EGASwitchCase_NegHSync_program_cpp

Lines changed: 156 additions & 0 deletions
Large diffs are not rendered by default.

firmware/src/EGASwitchCase_PosHSync_config_cpp

Lines changed: 156 additions & 0 deletions
Large diffs are not rendered by default.

firmware/src/EGASwitchCase_PosHSync_program_cpp

Lines changed: 156 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
;; Copyright (C) 2025 Scrap Computing
2+
;; Automatically generated by gen_ega_pios.sh DO NOT EDIT!
3+
.program EGA640x350_NegHSync_delay04_offset10
4+
.define TTL_PIN_CNT 8
5+
.define HSYNC_GPIO 7
6+
; Pixel clock 640 mode: 16.257MHz: 61.512ns/pixel ~16.608 instrs / pixel (3.704ns/instr)
7+
entry:
8+
.wrap_target
9+
loop:
10+
in pins, TTL_PIN_CNT [3] ; ISR = HVRRGGBB(#0)
11+
in pins, TTL_PIN_CNT [3] ; ISR = HVRRGGBB(#1),HVRRGGBB(#0)
12+
in pins, TTL_PIN_CNT [3] ; ISR = HVRRGGBB(#2),HVRRGGBB(#1),HVRRGGBB(#0)
13+
in pins, TTL_PIN_CNT [1] ; ISR = HVRRGGBB(#3),HVRRGGBB(#2),HVRRGGBB(#1),HVRRGGBB(#0)
14+
push noblock ; FIFO = ISR (#3,#2,#1,#0)
15+
jmp pin loop ; Loop until HSync is 0
16+
17+
; HSync is now 0, wait until it becomes 1
18+
wait_hsync_1:
19+
in null, 32
20+
push noblock
21+
jmp pin hsync_is_1 ; break out of loop if HSync is 1
22+
jmp wait_hsync_1
23+
24+
hsync_is_1:
25+
wait 1 gpio HSYNC_GPIO [10] ; sampling offset
26+
.wrap ; jmp loop
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
;; Copyright (C) 2025 Scrap Computing
2+
;; Automatically generated by gen_ega_pios.sh DO NOT EDIT!
3+
.program EGA640x350_NegHSync_delay04_offset11
4+
.define TTL_PIN_CNT 8
5+
.define HSYNC_GPIO 7
6+
; Pixel clock 640 mode: 16.257MHz: 61.512ns/pixel ~16.608 instrs / pixel (3.704ns/instr)
7+
entry:
8+
.wrap_target
9+
loop:
10+
in pins, TTL_PIN_CNT [3] ; ISR = HVRRGGBB(#0)
11+
in pins, TTL_PIN_CNT [3] ; ISR = HVRRGGBB(#1),HVRRGGBB(#0)
12+
in pins, TTL_PIN_CNT [3] ; ISR = HVRRGGBB(#2),HVRRGGBB(#1),HVRRGGBB(#0)
13+
in pins, TTL_PIN_CNT [1] ; ISR = HVRRGGBB(#3),HVRRGGBB(#2),HVRRGGBB(#1),HVRRGGBB(#0)
14+
push noblock ; FIFO = ISR (#3,#2,#1,#0)
15+
jmp pin loop ; Loop until HSync is 0
16+
17+
; HSync is now 0, wait until it becomes 1
18+
wait_hsync_1:
19+
in null, 32
20+
push noblock
21+
jmp pin hsync_is_1 ; break out of loop if HSync is 1
22+
jmp wait_hsync_1
23+
24+
hsync_is_1:
25+
wait 1 gpio HSYNC_GPIO [11] ; sampling offset
26+
.wrap ; jmp loop
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
;; Copyright (C) 2025 Scrap Computing
2+
;; Automatically generated by gen_ega_pios.sh DO NOT EDIT!
3+
.program EGA640x350_NegHSync_delay04_offset12
4+
.define TTL_PIN_CNT 8
5+
.define HSYNC_GPIO 7
6+
; Pixel clock 640 mode: 16.257MHz: 61.512ns/pixel ~16.608 instrs / pixel (3.704ns/instr)
7+
entry:
8+
.wrap_target
9+
loop:
10+
in pins, TTL_PIN_CNT [3] ; ISR = HVRRGGBB(#0)
11+
in pins, TTL_PIN_CNT [3] ; ISR = HVRRGGBB(#1),HVRRGGBB(#0)
12+
in pins, TTL_PIN_CNT [3] ; ISR = HVRRGGBB(#2),HVRRGGBB(#1),HVRRGGBB(#0)
13+
in pins, TTL_PIN_CNT [1] ; ISR = HVRRGGBB(#3),HVRRGGBB(#2),HVRRGGBB(#1),HVRRGGBB(#0)
14+
push noblock ; FIFO = ISR (#3,#2,#1,#0)
15+
jmp pin loop ; Loop until HSync is 0
16+
17+
; HSync is now 0, wait until it becomes 1
18+
wait_hsync_1:
19+
in null, 32
20+
push noblock
21+
jmp pin hsync_is_1 ; break out of loop if HSync is 1
22+
jmp wait_hsync_1
23+
24+
hsync_is_1:
25+
wait 1 gpio HSYNC_GPIO [12] ; sampling offset
26+
.wrap ; jmp loop

0 commit comments

Comments
 (0)