New size coding contest "ZX Spectrum effect"
Forum rules
Be nice. No drama.
Be nice. No drama.
Re: New size coding contest "ZX Spectrum effect"
This is outside of the competition here. I just wanted to point out another idea.
I tried using the v6502 CPU. The actual program is 19 bytes without crashing.
To activate the v6502 CPU on the Gigatron, another 12 bytes are required for the official route.
The entire GT1 file is 40 bytes.
Maybe there is a shorter way to activate the v6502 CPU bypassing the system function, I don't know.
I tested it on real hardware.
The 6502 program:
.ORG $0060
LDA #$00
LOOP .BYTE $8d
addrL .BYTE $00
addrH .BYTE $08
EOR #$ff
INC addrL
BNE LOOP
EOR #$ff
INC addrH
BPL LOOP
STOP BNE STOP
0060: A9 00 8D 00 08 49 FF E6
0068: 63 D0 F7 49 FF E6 64 10
0070: F1 D0 FE
The gt1 startup file:
SYS_Run6502_v4_80 EQU 0x0B0C
sysFn EQU 0x22
vLR EQU 0x1A
LDWI SYS_Run6502_v4_80
STW sysFn
LDWI 0x0060 ; $6502_start_address
STW vLR
SYS 80
Everything together as gt1:
I tried using the v6502 CPU. The actual program is 19 bytes without crashing.
To activate the v6502 CPU on the Gigatron, another 12 bytes are required for the official route.
The entire GT1 file is 40 bytes.
Maybe there is a shorter way to activate the v6502 CPU bypassing the system function, I don't know.
I tested it on real hardware.
The 6502 program:
.ORG $0060
LDA #$00
LOOP .BYTE $8d
addrL .BYTE $00
addrH .BYTE $08
EOR #$ff
INC addrL
BNE LOOP
EOR #$ff
INC addrH
BPL LOOP
STOP BNE STOP
0060: A9 00 8D 00 08 49 FF E6
0068: 63 D0 F7 49 FF E6 64 10
0070: F1 D0 FE
The gt1 startup file:
SYS_Run6502_v4_80 EQU 0x0B0C
sysFn EQU 0x22
vLR EQU 0x1A
LDWI SYS_Run6502_v4_80
STW sysFn
LDWI 0x0060 ; $6502_start_address
STW vLR
SYS 80
Everything together as gt1:
Re: New size coding contest "ZX Spectrum effect"
\
All program is in User variables space
Code size 34 bytes, GT1 40 bytes.
Hans61:
Good idea too
Yoy gave me an intersting idea.
All program is in User variables space
Code: Select all
_CPU v5.vcpu
_VAR FC_Main #129
_RUN #131 ; FC_Main + 2
; -----------------------
_VAR ScrAdr #129
_VAR ScrAdrH #130
_ORG FC_Main
DC_W #$0800 ; set screen address before code
_LAB #1
LD ScrAdrH
XORW ScrAdr
ANDI #1
ADDI #63
POKE ScrAdr
INC ScrAdr
LD ScrAdr
XORI #160
BNE #1
ST ScrAdr
INC ScrAdrH
LD ScrAdrH
XORI #128
BNE #1
_LAB #2
BRA #2
Hans61:
Good idea too
- Attachments
-
- phib_chess.gt1
- (40 Bytes) Downloaded 280 times
Re: New size coding contest "ZX Spectrum effect"
Interesting.
@Phibrizzo : you can save 11 bytes with a single loop. Total: code = 23 bytes, gt1 = 29 bytes. (SMALLEST GT1)
@Hans61: you can also save a couple bytes as follows: Total: code = 10*vCPU + 19*v6502 = 29 bytes gt1 = 35 bytes
Both write the same pixels using the same loop and halt without crashing.
So vCPU wins, but only because the 6502 version needs 10 bytes to go into 6502 mode.
@Phibrizzo : you can save 11 bytes with a single loop. Total: code = 23 bytes, gt1 = 29 bytes. (SMALLEST GT1)
Code: Select all
* file: phib_chess_c.gt1
0081 00 08 |..|
0083 1a 82 [vCPU] LD $82 |..|
0085 fc 81 XORW $81 ||.|
0087 82 01 ANDI 1 |..|
0089 e3 3f ADDI $3f |c?|
008b f0 81 POKE $81 |p.|
008d 59 01 LDI 1 |Y.|
008f 99 81 ADDW $81 |..|
0091 2b 81 STW $81 |+.|
0093 35 53 81 BGE $0083 |5S.|
0096 90 94 BRA $0096 |..|
* 23 bytes
* start at $0083
Code: Select all
* file: chess6502b.gt1
0060 11 0c 0b [vCPU] LDWI $0b0c |...|
0063 2b 22 STW sysFn |+"|
0065 b4 e6 SYS 80 |4f|
0067 85 60 00 CALLI $0060 |.`.|
006a a9 00 [v6502] LDAIM 0 |).|
006c a8 TAY |(|
006d 99 00 08 STAAY $0800 |...|
0070 49 ff EORIM $ff |I.|
0072 c8 INY |H|
0073 d0 f8 BNE $006d |Px|
0075 49 ff EORIM $ff |I.|
0077 e6 6f INCZ $6f |fo|
0079 10 f2 BPL $006d |.r|
007b d0 fe BNE $007b |P~|
* 29 bytes
* start at $0067 #### THIS IS IMPORTANT
So vCPU wins, but only because the 6502 version needs 10 bytes to go into 6502 mode.
- Attachments
-
- phib_chess_c.gt1
- (29 Bytes) Downloaded 280 times
-
- chess6502b.gt1
- (35 Bytes) Downloaded 261 times
Re: New size coding contest "ZX Spectrum effect"
Found a devious way to save two bytes (execution starts in 0x8b)
Code = 21 bytes. GT1 = 27 bytes
Also found how to save two bytes from the 6502 version (now 33 bytes)
Code = 21 bytes. GT1 = 27 bytes
Code: Select all
* file: phib_chess_d.gt1
0081 ff 07
0083 fc 82 XORW $82 ||.|
0085 82 01 ANDI 1 |..|
0087 e3 3f ADDI $3f |c?|
0089 f0 81 POKE $81 |p.|
008b 59 01 LDI 1 |Y.|
008d 99 81 ADDW $81 |..|
008f 2b 81 STW $81 |+.|
0091 35 53 81 BGE $0083 |5S.|
0094 90 92 BRA $0094 |..|
* 21 bytes
* start at $008b
Code: Select all
* file: chess6502c.gt1
0060 11 0c 0b [vCPU] LDWI $0b0c |...|
0063 2b 22 STW sysFn |+"|
0065 b4 e6 SYS 80 |4f|
0067 85 60 00 CALLI $0060 |.`.|
006a a9 00 [v6502] LDAIM 0 |).|
006c a8 TAY |(|
006d 49 ff EORIM $ff |I.|
006f 99 00 08 STAAY $0800 |...|
0072 c8 INY |H|
0073 d0 f8 BNE $006d |Px|
0075 e6 71 INCZ $71 |fq|
0077 10 f6 BPL $006f |.v|
0079 d0 fe BNE $0079 |P~|
* 27 bytes
* start at $0067
Re: New size coding contest "ZX Spectrum effect"
This is my last word:
Code size: 32 bytes, GT1: 38 bytes.
Big thanks everyone for participating in the competition.
Maybe someone will suggest another?
Code: Select all
_CPU v5.vcpu
_VAR FC_Main #129
_RUN #141 ; FC_Main + 12
; -----------------------
_VAR ScrAdr #129
_VAR ScrAdrH #130
_ORG FC_Main
DC_W #$0800 ; load screen address before code
_LAB #1
XORW ScrAdrH
ANDI #1
ADDI #63
POKE ScrAdr
INC ScrAdr
; start from here <---
_LAB #2
LD ScrAdr
XORI #160
BNE #1
ST ScrAdr
INC ScrAdrH
LD ScrAdrH
XORI #128
BNE #2
_LAB #3
BRA #3
Big thanks everyone for participating in the competition.
Maybe someone will suggest another?
Re: New size coding contest "ZX Spectrum effect"
I am thinking of:Maybe someone will suggest another?
Code: Select all
"Write the nicest/most interesting/awesome demo/intro/graphic effect/game whatsoever"
Any language, any size (but smaller is beautiful), could run in 32k/64k/128k, can be run from sd card or rom ;-)
Should be run in romv5a, but if required, others are fine too.
Source, gt1 (if applicable) and picture/hardcopy should be attached to post.
If video is better - than link to any platform.
Competition should run until end of November 2024, so that in December, everyone could vote for her/his favorite.
Re: New size coding contest "ZX Spectrum effect"
Another nice contest could be:
"Size coding contest = create interesting/astonishing graphic effects with small piece of coding"
See: http://www.sizecoding.org/wiki/Main_Page
best, Peter
"Size coding contest = create interesting/astonishing graphic effects with small piece of coding"
See: http://www.sizecoding.org/wiki/Main_Page
best, Peter
Re: New size coding contest "ZX Spectrum effect"
On latest Revision 2024 Demo Party, i saw what people can do in 256 bytes (not kB or MB). This is not possible for regular people.
The same: 4 kilo bytes exe graphics competition.
I'll try to post links to Youtube later.
Edit:
https://www.youtube.com/watch?v=2p5HCTUNgfU
The same: 4 kilo bytes exe graphics competition.
I'll try to post links to Youtube later.
Edit:
https://www.youtube.com/watch?v=2p5HCTUNgfU
Re: New size coding contest "ZX Spectrum effect"
Hellopetersieg wrote: ↑23 Mar 2024, 16:06I am thinking of:Maybe someone will suggest another?What you think? If more than me would think, that could be fun, we should open a new thread for thisCode: Select all
"Write the nicest/most interesting/awesome demo/intro/graphic effect/game whatsoever" Any language, any size (but smaller is beautiful), could run in 32k/64k/128k, can be run from sd card or rom ;-) Should be run in romv5a, but if required, others are fine too. Source, gt1 (if applicable) and picture/hardcopy should be attached to post. If video is better - than link to any platform. Competition should run until end of November 2024, so that in December, everyone could vote for her/his favorite.
This is my little production for the competition: 32K+, ROM5/6 (tested).
Re: New size coding contest "ZX Spectrum effect"
Very nice!
best, Peter
best, Peter
- Attachments
-
- Bildschirmfoto 2024-07-13 um 20.20.55.png (64.78 KiB) Viewed 4090 times