Page 1 of 1

[ASM] 68000

Posted: Sat 26 Dec, 2009 4:26 pm
by Wesley
Merry Christmas everyone!!!

So, I haven't looked at very much ASM programming, would this be too difficult to accomplish?

1) Write a 68000 partial program to calculate the polynomial P(x)=2x^3-x^2=4.

2) Write a 68000 assembly program to count the odd numbers found in a numbered list located in memory between $4000 and $40ff. The numbers are 1-byte each.

Re: [ASM] 68000

Posted: Sat 26 Dec, 2009 6:24 pm
by King Harold
1) Sounds like a piece of cake, there is a mul[u/s] instruction so you don't even have to write a multiplication routine
2) That's easy on pretty much every processor I've worked with
Such as: (not optimized or tested, just written in half a minute)

Code: Select all

   ld hl,$4000
   ld d,$80  ;result at 8000 - 807F
   ld b,l
-: ld a,(hl)
   srl a
   jr nc,{+}
   ld e,a
   ex de,hl
   inc (hl)
   ex de,hl
+: inc hl
   djnz {-}