Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 21st, 2006, 10:36 PM
n000b n000b is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2003
Location: Melbourne, Australia
Posts: 588 n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 49 m
Reputation Power: 8
Send a message via ICQ to n000b
ASM: compare two characters?

Hi,

I have a character and I need to know whether it is greater than or less than some other characters (for example, I need to know if the character is greater than/less than the letter 'a').

How do I do this for the Motorola 68K processor?

Reply With Quote
  #2  
Old May 22nd, 2006, 05:06 AM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 30 m 28 sec
Reputation Power: 1008
Quote:
Originally Posted by n000b
Hi,

I have a character and I need to know whether it is greater than or less than some other characters (for example, I need to know if the character is greater than/less than the letter 'a').

How do I do this for the Motorola 68K processor?


This is a very beginner question, perhaps you should go read a tutorial on 68k asm.

There also isn't much experience with asm for that architecture here.

Reply With Quote
  #3  
Old May 22nd, 2006, 05:27 AM
n000b n000b is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2003
Location: Melbourne, Australia
Posts: 588 n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 49 m
Reputation Power: 8
Send a message via ICQ to n000b
I have tried Googling for a while with no result, could you please point me in the right direction?

Reply With Quote
  #4  
Old May 22nd, 2006, 05:54 AM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 30 m 28 sec
Reputation Power: 1008
I can't seem to find anything either, other than a tip to try find a manual on ebay.

Reply With Quote
  #5  
Old May 22nd, 2006, 06:00 AM
n000b n000b is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2003
Location: Melbourne, Australia
Posts: 588 n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 49 m
Reputation Power: 8
Send a message via ICQ to n000b
I'll have a look for something like that. Is it just one command that I need? If it is just one command then could you please tell me what it is and I'll go see how to use it

Reply With Quote
  #6  
Old May 22nd, 2006, 06:07 AM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 30 m 28 sec
Reputation Power: 1008
Hrm, i just found an old book on writing a compiler that uses 6800..

Quote:
On the 68000 the condition flags are set whenever any data is
moved or calculated. If the data is a 0000 (corresponding to a
false condition, remember), the zero flag will be set. The code
for "Branch on zero" is BEQ. So for our purposes here,


BEQ <=> Branch if false
BNE <=> Branch if true

Reply With Quote
  #7  
Old May 22nd, 2006, 06:11 AM
n000b n000b is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2003
Location: Melbourne, Australia
Posts: 588 n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 49 m
Reputation Power: 8
Send a message via ICQ to n000b
Thanks mate, I'll check in to it

Reply With Quote
  #8  
Old May 22nd, 2006, 08:39 PM
n000b n000b is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2003
Location: Melbourne, Australia
Posts: 588 n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 49 m
Reputation Power: 8
Send a message via ICQ to n000b
I thought that this might be how you do it but it doesn't work:

Code:
	org	$1000
	move.l	#$7ffe,sp
	
	move.b	#$64,d2
	move.b	#$68,d3
	
	sub.b	d3,d2
	bne	aaa
	bra	bbb


	
; loop through and display a string ('smaller')
aaa	move.l	#a,a4

anext	move.b	(a4)+,d1
	
	cmp.b	#null,d1
	beq	finish
	
	move.b	d1,d0
	
	move.b	#248,d7
	trap	#14

	bra	anext
	
	
	
; loop through and display a string ('bigger')
bbb	move.l	#b,a4

bnext	move.b	(a4)+,d1
	
	cmp.b	#null,d1
	beq	finish
	
	move.b	d1,d0
	
	move.b	#248,d7
	trap	#14

	bra	bnext
	
	
	
	
	
finish	move.b	#228,d7
	trap	#14

	
	org	$1500
a	dc.b	'smaller',null
b	dc.b	'bigger',null
null	equ	00	
	end


I'm basically subtracting one from the other and then using the branch if equal/not equal codes, but it's not working. What am I doing wrong?

Last edited by n000b : May 22nd, 2006 at 08:50 PM.

Reply With Quote
  #9  
Old May 22nd, 2006, 11:57 PM
n000b n000b is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2003
Location: Melbourne, Australia
Posts: 588 n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 49 m
Reputation Power: 8
Send a message via ICQ to n000b
I think I worked it out

Reply With Quote
  #10  
Old May 23rd, 2006, 08:23 AM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 30 m 28 sec
Reputation Power: 1008
Could you please post your solution then? We do get a fair few 68k assembler questions, and there isn't a whole lot of expertise on it in here. It might help a few other people.
Comments on this post
n000b agrees!

Reply With Quote
  #11  
Old May 23rd, 2006, 08:34 AM
n000b n000b is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2003
Location: Melbourne, Australia
Posts: 588 n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 49 m
Reputation Power: 8
Send a message via ICQ to n000b
I had to use the cmp.b instruction, and then use blt (less than), bgt (greater than), beq (equal) etc.

Like this:

Code:
; checks to see if d2 is greater than d1 and branches to "someplace" if it is
cmp.b d1,d2
bgt someplace
Comments on this post
LinuxPenguin agrees: Thanks for coming back to post your solution, it's a great help to those who bother searching.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > ASM: compare two characters?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register&