mirror of
https://github.com/Michaelangel007/apple2_castle_wolfenstein_map_viewer.git
synced 2025-03-12 16:30:52 +00:00
Fix CATALOG to show address and length
This commit is contained in:
parent
5093838713
commit
ff299f42ad
@ -13,6 +13,7 @@ var gFile,
|
|||||||
|
|
||||||
const
|
const
|
||||||
MAX_DISK_SIZE = 143360,
|
MAX_DISK_SIZE = 143360,
|
||||||
|
MAX_FILENAME = 30,
|
||||||
FILE_TYPE_TEXT = 0x00,
|
FILE_TYPE_TEXT = 0x00,
|
||||||
FILE_TYPE_INTEGER = 0x01,
|
FILE_TYPE_INTEGER = 0x01,
|
||||||
FILE_TYPE_APPLESOFT = 0x02,
|
FILE_TYPE_APPLESOFT = 0x02,
|
||||||
@ -36,6 +37,11 @@ console.log( "Loading..." );
|
|||||||
return ("" + new Array( width ).join( c ) + text).slice( -width );
|
return ("" + new Array( width ).join( c ) + text).slice( -width );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function makeHex4$( n )
|
||||||
|
{
|
||||||
|
return padLeft(n.toString(16).toUpperCase(), 4, '0' );
|
||||||
|
}
|
||||||
|
|
||||||
function makeUnsigned( n )
|
function makeUnsigned( n )
|
||||||
{
|
{
|
||||||
return ((n + 256) & 0xFF)|0;
|
return ((n + 256) & 0xFF)|0;
|
||||||
@ -64,7 +70,7 @@ console.log( "Loading..." );
|
|||||||
|
|
||||||
function parseName( catalogEntry )
|
function parseName( catalogEntry )
|
||||||
{
|
{
|
||||||
var name = '', c, MAX_FILENAME = 30;
|
var name = '', c;
|
||||||
|
|
||||||
for( var i = 0; i < MAX_FILENAME; i++ )
|
for( var i = 0; i < MAX_FILENAME; i++ )
|
||||||
{
|
{
|
||||||
@ -204,24 +210,29 @@ console.log( "Loading..." );
|
|||||||
|
|
||||||
function readCatalog()
|
function readCatalog()
|
||||||
{
|
{
|
||||||
var entry, i = 0, LOCKED = [ ' ', '*' ], entries = [], text = (new Array( 40 ).join('-')) + '\n', totalSize = 0, start, length;
|
var entry, i = 0, LOCKED = [ ' ', '*' ], entries = [], text = (new Array( 40 ).join('-')) + '\n', totalSize = 0, address, length, temp;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
entry = readCatalogEntry( i++ );
|
entry = readCatalogEntry( i++ );
|
||||||
if( entry && entry.track )
|
if( entry && entry.track )
|
||||||
{
|
{
|
||||||
text += LOCKED[ entry.locked ] + entry.type + ' ' + padLeft( entry.length, 5, '0' ) + ' ' + padLeft( entry.name, 30 );
|
text += LOCKED[ entry.locked ] + entry.type + ' ' + padLeft( entry.length, 5, '0' ) + ' ' + entry.name + (Array( MAX_FILENAME - entry.name.length).join(' '));
|
||||||
|
|
||||||
|
address = 0,
|
||||||
|
length = 0;
|
||||||
|
|
||||||
var temp;
|
|
||||||
switch( entry.file_type )
|
switch( entry.file_type )
|
||||||
{
|
{
|
||||||
case FILE_TYPE_APPLESOFT: start = 0x0801; length = 0; break;
|
case FILE_TYPE_APPLESOFT: address = 0x0801; length = 0; break;
|
||||||
case FILE_TYPE_BINARY : temp = readBinaryAddressLength( entry.track, entry.sector ); start = temp.address; length = temp.size; break;
|
case FILE_TYPE_INTEGER : address = 0x0801; length = 0; break;
|
||||||
|
case FILE_TYPE_BINARY : temp = readBinaryAddressLength( entry.track, entry.sector ); address = temp.address; length = temp.size; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
text += ',A$' + makeHex4$( address );
|
||||||
|
text += ',L$' + makeHex4$( length );
|
||||||
text += '\n';
|
text += '\n';
|
||||||
|
|
||||||
totalSize += entry.length;
|
totalSize += entry.length;
|
||||||
entries.push( entry );
|
entries.push( entry );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user