mirror of
https://github.com/nzeemin/ukncbtl-utils.git
synced 2025-04-18 06:04:02 +03:00
rt11dsk formatted with astyle
This commit is contained in:
parent
874a44e92f
commit
a4f142d675
@ -13,3 +13,5 @@ Utilites:
|
||||
* [sav2wav](https://github.com/nzeemin/ukncbtl-utils/wiki/sav2wav) -- converts RT11 SAV files to WAV sound files.
|
||||
* [UkncComSender](https://github.com/nzeemin/ukncbtl-utils/wiki/UkncComSender) -- sends RT11 SAV files to UKNC using serial port.
|
||||
* [ESCParser](https://github.com/nzeemin/ukncbtl-utils/wiki/ESCParser) -- ESC/P parser/interpreter with PostScript/SVG output.
|
||||
* [Sav2Cartridge](https://github.com/nzeemin/ukncbtl-utils/wiki/Sav2Cartridge) -- converts RT11 SAV files into UKNCBTL cartridge images.
|
||||
* [SavDisasm](https://github.com/nzeemin/ukncbtl-utils/wiki/SavDisasm) -- SAV files disassembler.
|
||||
|
32
astyle-cpp-options
Normal file
32
astyle-cpp-options
Normal file
@ -0,0 +1,32 @@
|
||||
## Formatting options for
|
||||
## Astyle - Source code indenter, formatter, and beautifier for C, C++, and Java Source Code
|
||||
## http://astyle.sourceforge.net/
|
||||
|
||||
# Indent as C/C++
|
||||
--mode=c
|
||||
# Use CRLF line end style
|
||||
--lineend=windows
|
||||
|
||||
# Allman style formatting/indenting uses broken brackets
|
||||
--style=break
|
||||
|
||||
# Indent using 4 spaces per indent
|
||||
--indent=spaces=4
|
||||
--indent-namespaces
|
||||
# Indent 'case X:' blocks from the 'case X:' headers. Case statements not enclosed in blocks are NOT indented.
|
||||
--indent-cases
|
||||
|
||||
--min-conditional-indent=0
|
||||
--max-instatement-indent=8
|
||||
|
||||
# Insert space padding around operators
|
||||
--pad-oper
|
||||
# Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...)
|
||||
--pad-header
|
||||
|
||||
--break-closing-brackets
|
||||
|
||||
# Don't break one-line blocks
|
||||
--keep-one-line-blocks
|
||||
# Don't break complex statements and multiple statements residing on a single line
|
||||
--keep-one-line-statements
|
4
rt11dsk/!astyle.bat
Normal file
4
rt11dsk/!astyle.bat
Normal file
@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
set ASTYLEEXE=c:\bin\astyle.exe
|
||||
set ASTYLEOPT=-n -Q --options=..\astyle-cpp-options
|
||||
%ASTYLEEXE% %ASTYLEOPT% *.h *.cpp --exclude=stdafx.h
|
@ -402,9 +402,9 @@ void CDiskImage::DecodeImageCatalog()
|
||||
|
||||
// Ïîëó÷àåì ïàìÿòü ïîä ñïèñîê ñåãìåíòîâ
|
||||
m_volumeinfo.catalogsegments = (CVolumeCatalogSegment*) ::malloc(
|
||||
sizeof(CVolumeCatalogSegment) * m_volumeinfo.catalogsegmentcount);
|
||||
sizeof(CVolumeCatalogSegment) * m_volumeinfo.catalogsegmentcount);
|
||||
memset(m_volumeinfo.catalogsegments, 0,
|
||||
sizeof(CVolumeCatalogSegment) * m_volumeinfo.catalogsegmentcount);
|
||||
sizeof(CVolumeCatalogSegment) * m_volumeinfo.catalogsegmentcount);
|
||||
|
||||
//TODO: Äëÿ çàãîëîâêà ñàìîãî ïåðâîãî ñåãìåíòà êàòàëîãà ñóùåñòâóåò ïðàâèëî:
|
||||
// åñëè óäâîèòü ñîäåðæèìîå ñëîâà 1 è ê ðåçóëüòàòó ïðèáàâèòü íà÷àëüíûé áëîê êàòàëîãà (îáû÷íî 6),
|
||||
@ -427,9 +427,9 @@ void CDiskImage::DecodeImageCatalog()
|
||||
|
||||
// Âûäåëÿåì ïàìÿòü ïîä çàïèñè ñåãìåíòà
|
||||
pSegment->catalogentries = (CVolumeCatalogEntry*) ::malloc(
|
||||
sizeof(CVolumeCatalogEntry) * nEntriesPerSegment);
|
||||
sizeof(CVolumeCatalogEntry) * nEntriesPerSegment);
|
||||
memset(pSegment->catalogentries, 0,
|
||||
sizeof(CVolumeCatalogEntry) * nEntriesPerSegment);
|
||||
sizeof(CVolumeCatalogEntry) * nEntriesPerSegment);
|
||||
|
||||
CVolumeCatalogEntry* pEntry = pSegment->catalogentries;
|
||||
WORD* pCatalog = pCatalogSector + 5; // Íà÷àëî îïèñàíèé ôàéëîâ
|
||||
@ -495,7 +495,7 @@ void CDiskImage::PrintCatalogDirectory()
|
||||
{
|
||||
CVolumeCatalogSegment* pSegment = m_volumeinfo.catalogsegments + segmno;
|
||||
if (pSegment->catalogentries == NULL) continue;
|
||||
|
||||
|
||||
for (int entryno = 0; entryno < m_volumeinfo.catalogentriespersegment; entryno++)
|
||||
{
|
||||
CVolumeCatalogEntry* pEntry = pSegment->catalogentries + entryno;
|
||||
@ -531,7 +531,7 @@ void CDiskImage::SaveEntryToExternalFile(LPCTSTR sFileName)
|
||||
{
|
||||
CVolumeCatalogSegment* pSegment = m_volumeinfo.catalogsegments + segmno;
|
||||
if (pSegment->catalogentries == NULL) continue;
|
||||
|
||||
|
||||
for (int entryno = 0; entryno < m_volumeinfo.catalogentriespersegment; entryno++)
|
||||
{
|
||||
CVolumeCatalogEntry* pEntry = pSegment->catalogentries + entryno;
|
||||
@ -704,7 +704,7 @@ void CDiskImage::AddFileToImage(LPCTSTR sFileName)
|
||||
{
|
||||
CVolumeCatalogSegment* pSegment = m_volumeinfo.catalogsegments + segmno;
|
||||
if (pSegment->catalogentries == NULL) continue;
|
||||
|
||||
|
||||
for (int entryno = 0; entryno < m_volumeinfo.catalogentriespersegment; entryno++)
|
||||
{
|
||||
CVolumeCatalogEntry* pEntry = pSegment->catalogentries + entryno;
|
||||
@ -782,7 +782,7 @@ void CDiskImage::AddFileToImage(LPCTSTR sFileName)
|
||||
memcpy(pData, pFileBlockData, RT11_BLOCK_SIZE);
|
||||
// Ñîîáùàåì ÷òî áëîê áûë èçìåíåí
|
||||
MarkBlockChanged(nBlock);
|
||||
|
||||
|
||||
nBlock++;
|
||||
}
|
||||
free(pFileData);
|
||||
@ -874,7 +874,7 @@ void CDiskImage::SaveAllUnusedEntriesToExternalFiles()
|
||||
if (pEntry->status != RT11_STATUS_EMPTY) continue;
|
||||
|
||||
pEntry->Print();
|
||||
|
||||
|
||||
unusedno++;
|
||||
TCHAR filename[20];
|
||||
_stprintf_s(filename, 20, _T("UNUSED%02d"), unusedno);
|
||||
|
@ -45,10 +45,10 @@ static DWORD CheckHomeBlockChecksum(void* buffer)
|
||||
DWORD crc = 0;
|
||||
for (int i = 0; i < 255; i++)
|
||||
{
|
||||
crc += (DWORD) *p;
|
||||
crc += (DWORD) * p;
|
||||
p++;
|
||||
}
|
||||
crc += ((DWORD)*p) << 16;
|
||||
crc += ((DWORD) * p) << 16;
|
||||
|
||||
return crc;
|
||||
}
|
||||
@ -335,7 +335,7 @@ void CHardImage::InvertImage()
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wprintf(_T("\nDone.\n"));
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ bool ParseCommandLine(int argc, _TCHAR* argv[])
|
||||
return false;
|
||||
}
|
||||
CommandInfo* pcinfo = NULL;
|
||||
for (int i = 0; i < sizeof(g_CommandInfos)/sizeof(CommandInfo); i++)
|
||||
for (int i = 0; i < sizeof(g_CommandInfos) / sizeof(CommandInfo); i++)
|
||||
{
|
||||
if (wcscmp(g_sCommand, g_CommandInfos[i].command) == 0)
|
||||
{
|
||||
|
@ -28,8 +28,8 @@ RT11 documentation set.
|
||||
|
||||
Note only a limited 40 character set is supported for this
|
||||
to work, {' ','A'-'Z','$','.','0'-'9'}.
|
||||
|
||||
Per your original request, the example from the manual
|
||||
|
||||
Per your original request, the example from the manual
|
||||
is as follows (back to Octal for Dec consistency)
|
||||
string = "X2b"
|
||||
X = 113000
|
||||
@ -43,10 +43,10 @@ binary 1 001 101 100 000 010
|
||||
|
||||
test_rad()
|
||||
{
|
||||
char buf[10];
|
||||
char buf[10];
|
||||
unsigned v = 0x9b02;
|
||||
r50asc(3,&v,buf);
|
||||
puts(buf); should be "X2B"
|
||||
puts(buf); should be "X2B"
|
||||
}
|
||||
|
||||
*/
|
||||
@ -58,29 +58,31 @@ and the output string str[] */
|
||||
|
||||
void r50asc(int cnt, WORD* r50, TCHAR str[])
|
||||
{
|
||||
unsigned int v,ch,ord,word=0;
|
||||
unsigned int v, ch, ord, word = 0;
|
||||
int i;
|
||||
|
||||
|
||||
/* sorry I think in decimal, 39 = Octal 47, decimal, 40 = Octal 50 */
|
||||
for (i=0; i<cnt; i++) {
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
|
||||
/* get 3 chars from each word */
|
||||
word = i/3;
|
||||
word = i / 3;
|
||||
v = r50[word];
|
||||
ord = 2 - (i % 3);
|
||||
|
||||
while (ord-- > 0) {
|
||||
v /=40;
|
||||
while (ord-- > 0)
|
||||
{
|
||||
v /= 40;
|
||||
}
|
||||
|
||||
v %= 40; /* mask all but bits of interest */
|
||||
if(v==0) ch = _T(' '); /* space */
|
||||
else if(v >= 1 && v <= 26) ch = v - 1 + _T('A'); /* printable */
|
||||
else if(v == 27) ch = _T('$');
|
||||
else if(v == 28) ch = _T('.');
|
||||
else if(v == 29) ch = 255; /* unused ! */
|
||||
else if(v >= 30 && v <= 39) ch = v - 30 + _T('0'); /* digit */
|
||||
if (v == 0) ch = _T(' '); /* space */
|
||||
else if (v >= 1 && v <= 26) ch = v - 1 + _T('A'); /* printable */
|
||||
else if (v == 27) ch = _T('$');
|
||||
else if (v == 28) ch = _T('.');
|
||||
else if (v == 29) ch = 255; /* unused ! */
|
||||
else if (v >= 30 && v <= 39) ch = v - 30 + _T('0'); /* digit */
|
||||
/* end of valid RAD50 range, display table values */
|
||||
|
||||
str[i] = ch;
|
||||
@ -93,29 +95,29 @@ void irad50( int cnt, TCHAR str[], WORD r50[] )
|
||||
{
|
||||
unsigned int v = 0;
|
||||
int i;
|
||||
/* sorry I think in decimal, 39 = Octal 47,
|
||||
/* sorry I think in decimal, 39 = Octal 47,
|
||||
decimal, 40 = Octal 50
|
||||
*/
|
||||
for(i=0;i<cnt;i++)
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
|
||||
if(str[i] == _T(' ')) v=0; /* space */
|
||||
else if(str[i] >= _T('A') &&
|
||||
str[i] <= _T('Z')) v = str[i] - _T('A') +1; /* printable */
|
||||
else if( str[i] == _T('$')) v = 27;
|
||||
else if( str[i] == _T('.')) v = 28;
|
||||
else if(str[i] >= _T('0') &&
|
||||
str[i] <= _T('9')) v = str[i] - _T('0') +30; /* digit */
|
||||
/* end of valid RAD50 range, display table values */
|
||||
if (str[i] == _T(' ')) v = 0; /* space */
|
||||
else if (str[i] >= _T('A') &&
|
||||
str[i] <= _T('Z')) v = str[i] - _T('A') + 1; /* printable */
|
||||
else if ( str[i] == _T('$')) v = 27;
|
||||
else if ( str[i] == _T('.')) v = 28;
|
||||
else if (str[i] >= _T('0') &&
|
||||
str[i] <= _T('9')) v = str[i] - _T('0') + 30; /* digit */
|
||||
/* end of valid RAD50 range, display table values */
|
||||
|
||||
if((i % 3) == 0)
|
||||
r50[i/3] = v * 1600; /* will clear all bits */
|
||||
else if ((i %3) == 1)
|
||||
r50[i/3] += v * 40;
|
||||
else
|
||||
r50[i/3] += v ;
|
||||
if ((i % 3) == 0)
|
||||
r50[i / 3] = v * 1600; /* will clear all bits */
|
||||
else if ((i % 3) == 1)
|
||||
r50[i / 3] += v * 40;
|
||||
else
|
||||
r50[i / 3] += v ;
|
||||
|
||||
/* put 3 chars into each word */
|
||||
/* put 3 chars into each word */
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,8 +126,8 @@ void irad50( int cnt, TCHAR str[], WORD r50[] )
|
||||
|
||||
void rtDateStr(WORD date, TCHAR* str)
|
||||
{
|
||||
const char* months[] =
|
||||
{ "???", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
||||
const char* months[] =
|
||||
{ "???", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
||||
|
||||
int year = (date & 0x1F) + 72;
|
||||
int day = (date >> 5) & 0x1F;
|
||||
|
Loading…
x
Reference in New Issue
Block a user