• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

struggling with one program

Pommie

Well-Known Member
Most Helpful Member
It seems pretty straight forward. Note that whoever set the question has used little endian (LSB first) for the numbers but big endian for the addresses. What have you tried?

Mike.
 

wdisayw

New Member
hi mike,thanks for replying back

N should be included in the loop.frankly,its obviously not very well to write $03,and im just curious,what is the way to mark larger instead of larger address in addressing
Code:
ORG  $D000
NUM1      EQU  $B0
NUM11     EQU  $01
NUM2      EQU  $C5
NUM22     EQU  $33
CONSTANT  EQU  $03    %00 to ff
      
       LDAA #NUM2
       ANDA #$F0
       LDAB #NUM22
       ANDB #$0F
       XGDY
       PSHY
       LDAA #NUM1
       ANDA #$F0
       LDAB #NUM11
       ANDB #$0F
       XGDX
       PSHX
SOON   LDAA $03,X   
       LDAB $03,Y
       DEX
       DEY
       CBA
       BEQ SOON
       PULX                 
       BPL SUNNY  
       BMI CRUSH  
SUNNY  
       STX $D040    %LARGER
       SWI
CRUSH  PULY
       STY $D040  %LARGER
       SWI
 
Last edited by a moderator:

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
I'm sorry for sounding like AudioGuru, but where do you even buy an old 68HCxx nowadays... I know NXP produces the enhanced chips, but is this purely academic? I mean are you just using a theoretical argument or simulation...

The last conditions are superfluous as they both do the same.. But!! Shouldn't there be a puly anyway?

Put your code in tags... MUCH easier to follow..
 

Nigel Goodwin

Super Moderator
Most Helpful Member
I'm sorry for sounding like AudioGuru, but where do you even buy an old 68HCxx nowadays... I know NXP produces the enhanced chips, but is this purely academic? I mean are you just using a theoretical argument or simulation...
All these people using antique devices are usually from third world countries, where they are still using ancient equipment in their colleges and universities - but it really makes little difference as regards learning programming skills, although you may as well learn something that has modern applications and you might come across in your future employment.

Having said that, the University where my son-in-law works as a technician are still collecting XP era PC's - simply because they have a number of multi-million Euro machines that run on XP based control systems, and supposedly won't work with later hardware or OS's. So they are collecting spares to keep them running as long as possible.
 

rjenkinsgb

Well-Known Member
Most Helpful Member
The simplest solution to me would be start with the last byte (most significant) and work down until you find a non-equal value.
Something like:


Get goth pointers in X and Y, offset by the size of the numbers
LDB LENGTH
LDX NUM1
LDY NUM2
ABX
ABY

offset the count in B to allow for the decrement at
the start of the loop
INC B

LOOP:

decrement as initially they will be one past the end, and then each pass though the loop.
DECX
DECY

if all values checked, numbers are equal; exit
DEC B
BEQ EQUAL

Compare values at X and Y
LDA 0,X
CMP 0,Y

BEQ LOOP if the same, go for the next byte.

If here, found one greater than the other; depending if A greater or less, copy one or the other
number base to the result location. Done.

[Not formatted as it's not perfect literal code, just a possible method.]
 

Latest threads

EE World Online Articles

Loading

 
Top