exl100

Émulateur Exelvision EXL 100 (1984) dans le navigateur : dsp-cpp en WebAssembly, cartouches et cassettes BASIC
git clone https://git.schurger.org/exl100.git
Log | Files | Refs | README

library-cram.mjs (1785B)


      1 // Volume Exelmémoire choisi dans la bibliothèque (EXL 100) : clic sur l'entrée, le volume part dans le
      2 // localStorage, la machine redémarre sur ExelBASIC avec l'Exelmémoire branchée et « CALL EXEC(n) » est tapé
      3 // automatiquement. Captures à 12 s (BASIC + frappe) et 30 s (programme lancé).
      4 //   node test/library-cram.mjs [bout de titre] [base-url] [préfixe des captures]
      5 import { open, sleep } from './cdp.mjs';
      6 
      7 const want = (process.argv[2] ?? 'kamicar').toLowerCase();
      8 const base = process.argv[3] ?? 'http://127.0.0.1:8195';
      9 const prefix = process.argv[4] ?? '/tmp/lib-cram';
     10 const page = await open(base + '/', { width: 900, height: 1100 });
     11 await page.evaluate(`localStorage.removeItem('exl100.cram.exl100'); localStorage.removeItem('exl100.exelmem')`);
     12 await page.evaluate('location.reload()');
     13 await sleep(7000);
     14 const hit = await page.evaluate(`(() => {
     15   const b = [...document.querySelectorAll('.pg')].find((b) => b.dataset.type === 'cram' && b.dataset.search.includes(${JSON.stringify(want)}));
     16   if (b) b.click();
     17   return b ? b.querySelector('.pg-t').textContent : null;
     18 })()`);
     19 console.log('entrée cliquée :', hit);
     20 await sleep(12000);
     21 const state = () => page.evaluate(`({ href: location.href, status: document.getElementById('status').textContent,
     22   cram: (() => { try { return Object.keys(localStorage).filter((k) => k.startsWith('exl100.')).map((k) => k + '=' + localStorage.getItem(k).length).join(' '); } catch (e) { return ''; } })() })`);
     23 console.log('à 12 s :', JSON.stringify(await state()));
     24 await page.screenshot(prefix + '-12s.png');
     25 await sleep(18000);
     26 console.log('à 30 s :', JSON.stringify(await state()));
     27 await page.screenshot(prefix + '-30s.png');
     28 console.log('Captures :', prefix + '-12s.png', prefix + '-30s.png');
     29 page.close();