Post Reply 
Speccy
01-16-2017, 08:14 PM
Post: #1
Speccy
With the news that the Sinclair ZX Spectrum may be recreated, I thought I would take a quick look at how it would fit on the HP Prime.

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
01-16-2017, 08:15 PM (This post was last modified: 01-16-2017 08:17 PM by StephenG1CMZ.)
Post: #2
RE: Speccy
Since

Code:


 LOCAL FONTSZ:=3;
 LOCAL BWIDTH:=8;
 //LOCAL XSCL:=1;
 //LOCAL YSCL:=1;
 LOCAL MLT:=8;
 LOCAL YLEN:=192; //OR 175 
 LOCAL ROWST:=IFTE(YLEN==192,24,21);

 DRAW_BORDER()
 BEGIN
  LOCAL COLY:=#0F0F0FFFh;
  //RECT_P(G4,0,0,255+2*BWIDTH,YLEN+2*BWIDTH,#0F0F0FFFh,#7F7F7FFFh);
  RECT_P(G4,0,0,255+2*BWIDTH,BWIDTH,COLY);
  BLIT_P(G0,G4); WAIT;
  RECT_P(G4,0,BWIDTH,BWIDTH,YLEN+BWIDTH,COLY);
  BLIT_P(G0,G4);WAIT;
  RECT_P(G4,255+BWIDTH,BWIDTH,255+2*BWIDTH,YLEN+BWIDTH,COLY);
  BLIT_P(G0,G4);WAIT;
  RECT_P(G4,0,YLEN+BWIDTH,255+2*BWIDTH,YLEN+2*BWIDTH,COLY);
  BLIT_P(G0,G4);
  WAIT;
 END;

 DRAW_PAPER()
 BEGIN
  RECT_P(G4,BWIDTH,BWIDTH,255,YLEN,#FF0101FFh,#07FF07FFh);
  BLIT_P(G0,G4);
  WAIT;
 END;
 
 LORES()
 BEGIN
  //SPECTRUM CHARS ARE 8*8 PIXELS
  //NOT SURE HOW IT MATCHES HP FONTS
  //MAY NEED TO AT EACH CHAR INO A BOX
  DIMGROB(G7,31,22);
  RECT_P(G7,0,0,255,YLEN,#010101h,#07FF07h);
  RECT(G7,8,8,9,9,#FF0000h,#1F1F1Fh);//WHIRE IS LORES PIXEL
  BLIT_P(G0,0,0,8,9,G7,8,8,9,29);
  TEXTOUT_P("THE GREEN SQ DEMOS LORES PIXELS",40,220);
  TEXTOUT_P(YLEN,33*MLT,MLT);
  
 END;

 EXPORT PRNCH ()
 BEGIN
  LOCAL II:=1;
  
   ///TEXTOUT OUGHT POSITION EACH CHAR INDEPENDENT OF FONT 
   TEXTOUT_P("01234567890123456789012345678901",G4,BWIDTH,MLT*II+BWIDTH,FONTSZ);
   FOR II FROM 0 TO ROWST-1 DO
    TEXTOUT_P(II,G4,MLT+BWIDTH,MLT*II+BWIDTH,FONTSZ);
   END; 
  TEXTOUT_P("Characters",G4,BWIDTH+MLT,MLT*ROWST+BWIDTH);
  //WAIT(1);
  TEXTOUT_P("SPECTRUM+:::32*24CH",G4,320/2,240/2,FONTSZ);
 END;
 EXPORT SINC()
 BEGIN
  DIMGROB_P(G4,320,240);
  RECT_P(G4);
  DRAW_BORDER();
  DRAW_PAPER();
 WAIT;
  RECT(G4,5,6,5,6);
  PRNCH();
  RECT_P(G0);
  BLIT_P(G0,G4);
  LORES();
  WAIT;
 END;


Borders

Code:


 LOCAL Y0:=0;
 LOCAL BWIDTH:=8; //FRAME OR BORDER
 //KNOWN BUG:A WIDTH OF 0 STILL GIVES A BORDER
 
 LOCAL XLEN:=255;//255; //255;
 LOCAL YLEN:=192; //192; //192; //OR 175 MAIN AREA
 //INNER RECT IS XLEN*YLEN
 LOCAL BORDERU,BORDERD,BORDERL,BORDERR,SCRN;
 LOCAL COLRB:=RGB(#7F,#7F,#7Fh);
 LOCAL COLRS:=RGB(0,#CDh,0);
 LOCAL FONTSZ:=1;

 INITS()
 BEGIN
  BORDERU:={0,Y0,             XLEN+2*BWIDTH-1,Y0+BWIDTH-1};
  BORDERD:={0,Y0+BWIDTH+YLEN, XLEN+2*BWIDTH-1,Y0+YLEN+2*BWIDTH-1};
  BORDERL:={0,Y0+BWIDTH,      BWIDTH-1,Y0+YLEN+BWIDTH-1};
  BORDERR:={XLEN+BWIDTH,Y0,   XLEN+2*BWIDTH-1,Y0+YLEN+2*BWIDTH-1};
  SCRN:=   {BWIDTH,Y0+BWIDTH, XLEN+BWIDTH-1,Y0+YLEN+BWIDTH-1,COLRS};
 END;

 DRAW_BORDER()
 BEGIN
  RECT_P(BORDERU(1),BORDERU(2),BORDERU(3),BORDERU(4),COLRB);
  RECT_P(BORDERR(1),BORDERR(2),BORDERR(3),BORDERR(4),COLRB);
  RECT_P(BORDERD(1),BORDERD(2),BORDERD(3),BORDERD(4),COLRB);
  RECT_P(BORDERL(1),BORDERL(2),BORDERL(3),BORDERL(4),COLRB);
  WAIT;
 END;

 DRAW_SCREEN()
 BEGIN
  RECT_P(SCRN(1),SCRN(2),SCRN(3),SCRN(4),COLRS);
 END;

 SHOW_TEXT()
 BEGIN
  LOCAL II;
  LOCAL LINES:=YLEN/8; //24 OR 22 AS YLEN
  FOR II FROM 3 TO 3 DO //DEMO WE CANNOT JUST PRINT A STRING
   TEXTOUT_P("777777",3*8+BWIDTH,II*8+BWIDTH+Y0,FONTSZ);
  END;
  FOR II FROM 0 TO 31 DO //COLUMNS
   TEXTOUT_P(7,II*8+BWIDTH,2*8+BWIDTH+Y0,FONTSZ);
  END;
  FOR II FROM 0 TO LINES-1 DO //ROWS
   TEXTOUT_P(II,2*8+BWIDTH,II*8+Y0+BWIDTH,FONTSZ);
  END;

 END;

 BIG_TEXT()
 BEGIN
  LOCAL II;
  WAIT;
  RECT_P();
  FOR II FROM 20 TO 20+8*24 DO
   TEXTOUT_P(II,3*8,20+II*8,2);
  END;
 END;

 
 EXPORT BORDER()
 BEGIN
  RECT_P();
  INITS();
  DRAW_BORDER();
  DRAW_SCREEN();
  SHOW_TEXT();
  //BIG_TEXT();
  DRAWMENU("");
  FREEZE; 
 END;

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)