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 Apr 25, 2002 | 07:59 PM
  #1  
super_si's Avatar
super_si
Thread Starter
Scooby Regular
 
Joined: Feb 2002
Posts: 7,951
Likes: 0
From: Lurkin Somewhere
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
Reply
Old Apr 25, 2002 | 10:36 PM
  #2  
Rob Walker's Avatar
Rob Walker
Scooby Regular
 
Joined: Nov 1999
Posts: 474
Likes: 0
From: Stockport
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...

Reply
Old Apr 25, 2002 | 10:40 PM
  #3  
super_si's Avatar
super_si
Thread Starter
Scooby Regular
 
Joined: Feb 2002
Posts: 7,951
Likes: 0
From: Lurkin Somewhere
Post

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

cheers

Si
Reply
Old Apr 25, 2002 | 10:43 PM
  #4  
super_si's Avatar
super_si
Thread Starter
Scooby Regular
 
Joined: Feb 2002
Posts: 7,951
Likes: 0
From: Lurkin Somewhere
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
Reply
Old Apr 25, 2002 | 11:05 PM
  #5  
Rob Walker's Avatar
Rob Walker
Scooby Regular
 
Joined: Nov 1999
Posts: 474
Likes: 0
From: Stockport
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...
Reply
Old Apr 26, 2002 | 08:29 AM
  #6  
super_si's Avatar
super_si
Thread Starter
Scooby Regular
 
Joined: Feb 2002
Posts: 7,951
Likes: 0
From: Lurkin Somewhere
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
Reply
Old Apr 26, 2002 | 10:54 AM
  #7  
super_si's Avatar
super_si
Thread Starter
Scooby Regular
 
Joined: Feb 2002
Posts: 7,951
Likes: 0
From: Lurkin Somewhere
Post

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

swap the bra for knickers.. might help?

Ill get my coat...

David
Reply
Old Apr 26, 2002 | 11:17 AM
  #9  
super_si's Avatar
super_si
Thread Starter
Scooby Regular
 
Joined: Feb 2002
Posts: 7,951
Likes: 0
From: Lurkin Somewhere
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
Reply
Old Apr 26, 2002 | 11:22 AM
  #10  
Rob Walker's Avatar
Rob Walker
Scooby Regular
 
Joined: Nov 1999
Posts: 474
Likes: 0
From: Stockport
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...
Reply
Old Apr 26, 2002 | 11:31 AM
  #11  
super_si's Avatar
super_si
Thread Starter
Scooby Regular
 
Joined: Feb 2002
Posts: 7,951
Likes: 0
From: Lurkin Somewhere
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!
Reply
Old Apr 26, 2002 | 12:16 PM
  #12  
chiark's Avatar
chiark
Scooby Regular
 
Joined: Jun 2000
Posts: 13,735
Likes: 0
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?
Reply
Old Apr 26, 2002 | 12:18 PM
  #13  
chiark's Avatar
chiark
Scooby Regular
 
Joined: Jun 2000
Posts: 13,735
Likes: 0
Post

To count characters, subtract the original address of your string from the pointer that's in A0...
Reply
Old Apr 26, 2002 | 12:31 PM
  #14  
super_si's Avatar
super_si
Thread Starter
Scooby Regular
 
Joined: Feb 2002
Posts: 7,951
Likes: 0
From: Lurkin Somewhere
Post

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

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

Reply
Old Apr 26, 2002 | 03:11 PM
  #16  
chiark's Avatar
chiark
Scooby Regular
 
Joined: Jun 2000
Posts: 13,735
Likes: 0
Post

certainly was. You knew exactly what hw was in there, and exactly what you could get away with
Reply
Old Apr 26, 2002 | 08:55 PM
  #17  
DazV's Avatar
DazV
Scooby Regular
 
Joined: Jun 2000
Posts: 3,783
Likes: 0
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!



Reply
Old Apr 26, 2002 | 10:00 PM
  #18  
Rob Walker's Avatar
Rob Walker
Scooby Regular
 
Joined: Nov 1999
Posts: 474
Likes: 0
From: Stockport
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...

Reply
Old Apr 26, 2002 | 10:49 PM
  #19  
DazV's Avatar
DazV
Scooby Regular
 
Joined: Jun 2000
Posts: 3,783
Likes: 0
Post

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




All times are GMT +1. The time now is 01:15 PM.