English Amiga Board


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

 
 
Thread Tools
Old 23 February 2021, 23:52   #1
Arnaud.68000
Registered User

Arnaud.68000's Avatar
 
Join Date: Nov 2020
Location: France
Posts: 18
[ASM68000] rubik's

Hi,


30 years after, i worked for monthes to code a 3D rubik's cube... with rotations of faces.


Here is the picture of the result :







Please find the code there (Sorry all my comments are in french).



https://github.com/Amiga68000/Rubiks...tag/2021-02-08


Don't hesitate to give me feedback if you find bug, optimizations or have suggestions or ideas.

Any question, please ask.

If i find motivation, i will try to implement filled shapes.



Thanks & have fun


Arnaud
Arnaud.68000 is offline  
Old 24 February 2021, 01:41   #2
a/b
Registered User

 
Join Date: Jun 2016
Location: europe
Posts: 306
Did one of those back in 92-93 with filled vectors and white line vectors for the grid.
I used 2x3 dual playfield so I only had to deal with 2 easy peasy convex objects, each in its own playfield, rotated two sets of 8 corner points and the rest was generated with unit vectors.
a/b is offline  
Old 24 February 2021, 08:32   #3
Valken
Registered User
 
Join Date: Feb 2009
Location: Amiga
Posts: 371
Very cool! You should make it into a full demo that we can play around with or randomize the rotations then try to solve it automatically!
Valken is offline  
Old 24 February 2021, 10:54   #4
heavy
noodle
 
Join Date: Jun 2007
Location: europe
Posts: 242
warning : somes bsr (pc) and bra (pc). work with jsr not bsr. doesn't work with asmone

Quote:
Originally Posted by a/b View Post
Did one of those back in 92-93 with filled vectors and white line vectors for the grid.
I used 2x3 dual playfield so I only had to deal with 2 easy peasy convex objects, each in its own playfield, rotated two sets of 8 corner points and the rest was generated with unit vectors.
I have seen only two rubik on A500. one from French group Intryx and one in the trackmo of Binary. with white line vectors for the grid : a great rubik!
is it this one ?
heavy is offline  
Old 24 February 2021, 11:17   #5
a/b
Registered User

 
Join Date: Jun 2016
Location: europe
Posts: 306
Yep, the latter.
a/b is offline  
Old 24 February 2021, 11:27   #6
heavy
noodle
 
Join Date: Jun 2007
Location: europe
Posts: 242
Made In Croatia / Binary (1993) :
http://janeway.exotica.org.uk/release.php?id=9158

impressive rubik's cube
can you tell more about how that work ? (differences with the one by Arnaud)
thanks
heavy is offline  
Old 25 February 2021, 00:09   #7
a/b
Registered User

 
Join Date: Jun 2016
Location: europe
Posts: 306
Eh, it's simple stuff made for a demo, nothing more nothing less. Didn't check Arnaud's code in detail, french gives me exception #4 ;p, but it looks like a completely different approach.
As I said, dual playfield is the critical part, makes rendering trivial. Simple "script", takes a series of +/- 1-6 (6 possible moves, sign determines rotation direction), selects one of 6 predefined poly/corner sets, generates inner 3d points, does some math and throws everything at the screen, Tops everything off with shiny line vectors to hide ugly edges ;P. The usual convex vector demo stuff.
Playfield priority (and the consequent remapping of colors) is based on the sum of corner z coords.
a/b is offline  
Old 25 February 2021, 23:23   #8
Arnaud.68000
Registered User

Arnaud.68000's Avatar
 
Join Date: Nov 2020
Location: France
Posts: 18
Why not Valken, but including a solver will be a little bit harder for me
First a simple demo should be easier.

Quote:
Made In Croatia / Binary (1993)
Very impressive to calculate and display in real time.


Quote:
french gives me exception #4 ;p
Nooooo ... if you want I will send my code to Buckingham Palace, I know that there several people speak French without #4 exception

@a/b, not sure to understand in details the method you describe :
If you do (or not) a rotation of a layer you use 2 playfields for 2 3D-objects, 1 for the body(without the layer) + 1 for the layer in rotation
You calculate only 8 corners per 3D-object, using a linear interpollaton, you calculate shapes and fill them.
i'm right ?
Why 2 playfiels, is it to simplify the filling ?


What i did is more complicated (i calculated and display each visible shape) and must use more CPU than your method


"Merci pour l'astuce" ;p

I will try to think how to implement it
Arnaud.68000 is offline  
Old 25 February 2021, 23:55   #9
heavy
noodle
 
Join Date: Jun 2007
Location: europe
Posts: 242
I just compiled your source with asm2 and winuae 4400 : nothing on the screen, except text and debug : no cube
I see the cube with debugdisplayraster=1
heavy is offline  
Old 26 February 2021, 00:05   #10
Arnaud.68000
Registered User

Arnaud.68000's Avatar
 
Join Date: Nov 2020
Location: France
Posts: 18
I don't understand,
I just download and tried the source and it works with my config :
- WinUAE 64.4.4.0 (A500 / 1Mo / true time)
- ASMTwo
What is your config under WinUae ? A500 or more ?

Quote:
warning : somes bsr (pc) and bra (pc). work with jsr not bsr. doesn't work with asmone
Ok "Heavy", I will try ASMOne to clean my code
Arnaud.68000 is offline  
Old 26 February 2021, 00:09   #11
heavy
noodle
 
Join Date: Jun 2007
Location: europe
Posts: 242
1 bsr and 1 bra to clean, it's enough
but on winuae32 4.4.0 (A500) : no cube on the screen
only with debugdisplay_raster=1
with ASMTwo !
and no more with asmone

Last edited by heavy; 26 February 2021 at 00:18.
heavy is offline  
Old 26 February 2021, 00:15   #12
Arnaud.68000
Registered User

Arnaud.68000's Avatar
 
Join Date: Nov 2020
Location: France
Posts: 18
You remind me a bug.

line 1680 :
Code:
	dc.w	COLOR01,MIRROR_SCROLL_COLOR
	dc.w	COLOR02,MIRROR_SCROLL_COLOR
	dc.w	COLOR03,MIRROR_SCROLL_COLOR
	;dc.w	COLOR04,MIRROR_SCROLL_COLOR
	dc.w	COLOR05,MIRROR_SCROLL_COLOR
	dc.w	COLOR06,MIRROR_SCROLL_COLOR
	dc.w	COLOR07,MIRROR_SCROLL_COLOR
Try to comment all the lines.

On my machine if I uncomment COLOR04, the cube is not displayed
Maybe you need uncomment more than 1 line.

I didn't find time to investigate this bug .. if someone has an idea ...
Arnaud.68000 is offline  
Old 26 February 2021, 00:23   #13
heavy
noodle
 
Join Date: Jun 2007
Location: europe
Posts: 242
nop, and now I have a guru
problem with the copperlist
heavy is offline  
Old 26 February 2021, 00:28   #14
heavy
noodle
 
Join Date: Jun 2007
Location: europe
Posts: 242
line 1499
change
Code:
	move.l	#COPSIZE-1,d0 ; problem with COPSIZE/4. works also with COPSIZE/2 .w
	move.l	#CopListDataStart,a0
	move.l	copperlist_PTR,a1
.l2:
	move.b	(a0)+,(a1)+ ; .b or .w if copsize/2 <- .L
	dbf		d0,.l2
your code is already in chip with section code_c
you don't need to allocmem in chip and copy the coplist

Last edited by heavy; 26 February 2021 at 00:44.
heavy is offline  
Old 26 February 2021, 00:36   #15
Arnaud.68000
Registered User

Arnaud.68000's Avatar
 
Join Date: Nov 2020
Location: France
Posts: 18
which machine do you emulate ?

Bellow extract of my config .uae

Quote:
config_description=Environnement ASM sur DD WB1.3
config_hardware=true
config_host=true
config_version=4.4.0
...
comp_catchdetect=true
win32.rom_path=./
win32.floppy_path=./
win32.hardfile_path=./
; host-specific
win32.middle_mouse=true
win32.soundcard=0
win32.soundcardname=WASAPIefault Audio Device
; common
use_gui=yes
use_debugger=false
kickstart_rom_file=.\10 - Rom\Kickstart 1.3.rom
kickstart_rom_file_id=C4F0F55F,KS ROM v1.3 (A500,A1000,A2000)
kickstart_ext_rom_file=
flash_file=
cart_file=
rtc_file=
kickshifter=false
floppy_volume=33
...
nr_floppies=2
floppy_speed=100
cd_speed=100
...
cachesize=0
...
bsdsocket_emu=false
synchronize_clock=false
maprom=0x0
parallel_postscript_emulation=false
parallel_postscript_detection=false
ghostscript_parameters=
parallel_autoflush=5
clipboard_sharing=true
...
immediate_blits=false
waiting_blits=automatic
ntsc=false
genlock=false
chipset=ocs
chipset_refreshrate=49.920410
collision_level=playfields
chipset_compatible=A500
rtc=MSM6242B
resetwarning=false
cia_todbug=true
fastmem_size=0
debugmem_start=0x0
debugmem_size=0
mem25bit_size=0
a3000mem_size=0
mbresmem_size=0
z3mem_size=0
z3mem_start=0x40000000
bogomem_size=2
gfxcard_hardware_vblank=false
gfxcard_hardware_sprite=true
gfxcard_multithread=false
chipmem_size=1
cpu_speed=real
cpu_throttle=0.0
cpu_type=68000
cpu_model=68000
cpu_compatible=true
cpu_24bit_addressing=true
cpu_data_cache=false
cpu_multiplier=2
cpu_cycle_exact=true
cpu_memory_cycle_exact=true
blitter_cycle_exact=true
cycle_exact=true
fpu_strict=false
rtg_nocustom=true
rtg_modes=0x212
debug_mem=false
log_illegal_mem=false
kbd_lang=us
filesystem2=rw,DH0:SYS:.\15 - HardDisk\SYS_WB1.3,0
uaehf0=dir,rw,DH0:SYS:.\15 - HardDisk\SYS_WB1.3,0
filesystem2=rw,DH1:PROG:.\15 - HardDisk\Prog,-128
uaehf1=dir,rw,DH1:PROG:.\15 - HardDisk\Prog,-128
filesystem2=rw,DH2:Sources:.\15 - HardDisk\Sources,0
uaehf2=dir,rw,DH2:Sources:.\15 - HardDisk\Sources,0
...
Arnaud.68000 is offline  
Old 26 February 2021, 00:38   #16
Arnaud.68000
Registered User

Arnaud.68000's Avatar
 
Join Date: Nov 2020
Location: France
Posts: 18
OK for the CODE_C, thanks
Arnaud.68000 is offline  
Old 26 February 2021, 00:43   #17
Arnaud.68000
Registered User

Arnaud.68000's Avatar
 
Join Date: Nov 2020
Location: France
Posts: 18
Quote:
Originally Posted by heavy View Post
line 1499
change
Code:
	move.l	#COPSIZE-1,d0 ; problem with COPSIZE/4
	move.l	#CopListDataStart,a0
	move.l	copperlist_PTR,a1
.l2:
	move.b	(a0)+,(a1)+ ; .b <- .L
	dbf		d0,.l2
your code is already in chip with section code_c
you don't need to allocmem in chip and copy the coplist
Is "move.l" the cause of your GURU ?
Arnaud.68000 is offline  
Old 26 February 2021, 00:49   #18
heavy
noodle
 
Join Date: Jun 2007
Location: europe
Posts: 242
there is an issue with your copperlist
if I put a comment somewhere, screen stay black
heavy is offline  
Old 26 February 2021, 01:17   #19
a/b
Registered User

 
Join Date: Jun 2016
Location: europe
Posts: 306
Quote:
Originally Posted by Arnaud.68000 View Post
You calculate only 8 corners per 3D-object, using a linear interpollaton, you calculate shapes and fill them.
i'm right ?
Yes, 8 corner points per object and the rest is interpolated.

Quote:
Originally Posted by Arnaud.68000 View Post
Why 2 playfiels, is it to simplify the filling ?
Yes, 1 blit to clear, draw all the edges in fill mode, and finally 1 blit to fill. Also, calculate min/max x/y so you don't have to clear/fill the entire buffer.
a/b is offline  
Old 26 February 2021, 13:42   #20
Arnaud.68000
Registered User

Arnaud.68000's Avatar
 
Join Date: Nov 2020
Location: France
Posts: 18
Quote:
Originally Posted by heavy View Post
there is an issue with your copperlist
if I put a comment somewhere, screen stay black
I don't have this issue, but I know I have the pb if I remove a comment in the miror color table
I will investigate, maybe a pb with the VBL ?
Arnaud.68000 is offline  
 


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

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 03:55.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.09477 seconds with 15 queries