inverse werks in manual

This commit is contained in:
2023-07-17 09:57:30 -04:00
parent 757ba190b9
commit 5724122140
3 changed files with 113 additions and 4 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ escflag .byte 0
paddlestate .byte 0
.align 40
man_text_en
icl 'man_cart_txt_EN.asm'
ins 'manual.bin' ;icl 'man_cart_txt_EN.asm'
man_text_en_end
.align $400
Binary file not shown.
+112 -3
View File
@@ -28,7 +28,20 @@ def break_long_string(long_string):
def remove_wierd(t: str) -> str:
t = re.sub(r'!.*\)?', '', t) # remove embedded image
return re.sub(r'[#`]', '', t)
t = re.sub(r'[#`]', '', t)
# convert inverses (** to ascii+128
i = 0
out = ''
while i < len(t):
if t[i:i+2] == '**':
star2_i = t.find('**', i+1)
out += ''.join(chr(ord(x)+128) for x in t[i+2:star2_i])
i = star2_i+2
else:
out += t[i]
i += 1
print(out)
return out
with open(sys.argv[1], 'r') as f:
@@ -144,12 +157,108 @@ utf_to_internal = {
'y': 121,
'z': 122,
'|': 124,
# INVERSE
chr(ord(' ')+128): 128+0,
chr(ord('!')+128): 128+1,
chr(ord('"')+128): 128+2,
chr(ord('#')+128): 128+3,
chr(ord('$')+128): 128+4,
chr(ord('%')+128): 128+5,
chr(ord('&')+128): 128+6,
chr(ord("'")+128): 128+7,
chr(ord('(')+128): 128+8,
chr(ord(')')+128): 128+9,
chr(ord('*')+128): 128+10,
chr(ord('+')+128): 128+11,
chr(ord(',')+128): 128+12,
chr(ord('-')+128): 128+13,
chr(ord('.')+128): 128+14,
chr(ord('/')+128): 128+15,
chr(ord('0')+128): 128+16,
chr(ord('1')+128): 128+17,
chr(ord('2')+128): 128+18,
chr(ord('3')+128): 128+19,
chr(ord('4')+128): 128+20,
chr(ord('5')+128): 128+21,
chr(ord('6')+128): 128+22,
chr(ord('7')+128): 128+23,
chr(ord('8')+128): 128+24,
chr(ord('9')+128): 128+25,
chr(ord(':')+128): 128+26,
chr(ord(';')+128): 128+27,
chr(ord('<')+128): 128+28,
chr(ord('=')+128): 128+29,
chr(ord('>')+128): 128+30,
chr(ord('?')+128): 128+31,
chr(ord('@')+128): 128+32,
chr(ord('A')+128): 128+33,
chr(ord('B')+128): 128+34,
chr(ord('C')+128): 128+35,
chr(ord('D')+128): 128+36,
chr(ord('E')+128): 128+37,
chr(ord('F')+128): 128+38,
chr(ord('G')+128): 128+39,
chr(ord('H')+128): 128+40,
chr(ord('I')+128): 128+41,
chr(ord('J')+128): 128+42,
chr(ord('K')+128): 128+43,
chr(ord('L')+128): 128+44,
chr(ord('M')+128): 128+45,
chr(ord('N')+128): 128+46,
chr(ord('O')+128): 128+47,
chr(ord('P')+128): 128+48,
chr(ord('Q')+128): 128+49,
chr(ord('R')+128): 128+50,
chr(ord('S')+128): 128+51,
chr(ord('T')+128): 128+52,
chr(ord('U')+128): 128+53,
chr(ord('V')+128): 128+54,
chr(ord('W')+128): 128+55,
chr(ord('X')+128): 128+56,
chr(ord('Y')+128): 128+57,
chr(ord('Z')+128): 128+58,
chr(ord('[')+128): 128+59,
chr(ord('\\')+128): 128+60,
chr(ord(']')+128): 128+61,
chr(ord('^')+128): 128+62,
chr(ord('_')+128): 128+63,
chr(ord('a')+128): 128+97,
chr(ord('b')+128): 128+98,
chr(ord('c')+128): 128+99,
chr(ord('d')+128): 128+100,
chr(ord('e')+128): 128+101,
chr(ord('f')+128): 128+102,
chr(ord('g')+128): 128+103,
chr(ord('h')+128): 128+104,
chr(ord('i')+128): 128+105,
chr(ord('j')+128): 128+106,
chr(ord('k')+128): 128+107,
chr(ord('l')+128): 128+108,
chr(ord('m')+128): 128+109,
chr(ord('n')+128): 128+110,
chr(ord('o')+128): 128+111,
chr(ord('p')+128): 128+112,
chr(ord('q')+128): 128+113,
chr(ord('r')+128): 128+114,
chr(ord('s')+128): 128+115,
chr(ord('t')+128): 128+116,
chr(ord('u')+128): 128+117,
chr(ord('v')+128): 128+118,
chr(ord('w')+128): 128+119,
chr(ord('x')+128): 128+120,
chr(ord('y')+128): 128+121,
chr(ord('z')+128): 128+122,
chr(ord('|')+128): 128+124,
}
# convert to SCREENCODES
bin_out = bytearray()
for line in out2.split('\n'):
for i, c in enumerate(line):
bin_out.append(utf_to_internal[c])
print(bin_out)
if len(line) < 40:
bin_out += bytes(40-len(line))
# save to a file
with open('manual.bin', 'wb') as f:
f.write(bin_out)