EASy68K  
It is currently Mon Nov 19, 2018 8:54 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Is this possible?
PostPosted: Mon Apr 09, 2012 12:05 pm 
Offline

Joined: Mon Apr 11, 2005 12:57 am
Posts: 27
Location: Australia
Hi,

I've been using Easy68K for some time and think it's a wonderful product. I haven't used it for about 18 months, but I'm back at it again, the latest version is great. I really like the new compiler options.
I use Easy68K to write and test all my programs. as part of my current hardware setup I use a serial port connected to a dumb terminal, at differemt points in my code I send messages to the terminal so I can tell what it's doing. Is there a way I could do this in Easy68K/Sim68K? It would make it easier for testing. the Graphics interface seams a bit complicated for a scrolling text window.

Thanks
Kenneth


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 09, 2012 12:50 pm 
Offline

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
Couldn't you just abstract the character and string output functions to use the Sim68K I/O Window?

TRAP#15, 5, Read single ASCII character from the keyboard into D1.B
TRAP#15, 6, Outputs character in D1
TRAP#15, 13, Display the NULL terminated string at (A1) with CR, LF.
TRAP#15, 14, Display the NULL terminated string at (A1) without CR, LF.

Edit: fixed traps


Last edited by clive on Tue Apr 10, 2012 4:08 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 09, 2012 2:23 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1087
I'm not sure I understand the question. Are you currently using EASy68K to communicate with the terminal over the PC serial port?

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 10, 2012 3:36 am 
Offline

Joined: Mon Apr 11, 2005 12:57 am
Posts: 27
Location: Australia
Thanks for the responses,

clive, I could use this, but where does the output go? what is the default printer?

profkelly, I'm not trying to talk to any real hardware from the Simulator, I'm trying to replicate what happens on my real hardware. Currently as part of testing my hardware I have a terminal pluged into the serial interface on my test hardware, at different points in my code I send messages to this terminal, to see where any problems may be coming from, I also use keyboard input on the terminal as a wait for keypress, so I can step through sections of code. It is the display of the messages I wish to replicate. my next phase of hardware is to develop a graphics interface so I would like to use the main simulator I/O window to draw the graphics, while the replicated terminal provides feed back as to what the code is doing.

Thanks
Kenneth


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 10, 2012 1:38 pm 
Offline

Joined: Mon Dec 27, 2004 11:40 pm
Posts: 318
I solved this for my own use by writing a BIOS for each target system that replicates as much of the Sim68K TRAP #15 functionality as it can. This can be as little as just character I/O on the simplest systems.

As a result code that runs on Sim68K will usually run identically without any changes on the target system.

Lee.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 10, 2012 4:01 pm 
Offline

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
kkeeley wrote:
clive, I could use this, but where does the output go? what is the default printer?


It goes into the output window, much like a serial terminal. Mine comes up as "Sim68K I/O", try "View -> Output Window". On real hardware I usually use a serial port to provide debug or telemetry data.

The default printer is picked under "File -> Printer Setup", and is presumably the Windows default unless otherwise selected.

Sorry the trap code was 13, not 10

Code:
   ORG   $1000
START:            ; first instruction of program

   LEA   Hello,A1
   MOVE.B   #13,D0
   TRAP   #15
   
   MOVE.B   #9,D0
   TRAP   #15      ; halt simulator

* Variables and Strings

Hello   DC.B   'Hello World!',0

   END   START      ; last line of source


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 10, 2012 8:55 pm 
Offline

Joined: Mon Apr 11, 2005 12:57 am
Posts: 27
Location: Australia
Tanks for the replys,

clive, the trap code 13 idea works, only problem I have is I was about to start playing with a bit of graphics hardware and if I use the trap code 13 am I still able to have a second display with graphics on it?

lee, I would love to see some examples of how you have implemented the Trap #15 codes in your BIOS, I was thinking of doing almost the same thing.

Thanks again
Kenneth


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 13, 2012 10:09 pm 
Offline

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
I mashed this up with some routines I'd already used, I haven't tested the TRAP implementation because I'd need to burn some ROMs, but it should be a workable outline. You'll need to modify the serial IO routines to match your hardware, and add any other functions you want to support.

Code:
;------------------------------------------------------------------------------
; IDP
;------------------------------------------------------------------------------

UART1_SRX   EQU $00B00007
UART1_RBX   EQU $00B0000F
UART1_TBX   EQU $00B0000F

;------------------------------------------------------------------------------
; Output character in D0 to Console, Kills D0

_outchr move.l  d1,-(a7)
_outchr1
        move.b  UART1_SRX,d1              ; Read UART 1 Status
        btst    #2,d1                     ; Tx Empty
        beq     _outchr1
        move.b  d0,UART1_TBX              ; Output character to UART 1
        move.l  (a7)+,d1
        rts

;------------------------------------------------------------------------------
; Input character from Console to D0, Kills D0

_inpchr move.b  UART1_SRX,d0            ; Read UART 1 Status
        btst    #0,d0                   ; Rx Full
        beq     _inpchr
        move.b  UART1_RBX,d0            ; Read UART 1
        andi.w  #$FF,d0
        rts

;------------------------------------------------------------------------------
; Output String at A0 to Console, Kills A0

_outstr movem.l d0/d1,-(a7)
_outstr1
        move.b  UART1_SRX,d1            ; Read UART 1 Status
        btst    #2,d1                   ; Tx Empty
        beq     _outstr1
        move.b  (a0)+,d0
        andi.w  #$FF,d0
        beq     _outstr2
        move.b  d0,UART1_TBX            ; Output character to UART 1
        bra     _outstr1
_outstr2
        movem.l (a7)+,d0/d1
        rts

;------------------------------------------------------------------------------

_outcrlf
        move.l  d0,-(a7)
        move.b  #13,d0
        bsr     _outchr
        move.b  #10,d0
        bsr     _outchr
        move.l  (a7)+,d0
        rts

;------------------------------------------------------------------------------

_trap15 ; EASy68k Emulation Trap, subset thereof

        cmp.b   #5,d0    ; Read single ASCII character from the keyboard into D1.B
        beq     _trap15_5

        cmp.b   #6,d0    ; Outputs character in D1
        beq     _trap15_6

        cmp.b   #9,d0   ; Halt simulator
        beq     _trap15_9
   
        cmp.b   #13,d0    ; Display the NULL terminated string at (A1) with CR, LF
        beq     _trap15_13

        cmp.b   #14,d0 ; Display the NULL terminated string at (A1) without CR, LF
        beq     _trap15_14

        rte

;------------------------------------------------------------------------------

_trap15_5 ; Read single ASCII character from the keyboard into D1.B
        move.l  d0,-(a7)
        bsr     _inpchr
        move.b  d0,d1
        move.l  (a7)+,d0
        rte

;------------------------------------------------------------------------------

_trap15_6 ; Outputs character in D1
        move.l  d0,-(a7)
        move.b  d1,d0
        bsr     _outchr
        move.l  (a7)+,d0
        rte

;------------------------------------------------------------------------------

_trap15_9 ; Halt
        bra.l    *
   
;------------------------------------------------------------------------------

_trap15_13 ; Display the NULL terminated string at (A1) with CR, LF
        move.l  a0,-(a7)
        movea   a1,a0
        bsr     _outstr
        bsr     _outcrlf
        move.l  (a7)+,a0
        rte

;------------------------------------------------------------------------------

_trap15_14 ; Display the NULL terminated string at (A1) without CR, LF
        move.l  a0,-(a7)
        movea   a1,a0
        bsr     _outstr
        move.l  (a7)+,a0
        rte

;------------------------------------------------------------------------------


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group