[ASM] 68000

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
User avatar
Regular Member
Posts: 137
Joined: Sun 12 Oct, 2008 1:42 am
Location: Boise, Idaho

[ASM] 68000

Post 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.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Re: [ASM] 68000

Post 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 {-}
Post Reply