diff --git a/src/a5200cart.asm b/src/a5200cart.asm index fc9e6d7..4e2a9f9 100644 --- a/src/a5200cart.asm +++ b/src/a5200cart.asm @@ -27,7 +27,7 @@ ; Startup and support code for the Atari 5200 port ; ------------------------------------------------ - .import interpreter_run, set_grmode, bytecode_start, get_key + .import start, set_grmode, get_key ; Linker vars .import __CART_PAL__ .import __BSS_RUN__, __BSS_SIZE__ @@ -178,9 +178,7 @@ copy_interpreter: jsr set_grmode ; Starts interpreter - lda #bytecode_start - jsr interpreter_run + jsr start ; Waits for key press jsr get_key diff --git a/src/cmdmenu.asm b/src/cmdmenu.asm index afde202..b2b1eb1 100644 --- a/src/cmdmenu.asm +++ b/src/cmdmenu.asm @@ -35,9 +35,6 @@ ; From alloc.asm .importzp prog_ptr .import parser_alloc_init - ; From bytecode - .import bytecode_start - .importzp NUM_VARS ; Exported to CMDLINE.BAS BMAX=bmax diff --git a/src/comp_header.asm b/src/comp_header.asm index ed43745..23bf385 100644 --- a/src/comp_header.asm +++ b/src/comp_header.asm @@ -19,9 +19,7 @@ ; Compiled header written from the IDE ; ------------------------------------ - .export start .export BYTECODE_ADDR - .exportzp ZP_INTERP_LOAD, ZP_INTERP_SIZE .include "atari.inc" @@ -31,7 +29,7 @@ .import __JUMPTAB_RUN__, __RUNTIME_RUN__, __RUNTIME_SIZE__ .import __DATA_SIZE__ - .import interpreter_run, bytecode_start + .import bytecode_start, start ; Interpreter locations exported as ZP to the BASIC sources ZP_INTERP_LOAD = < __INTERP_START__ @@ -50,10 +48,10 @@ BYTECODE_ADDR= __RUNTIME_RUN__ + __RUNTIME_SIZE__ + __DATA_SIZE__ COMP_HEAD_1: ; Atari binary header .byte 255, 255 - ; Chunk 1: Run address at "compiled_start" + ; Chunk 1: Run address at "start" .word RUNAD .word RUNAD+1 - .word compiled_start + .word start ; Chunk 2: interpreter at page 0 .word __INTERP_START__ .word __INTERP_START__ + __INTERP_SIZE__- 1 @@ -70,16 +68,4 @@ COMP_HEAD_2: .export COMP_RT_SIZE COMP_RT_SIZE = __RUNTIME_RUN__ + __RUNTIME_SIZE__ + __DATA_SIZE__ - __JUMPTAB_RUN__ + 4 - ; This is the runtime startup code, loads the editor. - ; Note that this code is patched before writing to a file - ; and copied into the resulting executables. - .segment "RUNTIME" -start: -compiled_start: - lda #BYTECODE_ADDR - - jsr interpreter_run - jmp (DOSVEC) - ; vi:syntax=asm_ca65 diff --git a/src/compile.asm b/src/compile.asm index 02d3b36..5b90414 100644 --- a/src/compile.asm +++ b/src/compile.asm @@ -39,8 +39,6 @@ ; From alloc.asm .importzp prog_ptr .import parser_alloc_init - ; From bytecode - .import bytecode_start .include "atari.inc" diff --git a/src/interpreter.asm b/src/interpreter.asm index b9ec0a7..27984ba 100644 --- a/src/interpreter.asm +++ b/src/interpreter.asm @@ -27,6 +27,7 @@ ; The opcode interpreter ; ---------------------- + .export start .export interpreter_run, stack_l, stack_h .export pushAX, stack_end @@ -139,6 +140,12 @@ move_ins = move_loop::ins ; Rest of interpreter is in runtime segment .segment "RUNTIME" + .import bytecode_start + ; Main start for a compiled program, runs the + ; bytecode from the bytecode segment. +start: + lda #bytecode_start ; Main interpreter call ; AX : address of code start diff --git a/src/standalone.asm b/src/standalone.asm index 4c3c3bc..2f6d405 100644 --- a/src/standalone.asm +++ b/src/standalone.asm @@ -24,20 +24,11 @@ ; linked into a combine executable.) -; Standalone interpreter -; ---------------------- +; Standalone interpreter variables +; -------------------------------- - ; Main symbol - .export start + ; Main bytecode symbol .exportzp array_ptr, BASIC_TOP - ; From intrepreter.asm - .import interpreter_run - ; From bytecode - .import bytecode_start - ; Linker vars - .import __HEAP_RUN__ - - .include "atari.inc" .zeropage @@ -45,12 +36,4 @@ array_ptr: .res 2 ; Top of array memory BASIC_TOP= array_ptr - .code -start: - lda #bytecode_start - - jsr interpreter_run - jmp (DOSVEC) - ; vi:syntax=asm_ca65