<meta charset="utf-8">
  <title>Memory experiments</title>
  <link href="../css/candy.css" rel="stylesheet">  
  <link href="../css/c64.css" rel="stylesheet">
  <link href="../style.css" rel="stylesheet">
 <body class="candy greasy-green">

  <h1>Memory experiments</h1>

    var C64 = {}

  <details open>
   <summary title="Click to open/close">Log messages</summary>
   <pre class="log"><tt></tt></pre>

  <script src="log.js"></script>
  <script src="memory.js"></script>

    // TODO load BASIC and KERNAL as well (through a more SOLID/GRASP version of loader.js)
    var request = new XMLHttpRequest()'GET', '../roms/chargen', true)
    request.responseType = 'arraybuffer'
    request.onload = function() {
        if(this.status == 200) {
           var program = new Uint8Array(this.response)
           C64.memory.set(program, 0x1000)

           C64.memory.write(0x0100, 0x10)
           C64.memory.write(0x1100, 0x10)
           C64.memory.write(0x2100, 0x10)
           C64.memory.write(0x3100, 0x10)
           C64.memory.write(0x4100, 0x10)
           C64.memory.write(0xdc01, 0x10)

           Log.dump(C64.memory.ram, 0x1000, 0x1020)
           Log.dump(C64.memory.ram, 0xdc00, 0xdc20)