English Amiga Board


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

 
 
Thread Tools
Old 10 December 2018, 18:37   #941
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,959
Quote:
Originally Posted by Hedeon View Post
What?! Close the longest troll.thread?? Nooo...
Right, dont close this thread. I always want to hear about advantages x86 code over 68k code. And maybe litwr will be soon very good 68k coder. Learning 68k coding is easy enough.
Don_Adan is offline  
Old 10 December 2018, 18:53   #942
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Does it matter though? Yes, especially if there is a vulnerability that can be exploited in the host hypervisor via the guest.

Last edited by ross; 10 December 2018 at 19:04. Reason: small removal ;)
ross is offline  
Old 11 December 2018, 15:46   #943
Megol
Registered User
 
Megol's Avatar
 
Join Date: May 2014
Location: inside the emulator
Posts: 377
Quote:
Originally Posted by ross View Post
It means not understanding how server farms work today and what it means to have a virtual machine run by a complete stranger.
Detect and abuse are one step away..
Intel created the UMIP or User mode Instruction Prevention extension to stop abuse of the SMSW instruction (and some others) _outside_ the virtualization problem.
Sure one could applaud their determination of keeping backwards compatibility with crazy design decisions for the 80286, but couldn't they have added this extension with the 80386 instead of waiting 34 years(!) to patch a known problem?!?

It's just another of those things with x86 that doesn't make sense.
Quote:
Heard by chance of Meltdown and Spectre and their consequences?
Spectre and Meltdown use completely unrelated mechanisms?
Megol is offline  
Old 11 December 2018, 17:15   #944
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by Megol View Post
Spectre and Meltdown use completely unrelated mechanisms?
Right, Meltdown seems to affect only Intel processors and *fully* (HW support) virtualized machines are not affected.
More problematic are Spectre vulnerabilities (bounds check bypass and branch target injection) that can cross between VMs..
ross is offline  
Old 11 December 2018, 18:23   #945
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
Ok, how about this: https://projecteuler.net/problem=25

And here is my implementation (noob on asm)
Code:
	;; vasmm68k_mot -Fhunkexe -o euler25 euler25.asm
DIGITS = 1000
NUMSTORAGE = DIGITS/2
        opt x+
	lea.l	-NUMSTORAGE(sp),sp
	move.l	sp,a1
	lea.l	-NUMSTORAGE(sp),sp
	move.l	sp,a2
	lea.l	-NUMSTORAGE(sp),sp
	move.l	sp,a3

	;; clear the numbers
	move.l	a3,a0
	moveq	#0,d0
	move.w	#(3*NUMSTORAGE)/4-1,d1
.clrloop
	move.l	d0,(a0)+
	dbra	d1,.clrloop

	;; init *a1 and *a2 to 1
	moveq	#1,d0
	move.b	d0,NUMSTORAGE-1(a1)
	move.b	d0,NUMSTORAGE-1(a2)
	moveq	#2,d0	; d0 will hold the term-number we are now calculating
	moveq	#1-1,d7		;number of pair of digits, normalised for dbra

	;; n1 ->
	;; n2 ->
	;; n3 ->
	;; n1 ->
	;; n2 ->
	;; n3 ->
	
	;; addfib n1,n2,n3  n3 = n1 + n2
addfib:	MACRO
	addq	#1,d0		;increase the term-number
	;; move num2 to num3
	moveq	#NUMSTORAGE/4-1,d1
	move.l	\2,a4
	move.l	\3,a5
mvloop\@
	move.l	(a4)+,(a5)+
	dbra	d1,mvloop\@

	lea.l	NUMSTORAGE(\1),a4
	lea.l	NUMSTORAGE(\3),a5
	move.w	d7,d1
addloop\@
	abcd	-(a4),-(a5)
	dbra	d1,addloop\@
	bcc.s	nocarry\@
	move.b	#1,-(a5)	
	addq	#1,d7
nocarry\@
	cmp.b	#9,(\3)
	bgt.s	done
	ENDM

loop:	
	addfib a1,a2,a3
	addfib a2,a3,a1
	addfib a3,a1,a2
	bra	loop
	
done:	
	lea.l	3*NUMSTORAGE(sp),sp
	rts
224 bytes.
After you run it, type set in shell and see the answer in RC.
alkis is offline  
Old 11 December 2018, 21:58   #946
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
I've just finished a 44 bytes version (no bss space, only code and stack usage).
I publish it or wait a bit for someone different result? (I love this little competitions )
ross is offline  
Old 11 December 2018, 22:46   #947
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
Quote:
Originally Posted by ross View Post
I've just finished a 44 bytes version (no bss space, only code and stack usage).
I publish it or wait a bit for someone different result? (I love this little competitions )
lol, 44 bytes?

Man, I knew I was noob. I didn't knew I was that much of a noob though
Well played, sir!
alkis is offline  
Old 11 December 2018, 22:53   #948
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by alkis View Post
lol, 44 bytes?

Man, I knew I was noob. I didn't knew I was that much of a noob though
Well played, sir!
Uh sorry! I've not counted rts!
So actually 46

Just curious, i've not assembled your source.
What's your result?

Mine is 4782.
ross is offline  
Old 11 December 2018, 22:58   #949
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
Quote:
Originally Posted by ross View Post
Uh sorry! I've not counted rts!
So actually 46

Just curious, i've not assembled your source.
What's your result?

Mine is 4782.
4782 indeed.
alkis is offline  
Old 11 December 2018, 23:26   #950
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
Quote:
Originally Posted by ross View Post
I've just finished a 44 bytes version (no bss space, only code and stack usage).
The no bss space got me wondering
Umm, what's the final executable size?
alkis is offline  
Old 11 December 2018, 23:35   #951
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by alkis View Post
The no bss space got me wondering
Umm, what's the final executable size?
84: header(36)+code(46)+pad(2)
ross is offline  
Old 12 December 2018, 00:16   #952
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
code 94, final exe 132

Code:
	;; vasmm68k_mot -Fhunkexe -o euler25 euler25.asm
DIGITS = 1000
NUMSTORAGE = DIGITS/2
	opt x+
	
	lea.l	-NUMSTORAGE(sp),sp
	move.l	sp,a1
	lea.l	-NUMSTORAGE(sp),sp
	move.l	sp,a2
	lea.l	-NUMSTORAGE(sp),sp
	move.l	sp,a3


	;; init *a1 and *a2 to 1
	moveq	#1,d0
	move.b	d0,NUMSTORAGE-1(a1)
	move.b	d0,NUMSTORAGE-1(a2)
	move.b	d0,(a2)
	moveq	#2,d0	; d0 will hold the term-number we are now calculating
	moveq	#1-1,d7		;number of pair of digits, normalised for dbra

loop:
	addq	#1,d0
	
	lea.l	NUMSTORAGE(a2),a6
	lea.l	NUMSTORAGE(a1),a4
	lea.l	NUMSTORAGE(a3),a5

	move.w	d7,d1
	
digloop:
	move.b	-(a6),-1(a5)
	abcd	-(a4),-(a5)
	scc	d2
	move.b	(a6),(a4)
	move.b	(a5),(a6)
	dbra	d1,digloop
	tst.b	d2
	bne.s	nocarry
	move.b	#1,-(a6)
	move.b	#0,-(a4)
	addq	#1,d7
nocarry:
	cmp.b	#9,(a2)
	bgt.s	done
	bra.s	loop
done:	
	lea.l	3*NUMSTORAGE(sp),sp
	rts
alkis is offline  
Old 12 December 2018, 00:37   #953
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by alkis View Post
code 94, final exe 132
Much better.

If you only look at the formula you see that at step n you need to sum n-1 to n-2.
But you have to actually think about what does it represent the Fibonacci sequence: a recurrence relation.
So if you use n-2 as the current n..
ross is offline  
Old 12 December 2018, 13:02   #954
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
At 46 right now, gonna keep trying. Out of curiosity, I have 18 instructions.
Awaiting meynaf's 44 ;P...
a/b is offline  
Old 12 December 2018, 13:12   #955
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by a/b View Post
At 46 right now, gonna keep trying. Out of curiosity, I have 18 instructions.
Awaiting meynaf's 44 ;P...
There is a 44 bytes possibility but is forbidden with scheduler active
The 44 bytes code is 16 instructions.

My 46 bytes version is 18 instructions, like yours.
But probably there are more possibilities to do it in 46 bytes.

And yes as usual when meynaf will see my code i'm expecting a 2 bytes strip
ross is offline  
Old 12 December 2018, 13:21   #956
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by a/b View Post
Out of curiosity
I have a curiosity too.

Since I wanted to find a way to use the link instruction (I committed myself to using it at all costs!), did you accidentally use it too?
ross is offline  
Old 12 December 2018, 13:51   #957
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
Yeah, I'm using link.
a/b is offline  
Old 12 December 2018, 14:14   #958
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by a/b View Post
Awaiting meynaf's 44 ;P...
44 bytes for what ?
Does it include displaying the number ?


Quote:
Originally Posted by ross View Post
And yes as usual when meynaf will see my code i'm expecting a 2 bytes strip
Maybe, maybe not. I have bigger things on the fire currently.
meynaf is offline  
Old 12 December 2018, 15:29   #959
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by meynaf View Post
44 bytes for what ?
Does it include displaying the number ?
Nope, a simple return code displayed on CLI (so a value in d0.l at exit).

Quote:
Maybe, maybe not. I have bigger things on the fire currently.
Yep, don't distract yourself
ross is offline  
Old 12 December 2018, 15:47   #960
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by ross View Post
Nope, a simple return code displayed on CLI (so a value in d0.l at exit).
Ok then, let's go.
Code:
 move.l #4782,d0
 rts

(What ? It gives the right result, no ?)
meynaf is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Any software to see technical OS details? necronom support.Other 3 02 April 2016 12:05
2-star rarity details? stet HOL suggestions and feedback 0 14 December 2015 05:24
EAB's FTP details... Basquemactee1 project.Amiga File Server 2 30 October 2013 22:54
req details for sdl turrican3 request.Other 0 20 April 2008 22:06
Forum Details BippyM request.Other 0 15 May 2006 00:56

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 11:43.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.45238 seconds with 16 queries