Post Reply 
HP48 Character Bitmaps
11-08-2018, 03:06 PM
Post: #8
RE: HP48 Character Bitmaps
One possibility would be to convert characters into a GROB, then "explode" each column of that GROB into a character string representing the bit state of that column.

Yes, it's a bit tedious, but something like the following could work (assumes a 48gx platform):
Code:
@ character to rows
c2r
\<<
  @ convert char to GROB using 6x8 font
  2 \->GROB

  @ save char GROB
  \-> cgrob
  \<<
    @ for each column
    0 5 FOR col

      @ build a transposed row (initially empty)
      ""

      @ retrieve the current column
      cgrob
      col R\->B #7d OVER #0
      2 \->LIST
      3 ROLLD 2 \->LIST
      SUB

      @ store the current column in PICT
      PICT STO

      @ build the char column as a row of "  " or "**"
      7 0 FOR row
        #0 row R\->B
        2 \->LIST
        PIX? "**" "  " IFTE
        +

      -1 STEP
    NEXT
  \>>
\>>

The above will obliterate whatever is currently in PICT, so you'd probably want to save the current PICT contents and restore after execution.

"c2r" converts a single character to a series of strings which are left on the stack, presumably suitable for printing or whatever is appropriate in your case.

Here's an example of a program which uses c2r to leave a series of strings on the stack
Code:
chrs
\<<
  @ save the current PICT
  PICT RCL

  @ the string for conversion
  "Banners are fun!"
  \-> svpic banner
  \<<

    @ for each character
    1 banner SIZE FOR cnum

      @ obtain the character
      banner cnum DUP SUB

      @ convert it to 6 rows
      c2r

    NEXT

    @ restore the saved PICT
    svpic PICT STO
  \>>
\>>

..and finally, the output (shown as if each resulting string were printed in sequence):
Code:
  **************
  **    **    **
  **    **    **
  **    **    **
    ****  ****  
                
    **          
  **  **  **    
  **  **  **    
  **  **  **    
  ********      
                
  **********    
          **    
          **    
          **    
  ********      
                
  **********    
          **    
          **    
          **    
  ********      
                
    ******      
  **  **  **    
  **  **  **    
  **  **  **    
      ****      
                
  **********    
        **      
          **    
          **    
          **    
                
  **    **      
  **  **  **    
  **  **  **    
  **  **  **    
    **    **    
                
                
                
                
                
                
                
    **          
  **  **  **    
  **  **  **    
  **  **  **    
  ********      
                
  **********    
        **      
          **    
          **    
          **    
                
    ******      
  **  **  **    
  **  **  **    
  **  **  **    
      ****      
                
                
                
                
                
                
                
        **      
  ************  
        **    **
            **  
                
                
    ********    
  **            
  **            
  **            
  **********    
                
  **********    
          **    
          **    
          **    
  ********      
                
                
                
  **  **********
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP48 Character Bitmaps - TomC - 11-07-2018, 04:23 AM
RE: HP48 Character Bitmaps - Chris Dreher - 11-07-2018, 06:19 AM
RE: HP48 Character Bitmaps - TomC - 11-07-2018, 08:56 PM
RE: HP48 Character Bitmaps - EugeneNine - 11-07-2018, 10:50 PM
RE: HP48 Character Bitmaps - acoto - 11-08-2018, 01:12 AM
RE: HP48 Character Bitmaps - DavidM - 11-08-2018 03:06 PM
RE: HP48 Character Bitmaps - TomC - 11-08-2018, 06:41 PM
RE: HP48 Character Bitmaps - DavidM - 11-08-2018, 06:51 PM
RE: HP48 Character Bitmaps - TomC - 11-09-2018, 06:55 AM



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