Fixing up wikilinks
This commit is contained in:
@@ -343,12 +343,12 @@ Writable in config mode only.
|
||||
bit 1 = Reset the sprite clip index
|
||||
bit 0 = Reset the Layer 2 clip index
|
||||
|
||||
0x1E (30) => Active video line (MSB)
|
||||
0x1E (30) => Active Video Line (MSB)
|
||||
(R)
|
||||
bits 7:1 = Reserved
|
||||
bit 0 = Active line MSB
|
||||
|
||||
0x1F (31) => Active video line (LSB)
|
||||
0x1F (31) => Active Video Line (LSB)
|
||||
(R)
|
||||
bits 7:0 = Active line LSB
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export default function RegisterDetail({
|
||||
<code>{register.hex_address}</code> ( {register.dec_address} )
|
||||
<strong>{register.name}</strong> {register.issue_4_only && <span className="badge bg-danger">Issue 4 Only</span>}
|
||||
<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 />
|
||||
</Link>
|
||||
|
||||
|
||||
@@ -86,6 +86,16 @@ export function processRegisterBlock(paragraph: string, registers: Register[]) {
|
||||
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 reg: Register = {
|
||||
@@ -102,7 +112,7 @@ export function processRegisterBlock(paragraph: string, registers: Register[]) {
|
||||
notes: [],
|
||||
};
|
||||
|
||||
// Dispatch to appropriate parser based on hex
|
||||
// Dispatch to the appropriate parser based on hex
|
||||
const hexKey = normalizeHex(hex);
|
||||
switch (hexKey) {
|
||||
case '0xF0':
|
||||
@@ -113,6 +123,8 @@ export function processRegisterBlock(paragraph: string, registers: Register[]) {
|
||||
break;
|
||||
}
|
||||
|
||||
reg.wiki_link = makeWikiLink(hexKey, reg.name);
|
||||
|
||||
return reg;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user