diff --git a/bin/8ball20.prg b/bin/8ball20.prg index 86d100e..bbcf89f 100644 Binary files a/bin/8ball20.prg and b/bin/8ball20.prg differ diff --git a/bin/8ball64.prg b/bin/8ball64.prg index c1ac05f..85ec3fa 100644 Binary files a/bin/8ball64.prg and b/bin/8ball64.prg differ diff --git a/bin/8ballvm20.prg b/bin/8ballvm20.prg index c19f24f..970bc44 100644 Binary files a/bin/8ballvm20.prg and b/bin/8ballvm20.prg differ diff --git a/bin/8ballvm64.prg b/bin/8ballvm64.prg index 68adca3..870d9fd 100644 Binary files a/bin/8ballvm64.prg and b/bin/8ballvm64.prg differ diff --git a/bin/disass b/bin/disass index 348ce3e..06f0fe7 100755 Binary files a/bin/disass and b/bin/disass differ diff --git a/bin/disass20.prg b/bin/disass20.prg index fc6f1e0..3bfa217 100644 Binary files a/bin/disass20.prg and b/bin/disass20.prg differ diff --git a/bin/disass64.prg b/bin/disass64.prg index b6fef32..8f7e72f 100644 Binary files a/bin/disass64.prg and b/bin/disass64.prg differ diff --git a/bin/eightball b/bin/eightball index 2ecf6e1..20e3835 100755 Binary files a/bin/eightball and b/bin/eightball differ diff --git a/bin/eightballvm b/bin/eightballvm index c934183..58e7640 100755 Binary files a/bin/eightballvm and b/bin/eightballvm differ diff --git a/disk-images/eightball.d64 b/disk-images/eightball.d64 index d2077dc..35bc264 100644 Binary files a/disk-images/eightball.d64 and b/disk-images/eightball.d64 differ diff --git a/disk-images/eightball.dsk b/disk-images/eightball.dsk index a316f53..c1ecd21 100644 Binary files a/disk-images/eightball.dsk and b/disk-images/eightball.dsk differ diff --git a/eightball.c b/eightball.c index 05f2814..32f600c 100644 --- a/eightball.c +++ b/eightball.c @@ -400,9 +400,6 @@ void error(unsigned char errcode) { printchar('?'); print(errmsgs[errcode - ERR_FIRST]); - print(" \""); - print(txtPtr); - print("\"\n"); } #ifdef A2E #pragma code-name (pop) diff --git a/eightballutils.h b/eightballutils.h index f2c6ec5..c3c24d2 100644 --- a/eightballutils.h +++ b/eightballutils.h @@ -37,7 +37,7 @@ /* */ /**************************************************************************/ -#define VERSIONSTR "0.77" +#define VERSIONSTR "0.78" void print(char *str); diff --git a/eightballvm.c b/eightballvm.c index d812aaf..b2660da 100644 --- a/eightballvm.c +++ b/eightballvm.c @@ -180,9 +180,6 @@ unsigned char *memory = 0; #define CHECKSTACKOVERFLOW(bytes) #endif -/* Handler for unsupported bytecode */ -#define UNSUPPORTED() unsupported() - #ifdef STACKCHECKS /* * Check for evaluation stack underflow. @@ -1084,76 +1081,264 @@ typedef void (*func)(void); * Must be in same order as enum bytecode. */ func jumptbl[] = { -vm_end, -vm_ldimm, -vm_ldaword, -vm_ldawordimm, -vm_ldabyte, -vm_ldabyteimm, -vm_staword, -vm_stawordimm, -vm_stabyte, -vm_stabyteimm, -vm_ldrword, -vm_ldrwordimm, -vm_ldrbyte, -vm_ldrbyteimm, -vm_strword, -vm_strwordimm, -vm_strbyte, -vm_strbyteimm, -vm_swap, -vm_dup, -vm_dup2, -vm_drop, -vm_over, -vm_pick, -vm_popword, -vm_popbyte, -vm_pshword, -vm_pshbyte, -vm_discard, -vm_sptofp, -vm_fptosp, -vm_ator, -vm_rtoa, -vm_inc, -vm_dec, -vm_add, -vm_sub, -vm_mul, -vm_div, -vm_mod, -vm_neg, -vm_gt, -vm_gte, -vm_lt, -vm_lte, -vm_eql, -vm_neql, -vm_and, -vm_or, -vm_not, -vm_bitand, -vm_bitor, -vm_bitxor, -vm_bitnot, -vm_lsh, -vm_rsh, -vm_jmp, -vm_jmpimm, -vm_brnch, -vm_brnchimm, -vm_jsr, -vm_jsrimm, -vm_rts, -vm_prdec, -vm_prhex, -vm_prch, -vm_prstr, -vm_prmsg, -vm_kbdch, -vm_kbdln}; + vm_end, + vm_ldimm, + vm_ldaword, + vm_ldawordimm, + vm_ldabyte, + vm_ldabyteimm, + vm_staword, + vm_stawordimm, + vm_stabyte, + vm_stabyteimm, + vm_ldrword, + vm_ldrwordimm, + vm_ldrbyte, + vm_ldrbyteimm, + vm_strword, + vm_strwordimm, + vm_strbyte, + vm_strbyteimm, + vm_swap, + vm_dup, + vm_dup2, + vm_drop, + vm_over, + vm_pick, + vm_popword, + vm_popbyte, + vm_pshword, + vm_pshbyte, + vm_discard, + vm_sptofp, + vm_fptosp, + vm_ator, + vm_rtoa, + vm_inc, + vm_dec, + vm_add, + vm_sub, + vm_mul, + vm_div, + vm_mod, + vm_neg, + vm_gt, + vm_gte, + vm_lt, + vm_lte, + vm_eql, + vm_neql, + vm_and, + vm_or, + vm_not, + vm_bitand, + vm_bitor, + vm_bitxor, + vm_bitnot, + vm_lsh, + vm_rsh, + vm_jmp, + vm_jmpimm, + vm_brnch, + vm_brnchimm, + vm_jsr, + vm_jsrimm, + vm_rts, + vm_prdec, + vm_prhex, + vm_prch, + vm_prstr, + vm_prmsg, + vm_kbdch, + vm_kbdln, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported, + unsupported /* Should be at least 255 lines long */ +}; /* * Fetch, decode and execute a VM instruction. @@ -1255,7 +1440,46 @@ void execute() #endif #endif +#ifndef A2E jumptbl[MEM(pc)](); +#else +#if 0 + /* Slight speedup versus the code emitted by cc65 */ + __asm__("ml: lda (_pc)"); + __asm__(" stz tmp1"); + __asm__(" asl a"); + __asm__(" rol tmp1"); + __asm__(" clc"); + __asm__(" adc #<(_jumptbl)"); + __asm__(" sta ptr1"); + __asm__(" lda tmp1"); + __asm__(" adc #>(_jumptbl)"); + __asm__(" sta ptr1+1"); + __asm__(" ldy #$01"); + __asm__(" lda (ptr1),y"); + __asm__(" tax"); + __asm__(" lda (ptr1)"); + __asm__(" jsr callax"); + __asm__(" bra ml"); +#else + /* This version assumes (_pc) < 128, saves a few more cycles */ + /* Slight speedup versus the code emitted by cc65 */ + __asm__("ml: lda (_pc)"); + __asm__(" asl a"); + __asm__(" clc"); + __asm__(" adc #<(_jumptbl)"); + __asm__(" sta ptr1"); + __asm__(" lda #$00"); + __asm__(" adc #>(_jumptbl)"); + __asm__(" sta ptr1+1"); + __asm__(" ldy #$01"); + __asm__(" lda (ptr1),y"); + __asm__(" tax"); + __asm__(" lda (ptr1)"); + __asm__(" jsr callax"); + __asm__(" bra ml"); +#endif +#endif } };