xpos! = -40 * 3
ypos! = 40 * 3
zpos! = 0
theight! = 40
twidth! = 40
OPEN "d:\czn\study\pic.asm" FOR OUTPUT AS #1

CLS
PRINT #1, " CNOP 0,8"
PRINT #1, "VTX_GRID:"

FOR i = 0 TO 5      'up/down

 FOR j = 0 TO 5     'side to side
 ypos! = ypos! + theight!

 PRINT #1, " DH ";
 PRINT #1, LTRIM$(STR$(xpos!)) + "," + LTRIM$(STR$(ypos!)) + "," + LTRIM$(STR$(zpos!));
 PRINT #1, ",0,";
 PRINT #1, "0,0"
 PRINT #1, " DB 0,0,127,255"
 xpos! = xpos! + twidth!

 PRINT #1, " DH ";
 PRINT #1, LTRIM$(STR$(xpos!)) + "," + LTRIM$(STR$(ypos!)) + "," + LTRIM$(STR$(zpos!));
 PRINT #1, ",0,";
 PRINT #1, "2560,0"
 PRINT #1, " DB 0,0,127,255"
 ypos! = ypos! - theight!

 PRINT #1, " DH ";
 PRINT #1, LTRIM$(STR$(xpos!)) + "," + LTRIM$(STR$(ypos!)) + "," + LTRIM$(STR$(zpos!));
 PRINT #1, ",0,";
 PRINT #1, "2560,2560"
 PRINT #1, " DB 0,0,127,255"
 xpos! = xpos! - twidth!

 PRINT #1, " DH ";
 PRINT #1, LTRIM$(STR$(xpos!)) + "," + LTRIM$(STR$(ypos!)) + "," + LTRIM$(STR$(zpos!));
 PRINT #1, ",0,";
 PRINT #1, "0,2560"
 PRINT #1, " DB 0,0,127,255"



 xpos! = xpos! + twidth!
 NEXT j

 ypos! = ypos! - theight!
 xpos! = xpos! - (6 * twidth!)

NEXT i


PRINT #1, " CNOP 0,8"
PRINT #1, "GRID_DL:"
offset! = 0
coord! = 0
toffset! = 0
FOR i = 0 TO 5

  FOR j = 0 TO 5

  PRINT #1, " gsLoadTextureBlock  texture+" + LTRIM$(STR$(toffset!)) + ",40,40"

  PRINT #1, " gsVertex VTX_GRID+" + LTRIM$(STR$(offset!)) + ",4,0"
  PRINT #1, " gsTRI1 0,1,2,0"
  PRINT #1, " gsTRI1 0,2,3,0"





  offset! = offset! + (4 * 16)
  toffset = toffset! + (40 * 40 * 2)

  NEXT j
NEXT i

   PRINT #1, " gsEndDisplaylist"

   CLOSE #1

