EASy68K  
It is currently Fri Apr 10, 2020 1:46 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat Oct 26, 2013 2:56 pm 
Offline

Joined: Fri Oct 18, 2013 9:44 am
Posts: 6
Hi

This is Yim, I am new, i try to study assembly language by EASY68K but i really have no idea how to start it.

If i enter a letter from the keyboard then I want it to display on the screen, may i know how can i do it ?

How can i use the 'trap' to gets the input from the keyboard?

Thank you for helping,


Top
 Profile  
 
PostPosted: Sun Oct 27, 2013 4:59 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1118
Here is an example that reads a single ASCII character from the keyboard and echos it to the screen.
Code:
*-----------------------------------------------------------
* Title      : Character Echo
* Written by : Charles Kelly
* Date       : 10-27-2013
* Description: Read single ASCII character and echo it to screen.
*-----------------------------------------------------------
    ORG    $1000
START:                  ; first instruction of program

loop
    move.b  #5,D0       ; trap task #5, read single ASCII character into D1.B
    trap    #15
   
    move.b  #6,D0       ; trap task #6, display single ASCII character in D1.B
    trap    #15
    bra     loop        ; ***** INFINITE LOOP *****

    SIMHALT             ; halt simulator

* Put variables and constants here

    END    START        ; last line of source

_________________
Prof. Kelly


Top
 Profile  
 
PostPosted: Tue Oct 29, 2013 9:11 am 
Offline

Joined: Fri Oct 18, 2013 9:44 am
Posts: 6
Thank you so much Prof. Kelly.
If i define string
How can I use 2 loops to control the display of string in column and row
Any hint?


Top
 Profile  
 
PostPosted: Tue Oct 29, 2013 8:44 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1118
A string is simply an array of characters. Load the address of the string into an address register then use the MOVE instruction and one of the address register relative addressing modes to read one character at a time from the string.

LEA STRING,A0
then

MOVE.B (A0)+,D1 or
MOVE.B (A0,D0),D1 where D0 is an index into the string

Use trap task #6 from above to display the character that was just moved into register D1.

_________________
Prof. Kelly


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 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