Re: SCREEN1 = SYSVAR @ JSROM
Posted: Sun Jun 16, 2019 12:11 pm
I sometimes mix up the various Adventure Creation Tools for the QL - It actually was ACT, as you say.
Tobias
Tobias
RIP Sir Clive Sinclair 1940 - 2021
https://qlforum.co.uk/
Doesn't matter.tofro wrote:I sometimes mix up the various Adventure Creation Tools for the QL - It actually was ACT, as you say.
Tobias
Hi,The most simple way to actually implement character printing would be, IMHO, the following:
Restrict yourself to available print positions that are word-aligned in screen memory (i.e. 8 pixels in mode 4, 4 in mode 8).
Don't stick with the QL font format, but rather prepare the font like you would see it on-screen (i.e. pre-defined foreground and background color). You don't need to stick with QL character sizes as well - 8 x 8 is easily possible then.
Code: Select all
char link a4,#-$0c ;locals ch
ch_x equ -$02 ;d1
ch_y equ -$04 ;d2
ch_col equ -$06 ;d3
ch_ch equ -$08 ;d4
ch_wd equ -$0a ;word
ch_wm equ -$0c ;mask
lea dctl,a2 ;display ctrl copy
move.w d1,ch_x(a4) ;x, save locals
move.w d2,ch_y(a4) ;y
move.w d3,ch_col(a4) ;col
move.w d4,ch_ch(a4) ;ch
* lea dbg,a5 ;debug
* lea out,a1 ;debug
* move.l a5,(a1) ;debug
lea ch_fnt,a3 ;font raster
lsl.w #3,d4 ;d4=ch*8, index to fnt
lea 0(a3,d4.w),a3 ;a3=fnt[ch*8]
bsr acalc ;a0=address x,y
moveq #7,d7 ;8 scan lines, -1 for DBF
ch_ln move.b (a3)+,d0 ;scan line
clr.b d4 ; 076543210
clr.w d5 ;d3=......GR.
ch_tg btst #2,d3 ;test G bit
beq.s ch_tr
move.b d0,d4
ch_tr btst #1,d3 ;test R bit
beq.s ch_w
move.b d0,d5
ch_w lsl.w #8,d4 ;word
or.w d5,d4
* move.w d4,(a5)+ ;debug
ch_m clr.w d1 ;mask
move.b d0,d1
lsl.w #8,d0
or.w d1,d0
not.w d0
* move.w d0,(a5)+ ;debug
and.w d0,(a0) ;mask
or.w d4,(a0) ;word
lea 128(a0),a0 ;next line
dbf.w d7,ch_ln
ch_exit unlk a4
clr.l d0 ;No error code
rts ;Return to BASIC
; Font raster 8x8 pixels
ch_fnt ; 0 76543210
dc.b %11111111
dc.b %10000001
dc.b %10000001
dc.b %10000001
dc.b %10000001
dc.b %10000001
dc.b %10000001
dc.b %11111111
; 1 76543210
dc.b %11111111
dc.b %11000011
dc.b %10100101
dc.b %10011001
dc.b %10011001
dc.b %10100101
dc.b %11000011
dc.b %11111111
dbg dc.w 1 ;Debug buffer RESPRed
end
Code: Select all
PROCEDURE Fill*(tgc, rpc, x, y: INTEGER);
VAR c: INTEGER; (*tgc, rpc - target, replacement colour*)
BEGIN
(*c = pick colour at x,y coord *)
IF c = tgc THEN
Display.Dot(rpc, x, y, Display.replace); (*no clip*)
Fill(tgc, rpc, x, y-1); (*south*)
Fill(tgc, rpc, x, y+1); (*north*)
Fill(tgc, rpc, x-1, y); (*west*)
Fill(tgc, rpc, x+1, y); (*east*)
END
END Fill;
I could think of two arrays x1[y=0..255], x2[y=0..255], that I can get populated each time I call a routine to plot a pixel, where x1<=x2. First I draw shape outline, second step I walk through the arrays and for each x1,x2>0 I draw a line for a given y. I will call BLOCK for faster fill.This can work with a static size buffer of max. 256 (max # of scanlines) x 2 (number of points) x 2 (word x coordinates)
Yep. Pseudo code for a SD.FILL operation in QDOS looks like that:tcat wrote:Hi,
Am I Close?
Tomas
Code: Select all
Allocate a yRes * 2 * WORD array.
Initialize all the min and max X values in that array to an invalid x coordinate
Code: Select all
consult the pair of x coordinates for this y in the allocated array
if both coordinates are the invalid value (scanline has not been visited yet)
set both x coordinates to the one you're setting a pixel at
else if the x value is smaller than the current min x in the pair
replace min x in the pair with the current x
else if current x is larger than the current max x in the pair
replace max x in the pair with the current x
else if it's in-between (which is a sure sign you're handling a concave form)
do nothing
Code: Select all
run through the fill buffer,
for each y coordinate in that buffer
draw a horizontal line between min x and max x