Conversion of VIC-SSS-MMX to CBM prg Studio

You need an actual VIC.

Moderator: Moderators

User avatar
MrSterlingBS
Vic 20 Enthusiast
Posts: 174
Joined: Tue Jan 31, 2023 2:56 am
Location: Germany,Braunschweig

Re: Conversion of VIC-SSS-MMX to CBM prg Studio

Post by MrSterlingBS »

graphic error.jpg
here is the picture . . .
User avatar
thegg
Vic 20 Amateur
Posts: 69
Joined: Mon Aug 30, 2021 4:49 am
Location: England
Occupation: retired

Re: Conversion of VIC-SSS-MMX to CBM prg Studio

Post by thegg »

The glitch in the graphic display is happening at the point the SSS switches to the other screen in the double buffered display. I don't yet understand why it switches at that point, but I think it has been deliberately chosen: perhaps to allow enough time to rebuild the whole screen before it appears at the top of the display. The glitch disappears if the vsync occurs a few rasters later. You can see this if you change the raster line value from $76 to $80 in the basic file line 67 (assuming PAL system).

Thanks for pointing the issue out. I hadn't noticed. I'm not sure yet whether or not the issue is a feature of the SSS or the conversion. I have noted it and perhaps the cause will reveal itself when I have a better understanding of how the SSS works.
rhurst
Omega Star Commander
Posts: 1371
Joined: Thu Jan 31, 2008 2:12 pm
Website: https://robert.hurst-ri.us
Location: Providence, RI
Occupation: Tech & Innovation

Re: Conversion of VIC-SSS-MMX to CBM prg Studio

Post by rhurst »

Nice! 8)
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
User avatar
thegg
Vic 20 Amateur
Posts: 69
Joined: Mon Aug 30, 2021 4:49 am
Location: England
Occupation: retired

Re: Conversion of VIC-SSS-MMX to CBM prg Studio

Post by thegg »

Robert: glad you approve.

Attached is an update to the project that includes much of beamrider's modifications for the handling of multicolour and taller (3x2) sprites and a small addition of my own. The archive contains a Readme giving a bit more detail. There is an executable for the demo as well as the source to build it.

The demo is just an illustration of the SSS functionality. How to use it remains essentially the same except for the creation of a sprite that has a new interface. This is documented in the source files.

Thanks to Robert and beamrider for making their source material available.
CBMSSS.zip
(469.69 KiB) Downloaded 67 times
Enjoy
Dave
User avatar
MrSterlingBS
Vic 20 Enthusiast
Posts: 174
Joined: Tue Jan 31, 2023 2:56 am
Location: Germany,Braunschweig

Re: Conversion of VIC-SSS-MMX to CBM prg Studio

Post by MrSterlingBS »

Nice, maybe that what i need.
I realized at the weekend that the multicolor sprites are not 100% correct.

@thegg

It is possible to take a look at my problem @the SoftwareSprite thread?


Best regards
Sven
User avatar
MrSterlingBS
Vic 20 Enthusiast
Posts: 174
Joined: Tue Jan 31, 2023 2:56 am
Location: Germany,Braunschweig

Re: Conversion of VIC-SSS-MMX to CBM prg Studio

Post by MrSterlingBS »

@ thegg
I see you have the same idea with the BigRedDude.

Your work is amazing.


BR
Sven
User avatar
MrSterlingBS
Vic 20 Enthusiast
Posts: 174
Joined: Tue Jan 31, 2023 2:56 am
Location: Germany,Braunschweig

Re: Conversion of VIC-SSS-MMX to CBM prg Studio

Post by MrSterlingBS »

Hello,

i take a deeper look at the code and have a question.
There are some "illegal"-opcodes describet in "no more secrets" and i found some interesting optimazion for the sprite stack.
The SSSXYPrintS can be done by the LAX opcode instead of LDA/LDX and saves 9 cycles. The check with the newest SpriteStack version runs normal.

There are some other optimizations possible and i have added this in the code "VIC-SSS-MMX.asm". No huge speed increase, but ...

Code: Select all

SSSXYPRINTS 
                PLA
                STA VECTORFG
                PLA
                STA VECTORFG+1
                LDY #$01
                byte $B3, $F7           ; opcode LAX 5 (+1) cylces
                ;LDA (VECTORFG),Y       ; 5 (+1) cycles
                ;PHA                    ; 3 cycles
                INY
                LDA (VECTORFG),Y
                TAY
                ;PLA                    ; 4 cycles
                ;TAX                    ; 2 cycles
                JSR SSSPLOT
                LDY #3
                JMP DOSSSPRINTS
Another in ...

Code: Select all

SSSUPDATE 
                LDX #0
                STX sssIDX   ;mod: sssnum in original
@do 
                CPX SPRITES
                BCC @cc
                RTS
@cc             
                ; Mod draw sprites in Z_ORDER
                LDA SSSZORDR,X
                byte $8F, sssNUM        ; opcode SAX 
                ;STA sssNUM
                ;TAX
and two times in the code...

Code: Select all

;and #$7e
                ;lsr 
                byte $4B,$7E            ; opcode ALR (ASR)
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: Conversion of VIC-SSS-MMX to CBM prg Studio

Post by tokra »

MrSterlingBS wrote: Tue Apr 11, 2023 11:44 am There are some "illegal"-opcodes describet in "no more secrets" and i found some interesting optimazion for the sprite stack.
The SSSXYPrintS can be done by the LAX opcode instead of LDA/LDX and saves 9 cycles. The check with the newest SpriteStack version runs normal.
Unless absolutely necessary you should really avoid such "optimizations" with illegal opcodes. Some people are now using newer 65C02 as replacements for a defect 6502 and the new ones do not support illegal opcodes at all. Then for marginal speed increases you just cut your user-base unnecessarily. It is better to do optimizations with normal opcodes.
There are some other optimizations possible and i have added this in the code "VIC-SSS-MMX.asm". No huge speed increase, but ...

Code: Select all

SSSXYPRINTS 
                PLA
                STA VECTORFG
                PLA
                STA VECTORFG+1
                LDY #$01
                byte $B3, $F7           ; opcode LAX 5 (+1) cylces
                ;LDA (VECTORFG),Y       ; 5 (+1) cycles
                ;PHA                    ; 3 cycles
                INY
                LDA (VECTORFG),Y
                TAY
                ;PLA                    ; 4 cycles
                ;TAX                    ; 2 cycles
                JSR SSSPLOT
                LDY #3
                JMP DOSSSPRINTS
With your code you actually change what is in the Accumulator at the end. Since with the PLA the result of the first LDA will be restored in the Accumulator, but just keep the value of the second LDA (VECTORFG),y in it. Using LAX would only save 2 cycles (the TAX).

Code: Select all

SSSUPDATE 
                LDX #0
                STX sssIDX   ;mod: sssnum in original
@do 
                CPX SPRITES
                BCC @cc
                RTS
@cc             
                ; Mod draw sprites in Z_ORDER
                LDA SSSZORDR,X
                byte $8F, sssNUM        ; opcode SAX 
                ;STA sssNUM
                ;TAX
SAX does something different than you think obviously. It does NOT store the value to the X-register, but just applies an AND-operation to the Accumulator and X-register and stores that (ANDed) value.

Golden rule for using illegals in my opinion: only use them If it is not possible to do the task otherwise or the speed-increase is so significant that not using them would seriously affect the final product.
User avatar
MrSterlingBS
Vic 20 Enthusiast
Posts: 174
Joined: Tue Jan 31, 2023 2:56 am
Location: Germany,Braunschweig

Re: Conversion of VIC-SSS-MMX to CBM prg Studio

Post by MrSterlingBS »

Good morning,

I didn't know that many use a 65c02 these days in real hardware.
The optimization was just an attempt. I enjoy making very small improvements, even if they don't really affect performance.

Unfortunately I haven't owned a real VC-20(+16k) since 1987. I bought an AMIGA 500 then. :cry:

Is there a VIC emulator that can also simulate 65C02 or even a 65CE02?

Thank you for your answer and time.

BR Sven

PS: 6502 coding is fun!
Post Reply