import { RAM } from '../api/ram' ; import { uint16 , uint8 } from '../api/types' ; export class DRAM implements RAM { private readonly data : Uint8Array ; constructor ( size , private readonly offset = 0x0000 ) { this . data = new Uint8Array ( size ) ; } public read ( addr ) { return this . data [ ( addr - this . offset ) & 0xFFFF ] ; } public write ( addr , data ) { this . data [ ( addr - this . offset ) & 0xFFFF ] = data ; } }