import { Utility } from '../../misc/utility' ; import { PagedMemory } from './pagedmemory' ; import * as fs from 'fs' ; import { BankType } from './simmemory' ; /**
 * Represents the memory of a ZX 128k.
 * Especially sets the ROM area and
 * the initial slot/bank configuration.
 */ export class Zx128Memory extends PagedMemory { constructor ( ) { super ( 4 , 10 ) ; this . bankTypes [ 8 ] = BankType . ROM ; this . bankTypes [ 9 ] = BankType . ROM ; this . slots = [ 8 , 5 , 2 , 0 ] ; const romFilePath = Utility . getExtensionPath ( ) + '/data/128.rom' ; const romBuffer = fs . readFileSync ( romFilePath ) ; const size = 0x4000 ; const rom0 = new Uint8Array ( romBuffer . buffer , 0 , size ) ; const rom1 = new Uint8Array ( romBuffer . buffer , size , size ) ; this . writeBank ( 8 , rom0 ) ; this . writeBank ( 9 , rom1 ) ; this . slots [ 0 ] = 9 ; } }