diff --git a/bin/jst b/bin/jst index ee0bc62..5b41dfe 100644 Binary files a/bin/jst and b/bin/jst differ diff --git a/docs/bugs.txt b/docs/bugs.txt index 3e97fd0..af8d11f 100644 --- a/docs/bugs.txt +++ b/docs/bugs.txt @@ -1,5 +1,6 @@ General: +- resload_ReadJoyPort limitations: 1) not cached against multiple quick reads and 2) mouse not supported (yet?) - address error (and possibly others like illegal instruction...) are forwarded to the program instead of being intercepted by JST exception layer in relocated VBR (ex: Universe: g 1 => universe custom guru screen) - add NoMemReverse (not very useful) diff --git a/docs/history.txt b/docs/history.txt index f713434..54992d4 100644 --- a/docs/history.txt +++ b/docs/history.txt @@ -1,3 +1,8 @@ +v7.4 (08.10.2024) + +- supports whdload v19 ReadJoyPort API (to some extent) +- fixed potential memory cleanup issue with kick 1.3 (thanks Peter Pettersson) + v7.3 (07.02.2023) - can load whdload slaves containing debug symbols, like Turrican 2 AGA diff --git a/src/ReadJoypad.s b/src/ReadJoypad.s index df49f74..71db13e 100644 --- a/src/ReadJoypad.s +++ b/src/ReadJoypad.s @@ -45,6 +45,7 @@ BITDEF JP,BTN_RED,$16 BITDEF JP,BTN_BLU,$17 + POTGO_RESET = $FF00 ; was $FFFF but changed, thanks to robinsonb5@eab ; optional call to differentiate 2-button joystick from CD32 joypad @@ -91,11 +92,11 @@ _detect_controller_types: rts .do_detect moveq #0,d0 - bsr .detect + bsr _detect_a_controller ; ignore first read bsr .wvbl moveq #0,d0 - bsr .detect + bsr _detect_a_controller lea controller_joypad_0(pc),a0 move.b D0,(A0) @@ -103,8 +104,8 @@ _detect_controller_types: bsr .wvbl moveq #1,d0 - bsr .detect - lea controller_joypad_1(pc),a0 + bsr _detect_a_controller + lea controller_joypad_0+1(pc),a0 move.b D0,(A0) rts @@ -117,7 +118,8 @@ _detect_controller_types: btst #5,d0 beq.b .wait rts -.detect + +_detect_a_controller: movem.l d1-d6/a0-a1,-(a7) tst.l d0 @@ -218,7 +220,7 @@ _read_joystick: moveq #14,d4 ; blue button ( port 1 ) move.w #$6f00,d5 ; for potgo port 1 moveq #joy1dat,d6 ; port 1 - move.b controller_joypad_1(pc),d2 + move.b controller_joypad_0+1(pc),d2 .direction lea $DFF000,a0 @@ -325,7 +327,6 @@ joy0 dc.l 0 joy1 dc.l 0 controller_joypad_0: dc.b $FF ; set: joystick 0 is a joypad, else joystick -controller_joypad_1: dc.b $FF detected_by_os dc.b 0 \ No newline at end of file diff --git a/src/jst_whd.asm b/src/jst_whd.asm index 49e9f8a..80456bd 100644 --- a/src/jst_whd.asm +++ b/src/jst_whd.asm @@ -319,7 +319,28 @@ fake_resload: ;Get the string which has been specified via the Custom/S option. ; The buffer is filled as far as possible. If buffer was not large ; enough false will be returned. - + DEF_WHDOFFSET resload_VSNPrintF + ; format string like clib.vsnprintf/exec.RawDoFmt (84) + ; IN: d0 = ULONG length of buffer + ; a0 = APTR buffer to fill + ; a1 = CPTR format string + ; a2 = APTR argument array + ; OUT: d0 = ULONG length of created string with unlimited + ; buffer without final '\0' + ; a0 = APTR pointer to final '\0' + + DEF_WHDOFFSET resload_Log + ; write log message (88) + ; IN: a0 = CSTR format string + ; (4,a7) = LABEL argument array + ; OUT: - + +;******* the following functions require ws_Version >= 19 + + DEF_WHDOFFSET resload_ReadJoyPort + ; return the state of the selected joy/mouse port (8c) + ; IN: d0 = ULONG port/flags + ; OUT: d0 = ULONG state fake_resload_end: @@ -475,6 +496,33 @@ jst_resload_Examine jst_resload_ExNext WHDLOAD_UNSUPPORTED_CALL WHD_ExNext,"ExNext" +jst_resload_Log: + WHDLOAD_UNSUPPORTED_CALL WHD_Log,"Log" +jst_resload_VSNPrintF: + WHDLOAD_UNSUPPORTED_CALL WHD_VSNPrintF,"VSNPrintF" + +jst_resload_ReadJoyPort: + movem.l d1-d2/a0,-(a7) + move.w d0,d1 + and.w #1,d1 ; port + lea controller_joypad_0(pc),a0 + + btst #31,d0 ; RJP_Detect + beq.b .1 + ; detect controllers and update status + bsr _detect_a_controller + move.b d0,(a0,d1.w) +.1 + move.l #RJP_TYPE_GAMECTRL,d2 + tst.b (a0,d1.w) + bne.b .2 + move.l #RJP_TYPE_JOYSTK,d2 +.2 + move.l d1,d0 + bsr _read_joystick + or.l d2,d0 + movem.l (a7)+,d1-d2/a0 + rts jst_resload_GetCustom: STORE_REGS D1/A1/A4 @@ -963,12 +1011,12 @@ jst_resload_Control: .sk12 cmp.l #WHDLTAG_VERSION_GET,D0 ;get WHDLoad major version number bne.b .sk13 - move.l #18,D0 ; highest possible + move.l #19,D0 ; highest possible bra.b .storetag .sk13 cmp.l #WHDLTAG_REVISION_GET,D0 ;get WHDLoad major version number bne.b .sk14 - moveq.l #2,D0 ; highest possible + moveq.l #0,D0 ; highest possible bra .storetag .storetag: move.l D0,(A0)+ @@ -1649,6 +1697,7 @@ WHD_OsEmuFail: lea WHDMessAbort(pc),A5 bra RTStoreMessage + ; cdio eats a lot of stack, not suitable for all games ; this stack is shared by RN decruncher, same issue (when game files are packed) ds.b WHD_STACK_SIZE,0 diff --git a/src/version b/src/version index f994162..37722eb 100644 --- a/src/version +++ b/src/version @@ -1 +1 @@ -7.3 +7.4