m68k

Thread Starter

active92

Joined Oct 26, 2012
10
sstack equ $30000
ustack equ $20000

org $10000
memd0 ds.b $a5


START ORG $1000
lea sstack,A7
andi.w #$dfff,SR
lea ustack,a7
jsr init
move.b #3,d0
jsr delay
move.b #3,d0
jsr ldelay

trap #15

org $2000
init move.b #0,D0
move.b d0,memd0
rts

delay sub.b #1,d0
bne delay
rts

ldelay move.b d0,memd0
move.b #3,d0
jsr delay
move.b memd0,d0
sub.b #1,d0
bne ldelay
rts

sub.b #1,d1

END START

This is a subroutine code. I need to draw a flow chart on this but I really have no idea how to do it. Can anyone help me please?
 

MrChips

Joined Oct 2, 2009
35,093
That's putting the carriage before the horse. One does not build a house and draw the plans after.

Flowchart comes before the code. Flowchart dictates the code. Not the other way around.
 

Thread Starter

active92

Joined Oct 26, 2012
10
But this is my lab work. We are asked to make a flow chart. I don't really understand some of the parts and when I tried to ask, our lecturer doesn't want to answer them until the deadline is over. I need to submit it by tomorrow =(
 

Thread Starter

active92

Joined Oct 26, 2012
10
I know it started with initialize sstack, clear SR, initialize ustack, followed by subroutine, move 03 to d0 means delaying 3 seconds (not sure if this is right), then subroutine again and again move 03 to d0 and I'm stuck because subroutine started and before it ends, another subroutine started.
 

Thread Starter

active92

Joined Oct 26, 2012
10
INSTRUCTION
lea sstack, A7
Andi.w #$dfff,SR
lea ustack, a7
jsr init
move.b #0,D0
move.b d0,memd0
rts
move.b #3,d0
jsr delay
sub.b #1,d0
bne delay
sub.b #1,d0
bne delay
sub.b #1,d0
bne delay
rts
move.b #3,d0
jsr delay
move.b d0,memd0
move.b #3,d0
jsr delay
sub.b #1,d0
bne delay
sub.b #1,d0
bne delay
sub.b #1,d0
bne delay
rts

move.b d0,memd0
sub.b #1,d0
bne 1delay
move.b d0,memd0
move.b #3,d0
jsr delay
sub.b #1,d0
bne delay
sub.b #1,d0
bne delay
sub.b #1,d0
bne delay
rts
move.b d0,memd0
sub.b #1,d0
bne delay
move.b d0,memd0
move.b #3,d0
jsr delay
sub.b #1,d0
bne delay
sub.b #1,d0
bne delay
sub.b #1,d0
bne delay
rts
move.b d0,memd0
sub.b #1,d0
bne 1delay
rts
trap #15

I dont understand the part highlighted in red.
 
Top