Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #1156 > unrolled thread

Applesoft LoRes BMP Viewer

Started bycybernesto <cybernesto@gmail.com>
First post2014-02-20 13:11 -0800
Last post2015-02-28 19:05 -0600
Articles 5 — 4 participants

Back to article view | Back to comp.sys.apple2.programmer


Contents

  Applesoft LoRes BMP Viewer cybernesto <cybernesto@gmail.com> - 2014-02-20 13:11 -0800
    Re: Applesoft LoRes BMP Viewer laseractiveguy@gmail.com - 2015-02-27 17:21 -0800
    Re: Applesoft LoRes BMP Viewer laseractiveguy@gmail.com - 2015-02-27 17:22 -0800
    Re: Applesoft LoRes BMP Viewer David Schmidt <schmidtd@my-deja.com> - 2015-02-27 21:09 -0500
      Re: Applesoft LoRes BMP Viewer "Bill Buckels" <bbuckels@mts.net> - 2015-02-28 19:05 -0600

#1156 — Applesoft LoRes BMP Viewer

Fromcybernesto <cybernesto@gmail.com>
Date2014-02-20 13:11 -0800
SubjectApplesoft LoRes BMP Viewer
Message-ID<aa794e08-f716-4923-bfcf-8e0dbcf13461@googlegroups.com>
Looking at the flappy bird post from mmphosis made me think if it was possible to write a simple viewer for bmp files in Applesoft. After some hours fiddling with soft switches I managed to write a version able to display 16 color bmp files with following resolutions:
40 x 40 px (Lo res mixed mode)
40 x 48 px (Lo res full screen)
80 x 40 px (Double lo res mixed mode)
80 x 48 px (Double lo res full screen)

-----LORESBMP.BAS------
10 ST = 16384: GR 
15 OFFS = PEEK(ST +6) -4
20 XS = PEEK(ST +14) -1
25 YS = PEEK(ST +18) -1
30 ST = ST +OFFS
40 IF XS <40 THEN GOTO 50
45 POKE -16371,0: POKE -16383,0: POKE -16290,0
50 IF YS <40 THEN GOTO 60
55 POKE -16302,0
60 FOR Y = YS TO 0 STEP -1
70 FOR X = 0 TO XS STEP 2
80 CL = PEEK(ST +I)
90 C1 = INT(CL/16)
100 C2 = CL -C1 *16
110 COLOR= C1: PLOT X,Y
120 COLOR= C2: PLOT X +1,Y
130 I = I +1
140 NEXT X
150 NEXT Y
160 P = PEEK(49152)
170 IF P <127 THEN GOTO 160
180 POKE -16289,0: POKE -16372,0: POKE -16384,0
190 TEXT 
200 HOME
------------

BMP files can be transferred as binary files using AppleCommander or CiderPress to a disk image. Then it should be loaded with
] BLOAD PICTURE.BMP, A$4000
before running the viewer. 
The code takes into account the 4 bytes offset in DOS3.3 binary files. If you want to run it using ProDos you should remove '-4' from line 15 and add 4 to the offsets in lines 20 and 25.
To convert the palette of the original files into something the Apple II displays correctly you can use this palette file.

-----LORES.PAL------
JASC-PAL
0100
16  
0 0 0
227 30 96
96 78 189
255 68 253
0 163 96
156 156 156
20 207 253
208 195 255
96 114 3
255 106 60
156 156 156
255 160 208
20 245 60
208 221 141
114 255 208
255 255 255
------------

This can be used for example with the GIMP or Irfanview. The RGB values are based on the "exact" ntsc color calculations found in http://mrob.com/pub/xapple2/colors.html

Here are some samples 
http://flic.kr/s/aHsjSX7i3C
I always wondered why there wasn't an Apple II Version of the nyan cat. Maybe someone can help me porting the song to stitch or Electric Duet?

 Anyway, have fun with it. If you want to use a similar approach but with HGR or DHGR pictures, you might want to take a look at this project https://github.com/cybernesto/VBMP

[toc] | [next] | [standalone]


#1533

Fromlaseractiveguy@gmail.com
Date2015-02-27 17:21 -0800
Message-ID<2aaeb50f-2e54-4120-92fa-c30c933db76c@googlegroups.com>
In reply to#1156
You ever port that song... get ahold of me at the LaserActiveGuy channel... I'll hook you up with some great Apple II music!


On Thursday, February 20, 2014 at 4:11:04 PM UTC-5, cybernesto wrote:
> Looking at the flappy bird post from mmphosis made me think if it was possible to write a simple viewer for bmp files in Applesoft. After some hours fiddling with soft switches I managed to write a version able to display 16 color bmp files with following resolutions:
> 40 x 40 px (Lo res mixed mode)
> 40 x 48 px (Lo res full screen)
> 80 x 40 px (Double lo res mixed mode)
> 80 x 48 px (Double lo res full screen)
> 
> -----LORESBMP.BAS------
> 10 ST = 16384: GR 
> 15 OFFS = PEEK(ST +6) -4
> 20 XS = PEEK(ST +14) -1
> 25 YS = PEEK(ST +18) -1
> 30 ST = ST +OFFS
> 40 IF XS <40 THEN GOTO 50
> 45 POKE -16371,0: POKE -16383,0: POKE -16290,0
> 50 IF YS <40 THEN GOTO 60
> 55 POKE -16302,0
> 60 FOR Y = YS TO 0 STEP -1
> 70 FOR X = 0 TO XS STEP 2
> 80 CL = PEEK(ST +I)
> 90 C1 = INT(CL/16)
> 100 C2 = CL -C1 *16
> 110 COLOR= C1: PLOT X,Y
> 120 COLOR= C2: PLOT X +1,Y
> 130 I = I +1
> 140 NEXT X
> 150 NEXT Y
> 160 P = PEEK(49152)
> 170 IF P <127 THEN GOTO 160
> 180 POKE -16289,0: POKE -16372,0: POKE -16384,0
> 190 TEXT 
> 200 HOME
> ------------
> 
> BMP files can be transferred as binary files using AppleCommander or CiderPress to a disk image. Then it should be loaded with
> ] BLOAD PICTURE.BMP, A$4000
> before running the viewer. 
> The code takes into account the 4 bytes offset in DOS3.3 binary files. If you want to run it using ProDos you should remove '-4' from line 15 and add 4 to the offsets in lines 20 and 25.
> To convert the palette of the original files into something the Apple II displays correctly you can use this palette file.
> 
> -----LORES.PAL------
> JASC-PAL
> 0100
> 16  
> 0 0 0
> 227 30 96
> 96 78 189
> 255 68 253
> 0 163 96
> 156 156 156
> 20 207 253
> 208 195 255
> 96 114 3
> 255 106 60
> 156 156 156
> 255 160 208
> 20 245 60
> 208 221 141
> 114 255 208
> 255 255 255
> ------------
> 
> This can be used for example with the GIMP or Irfanview. The RGB values are based on the "exact" ntsc color calculations found in http://mrob.com/pub/xapple2/colors.html
> 
> Here are some samples 
> http://flic.kr/s/aHsjSX7i3C
> I always wondered why there wasn't an Apple II Version of the nyan cat. Maybe someone can help me porting the song to stitch or Electric Duet?
> 
>  Anyway, have fun with it. If you want to use a similar approach but with HGR or DHGR pictures, you might want to take a look at this project https://github.com/cybernesto/VBMP

[toc] | [prev] | [next] | [standalone]


#1534

Fromlaseractiveguy@gmail.com
Date2015-02-27 17:22 -0800
Message-ID<90ad9c16-139b-43d2-9cb2-1e4591401ea9@googlegroups.com>
In reply to#1156
You ever port that Music... get ahold of me at the LaserActiveGuy CHannel on Youtube... I'll hook you up with some great music!

Tom at Naspite Labs!


On Thursday, February 20, 2014 at 4:11:04 PM UTC-5, cybernesto wrote:
> Looking at the flappy bird post from mmphosis made me think if it was possible to write a simple viewer for bmp files in Applesoft. After some hours fiddling with soft switches I managed to write a version able to display 16 color bmp files with following resolutions:
> 40 x 40 px (Lo res mixed mode)
> 40 x 48 px (Lo res full screen)
> 80 x 40 px (Double lo res mixed mode)
> 80 x 48 px (Double lo res full screen)
> 
> -----LORESBMP.BAS------
> 10 ST = 16384: GR 
> 15 OFFS = PEEK(ST +6) -4
> 20 XS = PEEK(ST +14) -1
> 25 YS = PEEK(ST +18) -1
> 30 ST = ST +OFFS
> 40 IF XS <40 THEN GOTO 50
> 45 POKE -16371,0: POKE -16383,0: POKE -16290,0
> 50 IF YS <40 THEN GOTO 60
> 55 POKE -16302,0
> 60 FOR Y = YS TO 0 STEP -1
> 70 FOR X = 0 TO XS STEP 2
> 80 CL = PEEK(ST +I)
> 90 C1 = INT(CL/16)
> 100 C2 = CL -C1 *16
> 110 COLOR= C1: PLOT X,Y
> 120 COLOR= C2: PLOT X +1,Y
> 130 I = I +1
> 140 NEXT X
> 150 NEXT Y
> 160 P = PEEK(49152)
> 170 IF P <127 THEN GOTO 160
> 180 POKE -16289,0: POKE -16372,0: POKE -16384,0
> 190 TEXT 
> 200 HOME
> ------------
> 
> BMP files can be transferred as binary files using AppleCommander or CiderPress to a disk image. Then it should be loaded with
> ] BLOAD PICTURE.BMP, A$4000
> before running the viewer. 
> The code takes into account the 4 bytes offset in DOS3.3 binary files. If you want to run it using ProDos you should remove '-4' from line 15 and add 4 to the offsets in lines 20 and 25.
> To convert the palette of the original files into something the Apple II displays correctly you can use this palette file.
> 
> -----LORES.PAL------
> JASC-PAL
> 0100
> 16  
> 0 0 0
> 227 30 96
> 96 78 189
> 255 68 253
> 0 163 96
> 156 156 156
> 20 207 253
> 208 195 255
> 96 114 3
> 255 106 60
> 156 156 156
> 255 160 208
> 20 245 60
> 208 221 141
> 114 255 208
> 255 255 255
> ------------
> 
> This can be used for example with the GIMP or Irfanview. The RGB values are based on the "exact" ntsc color calculations found in http://mrob.com/pub/xapple2/colors.html
> 
> Here are some samples 
> http://flic.kr/s/aHsjSX7i3C
> I always wondered why there wasn't an Apple II Version of the nyan cat. Maybe someone can help me porting the song to stitch or Electric Duet?
> 
>  Anyway, have fun with it. If you want to use a similar approach but with HGR or DHGR pictures, you might want to take a look at this project https://github.com/cybernesto/VBMP

[toc] | [prev] | [next] | [standalone]


#1535

FromDavid Schmidt <schmidtd@my-deja.com>
Date2015-02-27 21:09 -0500
Message-ID<mcr80c$2q0$1@dont-email.me>
In reply to#1156
On 2/20/2014 4:11 PM, cybernesto wrote:
> [...]
> This can be used for example with the GIMP or Irfanview. The RGB values are based on the "exact" ntsc color calculations found in http://mrob.com/pub/xapple2/colors.html

Yes, but... what color will "THE DRESS" look like when fed through this? 
  (Note to those reading this after this week: there was once an 
internet controversy about the color of a dress... ah, never mind.)

[toc] | [prev] | [next] | [standalone]


#1540

From"Bill Buckels" <bbuckels@mts.net>
Date2015-02-28 19:05 -0600
Message-ID<mctok9$pvi$1@speranza.aioe.org>
In reply to#1535
"David Schmidt" <schmidtd@my-deja.com> wrote:
 >Yes, but... what color will "THE DRESS" look like when fed through this?

When I fed the dress through Bmp2DHR after doing the gamma correction, 
dithering the NTSC colors correctly using CCIR luminosity showed blue and 
black representation with no gold and no real white. The NTSC colors ranged 
from grey to purple.

When I first viewed this I saw gold on my LCD monitor in a dark room, and 
what seemed to be a mauvy white.

BTW Bmp2DHR supports better VBMP output than The GIMP. And that is an 
indisputable fact. The GIMP's dithering also comed nowhere close to 
Bmp2DHR's.

Bill
 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.apple2.programmer


csiph-web