|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
||||
|
||||
|
Quote:
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.
__________________
~James [Not currently seeking freelance work] Like philosophy or interested in spirituality? Philosophorum. Game Dev Experts Forums Foresight Linux - Because your desktop should be cool! Linux FAQ FedoraFAQ UbuntuGuide |
|
#3
|
|||
|
|||
|
I have tried Googling for a while with no result, could you please point me in the right direction?
|
|
#4
|
||||
|
||||
|
I can't seem to find anything either, other than a tip to try find a manual on ebay.
|
|
#5
|
|||
|
|||
|
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
![]() |
|
#6
|
||||
|
||||
|
Hrm, i just found an old book on writing a compiler that uses 6800..
Quote:
|
|
#7
|
|||
|
|||
|
Thanks mate, I'll check in to it
![]() |
|
#8
|
|||
|
|||
|
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. |
|
#9
|
|||
|
|||
|
I think I worked it out
![]() |
|
#10
|
||||
|
||||
|
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.
|
|
#11
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > ASM: compare two characters? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|