-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/c64 graphics mode support in native Silk.NET OpenGL renderer (#…
…98)
- Loading branch information
Showing
22 changed files
with
971 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
40 gosub 200: rem set up bitmap hires mode | ||
50 gosub 400: rem set default bitmap colors | ||
60 gosub 300: rem clear screen | ||
|
||
100 rem draw pixels in a "character" and set color | ||
105 bk=0: white=1: red=2: cyan=3: viol=4 | ||
106 green=5: blue=6: yellow=7 | ||
|
||
110 col=19: row=11: fg=white: bg=red: gosub 500 | ||
111 col=20: row=11: fg=yellow: bg=green: gosub 500 | ||
112 col=21: row=11: fg=viol: bg=blue: gosub 500 | ||
|
||
120 col=20: row=12: fg=white: bg=bk: gosub 500 | ||
|
||
130 col=19: row=13: fg=white: bg=red: gosub 500 | ||
131 col=20: row=13: fg=yellow: bg=green: gosub 500 | ||
132 col=21: row=13: fg=viol: bg=blue: gosub 500 | ||
|
||
190 goto 190: rem let it stay on screen | ||
|
||
200 rem setup bitmap hires mode | ||
220 rem set up hi-res screen | ||
222 base=2*4096 | ||
224 poke53272,peek(53272)or8:rem put bit map at 8192 | ||
226 poke53265,peek(53265)or32:rem enter bit map mode | ||
250 return | ||
|
||
300 rem clear screen subroutine | ||
305 a$="":s1=peek(51):s2=peek(52):poke 51,64:poke 52,63 | ||
310 fort=1to125:a$=a$+chr$(0):next | ||
320 poke51,s1:poke52,s2:return | ||
|
||
400 rem set bitmap colors | ||
410 rem set color map (which is same area as text screen in text mode) | ||
420 a$="" | ||
430 for i=1 to 37 | ||
440 a$=a$+"c" | ||
450 next | ||
460 print chr$(19); | ||
470 for i=1 to 27 | ||
480 printa$; | ||
490 next | ||
495 poke2023,peek(2022) : rem bottom right character | ||
497 return | ||
|
||
500 rem draw pixels in a "character" and set color | ||
501 rem input: col, row, fg, bg | ||
505 rem 1. draw pixels | ||
520 off = row * (40 * 8) + col * 8 | ||
530 ch = base + off | ||
540 poke ch + 0, 128 | ||
541 poke ch + 1, 64 | ||
542 poke ch + 2, 32 | ||
543 poke ch + 3, 16 | ||
544 poke ch + 4, 8 | ||
545 poke ch + 5, 4 | ||
546 poke ch + 6, 2 | ||
547 poke ch + 7, 1 | ||
|
||
600 rem 2. set color for same "character" | ||
620 off = row * 40 + col | ||
630 chcol = 1024 + off : rem assume screen ram has not moved from default | ||
640 poke chcol, (bg + (16 * fg)) | ||
650 return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
10 rem define 2^i function (perf trick) | ||
12 for i=0 to 7 | ||
14 bi(i)=2^i | ||
16 next: rem set up array of powers of 2 (bit value) | ||
|
||
20 rem set up hi-res screen | ||
22 base=2*4096 | ||
24 poke53272,peek(53272)or8:rem put bit map at 8192 | ||
26 poke53265,peek(53265)or32:rem enter bit map mode | ||
|
||
50 gosub 400: rem set bitmap colors | ||
60 gosub 300: rem clear screen | ||
|
||
70 rem draw sine wave | ||
80 fory=0to199step.5:rem from the top of the screen to the bottom | ||
90 x=int(160+40*sin(y/10)): rem sine wave shape | ||
100 by=base+40*(y and 248)+(y and 7)+(x and 504): rem find hi-res byte | ||
110 pokeby,peek(by)or(bi(not x and 7)) | ||
112 next y:rem poke in bit value | ||
120 goto 120: rem let it stay on screen | ||
|
||
300 rem clear screen subroutine | ||
305 a$="":s1=peek(51):s2=peek(52):poke 51,64:poke 52,63 | ||
310 fort=1to125:a$=a$+chr$(0):next | ||
320 poke51,s1:poke52,s2:return | ||
|
||
400 rem set bitmap colors | ||
410 rem set color map (which is same area as text screen in text mode) | ||
420 a$="" | ||
430 for i=1 to 37 | ||
440 a$=a$+"c" | ||
450 next | ||
460 print chr$(19); | ||
470 for i=1 to 27 | ||
480 printa$; | ||
490 next | ||
495 poke2023,peek(2022) : rem bottom right character | ||
497 return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
40 gosub 200: rem set up bitmap lowres multicolor mode | ||
50 gosub 400: rem set default bitmap colors | ||
60 gosub 300: rem clear screen | ||
|
||
|
||
100 rem draw pixels in a "character" and set color | ||
105 bk=0: white=1: red=2: cyan=3: viol=4 | ||
106 green=5: blue=6: yellow=7: dg=11 | ||
|
||
108 rem set common background color (pattern 00) | ||
109 poke 53281, dg | ||
|
||
110 col=19: row=11: c1=white: c2=red: c3=viol: gosub 500 | ||
111 col=20: row=11: c1=yellow: c2=green: c3=cyan: gosub 500 | ||
112 col=21: row=11: c1=viol: c2=blue: c3=yellow: gosub 500 | ||
|
||
120 col=20: row=12: c1=white: c2=bk: c3=green: gosub 500 | ||
|
||
130 col=19: row=13: c1=white: c2=red: c3=viol: gosub 500 | ||
131 col=20: row=13: c1=yellow: c2=green: c3=cyan: gosub 500 | ||
132 col=21: row=13: c1=viol: c2=blue: c3=yellow: gosub 500 | ||
|
||
190 goto 190: rem let it stay on screen | ||
|
||
200 rem setup bitmap lowres multicolor mode | ||
222 base=2*4096 | ||
224 poke53272,peek(53272)or8:rem put bit map at 8192 | ||
226 poke53265,peek(53265)or32:rem enter bit map mode | ||
228 poke53270,peek(53270)or16:rem set multicolor mode | ||
250 return | ||
|
||
300 rem clear screen subroutine | ||
305 a$="":s1=peek(51):s2=peek(52):poke 51,64:poke 52,63 | ||
310 fort=1to125:a$=a$+chr$(0):next | ||
320 poke51,s1:poke52,s2:return | ||
|
||
400 rem set bitmap colors | ||
410 rem set color map (which is same area as text screen in text mode) | ||
420 a$="" | ||
430 for i=1 to 37 | ||
440 a$=a$+"c" | ||
450 next | ||
460 print chr$(19); | ||
470 for i=1 to 27 | ||
480 printa$; | ||
490 next | ||
495 poke2023,peek(2022) : rem bottom right character | ||
497 return | ||
|
||
500 rem draw pixels in a "character" and set color | ||
501 rem input: col, row, c1, c2, c3 | ||
505 rem 1. draw pixels | ||
520 off = row * (40 * 8) + col * 8 | ||
530 ch = base + off | ||
|
||
540 poke ch + 0, 128 + 64: rem pixel pattern 11 | ||
541 poke ch + 1, 32 + 0 : rem pixel pattern 10 | ||
542 poke ch + 2, 0 + 4 : rem pixel pattern 01 | ||
543 poke ch + 3, 0 + 0 : rem pixel pattern 00 | ||
544 poke ch + 4, 0 + 0 : rem pixel pattern 00 | ||
545 poke ch + 5, 0 + 4 : rem pixel pattern 01 | ||
546 poke ch + 6, 32 + 0 : rem pixel pattern 10 | ||
547 poke ch + 7, 128 + 64: rem pixel pattern 11 | ||
|
||
600 rem 2. set color for same "character" (c1 pattern 01, c2 pattern 10) | ||
620 off = row * 40 + col | ||
630 chcol = 1024 + off : rem assume screen ram has not moved from default | ||
640 poke chcol, (c2 + (16 * c1)) | ||
|
||
660 rem 2. set color RAM for same "character" (c3 pattern 11) | ||
670 chcol = 55296 + off : rem color ram always at 55296 ($d800) | ||
680 poke chcol, c3 | ||
690 return |
Binary file added
BIN
+2.61 KB
samples/Basic/C64/Sprites/Build/SingleColorSpriteAndHiResGraphics.prg
Binary file not shown.
Binary file added
BIN
+4.17 KB
samples/Basic/C64/Sprites/Build/SingleColorSpriteAndLowResGraphics.prg
Binary file not shown.
123 changes: 123 additions & 0 deletions
123
samples/Basic/C64/Sprites/SingleColorSpriteAndHiResGraphics.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
40 gosub 200: rem set up bitmap hires mode | ||
50 gosub 400: rem set default bitmap colors | ||
60 gosub 300: rem clear screen | ||
|
||
100 rem draw pixels in a "character" and set color | ||
105 bk=0: white=1: red=2: cyan=3: viol=4 | ||
106 green=5: blue=6: yellow=7 | ||
|
||
110 col=19: row=11: fg=white: bg=red: gosub 500 | ||
111 col=20: row=11: fg=yellow: bg=green: gosub 500 | ||
112 col=21: row=11: fg=viol: bg=blue: gosub 500 | ||
|
||
120 col=20: row=12: fg=white: bg=bk: gosub 500 | ||
|
||
130 col=19: row=13: fg=white: bg=red: gosub 500 | ||
131 col=20: row=13: fg=yellow: bg=green: gosub 500 | ||
132 col=21: row=13: fg=viol: bg=blue: gosub 500 | ||
|
||
190 goto 730: rem jump to sprite loop | ||
|
||
200 rem setup bitmap hires mode | ||
220 rem set up hi-res screen | ||
222 base=2*4096 | ||
224 poke53272,peek(53272)or8:rem put bit map at 8192 | ||
226 poke53265,peek(53265)or32:rem enter bit map mode | ||
250 return | ||
|
||
300 rem clear screen subroutine | ||
305 a$="":s1=peek(51):s2=peek(52):poke 51,64:poke 52,63 | ||
310 fort=1to125:a$=a$+chr$(0):next | ||
320 poke51,s1:poke52,s2:return | ||
|
||
400 rem set bitmap colors | ||
410 rem set color map (which is same area as text screen in text mode) | ||
420 a$="" | ||
430 for i=1 to 37 | ||
440 a$=a$+"c" | ||
450 next | ||
460 print chr$(19); | ||
470 for i=1 to 27 | ||
480 printa$; | ||
490 next | ||
495 poke2023,peek(2022) : rem bottom right character | ||
497 return | ||
|
||
500 rem draw pixels in a "character" and set color | ||
501 rem input: col, row, fg, bg | ||
505 rem 1. draw pixels | ||
520 off = row * (40 * 8) + col * 8 | ||
530 ch = base + off | ||
540 poke ch + 0, 128 | ||
541 poke ch + 1, 64 | ||
542 poke ch + 2, 32 | ||
543 poke ch + 3, 16 | ||
544 poke ch + 4, 8 | ||
545 poke ch + 5, 4 | ||
546 poke ch + 6, 2 | ||
547 poke ch + 7, 1 | ||
|
||
600 rem 2. set color for same "character" | ||
620 off = row * 40 + col | ||
630 chcol = 1024 + off : rem assume screen ram has not moved from default | ||
640 poke chcol, (bg + (16 * fg)) | ||
650 return | ||
|
||
700 rem sprite loop | ||
|
||
730 for s=0 to 7 :rem set sprite ptrs to 12288 | ||
732 poke 2040+s,192 | ||
734 next | ||
|
||
742 poke 53293,2 :rem set sprite 6 color to red | ||
743 poke 53294,5 :rem set sprite 7 color to green | ||
|
||
745 poke 53271,128 :rem set sprite 7 double height | ||
747 poke 53277,128 :rem set sprite 7 double width | ||
|
||
748 poke 53275,128 :rem set sprite 7 appear in background | ||
|
||
750 for n=0 to 62 :rem load sprite data | ||
760 read q | ||
770 poke12288+n, q | ||
780 next | ||
|
||
783 poke 53269,128+64 :rem enable sprite 6 and 7 | ||
|
||
785 for z=1 to 200 :rem move sprites around | ||
|
||
791 poke 53260, ((z*2))+80 and 255 :rem set sprite 6 horizontal position | ||
791 poke 53261, ((z/2)+40) and 255 :rem set sprite 6 vertical position | ||
|
||
792 poke 53262, z :rem set sprite 7 horizontal position | ||
793 poke 53263, z :rem set sprite 7 vertical position | ||
|
||
798 next | ||
|
||
799 goto 785 | ||
|
||
800 data 255,255,255 | ||
810 data 0,126,0 | ||
820 data 1,129,128 | ||
830 data 2,0,64 | ||
840 data 12,0,48 | ||
850 data 8,0,16 | ||
860 data 19,197,200 | ||
870 data 16,0,8 | ||
880 data 160,195,5 | ||
890 data 160,195,5 | ||
900 data 160,24,5 | ||
910 data 160,24,5 | ||
920 data 160,24,5 | ||
930 data 16,126,8 | ||
940 data 17,60,136 | ||
950 data 8,129,16 | ||
960 data 8,126,16 | ||
970 data 4,0,32 | ||
980 data 2,0,64 | ||
990 data 1,129,128 | ||
999 data 255,255,255 | ||
|
||
1000 rem show sprite 6 and 7 at top/left | ||
1005 poke 53260, 24: poke 53261, 50 | ||
1010 poke 53262, 24: poke 53263, 50 |
Oops, something went wrong.