Author Topic: Change the 8256 ASCII character on the Joyce.  (Read 4575 times)

0 Members and 1 Guest are viewing this topic.

Offline funkheld

  • 464 Plus
  • *****
  • Posts: 386
    • Awards
Change the 8256 ASCII character on the Joyce.
« on: 10:00, 30 August 20 »



I would like to change the ASCII character for the joyce 8256.


i don't want a graphics mode.
i just want to learn how to change the characters.
What I have seen so far did not convince me because it was very difficult for a beginner to understand.


an explanation for a beginner with a little program code, for example, to change an "A".


thank you.
greeting
like
0
No reactions

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 810
  • Country: gb
  • PCW since '85, more CP/M than Loco
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #1 on: 15:34, 30 August 20 »
I need to try to pin down just what you want.

I take it you're talking about changing the 'font', style or whatever, i.e. you change the normal 'A' into a different style of 'A'?

I'm sure this is possible, but rather complicated, as the data for the character matrix is held in banked RAM so you need to swap banks, then work out which bytes you need to change, make the chage and then swap bank back to normal.   A lot of work for 1 character.

If you want to swap the complete character set, then there is a little prog that will do the whole job for you, and a set of different fonts available.   I usually swap my system to a SansSerif font as I prefer this to the normal font, but there and a number to choose from.

There is another option if you want.   Long ago there was a system on the market called SuperFont or something like, this supplied a set of different fonts that could be loaded for both CP/M and Loco.   This worked by replacing the matrix code on the boot disk, i.e. before the working data is loaded and bank swapped.   The data once loaded became the new standard font.   I had three different versions of Loco set up, but I only bothered with a Script version of CP/M.  Oh, here, the address in the .EMS file will vary for the different versions, I did my changes with the old 1.4 CP/M system, but I'm sure the address could be worked out for other versions.  The Loco is prob is a different file (matrix.???).   Hmm? I'm just wondering if this variant was more to do with Printing than the screen?

There was no code involved for the latter, but the system that that swaps the data on the working machine does have code involved, I think this can be implemented as either <prog> <font> where the little prog is separate from the data or as <font-prog> where a prog for each font includes the font data.   This variant is specifically for the screen, I've not tried it regarding printing.

Geoff
like
0
No reactions

Offline funkheld

  • 464 Plus
  • *****
  • Posts: 386
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #2 on: 17:24, 30 August 20 »
hello, thanks for the info.

I can't find a doc for such things.
Nobody has really explained it yet.

greeting
like
0
No reactions

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 810
  • Country: gb
  • PCW since '85, more CP/M than Loco
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #3 on: 17:48, 30 August 20 »
Hello,

I've dug out some disks etc from my archives!

The font system I'm using is something called LetaFont.   This is the system that has data files, and stand-alone .COM files, and you can do it either way.

The main prog has a number of other functions in there, so it would be more difficult to work with.   The stand-alone .COM files have &H800 bytes of font data, and &H7F of 'code', and this seems to comprise a section at the top of the file which will be the 'loader', and a section at the end which seems to include some screen locating ESC codes (re the Status Bar ??) but these are clearly separate from the real code.

I guess that you need the assembly of the active code, I'll see if I can do something with that.  Prob less than 100 bytes.

I'd also wonder if you are thinking of swapping indiv chars ONLY?   And temporary ONLY??  You've not clarified this.  If so, them maybe you'd HAVE to work with the code to swap the data for JUST the letter needed, so you can swap it back?

I've also found the bits for the SuperType system, and YES, this is actually for Printing ONLY   I used it for Loco, but never actually used it for CP/M, although it will work there too.   However, I now remember that LONG ago I did find font data in a game, I think the same format of data as used in the LetaFont system, and I did work out how to insert that data into a CP/M .EMS file so that it changed the screen font to Script style - this worked fine but it was ONLY ever for Script.   The data was 'borrowed' from the 3D Clock Chess game!

I've found the download for LetaFont - attached?


Geoff
« Last Edit: 17:52, 30 August 20 by GeoffB17 »
like
0
No reactions

Offline funkheld

  • 464 Plus
  • *****
  • Posts: 386
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #4 on: 09:41, 31 August 20 »

Hello, thanks for the help.
it will try to use it with byte change in the com.


which 8 byte of the udg do you have to change so that you hit an ascii?


greeting
« Last Edit: 09:48, 31 August 20 by funkheld »
like
0
No reactions

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 810
  • Country: gb
  • PCW since '85, more CP/M than Loco
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #5 on: 15:24, 31 August 20 »
Hello,

I've done a disassembly of the code, which should be attached.   There's not much of it!

I'd assumed there was some bank switching involved, but seems there is not.  The code merely sets the parameters, and then does a LDIR to copy the char data plus to address in normal memory E290, then it jumps to that address and runs the code just moved there, which does a little something (???) and then does another LDIR to move JUST the 800H char data to B800H and that's it.

Seems a bit long winded, but I assume the LDIR is pretty efficient.   Bang and it's done!

I assume that B800H is the final destination of the matrix.   It would make sense if B800 was in a different bank and there was a bank swap between the two LDIR, maybe there is and I've not spotted it??

I'm not sure of the full details about the char layout, I think it's hidden in the manual.  I'll have a dig.   But the char data 800H bytes is 256 chars x 8 bytes each so you can calculate which 8 bytes are for each char easily enounh, and change the data for each char using similar code to that used here.

By the way, I think there's a prog within the LetaFont progs to edit/create new chars.

Geoff
like
0
No reactions

Offline funkheld

  • 464 Plus
  • *****
  • Posts: 386
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #6 on: 19:04, 31 August 20 »

Hello, thanks for your help.


greeting
« Last Edit: 19:54, 31 August 20 by funkheld »
like
0
No reactions

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 810
  • Country: gb
  • PCW since '85, more CP/M than Loco
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #7 on: 20:13, 31 August 20 »
Hello,

As I understand it, the .UDG file contains ONLY the raw char data, so 2048 bytes will be correct, 256 x 8.

The .COM file contains this data, as well as some actual program code at the start, as per the listing I sent you, but there is also some code/data at the end which as far as I can tell is a number of terminal codes connected with cursor positioning, etc.   It is not machine code.   I believe that the .COM prog makes some adjustment to the status bar at the bottom of the PCW screen, although this may well be disabled.  I've never seen it on my PCW, I'm sure I've got it disabled.  If you use DUMP on the file, you will see the extra lines at the bottom, which includes a number of ESC, Y, nn, nn, sequences.   

Geoff
like
0
No reactions

Offline funkheld

  • 464 Plus
  • *****
  • Posts: 386
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #8 on: 20:26, 31 August 20 »
Hi, Thank You.

i implemented your program for pasmo and it
works. see picture.
I have not set an ascii byte.
here 2048 ASCII characters are set:
  LD BC, # 0800

how can I actually put 2048 bytes behind the asm code?

greeting

Code: [Select]

  org  #0100
 
  LD HL,#10E         
  LD DE,#E290       
  LD BC,#0864         
  LDIR                 
  JP #E290             


  LD HL,(#0001)         
  LD DE,#0057       
  ADD HL,DE                 
  LD (#E29E),HL       
  LD BC,#E2A2         
  CALL #0000           
  JP (HL)                 
  NOP                   
  LD DE,#B800         
  LD HL,#E2AE         
  LD BC,#0800         
  LDIR                 
  RET       


  data...ascii 2048

« Last Edit: 20:28, 31 August 20 by funkheld »
like
0
No reactions

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 810
  • Country: gb
  • PCW since '85, more CP/M than Loco
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #9 on: 20:54, 31 August 20 »
I'm not sure what you're trying to do here?

I take it that you've changed some of the ASCII char set as a somewhat random pattern, applied the set and printed some of the chars?

If you want to add such chars into your ASM prog, then you could create the values and include them in your prog as DB, the assembly equivalent of DATA in BASIC.   There's DW for a word, and I think DS for a string, but the values are compiled into the prog just like literal data.  Check your Assembler instructions, it may be different.

You define each char as 8 lines each of 8 dots (bits), and give the value of each line.   So if the line has no bits set, it's 0 (zero) and if every bit is set then it's 255 (&HFF).   Just as per binary.   So 7,7,7,7,7,7,7,0 would be a char with the 3 right-most bits set on each line, with a small gap at the bottom.   One of the progs in the LetaFont package allows the creating of chars.

Geoff
like
0
No reactions

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 810
  • Country: gb
  • PCW since '85, more CP/M than Loco
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #10 on: 23:12, 31 August 20 »
Depending on what you're planning to do, you could write a BASIC prog to create the Assembly listing, or at least the part for the Character data.

One assembler I use has DEFB for the bytes, I'm sure something else has used DB - maybe the latter was for 8080 code?

Anyway, if you start with a .UDG file with all the data, you could read the bytes in from that, 8 at a time, and for each time output a test $ something like:

DEFB   #nn, #nn, #nn, #nn, #nn, #nn, #nn, #nn   ; Char ?, ASC nn   (for example

The #nn would be for hex numbers, maybe you can just put nnn if you're using decimal digits?   Again, check your assembler.

Then you've got an Assembly file for the whole setup, and you know exactly while bits of data you might want to change for your own character definitions.

Then, use an editor to merge the original assembler code listing with the generated data section.

Geoff
like
0
No reactions

Offline funkheld

  • 464 Plus
  • *****
  • Posts: 386
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #11 on: 23:43, 31 August 20 »
Hello, thanks for the help.

will now familiarize myself with asm.

greeting
« Last Edit: 00:21, 01 September 20 by funkheld »
like
0
No reactions

Offline funkheld

  • 464 Plus
  • *****
  • Posts: 386
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #12 on: 00:22, 01 September 20 »
a small step now works thanks to your help.

I changed "A" and "B".

greeting

Code: [Select]

  org  #0100
 
  LD HL,#10E         
  LD DE,#E290       
  LD BC,#0864         
  LDIR                 
  JP #E290             


  LD HL,(#0001)         
  LD DE,#0057       
  ADD HL,DE                 
  LD (#E29E),HL       
  LD BC,#E2A2         
  CALL #0000           
  JP (HL)                 
  NOP                   
  LD DE,#B800         
  LD HL,#E2AE         
  LD BC,#0800         
  LDIR                 
  RET   


db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0


db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0


db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0


db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0


db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0


db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0


db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 255,129,129,129,129,129,129,255
db 8,8,8,8,8,8,8,8
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0


db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0


db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0


db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0



like
0
No reactions

Offline funkheld

  • 464 Plus
  • *****
  • Posts: 386
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #13 on: 01:16, 01 September 20 »

how can you please make an asm of it without it becoming a com.
i would like to use the asm as inline.


would like to #b800 then assign the data individually.
for example #b800,  b801.


thank you.
greeting
like
0
No reactions

Offline JohnElliott

  • CPC664
  • ***
  • Posts: 131
  • Country: gb
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #14 on: 01:22, 01 September 20 »
I don't think the code in LETAFONT is particularly good, but then I would say that when I've written my own font editor for the PCW (SETFONT at https://www.seasip.info/Cpm/software/amstrad.html ), wouldn't I?

What the LETAFONT font loader does is copy the font and its loader to #E290 in common memory. It then jumps to that loader, which in turn runs another routine in the  'screen environment' memory arrangement to copy the font to the correct location.
Code: [Select]
           ORG  0100h                   
           LD   HL,STAGE2         ; Where the loader currently is         
           LD   DE,HICODE         ; Where the loader should be
           LD   BC,2048 + 100     ; 2048 bytes for font, 100 bytes for loader
           LDIR                   ; Copy to high memory
           JP   HICODE            ; And jump to it
STAGE2:
           .phase 0E290h       
HICODE:
           LD HL,(0001h)          ; Address of BIOS jumpblock       
           LD DE,0057h            ; Offset to USERF entry
           ADD HL,DE              ; Address of USERF routine
           LD (CALL_ADDR + 1),HL  ; Set up a call to it
           LD   BC,COPY_CODE      ; BC = address of code to run
CALL_ADDR: CALL 0000h             ; Call USERF
           DEFW 00E9h             ; with parameter SCR_RUN_ROUTINE
; BUG there should be a RET here

COPY_CODE: LD DE,0B800h           ; Copy 2k of font from 0E2AEh to 0B800h         
           LD HL,0E2AEh         
           LD BC,0800h         
           LDIR                 
           RET                     
My comments on this code:
  • It doesn't check that it's running on a PCW before doing a PCW-specific font load. What it ought to be doing is a USERF call to CD VERSION to see if it's running on a PCW, CPC or Spectrum +3, and loading the font to the appropriate place for each system. And if none of the above, terminate gracefully.
  • It doesn't check that the top of memory is above 0EB00h before using memory up to there as a transfer buffer.
  • It's missing a RET after the call to USERF, so having copied 2k of data to the font, it then copies 2k of data to 0B800h in the TPA. Fortunately this particular bug is harmless.
« Last Edit: 01:24, 01 September 20 by JohnElliott »
like
0
No reactions

Offline JohnElliott

  • CPC664
  • ***
  • Posts: 131
  • Country: gb
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #15 on: 01:43, 01 September 20 »
Here's my (completely untested) attempt at a code snippet that can be used to redefine individual characters from within a machine code program (rather than as a standalone COM file). It needs a transfer buffer above 0C000h -- the address is given by the BUFFER equate.

Call INIT to initialise the code, GETCHAR to retrieve a character bitmap (A = character 0-255, HL = address to get the bitmap to) and PUTCHAR to redefine a character (A=character, HL = address of new bitmap)

Code: [Select]
BUFFER EQU 0C000h

INIT:
      LD HL, (1)           ; Initialise the USERF call
      LD DE, 0057h
      ADD HL, DE
      LD (USERF+1), HL
      LD HL,MYCODE    ;Copy transfer code into the buffer
      LD DE, BUFFER
      LD BC, MYEND - MYCODE
      LDIR
      LD A,0FFh
      CALL USERF
      DEFW 00E3h ; Detect if PCW, CPC or Spectrum +3
      LD HL, 0B800h
      DEC A           ; Was A = 1? If so, it's a PCW
      JR Z, INIT_PCW
      LD HL, 08000h     
      INC A            ; Was A = 0? If so, it's a CPC
      JR Z, INIT_CPC     
      LD HL, 03000h
      CP 3             ; Was A = 3? If so, it's a Spectrum +3     
      JR Z, INIT_CPC     
      LD DE,UNKSYS     
      LD C,9     
      CALL 5
      RST 0           ; Abort if this is not a supported platform
;
UNKSYS: DEFB 'Not a PCW, CPC or Spectrum +3',13,10,'$'
;
INIT_CPC:
      LD (FONTBASE), HL
      LD HL, BUFFER+8
      LD (SCR_X), HL      ; On the CPC and +3, call the transfer function directly through USERF
      RET                 ; rather than using SCR RUN ROUTINE to run it in the screen environment

INIT_PCW:     
      LD (FONTBASE), HL
      RET
;
FONTBASE: DEFW 0
;
; Call with A = character to get, HL = destination address
;
GETCHAR:
      PUSH HL ; Save destination address
      LD L,A    ; Find address of character (char number * 8 + font base)
      LD H,0
      ADD HL,HL ; *2
      ADD HL,HL ; *4
      ADD HL,HL ; *8
      LD DE,(FONTBASE)
      ADD HL,DE
      LD (BUFFER+12), HL  ; Source address
      LD HL, BUFFER
      LD (BUFFER+9),HL   ; Destination address
      CALL DO_TRANSFER
      POP DE                    ; Restore address of result
      LD HL, BUFFER
      LD BC, 8
      LDIR    ; Copy 8 bytes to result     
      RET
;
; Call with A = character to redefine, HL = address of 8 bytes
;
PUTCHAR:
      LD DE, BUFFER
      LD BC, 8
      LDIR               ; Copy 8 bytes into the buffer
      LD L,A
      LD H,0
      ADD HL,HL ; *2
      ADD HL,HL ; *4
      ADD HL,HL ; *8
      LD DE,(FONTBASE)
      ADD HL,DE
      LD (BUFFER+9), HL   ; Destination address
      LD HL, BUFFER
      LD (BUFFER+12),HL  ; Source address
DO_TRANSFER:
      LD BC, BUFFER + 8   ; Transfer routine
      CALL USERF
SCR_X:
      DEFW 00E9h             ; SCR RUN ROUTINE
      RET

USERF: JP 0

MYCODE:
      DEFB 0,0,0,0,0,0,0,0  ; 8 bytes for current character
; BUFFER+8 = transfer routine
      LD DE, 0 ; BUFFER+9 = destination address
      LD HL, 0 ; BUFFER+12 = source address
      LD BC, 8 ; 8 bytes per character
      LDIR     
      RET
MYEND:


« Last Edit: 02:04, 01 September 20 by JohnElliott »
like
0
No reactions

Offline funkheld

  • 464 Plus
  • *****
  • Posts: 386
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #16 on: 09:54, 01 September 20 »
hello thanks , is wonderfull.


wat is this : .phase 0E290h   
pasmo doesn't know that.

greeting
like
0
No reactions

Offline JohnElliott

  • CPC664
  • ***
  • Posts: 131
  • Country: gb
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #17 on: 13:30, 01 September 20 »
.phase is a directive in the M80 assembler. In this case, .phase 0E290h means that the location of the code should not be changed, but labels after that point should be calculated as if the code is at 0E290h. This is different from ORG 0E290h, which means that the code should actually be placed at 0E290h, and can cause an assembler to generate a lot of packing bytes.

In my disassembly, you'll see:
Code: [Select]
STAGE2:
           .phase 0E290h       
HICODE:

Both STAGE2 and HICODE refer to the same piece of code, but STAGE2 is before the .phase and so evaluates to where it is now (010Eh), while HICODE is after the .phase and so evaluates to where it will end up (0E290h).
« Last Edit: 13:32, 01 September 20 by JohnElliott »
like
0
No reactions

Offline funkheld

  • 464 Plus
  • *****
  • Posts: 386
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #18 on: 13:47, 01 September 20 »
hello thanks for info.


greeting
like
0
No reactions

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 810
  • Country: gb
  • PCW since '85, more CP/M than Loco
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #19 on: 15:45, 01 September 20 »
Regarding John.s code, and especially the use of the USERF function, you might link to John's website and:

https://www.seasip.info/Cpm/xbios.html

The bit about SCR RUN ROUTINE 00E9h is a fair way down

I'd expect that this routine in fact does the Bank swap I was expecting should be there, then runs the routine passed, then sets the bank back to standard.   Seems that this option applies ONLY for the SCR processes, I was playing with some bank swap a while back regarding disk parameters and this needed explicit codes for bank swapping (using port numbers, if I remember correctly).

When you refer to using the asm instructions 'inline', which compiler/system were you thinking of using?
like
0
No reactions

Offline funkheld

  • 464 Plus
  • *****
  • Posts: 386
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #20 on: 20:42, 01 September 20 »
this is the mallard-80 basic with jetsam .


greeting
like
0
No reactions

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 810
  • Country: gb
  • PCW since '85, more CP/M than Loco
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #21 on: 21:25, 01 September 20 »
Oh?

As far as I'm aware, the Mallard BAIIC as supplied with the PCW does NOT allow 'inline' assembler, although there ARE BASICs that do.

The word 'inline' usually means that within the body of your BASIC prog you could have a section like:

asm:
  lines of assembly
end: or some other terminator

or every line of assembly would be prefixed by asm: or suchlike

Maybe you're referring to the type of setup that was in that Big Print/Screen Saver prog I sent you, where the BASIC prog reserves some upper RAM and loads machine code into that area, and this code is then 'CALLed' from the main BASIC?  This of course will need an extra level of prep to get the code correct for the eventul memory locations that it's going to run in.  Let the assember do more relative addressing?  Just extra complications to take care of.

Geoff
like
0
No reactions

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 810
  • Country: gb
  • PCW since '85, more CP/M than Loco
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #22 on: 21:14, 02 September 20 »
To follow up a reference in the above message, note that the BBC BASIC system does include facilities for 'inline assembly' and this can have significant benefits regarding performance.   BBC BASIC is available as a CP/M version (Z80) and I understand this still includes inline assembly.   Look for the 'Generic CP/M' version, rather than specific Amstrad CPC version which includes a lot of code specific to the CPC computers, and NOT for the PCW.

Note that if you want to do anything involving bank switching of memory, then you will need to protect BASIC and your code from problems by using the same link in the code we've been looking at here.   You'll need your main prog to create code in high RAM (&HC000 and above).   Your main prog will pass control to this link routine, which will THEN swap banks and perform it's function and then return any data (or whatever) via the same path before restoring the System RAM setup and returning control to the BASIC prog.   So depending on what you want to do, maybe not ALL your assembly code can be 'inline', and you may still need to use traditional methods (as well ?).

Geoff
like
0
No reactions

Offline JohnElliott

  • CPC664
  • ***
  • Posts: 131
  • Country: gb
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #23 on: 23:31, 02 September 20 »
Here's a Mallard BASIC program that redefines characters. It's based on the "ETHERNET" type-in in 8000 Plus issue 24, but I've extended it so it also works under Mallard BASIC on the CPC, +3 and PCW16.
Code: [Select]
1 ' Ethernet font loader by Tim Barnes
2 ' 8000 Plus issue 24, page 56
3 '
4 ' Converted to PCW/CPC/+3 portable version by John Elliott
6 '
10 MEMORY &HBFFE:FOR h=&HC000 TO &HC084:READ p$:POKE h,VAL("&H"+p$):NEXT h
20 FOR c=160 TO 187:POKE &HC099,c
30 FOR r=1 TO 8:READ binary(r):POKE &HC099+r,(binary(r)):NEXT r
40 cl=&HC000:CALL cl:NEXT c
50 DATA cd,79,c0,e3,00,fe,41,28,1e,b7,11,00,80,28,09,3d
51 DATA 28,0c,3d,3d,11,00,30,c0,cd,79,c0,65,c0,c9,01,62
52 DATA c0,cd,79,c0,e9,00,c9,11,39,c0,cd,79,c0,ec,00,d0
53 DATA 01,41,c0,cd,79,c0,ef,00,c9,43,52,54,50,4c,55,53
54 DATA 20,11,20,00,19,5e,23,56,af,67,3a,99,c0,6f,29,29
55 DATA 29,29,19,11,9a,c0,3e,08,eb,ed,a0,2b,ed,a0,3d,20
56 DATA f8,c9,11,00,b8,af,67,3a,99,c0,6f,29,29,29,19,11
57 DATA 9a,c0,eb,01,08,00,ed,b0,c9,e5,d5,2a,01,00,11,57
58 DATA 00,19,d1,e3,c9
70 DATA 0,32,0,2,2,0,32,0,0,8,0,128,128,0,8,0
80 DATA 10,41,169,170,186,42,10,0,240,252,206,254,126,188,240,0
90 DATA 85,131,135,131,131,131,85,0,84,130,130,130,130,130,84,0
100 DATA 85,143,156,129,135,159,85,0,84,226,114,226,130,242,84,0
110 DATA 85,143,156,129,156,143,85,0,84,226,114,226,114,226,84,0
120 DATA 3,15,58,251,58,15,3,170,129,225,185,191,185,225,129,170
130 DATA 31,195,192,243,192,195,31,85,224,12,12,60,12,12,224,85
140 DATA 249,225,7,86,7,225,249,85,62,14,192,212,192,14,62,85
150 DATA 0,31,57,63,29,7,0,170,1,241,153,249,113,193,1,170
160 DATA 229,249,206,195,200,192,255,85,84,68,84,148,228,56,252,85
170 DATA 255,213,213,215,220,240,255,85,252,118,198,6,6,6,254,85
180 DATA 253,253,253,0,169,169,169,85,84,84,84,0,252,252,252,85
190 DATA 255,213,215,214,215,213,255,85,254,86,214,214,214,86,254,85
200 DATA 153,36,90,169,149,90,36,90,90,36,90,149,169,90,36,153
Lines 20-40 show how it's used - POKE the character number and bitmap into memory at &HC099, and make a call to &HC000.
Lines 50-58 are the machine code routine itself.
Lines 70-200 are the new bitmaps for characters (in this case) 160-187.
Here's the source of the machine code, in case anyone's interested:
Code: [Select]
Z80-Assembler        Release 1.1                Page 1
Source file: charsp3.zsm
Title:       

LOC   OBJECT CODE   LINE   STMT SOURCE CODE
                       1      1 ;
                       2      2 ; A version of charset.zsm that is portable to the PCW, CPC, Spectrum +3 and
                       3      3 ; PCW16.
                       4      4 ;
                       5      5         org     0C000h
                       6      6
00e9                   7      7 SCR_RUN      equ    00E9h    ;Run a routine in the screen environment (PCW)
00ec                   8      8 FIND_FID  equ    00ECh    ;Find a loaded FID (PCW16)
00ef                   9      9 BANK2_RUN equ    00EFh    ;Run a routine in bank 2 (PCW16)
                      10     10 ;
                      11     11 ; Start by finding out what sort of computer this is.
                      12     12 ;
c000  cd 79 c0        13     13     call    userf
c003  e3 00           14     14     defw    00e3h
c005  fe 41           15     15     cp    'A'        ;'A' => Anne
c007  28 1e           16     16     jr    z,lanne
c009  b7              17     17     or    a        ;0 => CPC
c00a  11 00 80        18     18     ld    de,8000h    ;     with font at 8000h in bank 0
c00d  28 09           19     19     jr    z,lcpc
c00f  3d              20     20     dec    a        ;1 => PCW
c010  28 0c           21     21     jr    z,lpcw
c012  3d              22     22     dec    a       
c013  3d              23     23     dec    a        ;3 => Spectrum +3
c014  11 00 30        24     24     ld    de,3000h    ;     with font at 3000h in bank 0
c017  c0              25     25     ret    nz
c018  cd 79 c0        26     26 lcpc:    call    userf        ;For the +3 and CPC, run 'install' in bank 0
c01b  65 c0           27     27     defw    install
c01d  c9              28     28     ret
                      29     29 ;
c01e  01 62 c0        30     30 lpcw:    ld    bc,ipcw        ;For the PCW, run 'install' in screen
c021  cd 79 c0        31     31     call    userf        ;environment
c024  e9 00           32     32     defw    SCR_RUN
c026  c9              33     33     ret
                      34     34 ;
c027  11 39 c0        35     35 lanne:    ld    de,crtp        ;For the PCW16, locate the video driver
c02a  cd 79 c0        36     36     call    userf
c02d  ec 00           37     37     defw    FIND_FID
c02f  d0              38     38     ret    nc
c030  01 41 c0        39     39     ld    bc,ianne
c033  cd 79 c0        40     40     call    userf
c036  ef 00           41     41     defw    BANK2_RUN    ;Run 'ianne' in bank 2.
c038  c9              42     42     ret
                      43     43
c039  43 52 54 50     44     44 crtp:    defb    'CRTPLUS '
c03d  4c 55 53 20     44     45
                      45     46 ;
                      46     47 ; Font installer for PCW16. This is a bit more complicated than the other
                      47     48 ; three, because the PCW16 uses a 16-row font, and so the 8-row bitmap passed
                      48     49 ; in has to be doubled.
                      49     50 ;
c041  11 20 00        50     51 ianne:    ld    de,32    ;HL->CRTPLUS.FID
c044  19              51     52     add    hl,de
c045  5e              52     53     ld    e,(hl)
c046  23              53     54     inc    hl
c047  56              54     55     ld    d,(hl)        ;DE->font
c048  af              55     56     xor     a
c049  67              56     57         ld      h, a
c04a  3a 99 c0        57     58         ld      a, (char)     ; at C099h
c04d  6f              58     59         ld      l, a
c04e  29              59     60         add     hl, hl        ; *2
Z80-Assembler        Release 1.1                Page 2
Source file: charsp3.zsm
Title:       

LOC   OBJECT CODE   LINE   STMT SOURCE CODE
c04f  29              60     61         add     hl, hl        ; *4
c050  29              61     62         add     hl, hl        ; *8
c051  29              62     63         add     hl, hl        ; *16
c052  19              63     64         add     hl, de        ; HL -> target character
c053  11 9a c0        64     65         ld      de, bitmap    ; DE -> source character
c056  3e 08           65     66     ld    a, 8
c058  eb              66     67     ex    de,hl
c059  ed a0           67     68 ia1:    ldi            ;Copy byte to first row
c05b  2b              68     69     dec    hl        ;Step source back 1 byte
c05c  ed a0           69     70     ldi            ;Copy byte to second row
c05e  3d              70     71     dec    a
c05f  20 f8           71     72     jr    nz,ia1
c061  c9              72     73     ret
                      73     74 ;
                      74     75 ; Installer for the other three system types
                      75     76 ;
c062  11 00 b8        76     77 ipcw:    ld    de,0B800h    ;For the PCW: Font is at B800h
                      77     78 install:
c065  af              78     79     xor     a
c066  67              79     80         ld      h, a
c067  3a 99 c0        80     81         ld      a, (char)     ; at C099h
c06a  6f              81     82         ld      l, a
c06b  29              82     83         add     hl, hl        ; *2
c06c  29              83     84         add     hl, hl        ; *4
c06d  29              84     85         add     hl, hl        ; *8
c06e  19              85     86         add     hl, de        ; HL -> target character
c06f  11 9a c0        86     87         ld      de, bitmap    ; DE -> source character
c072  eb              87     88         ex      de, hl
c073  01 08 00        88     89         ld      bc, 8
c076  ed b0           89     90         ldir                  ; Copy bitmap into font
c078  c9              90     91         ret
                      91     92 ;
c079  e5              92     93 userf:    push    hl        ;Find the address of USERF (preserving all
c07a  d5              93     94     push    de        ;registers)
c07b  2a 01 00        94     95     ld    hl,(1)   
c07e  11 57 00        95     96     ld    de,57h
c081  19              96     97     add    hl,de
c082  d1              97     98     pop    de
c083  e3              98     99     ex    (sp),hl
c084  c9              99    100     ret            ;And jump to it
                     100    101
                     101    102     org    0C099h
c099  00             102    103 char:   defb    0
c09a                 103    104 bitmap: defs    8

« Last Edit: 23:34, 02 September 20 by JohnElliott »
like
0
No reactions

Offline funkheld

  • 464 Plus
  • *****
  • Posts: 386
    • Awards
Re: Change the 8256 ASCII character on the Joyce.
« Reply #24 on: 11:40, 03 September 20 »

Hello thanks for the information.


there is another mistake.
what kind of message is that.


greeting

like
0
No reactions