Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in 
CSDb User Forums

Forums > CSDb Entries > Event id #2846 : The 256b sprite font compo
2019-07-22 00:58

Registered: Apr 2002
Posts: 333
Event id #2846 : The 256b sprite font compo

<Post edited by moderator on 22/7-2019 11:21>

* The object of the competition is to generate a sprite-font, in 256 bytes or less code.
* The code should be placed at $0900 and up, but no further than $09ff and must end with an RTS.
* The sprites should be placed at $2000-$2fff, so sprite number $80-$bf.
* 64 sprites are viewed, but it is up to the coder to decide how many he want to generate, but to be considered a font, at least the letters A-Z should be present and readable.
* For the other sprites, you can of course generate the appropriate numbers/punctuation characters, or spaceships or whatever, or not generate them at all and spend all your bytes on doing fancier A-Z, it's up to you to decide what will impress the voters most! :)
* Since the code to actually view the sprites would take quite some space, and the competition should not be about that optimizing the viewer code (or who can do the coolest looking viewer) I will provide the code that displays the 64 sprites on screen, it will occupy $0801-$08ff, and will perform a JSR to $0900 where your font generation code should be.
* The viewer has a number of tweakable parameters that are placed on $0810-$0814:
$0810 - $00=Sprites should be singlecolor. $ff=Sprites should be multicolor
$0811 - Bakground and border color.
$0812 - Sprite base color ($d027-$d02e will be set to this)
$0813 - Sprite multicolor1 ($d025 will be set to this)
$0814 - Sprite multicolor2 ($d026 will be set to this)
Simply change these bytes directly in the viewer code (if you compile it) or in the final binary if you use that, they should not be set from you generator code, as this is also not something that should steal your precious space.
* The generator code may *not* depend on A,X,Y holding specific startup values, or memory being initialized to something specific (you may for example not pull data from the viewer code and use etc.).
* The generator code may use ZP and stack (remember that your code is a subroutine that is being called though, so don't destroy the return address!)
* The generator may use memory up to $3fff
* Max three entries per coder
* The deadline for the compo is two months from now, 2019-09-22 at 23:59:59 CET
* Then follows a voting period of two weeks, a snapshot of the CSDb votes at 2019-10-06 at 23:59:59 CET will be the final result. (modedit: fixed date)
* No prizes except eternal glory.

Here's the viewer code for Kick Assembler usage, with a place to put your generator code at the end:
.pc =$0801 "Basic Starter"

.pc=$0810 "Constants"
.byte $00
.byte $06
.byte $0e
.byte $00
.byte $00

.pc = $0820 "Code"
lda multicol
sta $d01c
lda bgcol
sta $d020
sta $d021
lda sprmcol1
sta $d025
lda sprmcol2
sta $d026
lda sprcol
ldx #$07
sta $d027,x
bpl !loop-
ldx #$00
lda #$20
sta $0400,x
sta $0500,x
sta $0600,x
sta $0700,x
bne !loop-
lda #$ff
sta $d015
lda #$80
sta $d010
ldx #$07
ldy #$00
lda #$18+44
sta $d000,y
adc #29
bpl !loop-
jsr generatefont
lda #$35
sta $01
lda #$2f
sta ycoord
lda #$80
sta spridx
lda ycoord
cmp $d012
bne !wait-
adc #4
ldx #$07
ldy #$00
sta $d001,y
bpl !loop-
ldx #$00
ldy spridx
sta $07f8,x
cpx #8
bne !loop-
lda spridx
adc #8
sta spridx
lda ycoord
adc #25
sta ycoord
cmp #$2f+8*25
bne yloop
jmp mainloop

.byte 0
.byte 0

.pc=$0900 "Font generation code"

Yes, code is neither pretty nor optimal, but that's not the point here, the pretty code should be written by YOU! :D

If you prefer some other assembler, here's the prebuilt binary for the $0801-$08ff portion:

Here are some simple examples I've done to prove that it actually works:
Sprites using ROM font scaled to 3x3 pixel size. $0810 params set to : $00,$06,$0e,$00,$00

Exact same font but with multicolor params set (works this way as well!) $0810 params set to : $ff,$0b,$0c,$0f,$0f
... 5 posts hidden. Click here to view all posts....
2019-07-23 11:38

Registered: Apr 2002
Posts: 333
Quote: Can we still assume that interrupts are already disabled?

(as per comment #13 from Proposal - The sprite font compo!)

I just noticed that Geir's entry starts by disabling CIA interrupts, and was wondering if other ROM based entries can safely skip that step.

Yes, that was my intention, seems like I forgot to copy that text over to the official rules.
2019-07-23 19:46

Registered: May 2010
Posts: 110
So, the generator code should be less than or equal to 256b, but not the final .prg (or whatever format you use), since you're providing the viewer code?
2019-07-23 23:47

Registered: Apr 2002
Posts: 333
Quote: So, the generator code should be less than or equal to 256b, but not the final .prg (or whatever format you use), since you're providing the viewer code?

That is correct:
"The end result PRG should not be a 256 byte binary, instead it's the 257 bytes (for viewer code + load address) PLUS your code, so the ending .PRG file may be as big as 513 bytes." this was my summary of it posted in the discussion thread, unfortunately I forgot to copy it into the event description.
2019-07-24 00:27

Registered: May 2010
Posts: 110
2019-07-27 00:31

Registered: Feb 2004
Posts: 405
I assume its not safe to assume that $2000-$2ffff is filled with anything other than random bytes?
2019-07-27 01:02

Registered: Apr 2002
Posts: 333
Quote: I assume its not safe to assume that $2000-$2ffff is filled with anything other than random bytes?

That is correct, my "super-secret-verfier" does fill all areas with crap before running, so if your font doesn't look the same as the normal .PRG when run from that, the entry will be set as out-of-compo until fixed.
2019-08-07 10:25

Registered: Aug 2004
Posts: 949
Is it ok to trash locations $00 and $01?

I can shave two bytes off the entry I'm currently working on if that's legal, and the default viewer doesn't appear to care (I'm on 519b at the moment...)

(edit: I've managed to get down to 513b without changing location $00 after all, and I know that other entries already change $01, but it would be interesting to get a rules clarification anyway :) )
2019-08-07 20:33

Registered: Apr 2002
Posts: 333
Yeah, I see no reason why you can't trash $00 and $01, I assumed a lot of entries would be switching in the char ROM for example, so that was expected.
2019-08-10 17:08

Registered: Apr 2008
Posts: 310
I wanted to put data from page start but the jsr $0900 rule ruined the plan :( -> plan b
2019-08-10 20:02

Registered: Mar 2005
Posts: 325
@Mixer: True, "generatefont" address ought to be somewhat arbitrary within the page. Can you start at $9ff and read backwards? ;-)
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Users Online
Stainless Steel/F4CG
Båtsman/HmF, Latex
Rayne/Alpha Flight
Nojeee/Hokuto Force
Mr. Spock/T'Pau
Guests online: 53
Top Demos
1 Unboxed  (9.7)
2 Uncensored  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 The Shores of Reflec..  (9.6)
7 Lunatico  (9.6)
8 Wonderland XII  (9.5)
9 C=Bit 18  (9.5)
10 Old Men in Used Cars  (9.5)
Top onefile Demos
1 Smile to the Sky  (9.5)
2 Dawnfall V1.1  (9.5)
3 Crystal Gazer  (9.5)
4 Daah, Those Acid Pil..  (9.5)
5 Rewind  (9.5)
6 Instinct  (9.5)
7 Pandemoniac Part 5 o..  (9.5)
8 Innervasion  (9.4)
9 Bad Boy  (9.4)
10 Ghost in the Sydney  (9.4)
Top Groups
1 Fossil  (9.8)
2 PriorArt  (9.7)
3 Performers  (9.6)
4 Oxyron  (9.4)
5 Censor Design  (9.4)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.9)
3 Irata  (9.8)
4 hedning  (9.8)
5 Taper  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2019
Page generated in: 0.071 sec.