2727; Startup and support code for the Atari 5200 port
2828; ------------------------------------------------
2929
30- .import start , set_grmode
30+ .import interpreter_run , set_grmode, bytecode_start, get_key
3131 ; Linker vars
3232 .import __CART_PAL__
3333 .import __BSS_RUN__, __BSS_SIZE__
3838 .importzp move_dwn_src, move_dwn_dst
3939
4040 .exportzp COLRSH, DINDEX, COLCRS, ROWCRS, SAVMSC
41+ .exportzp BASIC_TOP, array_ptr
4142 .export STICK0, STICK1, STICK2, STICK3
4243 .export STRIG0, STRIG1, STRIG2, STRIG3
4344 .export PTRIG0
@@ -55,6 +56,10 @@ SAVMSC: .res 2
5556COLCRS: .res 2
5657ROWCRS: .res 1
5758
59+ ; ZP locations used by FastBasic:
60+ array_ptr: .res 2 ; Top of array memory
61+ BASIC_TOP = array_ptr
62+
5863 .data
5964 ; Emulate Atari 8-bit locations
6065 ; This have fixed locations because we need to optimize the
@@ -165,13 +170,22 @@ copy_interpreter:
165170 lda #2
166171 sta SKCTL ;Enable keyboard scanning circuit (without debounce)
167172 cli
168- ; Set initial graphics mode
173+
174+ ; Sets initial graphics mode
169175 lda #0
170176 jsr set_grmode
171177
172- jsr start
173- end_loop:
174- jmp end_loop
178+ ; Starts interpreter
179+ lda #<bytecode_start
180+ ldx #>bytecode_start
181+ jsr interpreter_run
182+
183+ ; Waits for key press
184+ jsr get_key
185+
186+ ; RESET
187+ jmp ($FFFC )
188+
175189
176190 .proc vbi_deferred
177191
0 commit comments