Continue to Site

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.

  • 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.

help with 68hc11

Status
Not open for further replies.

sgou038

New Member
Hi I am using a motorola 68hc11 simulator and i have to write this program for a assignment...

I do not even know where to begin with this one.

Question: A buffer is between $3200 and #34FF. WRite a program to
a) Count the number of numbers divided by 13 in the buffer.
b) Make a list of the addresses of these numbers, starting in $3600
c) Store these numbers in a list starting at $3800

and I finished a program for another assignment question, but I have one problem...
Question: There is a set of byte-sized numbers in memory buffer from $3000 to $33cc. WRite a program to move the address of all the numbers in this buffer that are higher in absolute value than %50 into a list starting at $3500.

Answer that i WRote:
ORG $2000 ; code start location in RAM

************
CLRA
CLRB
LDX #$3000 ; load immediate number (#$3000) into X register
LDY #$3500 ; Load immediate number (#$3500) into Y register

Loop LDAB $0,X
CMPB #$32
BLE SMALL
Loop1 STAB 0,Y
INX
INY
CPX #$33CC
BNE Loop
JMP STOP

SMALL CLRB
JMP LOOP1
JMP $8000 ; return to Buffalo ( system program in ROM)

************
* END OF FILE
stop END

problem is that:

the program copies something like
(in decimal)
3000-ono 3500-ono
12 0
34 0
55 55
66 66
77 77

I was wondering if I Could copy all the numbers greater than $50 as a list and not have all this 0s in the middle which correspond to the memories less than $50.

Thanks heaps :)
 
Looking at your code I would guess you need something like,
Code:
        LDX #$3000 ; load immediate number (#$3000) into X register
        LDY #$3500 ; Load immediate number (#$3500) into Y register

Loop    LDAB $0,X
	INX
        CMPB #$32
        BLE  TestX
        STAB 0,Y
        INY
TestX   CPX #$33CC
        BNE Loop
        JMP $8000 ; return to Buffalo ( system program in ROM)

stop     END

I don't understand part a of the other question.
a) Count the number of numbers divided by 13 in the buffer.

Mike.
 
As a starting point try,
Code:
        LDX  #$0 
        LDY  #$0 
Loop    LDAB $3200,X
Test13	SUBB #$0d
        BCC  NoStore    ;may need to be BCS
	BNE  Test13
        LDAC $3200,X
        STAB $3800,Y
	XGDY
	LSLD
	XGDY
	STX  $3600,Y
	XGDY
	LSRD
	XGDY
        INY
NoStore	INX
        CPX  #$0300
        BNE  Loop
        JMP  $8000 ; return to Buffalo ( system program in ROM)

stop     END

Edit, you should really study any code and work out what it is doing. You will get tested on it. Plus, the above is untested and probably bug ridden.:D

Mike.
 
Last edited:
heya,

I will try this later and will tell you how it works, took me a while to get the other one working so enough for today :D thanks heaps
 
heya, i started with this for now, to see if the initial loops work.. but there is some problem with the IDIV since it does not set the carry bit...
could you please have a look? thanks
ORG $3200 ; location of variable (low RAM)

NUMBER1 FCB 12
NUMBER2 FCB 26
NUMBER3 FCB 39
NUMBER4 FCB 66
NUMBER5 FCB 77

ORG $2000
CLRA
CLRB
LDY #$3200
Loop LDAB $0,Y

Test13 LDX #$D
IDIV
BCS NoStore ;may need to be BCS
CPD $0
STY $3600
INY
CPY #$34FF
JMP STOP
JMP LOOP
NoStore INY
CPY #$34FF
BNE Loop
 
Hi
I was wondering how do you read/write portA.B or C in the simulator. And how to use IRQ and RTI interrupts. IS there possible for you to show me an example?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top