CPCWiki forum

General Category => Programming => Topic started by: llopis on 22:04, 09 November 18

Title: Minimal library to draw text
Post by: llopis on 22:04, 09 November 18
I'm thinking of creating a diagnostic program that would be 100% in ROM. I'd love to find out a library/routine to draw text on screen. It can be super simple, hardwired fonts, no fancy colors or anything. I could do it myself, but I'm sure that must be done somewhere already. Can someone point me in the right direction?

Title: Re: Minimal library to draw text
Post by: LambdaMikel on 16:21, 10 November 18
If we do, are you going to acknowledge help that is offered to you, are you going to ignore the replies?
Title: Re: Minimal library to draw text
Post by: fgbrain on 22:21, 10 November 18
Its easy to make your own little text toutine.
Decide for which screen mode first.
Then grab the font you are using for texts
The shortest code will use mode 2 (1 byte per character line)
Title: Re: Minimal library to draw text
Post by: llopis on 08:49, 11 November 18
Quote from: LambdaMikel on 16:21, 10 November 18
If we do, are you going to acknowledge help that is offered to you, are you going to ignore the replies?
I'm not sure I follow. This would be for an open source project that I would put up on GitHub. I would acknowledge all significant contributions.


Sent from my iPhone using Tapatalk
Title: Re: Minimal library to draw text
Post by: llopis on 08:50, 11 November 18
Quote from: fgbrain on 22:21, 10 November 18
Its easy to make your own little text toutine.
Decide for which screen mode first.
Then grab the font you are using for texts
The shortest code will use mode 2 (1 byte per character line)
Right. I probably did that a bunch of times in the last. I was hoping not to have to write that myself again :-)


Sent from my iPhone using Tapatalk
Title: Re: Minimal library to draw text
Post by: LambdaMikel on 03:02, 13 November 18
Quote from: fgbrain on 22:21, 10 November 18
Then grab the font you are using for texts



Maybe just use the firmware routines?
Title: Re: Minimal library to draw text
Post by: llopis on 08:47, 13 November 18
Quote from: LambdaMikel on 03:02, 13 November 18
Maybe just use the firmware routines?
I could use the firmware routines to copy the font, but I want this routine to be completely independent of the system firmware (I realize it wasn't clear in my initial description). This is for a diagnostics program, so I want it to work even in the case of a faulty system ROM.
Title: Re: Minimal library to draw text
Post by: HAL6128 on 09:31, 14 November 18
just easily do (for MODE 2):

org &4000   ;just an example... could be somewhere else e.g. &00 in lower ROM ??

ld bc,&7f8e
out (c),c    ;enable mode 2 / disable upper and lower roms paging

ld d,&08 ;number of fine line
ld ix,pattern ;address of bit pattern
ld iy,&c030 ;address of screen ram
ld bc,&800 ;next line of screen address
.l1
ld a,(ix+&00)
ld (iy+&00),a
inc ix
add iy,bc
dec d
jp nz,l1
ret

.pattern
defb 16,16,40,40,68,124,130,130 ; just a simple "A"
Powered by SMFPacks Menu Editor Mod