LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-13-2008, 06:46 PM   #1
sadarax
Member
 
Registered: Sep 2005
Distribution: Ubuntu
Posts: 252

Rep: Reputation: 30
Motorola 68000 assembly text strings


I am writing an assembly program for the Motorola 68000, and I am having trouble doing dynamic strings. I want to be able to append information to a string, and then print it out.

EDIT: Made some progress. I can dynamically generate a string, but to append to that string is a problem. I am having trouble using the kludgey pointer system here in Assembler. I cannot seem to use pointers to the actual buffer....

Code:
goodbuffer  MACRO
            LEA     bufferptr,A1    ; Load pointer to string buffer
            LEA     \1,A2           ; Load the string starting address
            LEA     \2,A3           ; Load the string ending address
for_loop\@  CMPA    A2,A3           ; Check loop counters
            BEQ     loop_end\@      ; Check for ending loop
            MOVE.B  (A2),(A1)+      ; Move a character of string in A2 into the buffer
            ADDA    #1,A2           ; Increment the loop counter by 1
            BRA     for_loop\@      ; Loop again
loop_end\@
            LEA     bufferptr,A1    ; Reload original pointing address of bufferptr
            ADDA    A3,A1           ; Add ending string address to  bufferptr address
            MOVE.L A1,bufferptr     ; Store the new address into bufferptr
            ENDM
Here is an example in C++ of what to do in Assembly:

string str = "";
// doing stuff....
str += "ADDI.W ";
// more stuff....
str += " D2,D4";
cout << str << endl;
[/code]

Edit: Solved, though not efficiently.

Last edited by sadarax; 06-18-2008 at 10:26 PM. Reason: Made progress (SOLVED)
 
  


Reply

Tags
assembly, motorola, strings, text



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to store text(strings) in a 2D character array reading from a text file(C++) bewidankit Programming 3 02-14-2008 07:08 AM
How to search for text strings? armandino LQ Suggestions & Feedback 2 06-24-2007 07:51 PM
Is it possible to block text strings with IP tables? abefroman Linux - Security 27 06-29-2005 05:36 PM
Using c++ to write to a text file. Im having problem with strings swatward Programming 4 02-03-2005 09:17 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration