implement SYS command.

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-29 23:02:22 +09:30
1 parent 0d891bb06a
commit 8ecd10d5cd
4 files changed
+42 -2

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
cmd_sys:
jsr basic_end_of_statement_check
bcc +
;; SYS requires an argument
ldx #10
jmp do_basic_error
*
jsr basic_parse_line_number
;; setup call
lda #$4c ;JMP
sta sys_jmp
lda basic_line_number+0
sta sys_jmp+1
lda basic_line_number+1
sta sys_jmp+2
;; Setup the register values
lda sys_reg_p
pha
lda sys_reg_a
ldx sys_reg_x
ldy sys_reg_y
plp
;; Call the routine.
jsr sys_jmp
jmp basic_run_next_statement