From 06a04701c379e70953091a9ef15147df0375e343 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Sun, 14 Jan 2018 12:41:19 -0800 Subject: [PATCH] Found broken recursive calls on 65802 --- src/vmsrc/plvm01.s | 8 ++++---- src/vmsrc/plvm02.s | 20 ++++++++++---------- src/vmsrc/plvm03.s | 12 ++++++------ src/vmsrc/plvm802.s | 25 +++++++++++++------------ 4 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/vmsrc/plvm01.s b/src/vmsrc/plvm01.s index f587cd0..2d1c559 100644 --- a/src/vmsrc/plvm01.s +++ b/src/vmsrc/plvm01.s @@ -925,8 +925,8 @@ ICALADR JSR $FFFF STA IPH PLA STA IPL - LDY #$00 - JMP NEXTOP + LDY #$01 + JMP FETCHOP ;* ;* ENTER FUNCTION WITH FRAME SIZE AND PARAM COUNT ;* @@ -952,8 +952,8 @@ ENTER INY DEY STA (IFP),Y BNE - -+ LDY #$02 - JMP NEXTOP ++ LDY #$03 + JMP FETCHOP ;* ;* LEAVE FUNCTION ;* diff --git a/src/vmsrc/plvm02.s b/src/vmsrc/plvm02.s index a14fd81..5476ea6 100755 --- a/src/vmsrc/plvm02.s +++ b/src/vmsrc/plvm02.s @@ -1419,8 +1419,8 @@ CALL +INC_IP BIT LCRWEN+LCBNK2 BIT LCRWEN+LCBNK2 } - LDY #$00 - JMP NEXTOP + LDY #$01 + JMP FETCHOP ; CALLX +INC_IP LDA (IP),Y @@ -1455,8 +1455,8 @@ CALLX +INC_IP BIT LCRWEN+LCBNK2 BIT LCRWEN+LCBNK2 } - LDY #$00 - JMP NEXTOP + LDY #$01 + JMP FETCHOP ;* ;* INDIRECT CALL TO ADDRESS (NATIVE CODE) ;* @@ -1483,8 +1483,8 @@ ICAL LDA ESTKL,X BIT LCRWEN+LCBNK2 BIT LCRWEN+LCBNK2 } - LDY #$00 - JMP NEXTOP + LDY #$01 + JMP FETCHOP ; ICALX LDA ESTKL,X STA TMPL @@ -1517,8 +1517,8 @@ ICALX LDA ESTKL,X BIT LCRWEN+LCBNK2 BIT LCRWEN+LCBNK2 } - LDY #$00 - JMP NEXTOP + LDY #$01 + JMP FETCHOP ;* ;* JUMP INDIRECT TRHOUGH TMP ;* @@ -1551,8 +1551,8 @@ ENTER INY DEY STA (IFP),Y BNE - -+ LDY #$02 - JMP NEXTOP ++ LDY #$03 + JMP FETCHOP ;* ;* LEAVE FUNCTION ;* diff --git a/src/vmsrc/plvm03.s b/src/vmsrc/plvm03.s index 68f4050..27260d6 100755 --- a/src/vmsrc/plvm03.s +++ b/src/vmsrc/plvm03.s @@ -1064,8 +1064,8 @@ CALLADR JSR $FFFF STA IPH PLA STA IPL - LDY #$00 - JMP NEXTOP + LDY #$01 + JMP FETCHOP ;* ;* INDIRECT CALL TO ADDRESS (NATIVE CODE) ;* @@ -1090,8 +1090,8 @@ ICALADR JSR $FFFF STA IPH PLA STA IPL - LDY #$00 - JMP NEXTOP + LDY #$01 + JMP FETCHOP ;* ;* ENTER FUNCTION WITH FRAME SIZE AND PARAM COUNT ;* @@ -1120,8 +1120,8 @@ ENTER INY DEY STA (IFP),Y BNE - -+ LDY #$02 - JMP NEXTOP ++ LDY #$03 + JMP FETCHOP ;* ;* LEAVE FUNCTION ;* diff --git a/src/vmsrc/plvm802.s b/src/vmsrc/plvm802.s index d88823b..8b8acca 100644 --- a/src/vmsrc/plvm802.s +++ b/src/vmsrc/plvm802.s @@ -7,7 +7,7 @@ ;********************************************************** !CPU 65816 SELFMODIFY = 0 -DEBUG = 0 +DEBUG = 1 ;* ;* THE DEFAULT CPU MODE FOR EXECUTING OPCODES IS: ;* 16 BIT A/M @@ -592,14 +592,14 @@ _DIV STY IPY _DIV1 ASL ; DVDND DEY BCC _DIV1 - STA TMP ;NOS,S ; DVDND + STA TMP ; NOS,S ; DVDND LDA #$0000 ; REMNDR _DIVLP ROL ; REMNDR CMP TOS+2,S ; DVSR BCC + SBC TOS+2,S ; DVSR SEC -+ ROL TMP ;NOS,S ; DVDND ++ ROL TMP ; NOS,S ; DVDND DEY BNE _DIVLP _DIVEX LDY IPY @@ -1379,8 +1379,8 @@ EMUSTK STA TMP LDX LCRWEN+LCBNK2 LDX LCRWEN+LCBNK2 } - LDY #$00 - JMP NEXTOP + LDY #$01 + JMP FETCHOP ;* ;* CALL INTO ABSOLUTE ADDRESS (NATIVE CODE) ;* @@ -1497,8 +1497,8 @@ EMUSTKX STA TMP LDX LCRWEN+LCBNK2 LDX LCRWEN+LCBNK2 } - LDY #$00 - JMP NEXTOP + LDY #$01 + JMP FETCHOP ;* ;* JUMP INDIRECT THROUGH TMP ;* @@ -1543,8 +1543,8 @@ ENTER INY BNE - STX ESP + +ACCMEM16 ; 16 BIT A/M - LDY #$02 - JMP NEXTOP + LDY #$03 + JMP FETCHOP ;* ;* LEAVE FUNCTION ;* @@ -1598,6 +1598,7 @@ LEAVE +ACCMEM8 ; 8 BIT A/M STA IFP SEC ; SWITCH TO EMULATED MODE XCE + !AS LDA PSR PHA PLP @@ -1828,9 +1829,9 @@ STEP STX TMPL TSX CMP #$10 BCC DBGKEY -; LDX TMPL -; CPX #$56 ; FORCE PAUSE AT 'ICAL' -; BEQ DBGKEY + LDX TMPL + CPX #$54 ; FORCE PAUSE AT 'CALL' + BEQ DBGKEY - LDX $C000 CPX #$9B BNE +