QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: PMACKAY on August 27, 2018, 06:24:58 am

Title: redifine character set... something like on commodore64 or pcg on microbee
Post by: PMACKAY on August 27, 2018, 06:24:58 am
I can make my own character set using pset, but how can i change the defaults to print using _printstring (x,y),my character so i can keep the speed and work with the system how it is

on microbee you just poke into a memory address and type pcg (user defined) and use the normal print commands
same as for commodore64, ti, sega, bbc so how can i do this. 8x8, 8x16, 16x16.
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: bplus on August 27, 2018, 09:23:23 am
You could make your own "print" character sub.

Setup character draw subs that use pset or lines or circles or ... that fit into a character block 8x16.

sub printChar x, y, charID
select case charID
case c1& : drawC1 x, y
case c2& : drawC2 x, y
...
end select
end sub

sub drawC1 x, y
pset (? + x, ? + y), color?
line ( ? + x, ? + y)-step(?, ?), color?
circle(? + x, ? + y), r, color?
... a bunch of drawing instructions to make the character, all offset by the x, y place to put the top left corner of block.
end sub

with such you can control the colors more than you could with with a font character. You can even make the characters scalable.
This is like making your own tiles.
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: bplus on August 27, 2018, 09:34:03 am
You can also draw all the characters in advance into image handles and use _putimage where you want the character.
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: Petr on August 27, 2018, 10:38:03 am
Code: QB64: [Select]
  1. DIM SHARED chars(255) AS LONG
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3.  
  4. FOR Ascii = 0 TO 255
  5.     chars(Ascii) = _NEWIMAGE(10, 20, 32)
  6.     _DEST chars(Ascii)
  7.     _PRINTSTRING (0, 0), CHR$(Ascii), chars(Ascii)
  8. NEXT Ascii
  9.  
  10. Prnt "What you think? Something this?", 1, 10, 10, 20, 15
  11. Prnt "You have many options in QB64...", 2, 10, 500, 20, -15
  12.  
  13.  
  14.  
  15. SUB Prnt (text AS STRING, size AS INTEGER, StartX AS INTEGER, StartY AS INTEGER, Xspace AS INTEGER, Yspace AS INTEGER)
  16.     x = StartX
  17.     y = StartY
  18.     FOR f = 1 TO LEN(text)
  19.         ch = ASC(text, f)
  20.         x = x + Xspace
  21.         IF x MOD 5 = 0 THEN y = y + Yspace
  22.         _PUTIMAGE (x, y)-(x + (size * 16), y + (size * (8 * f))), chars(ch), 0
  23.         _DELAY .1
  24.     NEXT
  25.  
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: Petr on August 27, 2018, 10:53:47 am
Or see here https://www.qb64.org/forum/index.php?topic=311.msg2031#msg2031. You can use _LoadFont and _Font before save points to array, then this point you can view as quads or circles or 3D objects....
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: Cobalt on August 27, 2018, 10:57:17 am
I would use something like Davey W Taylor's Font Editor to make a new BIOS font and then load that. Galleon set me up a way to  get it to load in QB64. Just put the Charset.h in the QB64 directory.

DECLARE LIBRARY "charset"
 SUB Charset_8x8 (BYVAL o AS _OFFSET)
 SUB Charset_8x16 (BYVAL o AS _OFFSET)
END DECLARE
DIM SHARED c16(7, 15, 255) AS _UNSIGNED _BYTE, charload AS _UNSIGNED _BYTE

Code: QB64: [Select]
  1. CONST TRUE = -1, FALSE = NOT TRUE
  2. SUB loadreapingfont
  3.  OPEN "reaping.fnt" FOR BINARY AS #1
  4.  FOR c% = 0 TO 255
  5.   FOR y% = 0 TO 15
  6.    GET #1, , charload
  7.    FOR x% = 0 TO 7 'STEP -1
  8.     IF readbit(x%, charload) THEN c16(7 - x%, y%, c%) = 1 'any non-0 value should work
  9.    NEXT
  10.   NEXT
  11.  
  12. FUNCTION readbit (bit%, value%)
  13.  IF value% AND 2 ^ bit% THEN readbit = TRUE ELSE readbit = FALSE
  14.  

And I still use a POKE routine to display the text on screen 0 anyway. But that 'should' still work with normal PRINT or _PRINTSTRING in other screen modes as a 8x16 font. I think it will work with a 8x8 too but thats stuck on .NETs forum and until Galleon gets a backup copy to us to have here it maybe lost. Since I only use 8x16 I cut out the code for the 8x8 and don't have a copy.

Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: PMACKAY on August 27, 2018, 01:08:29 pm
I would use something like Davey W Taylor's Font Editor to make a new BIOS font and then load that. Galleon set me up a way to  get it to load in QB64. Just put the Charset.h in the QB64 directory.

DECLARE LIBRARY "charset"
 SUB Charset_8x8 (BYVAL o AS _OFFSET)
 SUB Charset_8x16 (BYVAL o AS _OFFSET)
END DECLARE
DIM SHARED c16(7, 15, 255) AS _UNSIGNED _BYTE, charload AS _UNSIGNED _BYTE

Code: QB64: [Select]
  1. CONST TRUE = -1, FALSE = NOT TRUE
  2. SUB loadreapingfont
  3.  OPEN "reaping.fnt" FOR BINARY AS #1
  4.  FOR c% = 0 TO 255
  5.   FOR y% = 0 TO 15
  6.    GET #1, , charload
  7.    FOR x% = 0 TO 7 'STEP -1
  8.     IF readbit(x%, charload) THEN c16(7 - x%, y%, c%) = 1 'any non-0 value should work
  9.    NEXT
  10.   NEXT
  11.  
  12. FUNCTION readbit (bit%, value%)
  13.  IF value% AND 2 ^ bit% THEN readbit = TRUE ELSE readbit = FALSE
  14.  

And I still use a POKE routine to display the text on screen 0 anyway. But that 'should' still work with normal PRINT or _PRINTSTRING in other screen modes as a 8x16 font. I think it will work with a 8x8 too but thats stuck on .NETs forum and until Galleon gets a backup copy to us to have here it maybe lost. Since I only use 8x16 I cut out the code for the 8x8 and don't have a copy.
thank you. this is what was looking for. as for 8 x 8 i can just double the length anyway :) cheers
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: PMACKAY on August 27, 2018, 01:12:37 pm
thank you guys for the kind help.... :) I will jump straight to it... when i wake up    3:12am here in australia. ZZZzzzZZzzZ   me
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: johnno56 on August 27, 2018, 04:28:36 pm
Melbourne. Where are you?

J
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: johnno56 on August 27, 2018, 04:58:03 pm
I used to have an Amstrad (8bit) back in the mid to late 80's and it, like the commodore and others, could redefine characters. I think they were re definable for two reasons. 1. If you had a LOT of patience - a new character set and 2. To create 8x8 tiles. I think the idea is, it is quicker to display a 64 pixel 'text' tile than it is to plot a 64 pixel tile. After all, a 4 mhz cpu, can only do SO much... lol

The method of 'mapping' the characters was using pencil and paper... Not as easy as THIS program. Great Job! Ah the memories...

J
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: bplus on August 28, 2018, 01:17:24 am
Ascii Character Editor sounded interesting, here is what I came up with today:
Code: QB64: [Select]
  1. _TITLE "Ascii Character Editor"
  2. 'started 2018-08-27 by bplus
  3. 'QB64 X 64 version 1.2 20180228/86  from git b301f92
  4.  
  5. '========================== Instructions: =================================
  6. '
  7. ' Arrow keys move the highlighter around, spacebar toggles tile on/off
  8. ' or just click with mouse to do the same.
  9.  
  10. ' Click buttons to either
  11. ' 1. Enter an ascii by number to edit.
  12. ' 2. Enter a character by pressing the key(s) from which the anscii number is taken.
  13. ' 3. Save a modified character.
  14. ' 4. Save all edits made to flie called "Character Set.DAT".
  15. ' Note: If want to work with more sets, just rename Character Set.DAT
  16. '       If that file isn't found, this app will start from scratch.
  17. '
  18. '==========================================================================
  19.  
  20. CONST CW = 8
  21. CONST CH = 16
  22. CONST SQ = 25
  23. CONST XOFF = 60
  24. CONST YOFF = 80
  25. CONST WW = 800
  26. CONST WH = 600
  27. SCREEN _NEWIMAGE(WW, WH, 32)
  28. _SCREENMOVE (1280 - WW) / 2 + 30, (760 - WH) / 2
  29. DIM SHARED AN%, CX, CY, BLK AS _UNSIGNED LONG, WHT AS _UNSIGNED LONG, FILE$
  30. DIM SHARED MAP(CW + 2, CH + 2) AS STRING * 1
  31. DIM SHARED CS(256) AS STRING * 128
  32. WHT = _RGB32(255, 255, 255)
  33. BLK = _RGB32(0, 0, 0)
  34.  
  35. '==============================   main
  36.  
  37. 'see if there is a file in the works to load else start from scratch
  38. IF _FILEEXISTS("Character Set.DAT") THEN
  39.     OPEN "Character Set.DAT" FOR INPUT AS #1
  40.     FOR i = 1 TO 256
  41.         INPUT #1, CS(i - 1)
  42.     NEXT
  43.     CLOSE #1
  44.     FILE$ = "Character Set.DAT"
  45.     FOR a = 0 TO 255
  46.         CLS
  47.         _PRINTSTRING (0, 0), CHR$(a)
  48.         b$ = ""
  49.         FOR y = 0 TO CH - 1
  50.             FOR x = 0 TO CW - 1
  51.                 IF POINT(x, y) <> BLK THEN b$ = b$ + "1" ELSE b$ = b$ + "0"
  52.             NEXT
  53.         NEXT
  54.         CS(a) = b$
  55.     NEXT
  56.     FILE$ = "Nothing saved yet."
  57.  
  58. FOR i = 1 TO 128
  59.     PRINT MID$(CS(1), i, 1);
  60.     IF i MOD CW = 0 THEN PRINT
  61. 'END
  62. 'sample B for starters
  63. AN% = 66
  64. load AN%
  65. CX = 1: CY = 1
  66.         mx = _MOUSEX
  67.         my = _MOUSEY
  68.         _DELAY .2
  69.         'ascii #  to edit
  70.         IF mx > 500 AND mx < 700 AND my > 50 AND my < 100 THEN
  71.             COLOR WHT, 0
  72.             LINE (500, 50)-(700, 100), BLK, BF
  73.             LOCATE 5, 67: INPUT "Ascii # "; a%
  74.             IF a% >= 0 AND a% <= 255 THEN AN% = a%: load AN%
  75.         END IF
  76.         'chr$  to edit
  77.         IF mx > 500 AND mx < 700 AND my > 110 AND my < 160 THEN
  78.             COLOR WHT, 0
  79.             LINE (500, 110)-(700, 160), BLK, BF
  80.             LOCATE 9, 67: INPUT "Enter Chr$ "; char$
  81.             a% = ASC(char$)
  82.             IF a% >= 0 AND a% <= 255 THEN AN% = a%: load AN%
  83.         END IF
  84.         'save character edit
  85.         IF mx > 500 AND mx < 700 AND my > 170 AND my < 220 THEN
  86.             b$ = ""
  87.             FOR y = 1 TO CH
  88.                 FOR x = 1 TO CW
  89.                     b$ = b$ + MAP(x, y)
  90.                 NEXT
  91.             NEXT
  92.             CS(AN%) = b$
  93.             COLOR WHT, 0
  94.             LINE (500, 170)-(700, 220), BLK, BF
  95.             LOCATE 13, 67: PRINT " Character recorded. "
  96.             _DISPLAY
  97.             _DELAY 1.5
  98.         END IF
  99.         'file character set
  100.         IF mx > 500 AND mx < 700 AND my > 230 AND my < 280 THEN
  101.             COLOR WHT, 0
  102.             LINE (500, 230)-(700, 280), BLK, BF
  103.             OPEN "Character Set.DAT" FOR OUTPUT AS #1
  104.             FOR a = 0 TO 255
  105.                 PRINT #1, CS(a)
  106.             NEXT
  107.             CLOSE #1
  108.             LOCATE 16, 65: PRINT "Filed Character Set.DAT"
  109.             _DISPLAY
  110.             _DELAY 1.5
  111.         END IF
  112.  
  113.         'mouse over edit box, toggle tiles and update cursor
  114.         tx = (mx - XOFF) \ SQ: ty = (my - YOFF) \ SQ
  115.         IF tx >= 1 AND tx <= CW AND ty >= 1 AND ty <= CH THEN
  116.             CX = tx: CY = ty
  117.             IF MAP(CX, CY) = "1" THEN MAP(CX, CY) = "0" ELSE MAP(CX, CY) = "1"
  118.         END IF
  119.     END IF
  120.     KH& = _KEYHIT
  121.     SELECT CASE KH&
  122.         CASE 32 'space bar
  123.             IF MAP(CX, CY) = "1" THEN MAP(CX, CY) = "0" ELSE MAP(CX, CY) = "1"
  124.         CASE 18432 'up
  125.             IF CY - 1 >= 1 THEN CY = CY - 1
  126.         CASE 20480 'down
  127.             IF CY + 1 <= CH THEN CY = CY + 1
  128.         CASE 19200 'left
  129.             IF CX - 1 >= 1 THEN CX = CX - 1
  130.         CASE 19712 'right
  131.             IF CX + 1 <= CW THEN CX = CX + 1
  132.     END SELECT
  133.  
  134.     IF _KEYDOWN(27) THEN END
  135.     update
  136.     _DISPLAY
  137.     _LIMIT 60
  138.  
  139. SUB load (asci)
  140.     FOR i = 1 TO 128
  141.         y = i \ CW + 1
  142.         x = i MOD CW: IF x = 0 THEN x = 8: y = y - 1
  143.         MAP(x, y) = MID$(CS(asci), i, 1)
  144.     NEXT
  145.  
  146. SUB update
  147.     COLOR WHT, _RGB32(100, 110, 100): CLS
  148.     drwBtn 500, 50, "Load map with Ascii"
  149.     drwBtn 500, 110, "Load map with Chr$"
  150.     drwBtn 500, 170, "Save Character Edit"
  151.     drwBtn 500, 230, "File Character Set"
  152.     COLOR _RGB32(250, 225, 255), _RGB32(100, 110, 100)
  153.     _PRINTSTRING (398, 400), "Current Ascii% =" + STR$(AN%) + " or CHR$(" + LTRIM$(STR$(AN%)) + ") = " + CHR$(AN%)
  154.     _PRINTSTRING (398, 440), "File: " + FILE$
  155.     LINE (XOFF - 1, YOFF - 1)-STEP((CW + 2) * SQ + 2, (CH + 2) * SQ + 2), _RGB32(255, 255, 0), B
  156.     LINE (XOFF + 1, YOFF + 1)-STEP((CW + 2) * SQ, (CH + 2) * SQ), BLK, B
  157.     LINE (XOFF, YOFF)-STEP((CW + 2) * SQ, (CH + 2) * SQ), _RGB32(255, 80, 0), BF
  158.     FOR y = 1 TO CH
  159.         FOR x = 1 TO CW
  160.             IF MAP(x, y) = "1" THEN c& = _RGB32(200, 200, 200) ELSE c& = _RGB32(0, 0, 0)
  161.             LINE ((x) * SQ + XOFF, (y) * SQ + YOFF)-STEP(SQ - 2, SQ - 2), c&, BF
  162.         NEXT
  163.     NEXT
  164.     ' let's see actual size!
  165.     COLOR _RGB32(255, 255, 0), _RGB32(100, 110, 100)
  166.     FOR i = 1 TO 4
  167.         drwChar XOFF + 16 * (i * 2), .5 * YOFF - (16 * i) / 2, AN%, i
  168.     NEXT
  169.     'highlight sqr
  170.     LINE (CX * SQ - 1 + XOFF, CY * SQ - 1 + YOFF)-STEP(SQ, SQ), WHT, B
  171.  
  172.  
  173. SUB drwBtn (x, y, s$)
  174.     th = 16: tw = 8 * LEN(s$): gray& = _RGB32(190, 190, 190)
  175.     LINE (x, y)-STEP(200, 50), _RGB32(0, 0, 0), BF
  176.     LINE (x, y)-STEP(197, 47), _RGB32(255, 255, 255), BF
  177.     LINE (x + 1, y + 1)-STEP(197, 47), gray&, BF
  178.     COLOR _RGB32(0, 0, 0), gray&
  179.     _PRINTSTRING (x + 100 - 4 * LEN(s$), y + 17), s$
  180.  
  181. SUB drwChar (x0, y0, ascn, size) 'what ever the present color is set at
  182.     FOR y = 0 TO CH - 1
  183.         FOR x = 0 TO CW - 1
  184.             i = i + 1
  185.             IF MID$(CS(ascn), i, 1) = "1" THEN LINE (x0 + x * size, y0 + y * size)-STEP(size - 1, size - 1), , BF
  186.         NEXT
  187.     NEXT
  188.  
 [ This attachment cannot be displayed inline in 'Print Page' view ]  

Then a quick little demo, showing table:
Code: QB64: [Select]
  1. _TITLE "Using custom characters"
  2. 'started 2018-08-27 by bplus
  3. 'QB64 X 64 version 1.2 20180228/86  from git b301f92
  4.  
  5.  
  6. CONST CW = 8
  7. CONST CH = 16
  8. CONST WW = 800
  9. CONST WH = 600
  10. CONST MAPW = 30
  11. CONST MAPH = 20
  12. CONST sq = 20
  13. SCREEN _NEWIMAGE(WW, WH, 32)
  14. _SCREENMOVE (1280 - WW) / 2 + 30, (760 - WH) / 2
  15. DIM SHARED AN%, CX, CY, BLK AS _UNSIGNED LONG, WHT AS _UNSIGNED LONG, FILE$
  16. DIM SHARED MAP(CW + 2, CH + 2) AS STRING * 1
  17. DIM SHARED CS(256) AS STRING * 128
  18. WHT = _RGB32(255, 255, 255)
  19. BLK = _RGB32(0, 0, 0)
  20.  
  21. '==============================   main
  22.  
  23. i = 0
  24. FOR y = 10 TO 500 STEP 40
  25.     FOR x = 10 TO 700 STEP 40
  26.         drwChar x, y, i, 2
  27.         i = i + 1
  28.         IF i > 155 THEN END
  29.     NEXT
  30.  
  31. SUB drwChar (x0, y0, ascn, size) 'what ever the present color is set at
  32.     'CS() DIM SHARED in starting setup
  33.     STATIC beenHere
  34.     IF beenHere = 0 THEN
  35.         'see if there is a file in the works to load else start from scratch
  36.         IF _FILEEXISTS("Character Set.DAT") THEN
  37.             OPEN "Character Set.DAT" FOR INPUT AS #1
  38.             FOR i = 1 TO 256
  39.                 INPUT #1, CS(i - 1)
  40.             NEXT
  41.             CLOSE #1
  42.             FILE$ = "Character Set.DAT"
  43.         ELSE
  44.             PRINT "Can't find Character Set.DAT file, goodbye!"
  45.             END
  46.         END IF
  47.         beenHere = -1
  48.     END IF
  49.     FOR y = 0 TO CH - 1
  50.         FOR x = 0 TO CW - 1
  51.             i = i + 1
  52.             IF MID$(CS(ascn), i, 1) = "1" THEN LINE (x0 + x * size, y0 + y * size)-STEP(size - 1, size - 1), , BF
  53.         NEXT
  54.     NEXT
  55.  
 [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: FellippeHeitor on August 28, 2018, 01:38:49 am
Now that was quick, bplus! And it does look good too!
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: johnno56 on August 28, 2018, 04:24:47 am
Just curious. Why are the characters 8x16? The old characters were 8x8...

J
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: bplus on August 28, 2018, 08:43:07 am
I was using QB64 default font. BTW, these characters can't be printed in normal PRINT statement, they are copied so all original characters remain intact and you make your own print statements by stringing the 8x16 tiles together or resize them and draw bigger!

If QB64 is not fast enough (it usually is), draw the characters to image handles as Petr has shown and make your own _printstring sub.
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: PMACKAY on August 28, 2018, 09:20:44 am
I used to have an Amstrad (8bit) back in the mid to late 80's and it, like the commodore and others, could redefine characters. I think they were re definable for two reasons. 1. If you had a LOT of patience - a new character set and 2. To create 8x8 tiles. I think the idea is, it is quicker to display a 64 pixel 'text' tile than it is to plot a 64 pixel tile. After all, a 4 mhz cpu, can only do SO much... lol

The method of 'mapping' the characters was using pencil and paper... Not as easy as THIS program. Great Job! Ah the memories...

J

this is what i want, not to make a new sub or thing, just straight out replacement of the character. redifine it.... the routine is faster to just print rather then slow the computer down using pset (x,y): i am able to rip character roms from original roms, but i just want to change a few not the whole set. its really to make my game more appealing... a monster as a monster. brick as bricks and so on. the ascii is great but now i want to be more creative.
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: PMACKAY on August 28, 2018, 09:55:24 am
Cobal. I seem to get an error message Segmentation fault (core dumped)I am not sure if I am doing something wrong.
   or I am missing something somewhere.
It is what I am after though...

DECLARE LIBRARY ".\Extensions\charset"
    SUB Charset_8x8 (BYVAL o AS _OFFSET)
    SUB Charset_8x16 (BYVAL o AS _OFFSET)
END DECLARE
DIM SHARED c16(7, 15, 255) AS _UNSIGNED _BYTE, charload AS _UNSIGNED _BYTE
CONST TRUE = -1, FALSE = NOT TRUE
 
 
 
loadreapingfont
Charset_8x16 (c16)
FOR i = 1 TO 255
    PRINT CHR$(i);
NEXT i
 
 
 
 
 
 
END
 
SUB loadreapingfont
    OPEN ".\FONT\char256.bin" FOR BINARY AS #1
    FOR c% = 0 TO 255
        FOR y% = 0 TO 15
            GET #1, , charload
            FOR x% = 0 TO 7 'STEP -1
                IF readbit(x%, charload) THEN c16(7 - x%, y%, c%) = 1 'any non-0 value should work
            NEXT
        NEXT
    NEXT
    CLOSE
END SUB
 
FUNCTION readbit (bit%, value%)
    IF value% AND 2 ^ bit% THEN readbit = TRUE ELSE readbit = FALSE
END FUNCTION
 there is an 8x16 font set here to downloadwas only using to test, but goes into error
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: Cobalt on August 28, 2018, 10:37:07 am
I've never seen that error(or any other than file not found) before.
,But it looks like this line:

"Charset_8x16 (c16) "

try changing it to:

Charset_8x16 _OFFSET(c16(0, 0, 0))

and you should be good to go.

Just FYI, you can change the name of the loader if you want, LOADREAPINGFONT the game I was working on was Reaping the Dungeon and thats how that got its name, its a bit long but worked for the project.
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: PMACKAY on August 28, 2018, 06:55:52 pm
Cobal. I seem to get an error message Segmentation fault (core dumped)I am not sure if I am doing something wrong.
   or I am missing something somewhere.
It is what I am after though...

DECLARE LIBRARY ".\Extensions\charset"
    SUB Charset_8x8 (BYVAL o AS _OFFSET)
    SUB Charset_8x16 (BYVAL o AS _OFFSET)
END DECLARE
DIM SHARED c16(7, 15, 255) AS _UNSIGNED _BYTE, charload AS _UNSIGNED _BYTE
CONST TRUE = -1, FALSE = NOT TRUE
 
 
 
loadreapingfont
Charset_8x16 (c16)
FOR i = 1 TO 255
    PRINT CHR$(i);
NEXT i
 
 
 
 
 
 
END
 
SUB loadreapingfont
    OPEN ".\FONT\char256.bin" FOR BINARY AS #1
    FOR c% = 0 TO 255
        FOR y% = 0 TO 15
            GET #1, , charload
            FOR x% = 0 TO 7 'STEP -1
                IF readbit(x%, charload) THEN c16(7 - x%, y%, c%) = 1 'any non-0 value should work
            NEXT
        NEXT
    NEXT
    CLOSE
END SUB
 
FUNCTION readbit (bit%, value%)
    IF value% AND 2 ^ bit% THEN readbit = TRUE ELSE readbit = FALSE
END FUNCTION
 there is an 8x16 font set here to downloadwas only using to test, but goes into error



Thank you cobalt... this works great. happy as a pig in mud :)
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: PMACKAY on August 28, 2018, 07:55:30 pm
Great stuff, I have ripped into the code and now works with 8x8 fonts.... Have also added.. Fonts were in reverse now fixed. this is just exactly what I wanted... Thank you heaps.


thank you every one for your input.


Now just to work out how to change the individual chars. (this is good). I understand it is in 8 bit string format, gets converted to binary then put in ram 1 bit at a time..
1+2+4+8+16+32+64+128 = 255 (easy old school stuff)

x^i,     funny i am stuffed for math but i can program :)
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: PMACKAY on August 28, 2018, 10:59:39 pm
Worked out... thank you
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: PMACKAY on August 29, 2018, 09:55:08 am
Here is a look at the routine working
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: Cobalt on August 29, 2018, 10:29:25 am
that is looking really cool.
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: PMACKAY on August 29, 2018, 10:57:10 am
I have managed to get the game to feel like it multi tasks. So simple to add stuff now. Just a timer and animate does the rest. Thanks for the awesome .h


I was scared to use pset for drawing as the way i update my screen in the game... there is lots of speed to be had. So lots more stuff can be done.
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: PMACKAY on August 29, 2018, 11:10:45 am
In cobalt routine if you do a for i% = 0 to 15 step 2
If readbit
If readbit again with +1
Next i%

That will double the 8x8 into the 8x16

Or if you leave the second one out it will make it look like scanlines on an old tv. Pretty cool.

Remove the 7-x% (just have x%) and it will reverse the character data... eg mirror it or flip
Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: PMACKAY on September 15, 2018, 08:54:40 pm
Just curious, is it possible to have charset.h make 16x16 and 32x32 chars. i know i can put characters together AB to give double width (16x16) but that uses two ASCII chars. can it work to give (a 16x16) rather than using two chars and losing a character.

AB
CD = 32 x 32 but I am wanting A = 32x32 (or at-least 16x16)

Pset works but I prefer AscII as much faster due to already programed in the system.

Wanting this as have a new idea for some different games.



Title: Re: redifine character set... something like on commodore64 or pcg on microbee
Post by: Cobalt on September 16, 2018, 12:09:41 am
not sure, that would be a question for Galleon, he is the one that set this up for me way back when. But he is unfortunatly no longer a part of the team. Steve or Fellippe might be able to figure it out, at least they would be your best bet.
You may have to make a BMP(or PNG) and load it. then you could place the characters with _PUTIMAGE and have that make the characters 16x16 or 32x32 in a graphics mode though.