Paul / Dan - Example below, here writing to the real screen. Memory does not seem to be the issue though?...
Example code (here to the real screen) below:
Blows up at 9000 odd - but other versions (the original) blew up earlier.
c
c simplified program to recreate error when using a large number of different colours
c
winapp
options(intl)
include <windows.ins>
external quiter
common /closing/ ictrl1,ictrl2,iquit
dimension ix(4),iy(4)
c
c set up whole screen as RGB graphics area and colour black
c
ixscrn = clearwin_info@('screen_width')
iyscrn = clearwin_info@('screen_depth')
idscrn = 1
iwiw = winio@('%ww[naked]%`gr&',ixscrn,iyscrn,idscrn)
iwiw = winio@('%lw',ictrl1)
call use_rgb_colours@(1,1)
call draw_filled_rectangle@(0,0,ixscrn,iyscrn,0)
c
c set up button / parameter to close program
c
iquit = 0
ixbut = ixscrn*0.75
iybut2 = iyscrn * 0.83
iwiw = winio@('%sp&',ixbut,iybut2)
iwiw = winio@('%ww[naked,topmost]%^tt[Quit]&',quiter)
iwiw = winio@('%lw',ictrl2)
c
c
c
call select_graphics_object@(1)
call perform_graphics_update@
c
c draw a 250 x 200 grid of rectangles each in a new colour (indexed by k)
c
c (we draw them as polygons as the original program involved both
c rectangles and parallelograms)
c
k = 0
do 10 i = 1,250
ix(1) = (i-1)*6 + 1
ix(2) = ix(1) + 5
ix(3) = ix(2)
ix(4) = ix(1)
do 20 j = 1,200
k = k + 1
c
c convert integer k to standard RGB match by extracting
c the 3 8-bit codes for blue, green and red
c (note the error occurs in the same place if we use kol = k)
c
kolb = mod(k,256)
kolg = mod(intl(k/256),256)
kolr = int(k/256**2)
kol = rgb@(kolr,kolg,kolb)
c
c set up 4 corners of rectangular polygon and draw
c
iy(1) = (j-1)*5 + 1
iy(2) = iy(1)
iy(3) = iy(1) + 4
iy(4) = iy(3)
call draw_filled_polygon@(ix,iy,4L,kol)
c
c
c
20 continue
call perform_graphics_update@
10 continue
c
c hold image on screen until quit button is activated
c
100 if(iquit .eq. 1)then
ictrl1 = 0L
call window_update@(ictrl1)
else
call yield_program_control@(y_temporarily)
goto 100
endif
end
c
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c call back for quit
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
subroutine quiter
common /closing/ ictrl1,ictrl2,iquit
iquit = 1
ictrl2 = 0L
call window_update@(ictrl2)
return
end