fixed JSASM cache

This commit is contained in:
Steven Hugg 2018-03-02 21:39:32 -06:00
parent 020aa0d378
commit f24213aa1d
3 changed files with 60 additions and 1 deletions

55
presets/verilog/test.asm Normal file
View File

@ -0,0 +1,55 @@
.arch femto16
.include "hvsync_generator.v"
.include "font_cp437_8x8.v"
.include "ram.v"
.include "tile_renderer.v"
.include "sprite_scanline_renderer.v"
.include "lfsr.v"
.include "sound_generator.v"
.include "cpu16.v"
.include "cpu_platform.v"
.module cpu_platform
.org 0x8000
.len 1024
mov sp,@$6fff
mov dx,@InitPageTable
jsr dx
mov ax,@$4ffe
mov dx,@ClearTiles
jsr dx
mov dx,@ClearSprites
jsr dx
reset
InitPageTable:
mov ax,@$6000 ; screen buffer
mov bx,@$7e00 ; page table start
mov cx,#32 ; 32 rows
InitPTLoop:
mov [bx],ax
add ax,#32
inc bx
dec cx
bnz InitPTLoop
rts
ClearTiles:
mov bx,@$6000
mov cx,@$390
ClearLoop:
mov [bx],ax
inc bx
dec cx
bnz ClearLoop
rts
ClearSprites:
mov bx,@$7f00
mov ax,#0
mov cx,#$40
ClearSLoop:
mov ax,[bx]
add ax,@$101
mov [bx],ax
inc bx
dec cx
bnz ClearSLoop

View File

@ -25,6 +25,7 @@ var VERILOG_PRESETS = [
{id:'sprite_scanline_renderer.v', name:'Sprite Scanline Renderer'},
{id:'cpu16.v', name:'16-Bit CPU'},
{id:'cpu_platform.v', name:'CPU Platform'},
{id:'test.asm', name:'Test ASM'},
];
var VERILOG_KEYCODE_MAP = makeKeycodeMap([

View File

@ -1141,11 +1141,14 @@ function compileJSASM(asmcode, platform, options, is_inline) {
filename = filename.substr(1, filename.length-2);
includes.push(filename);
};
var loaded_module = false;
asm.loadModule = function(top_module) {
// TODO: cache module
// compile last file in list
loaded_module = true;
var key = top_module + '/' + includes;
if (key != jsasm_module_key) {
jsasm_module_key = key;
jsasm_module_top = top_module;
var main_filename = includes[includes.length-1];
var code = '`include "' + main_filename + '"\n';
@ -1157,7 +1160,7 @@ function compileJSASM(asmcode, platform, options, is_inline) {
}
}
var result = asm.assembleFile(asmcode);
if (jsasm_module_output) {
if (loaded_module && jsasm_module_output) {
var asmout = result.output;
result.output = jsasm_module_output.output;
result.output.program_rom = asmout;