diff --git a/images/apple/PLEIADES-2.20.po b/images/apple/PLEIADES-2.20.po index 75679ec..4f09208 100644 Binary files a/images/apple/PLEIADES-2.20.po and b/images/apple/PLEIADES-2.20.po differ diff --git a/images/apple/PLFORTH.po b/images/apple/PLFORTH.po index ecfb56d..5a3d8da 100644 Binary files a/images/apple/PLFORTH.po and b/images/apple/PLFORTH.po differ diff --git a/src/dhgr.tk/utils/dhgrrgb.pla b/src/dhgr.tk/utils/dhgrrgb.pla index c65e3fb..58c281e 100644 --- a/src/dhgr.tk/utils/dhgrrgb.pla +++ b/src/dhgr.tk/utils/dhgrrgb.pla @@ -2,6 +2,7 @@ include "inc/cmdsys.plh" include "inc/args.plh" include "inc/fileio.plh" include "inc/int32.plh" +include "inc/sincos.plh" include "dhgr.tk/inc/dhgrlib.plh" include "dhgr.tk/inc/dhgrutils.plh" @@ -55,19 +56,6 @@ const MATCH_ONE = 8 const MATCH_ZERO = 0 byte clrRot = $00,$02,$04,$06,$08,$0A,$0C,$0E byte = $01,$03,$05,$07,$09,$0B,$0D,$0F -var sin90[] // first 90 degrees of sin in fixed s.15 format -var = 0, 571, 1143, 1714, 2285, 2855, 3425, 3993 -var = 4560, 5126, 5690, 6252, 6812, 7371, 7927, 8480 -var = 9032, 9580, 10125, 10668, 11207, 11743, 12275, 12803 -var = 13327, 13848, 14364, 14876, 15383, 15886, 16383, 16876 -var = 17364, 17846, 18323, 18794, 19260, 19720, 20173, 20621 -var = 21062, 21497, 21926, 22347, 22762, 23170, 23571, 23964 -var = 24351, 24730, 25101, 25465, 25821, 26169, 26509, 26841 -var = 27165, 27481, 27788, 28087, 28377, 28659, 28932, 29196 -var = 29451, 29697, 29935, 30163, 30381, 30591, 30791, 30982 -var = 31164, 31336, 31498, 31651, 31794, 31928, 32051, 32165 -var = 32270, 32364, 32449, 32523, 32588, 32643, 32688, 32723 -var = 32748, 32763, 32767 word hgrScan[] // HGR scanline order for saving memory buffer as DHGR word = $0000,$0400,$0800,$0C00,$1000,$1400,$1800,$1C00 word = $0080,$0480,$0880,$0C80,$1080,$1480,$1880,$1C80 @@ -117,23 +105,6 @@ def max(a, b)#1 return a > b ?? a :: b end -def sin(deg)#1 - while deg > 360; deg = deg - 360; loop - while deg < 0; deg = deg + 360; loop - if deg <= 90 - return sin90[deg] - elsif deg <= 180 - return sin90[180 - deg] - elsif deg <= 270 - return -sin90[deg - 180] - fin - return -sin90[360 - deg] -end - -def cos(deg)#1 - return sin(deg + 90) -end - def dist(dr, dg, db)#2 // Linear distance res[t_i32] rr, gg @@ -180,16 +151,12 @@ def calcChroma(angle)#0 for i = 0 to 3 // Calculate RGB for this DHGR pixel - //r = max(0, (saturation + (cos(angle - phase[RED]) >> 7))) - //g = max(0, (saturation + (cos(angle - phase[GRN]) >> 7))) - //b = max(0, (saturation + (cos(angle - phase[BLU]) >> 7))) - r = saturation + (cos(angle - phase[RED]) >> 7) - g = saturation + (cos(angle - phase[GRN]) >> 7) - b = saturation + (cos(angle - phase[BLU]) >> 7) - // Make chroma add up to white - ntscChroma[i*3 + RED] = (r + 2) / 4 - ntscChroma[i*3 + GRN] = (g + 2) / 4 - ntscChroma[i*3 + BLU] = (b + 2) / 4 + r = saturation + mulcos(255, angle - phase[RED]) + g = saturation + mulcos(255, angle - phase[GRN]) + b = saturation + mulcos(255, angle - phase[BLU]) + ntscChroma[i*3 + RED] = min(255, max(0, (r + 2) / 4)) + ntscChroma[i*3 + GRN] = min(255, max(0, (g + 2) / 4)) + ntscChroma[i*3 + BLU] = min(255, max(0, (b + 2) / 4)) // Next NTSC chroma pixel angle = angle - 90 next @@ -484,7 +451,7 @@ def rgbImportExport(rgbfile, dhgrfile)#0 fin end -puts("DHGR RGB converter 1.1\n") +puts("DHGR RGB converter 1.2\n") arg = argNext(argFirst) if ^arg while ^(arg + 1) == '-' diff --git a/src/scripts/hgrlib.4th b/src/scripts/hgrlib.4th index 7b5a2db..499f0c3 100644 --- a/src/scripts/hgrlib.4th +++ b/src/scripts/hgrlib.4th @@ -24,6 +24,9 @@ LOOKUP HGRDRAWBUF PLASMA HGRDRAWBUF LOOKUP HGRCOLOR PLASMA HGRCOLOR LOOKUP SETLINESPANS PLASMA SETLINESPANS LOOKUP LINESPANS PLASMA HGRLINE -LOOKUP HGRHLIN LOOKUP HGRVLIN SETLINESPANS +: SETLINE [ LOOKUP HGRHLIN ] LITERAL [ LOOKUP HGRVLIN ] LITERAL SETLINESPANS ; +: SETXORLINE [ LOOKUP HGRXORHLIN ] LITERAL [ LOOKUP HGRXORVLIN ] LITERAL SETLINESPANS ; +: SETORLINE [ LOOKUP HGRORHLIN ] LITERAL [ LOOKUP HGRORVLIN ] LITERAL SETLINESPANS ; +SETLINE ' TEXT 0= ?ENDSRC : TEXT -1 HGRMODE DROP TEXT ;