Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Assembler programmimg! 68000 processor! STUCK!

Thread Tools
 
Search this Thread
 
Old 25 April 2002, 07:59 PM
  #1  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Post

org $400
move.l #$FFF0,sp set the stack pointer

move.l #12,d0 switch off echo
move.l #0,d1
trap #15

loop move.b #5,d0 read one character into D1
trap #15

move.b #6,d0 echo it to the screen
trap #15

bra loop and repeat

end $400
wrote above program! I need to declare a String "123456abcdef"

Then calculate there code in ASCII now im stuck where i am! Any help thanks Si
Old 25 April 2002, 10:36 PM
  #2  
Rob Walker
Scooby Regular
 
Rob Walker's Avatar
 
Join Date: Nov 1999
Location: Stockport
Posts: 474
Likes: 0
Received 0 Likes on 0 Posts
Post

Long time since I did 68000, but off the top of my head...

to declare a string..

mystring dc.b "abcdef",0

to retrieve the ascii value just read the value out.. its stored as ascii anyway..

ie. to get the ascii value for the third char do this..

lea mystring,a0
moveq #2,d0 ;index
moveq #0,d1
move.b (a0,d0),d1 ;ascii for "c" is not stored in d1

Hope that helps...

Old 25 April 2002, 10:40 PM
  #3  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Post

your a life saver mate! ive got till 2morrow to figure it! any more would be marvellous!

cheers

Si
Old 25 April 2002, 10:43 PM
  #4  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Post



Define a string of your choice, no longer than twenty characters.
Write a FOR loop to add the ASCII codes of all characters in the string together,
and put the final result in register D5. The loop must also echo the characters
to the screen
Old 25 April 2002, 11:05 PM
  #5  
Rob Walker
Scooby Regular
 
Rob Walker's Avatar
 
Join Date: Nov 1999
Location: Stockport
Posts: 474
Likes: 0
Received 0 Likes on 0 Posts
Post



mystring dc.b "mystring",0

lea mystring,a0 ;ptr to our string
moveq #0,d5 ;initialize result
.loop
moveq #0,d1 ;do this so our ascii code is a word
move.b (a0)+,d1 ;get next character
tst.b d1 ;zero?
beq .exit ;yes.. exit

add.w d1,d5 ;add current ascii value to total

bsr echo ;add your own echo function here, ascii in d1

bra .loop ;loop always
.exit
rts ;result is in d5



there you are... hope I'm on commision.. i'm unemployed you know!!

warning.. this may not work.. its a long time since i've done 68k...
Old 26 April 2002, 08:29 AM
  #6  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Post

I got back to uni monday to find it was in for friday! 4days to learn! which is solid because it doesnt make any sence! cheers anyway!

Si
Old 26 April 2002, 10:54 AM
  #7  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Post

doesnt work! doh doh
Old 26 April 2002, 11:04 AM
  #8  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

swap the bra for knickers.. might help?

Ill get my coat...

David
Old 26 April 2002, 11:17 AM
  #9  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Post

arghhhhh fooooooooooooool nar that works! it the declaring of the string it done like!
org $400
move.l #$FFF0,sp set the stack pointer
mystring DC.B '0123456789abcdef
LEA mystring,A0 A0->"0123456789abcdef"
moveq #0,d5
loop
moveq #0,d1
move.b (a0)+,d1
tst.b d1

add.w d1,d5
move.b #6,d0
trap #15
end $400

couple hours to go DOH DOH
Old 26 April 2002, 11:22 AM
  #10  
Rob Walker
Scooby Regular
 
Rob Walker's Avatar
 
Join Date: Nov 1999
Location: Stockport
Posts: 474
Likes: 0
Received 0 Likes on 0 Posts
Post

You can't declare your string in the middle of the code.. it'll **** it up.. you have to move it outside of the code...
Old 26 April 2002, 11:31 AM
  #11  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Post

i know ! now ive changed to
ORG $400
MOVE.L #$FFF0,SP
LEA mystring,A0
LOOP: MOVE.B (A0)+,D1
BEQ NEXT
MOVE.B #6,D0
TRAP #15
BRA LOOP
NEXT: MOVE.B #9,d0
TRAP #15
mystring: DC.B 13,10,'Hello World!',0
END $400

printing to screen now need to count the characters!
Old 26 April 2002, 12:16 PM
  #12  
chiark
Scooby Regular
 
chiark's Avatar
 
Join Date: Jun 2000
Posts: 13,735
Likes: 0
Received 0 Likes on 0 Posts
Post

I thought string declaration depended on the compiler that you were using?

*sigh* happy days of amiga demo coding... $dff180 and all that jazz...

What compiler are you using?
Old 26 April 2002, 12:18 PM
  #13  
chiark
Scooby Regular
 
chiark's Avatar
 
Join Date: Jun 2000
Posts: 13,735
Likes: 0
Received 0 Likes on 0 Posts
Post

To count characters, subtract the original address of your string from the pointer that's in A0...
Old 26 April 2002, 12:31 PM
  #14  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Post

ITS THE motorola compiler @http://www-scm.tees.ac.uk/users/a.clements/welcome.htm
Old 26 April 2002, 01:44 PM
  #15  
Rob Walker
Scooby Regular
 
Rob Walker's Avatar
 
Join Date: Nov 1999
Location: Stockport
Posts: 474
Likes: 0
Received 0 Likes on 0 Posts
Post

Wasn't the Amiga a great machine to code on.. brought back happy memories doing that little bit of code...

Old 26 April 2002, 03:11 PM
  #16  
chiark
Scooby Regular
 
chiark's Avatar
 
Join Date: Jun 2000
Posts: 13,735
Likes: 0
Received 0 Likes on 0 Posts
Post

certainly was. You knew exactly what hw was in there, and exactly what you could get away with
Old 26 April 2002, 08:55 PM
  #17  
DazV
Scooby Regular
 
DazV's Avatar
 
Join Date: Jun 2000
Posts: 3,783
Likes: 0
Received 0 Likes on 0 Posts
Post

Anyone used to use the K SEKA DEVPAC assembler ?

Ah, the Copper list! I had a major sprite multiplexor running on that machine!

Still got my Hardware Reference Manual somewhere! What a classic!



Old 26 April 2002, 10:00 PM
  #18  
Rob Walker
Scooby Regular
 
Rob Walker's Avatar
 
Join Date: Nov 1999
Location: Stockport
Posts: 474
Likes: 0
Received 0 Likes on 0 Posts
Post

K Seka... ahhhh.. memories!!! bug ridden piece of crap that it was! graduated onto Devpac from there.. then onto the ultimate.. Snasm.. with remote debugging.. nice!

When I was moving house recently I found the Hardware Reference manual (bible) and the rom kernal one which cost me about £50 when I was a poor teenager...plus all my backup disks and crap like that. I'll have to take a look at them one of these days...

Old 26 April 2002, 10:49 PM
  #19  
DazV
Scooby Regular
 
DazV's Avatar
 
Join Date: Jun 2000
Posts: 3,783
Likes: 0
Received 0 Likes on 0 Posts
Post

heh, love it!
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Pro-Line Motorsport
Car Parts For Sale
48
21 July 2017 09:50 PM
Pro-Line Motorsport
Car Parts For Sale
11
21 November 2015 06:08 PM
gazzawrx
Non Car Related Items For sale
13
17 October 2015 06:51 PM
Pro-Line Motorsport
Car Parts For Sale
2
29 September 2015 07:36 PM
Pro-Line Motorsport
ScoobyNet General
9
28 September 2015 09:48 PM



Quick Reply: Assembler programmimg! 68000 processor! STUCK!



All times are GMT +1. The time now is 07:45 AM.