From d47b0cf841e97316d47c669f5f5df254dd0068e4 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 16 Jan 2021 23:21:49 +0100 Subject: [PATCH] hunt now works correctly --- src/mon_m65/bsmon.s | 2 +- src/mon_m65/mon_command_fill.s | 5 +---- src/mon_m65/mon_command_hunt.s | 6 ++---- src/mon_m65/mon_helper_get_addr_to_lac.s | 2 +- src/mon_m65/mon_helper_syntax.s | 17 +++++++++++++++++ 5 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 src/mon_m65/mon_helper_syntax.s diff --git a/src/mon_m65/bsmon.s b/src/mon_m65/bsmon.s index 0a3c7259..5f5be446 100644 --- a/src/mon_m65/bsmon.s +++ b/src/mon_m65/bsmon.s @@ -195,7 +195,7 @@ Jump_Table: !word Mon_Disassemble ; D !word Mon_Fill ; F !word Mon_Go ; G XXX to be debugged/adapted - !word Mon_Hunt ; H XXX to be bugfixed + !word Mon_Hunt ; H !word Mon_JSR ; J XXX to be debugged/adapted !word Mon_Memory ; M !word Mon_Register ; R diff --git a/src/mon_m65/mon_command_fill.s b/src/mon_m65/mon_command_fill.s index 9a9de779..e79f5ca0 100644 --- a/src/mon_m65/mon_command_fill.s +++ b/src/mon_m65/mon_command_fill.s @@ -11,10 +11,7 @@ Mon_Fill: jsr Get_Addr_To_LAC ; Long_AC = fill byte +beq Mon_Error - lda Long_AC+1 - ora Long_AC+2 - ora Long_AC+3 - +bne Mon_Error ; only 1 fill byte allowed + jsr Syntax_Byte_AC ; only 1 fill byte allowed ldz #$00 diff --git a/src/mon_m65/mon_command_hunt.s b/src/mon_m65/mon_command_hunt.s index b8cd50f1..048851a5 100644 --- a/src/mon_m65/mon_command_hunt.s +++ b/src/mon_m65/mon_command_hunt.s @@ -28,6 +28,7 @@ Mon_Hunt: @bin: jsr Got_Addr_To_LAC + jsr Syntax_Byte_AC @lpbin: @@ -36,10 +37,7 @@ Mon_Hunt: iny jsr Get_Addr_To_LAC beq @hunt - lda Long_AC+1 - ora Long_AC+2 - ora Long_AC+3 - +bne Mon_Error ; value above $FF + jsr Syntax_Byte_AC cpy #32 ; max data length bne @lpbin diff --git a/src/mon_m65/mon_helper_get_addr_to_lac.s b/src/mon_m65/mon_helper_get_addr_to_lac.s index d57c3e55..7bfb8d2b 100644 --- a/src/mon_m65/mon_helper_get_addr_to_lac.s +++ b/src/mon_m65/mon_helper_get_addr_to_lac.s @@ -40,7 +40,7 @@ Get_Addr_To_LAC: ; at this point .Y value determines a numeric system jsr Get_Char - beq @exit ; '?', ':'', ';' and zero terminate + beq @exit ; branch if terminated cmp #'0' bcc @exit cmp #':' diff --git a/src/mon_m65/mon_helper_syntax.s b/src/mon_m65/mon_helper_syntax.s new file mode 100644 index 00000000..ff77a4d5 --- /dev/null +++ b/src/mon_m65/mon_helper_syntax.s @@ -0,0 +1,17 @@ + +; Monitor helper code - syntax checking + + +Syntax_Byte_AC: ; ensure AC contains a 1-byte value + + php + pha + + lda Long_AC+1 + ora Long_AC+2 + ora Long_AC+3 + +bne Mon_Error ; value above $FF + + pla + plp + rts