Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for a keypress at the end of debug_stub #470

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ debug_stub::
cmp.b #16,d4
blt .regloop
and.w #$F0FF,sr ; Re-enable interrupts
.clrbuf jsr FW_CHECKINPUT ; Check for any existing characters in buffer
tst.b d0 ; Test return value, 0=empty, 1=characters available
beq.s .bufclr ; If 0, no characters pending, wait for keypress
jsr FW_INPUTCHAR ; Else, character available, clear it
bra.s .clrbuf ; Loop until input buffer cleared
.bufclr jsr FW_INPUTCHAR ; Wait for keypress
move.l 4.w,a0 ; And warmboot
jmp (a0)

Expand Down
13 changes: 12 additions & 1 deletion code/firmware/rosco_m68k_firmware/stage1/include/machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
#ifndef _ROSCOM68K_MACHINE_H
#define _ROSCOM68K_MACHINE_H

#include <stdnoreturn.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdnoreturn.h>

#ifdef REVISION1X
#define MFP_GPDR 0xf80001
Expand Down Expand Up @@ -205,6 +206,16 @@ void FW_SENDCHAR_C(char ch);
*/
char FW_RECVCHAR_C(void);

/*
* Firmware INPUTCHAR function (uses pointer at $494)
*/
char FW_INPUTCHAR_C(void);

/*
* Firmware CHECKINPUT function (uses pointer at $498)
*/
bool FW_CHECKINPUT_C(void);

/*
* Firmware CLRSCR function (uses pointer at $438)
*/
Expand Down
35 changes: 35 additions & 0 deletions code/firmware/rosco_m68k_firmware/stage1/trap14.asm
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,41 @@ FW_RECVCHAR::
move.l (A7)+,A1
rts

; Wraps FW_INPUTCHAR so it can be called from C-land
;
; Modifies: D0 (return)
FW_INPUTCHAR_C::
; Fall through to FW_INPUTCHAR

; Receive a single character via default input device.
; Ignores UART overrun errors.
;
; Trashes: Nothing
; Modifies: D0 (return)
FW_INPUTCHAR::
move.l A1,-(A7)
move.l EFP_INPUTCHAR,A1
jsr (A1)
move.l (A7)+,A1
rts

; Wraps FW_CHECKINPUT so it can be called from C-land
;
; Modifies: D0 (return)
FW_CHECKINPUT_C::
; Fall through to FW_CHECKINPUT

; Checks the default input device for a waiting character.
;
; Trashes: Nothing
; Modifies: D0 (return)
FW_CHECKINPUT::
move.l A1,-(A7)
move.l EFP_CHECKINPUT,A1
jsr (A1)
move.l (A7)+,A1
rts

; Wraps FW_CLRSCR so it can be called from C-land
;
; Modifies: Nothing
Expand Down
Loading