Fixing up wikilinks

This commit is contained in:
2025-10-13 18:36:05 +01:00
parent 9bc2557ff2
commit 7c4d93d7ba
3 changed files with 16 additions and 4 deletions

View File

@@ -343,12 +343,12 @@ Writable in config mode only.
bit 1 = Reset the sprite clip index bit 1 = Reset the sprite clip index
bit 0 = Reset the Layer 2 clip index bit 0 = Reset the Layer 2 clip index
0x1E (30) => Active video line (MSB) 0x1E (30) => Active Video Line (MSB)
(R) (R)
bits 7:1 = Reserved bits 7:1 = Reserved
bit 0 = Active line MSB bit 0 = Active line MSB
0x1F (31) => Active video line (LSB) 0x1F (31) => Active Video Line (LSB)
(R) (R)
bits 7:0 = Active line LSB bits 7:0 = Active line LSB

View File

@@ -26,7 +26,7 @@ export default function RegisterDetail({
<code>{register.hex_address}</code> ( {register.dec_address} ) &nbsp; <code>{register.hex_address}</code> ( {register.dec_address} ) &nbsp;
<strong>{register.name}</strong> {register.issue_4_only && <span className="badge bg-danger">Issue 4 Only</span>} <strong>{register.name}</strong> {register.issue_4_only && <span className="badge bg-danger">Issue 4 Only</span>}
<div className="float-end small text-muted"> <div className="float-end small text-muted">
<Link href={`https://wiki.specnext.dev/${encodeURIComponent((register.name).replace(' ','_'))}_Register`} className="text-decoration-none btn btn-sm btn-primary" title="Open wiki"> <Link href={register.wiki_link} className="text-decoration-none btn btn-sm btn-primary" title="Open wiki">
<Icon.Wikipedia /> <Icon.Wikipedia />
</Link> </Link>
&nbsp; &nbsp;

View File

@@ -86,6 +86,16 @@ export function processRegisterBlock(paragraph: string, registers: Register[]) {
return '0x' + h.slice(2).toUpperCase(); return '0x' + h.slice(2).toUpperCase();
}; };
const makeWikiLink = (hex: string, name: string): string => {
let link = `https://wiki.specnext.dev/`;
switch (hex) {
default:
link += `${name.replace(/ /g, "_")}_Register`;
}
return link;
}
const createRegister = (hex: string, dec: string | number, regName: string): Register => { const createRegister = (hex: string, dec: string | number, regName: string): Register => {
const reg: Register = { const reg: Register = {
@@ -102,7 +112,7 @@ export function processRegisterBlock(paragraph: string, registers: Register[]) {
notes: [], notes: [],
}; };
// Dispatch to appropriate parser based on hex // Dispatch to the appropriate parser based on hex
const hexKey = normalizeHex(hex); const hexKey = normalizeHex(hex);
switch (hexKey) { switch (hexKey) {
case '0xF0': case '0xF0':
@@ -113,6 +123,8 @@ export function processRegisterBlock(paragraph: string, registers: Register[]) {
break; break;
} }
reg.wiki_link = makeWikiLink(hexKey, reg.name);
return reg; return reg;
}; };