English Amiga Board Amiga Lore

Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

Thread Tools
Old Today, 20:50   #41
Vae victis!

ross's Avatar
Join Date: Mar 2017
Location: Crossing the Rubicon
Posts: 224
Originally Posted by meynaf View Post
Nobody else submitted full emu code so you can show it of course.
wow, i'm proud of it

simabcd	movem.l	d0-d4,-(a7)		; save regs (make stack for bfield usage)
	sne	d0			; save (~Z)
	moveq	#0,d1			; extra carry
	moveq	#7,d2			; loop and select (trick)
l0	eori.w	#3,d2			; switch (d2 select, 2nd loop possible)
	bfextu	3(a7){d2:4},d3		; extract source (nibble)
	bfextu	7(a7){d2:4},d4		; extract destination (nibble)
	addx.l	d1,d4			; sum carry, 2nd time also extra
	add.l	d3,d4			; bcd sum (X=0)
	cmpi.b	#$09,d4			; check if decimal carry
	bls.b	l1			; <=9 not needed
	subi.b	#$0a,d4			; simulate bcd unit
	ori	#%00010000,CCR		; propagate carry (X=1)
l1	bfins	d4,7(a7){d2:4}		; insert result
	bfextu	d4{24:d2},d1		; extra carry, take care of illegal encoding
	dbf	d2,l0			; loop (X untouched), on exit d1=0 (trick)
	or.b	7(a7),d0		; Z=Z&(~R) -> ~Z=~(Z&(~R)) -> ~Z=R|(~Z)
	roxl.b	d1,d0			; set C and (~)Z (very tricky)
	movem.l	(a7)+,d0-d4		; result in d1.b (upper bit untouched)
For the normal version I had come to the same unpk/unpk/pack combination,
so a/b I'm curious about versions with 15 instructions with different method.

Kudos to paraj!
ross is offline  
AdSense AdSense  
Old Today, 21:26   #42
Registered User

Join Date: Jun 2016
Location: europe
Posts: 21
I don't want this to turn into a s**tshow, because clearly I do this for fun, and as you said there is no price to win (and I doubt I would really care if there was one).

But here it is, from the original post:
I will regularly update results so that you know where you are in comparison to others (but no code shown before the end).
Deadline undecided yet -- will depend on the received submissions.
Winner is shortest code in number of instructions.

Not a single word about "bonus points" based on when you submit your code, how good it is compared to others, what you like more, etc. It's more on the opposite end, one could understand you are actually encouraging us to send our work in progress versions without having any consequences on the final standings.
And that's something I prefer to know in advance.

And if you really need a tiebreaker you can then introduce artistic points, or something similar. Or heck, send my code to paraj and his to me, and give us 24h to try to shave off an instruction or few. If either of us can make it, there it is, if not try something else.
a/b is online now  
AdSense AdSense  

Currently Active Users Viewing This Thread: 2 (1 members and 1 guests)
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone up for an ASM coding competition? DanScott Coders. Asm / Hardware 523 02 May 2017 09:24
4th tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 11 10 April 2013 20:32
3rd tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 6 26 March 2013 15:57
First tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 46 18 March 2013 12:33
2nd tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 10 17 March 2013 11:49

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 21:26.

Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.10828 seconds with 13 queries