CDBdefs
rem Channel Definition Block functions
:
rem Negative offsets PE or SMSQ/E only
def fn sd_xhits(ch): ret CHAN_W%(#ch; -24): enddef: rem -$18 x hit size
def fn sd_yhits(ch): ret CHAN_W%(#ch; -22): enddef: rem -$16 y hit size
def fn sd_xhito(ch): ret CHAN_W%(#ch; -20): enddef: rem -$14 x hit origin (screen coordinates)
def fn sd_yhito(ch): ret CHAN_W%(#ch; -18): enddef: rem -$12 y hit origin (screen coordinates)
def fn sd_xouts(ch): ret CHAN_W%(#ch; -16): enddef: rem -$10 x outline size
def fn sd_youts(ch): ret CHAN_W%(#ch; -14): enddef: rem -$0e y outline size
def fn sd_xouto(ch): ret CHAN_W%(#ch; -12): enddef: rem -$0c x outline origin (screen coordinates)
def fn sd_youto(ch): ret CHAN_W%(#ch; -10): enddef: rem -$0a y outline origin (screen coordinates)
def fn sd_prwlb(ch): ret CHAN_L (#ch; -8): enddef: rem -$08 primary link list bottom up (primary window)
def fn sd_pprwn(ch): ret CHAN_L (#ch; -8): enddef: rem -$08 pointer to primary window (secondary window)
def fn sd_prwlt(ch): ret CHAN_L (#ch; -4): enddef: rem -$04 primary link list top down (primary window)
def fn sd_sewll(ch): ret CHAN_L (#ch; 0): enddef: rem $00 secondary window link list pointer
def fn sd_wsave(ch): ret CHAN_L (#ch; 4): enddef: rem $04 window save area
def fn sd_wssiz(ch): ret CHAN_L (#ch; 8): enddef: rem $08 size of window save area
def fn sd_wwdef(ch): ret CHAN_L (#ch; 12): enddef: rem $0c pointer to window working definition
def fn sd_wlstt(ch): ret CHAN_B%(#ch; 16): enddef: rem $10 window lock status
def fn sd_prwin(ch): ret CHAN_B%(#ch; 17): enddef: rem $11 bit 7 set if primary window
def fn sd_behav(ch): ret CHAN_B%(#ch; 17): enddef: rem $11 bit 0 set if well behaved
def fn sd_wmode(ch): ret CHAN_B%(#ch; 18): enddef: rem $12 window's own display mode
def fn sd_mysav(ch): ret CHAN_B%(#ch; 19): enddef: rem $13 true if my save area
def fn sd_wmove(ch): ret CHAN_B%(#ch; 20): enddef: rem $14 window move/query ($80 query, $81 move, $81 resize)
def fn sd_pick (ch): ret CHAN_B%(#ch; 21): enddef: rem $15 pick status
def fn sd_bcolw(ch): ret CHAN_W%(#ch; 22): enddef: rem $16 border colour
:
rem Non-PE Qdos from here
def fn sd_xmin (ch): ret CHAN_W%(#ch; 24): enddef: rem $18 window left pixel, exclusive of border
def fn sd_ymin (ch): ret CHAN_W%(#ch; 26): enddef: rem $1a ditto top pixel
def fn sd_xsize(ch): ret CHAN_W%(#ch; 28): enddef: rem $1c window width, exclusive of border
def fn sd_ysize(ch): ret CHAN_W%(#ch; 30): enddef: rem $1e ditto height
def fn sd_borwd(ch): ret CHAN_W%(#ch; 32): enddef: rem $20 border height, border width is double this
def fn sd_xpos (ch): ret CHAN_W%(#ch; 34): enddef: rem $22 cursor position relative to left pixel above
def fn sd_ypos (ch): ret CHAN_W%(#ch; 36): enddef: rem $24 ditto top pixel
def fn sd_xinc (ch): ret CHAN_W%(#ch; 38): enddef: rem $26 cursor pixel width
def fn sd_yinc (ch): ret CHAN_W%(#ch; 40): enddef: rem $28 cursor pixel height
def fn sd_font1(ch): ret CHAN_L (#ch; 42): enddef: rem $2a font1 addresses, primary first font
def fn sd_font2(ch): ret CHAN_L (#ch; 46): enddef: rem $2e font2 addresses. default chars here
def fn sd_scrb (ch): ret CHAN_L (#ch; 50): enddef: rem $32 base address of screen
def fn sd_pmask(ch): ret CHAN_L (#ch; 54): enddef: rem $36 paper colour mask
def fn sd_smask(ch): ret CHAN_L (#ch; 58): enddef: rem $3a strip colour mask
def fn sd_imask(ch): ret CHAN_L (#ch; 62): enddef: rem $3e ink colour mask
def fn sd_cattr(ch): ret CHAN_B%(#ch; 66): enddef: rem $42 character attributes
def fn sd_curf (ch): ret CHAN_B%(#ch; 67): enddef: rem $43 cursor flag (0 suppressed, >0 visible, <0 invisible)
def fn sd_pcolr(ch): ret CHAN_B%(#ch; 68): enddef: rem $44 paper colour byte
def fn sd_scolr(ch): ret CHAN_B%(#ch; 69): enddef: rem $45 strip colour byte
def fn sd_icolr(ch): ret CHAN_B%(#ch; 70): enddef: rem $46 ink colour byte
def fn sd_bcolr(ch): ret CHAN_B%(#ch; 71): enddef: rem $47 border colour byte
def fn sd_nlsta(ch): ret CHAN_B%(#ch; 72): enddef: rem $48 new line status (0 none, >0 implicit, <0 explicit)
def fn sd_fmod (ch): ret CHAN_B%(#ch; 73): enddef: rem $49 fill mode (0 off, 1 on)
def fn sd_yorg (ch): ret CHAN_F (#ch; 74): enddef: rem $4a graphics window origin (added to Y coords)
def fn sd_xorg (ch): ret CHAN_F (#ch; 80): enddef: rem $50 ditto for X
def fn sd_scal (ch): ret CHAN_F (#ch; 86): enddef: rem $56 graphics scale factor (range from bottom row to top row)
def fn sd_fbuf (ch): ret CHAN_L (#ch; 92): enddef: rem $5c pointer to ALCHP'ed fill buffer, 0 if none
def fn sd_linel(ch): ret CHAN_W%(#ch; 100): enddef: rem $64 line length in bytes
def fn sd_sflag(ch): ret CHAN_B%(#ch; 102): enddef: rem $66 size flag, set by defbd, csize if wind too small
def fn sd_alpha(ch): ret CHAN_B%(#ch; 103): enddef: rem $67 alpha blending value (0 = transparent, $ff = opqaue)
def fn sd_keyq (ch): ret CHAN_L (#ch; 104): enddef: rem $68 -> keyboard queue
:
def fn is_prwin(ch): ret CHAN_B%(#ch; 17) && 128: enddef: rem Primary window?
def fn is_behav(ch): ret CHAN_B%(#ch; 17) && 1: enddef: rem Well behaved?
def fn is_con (ch): ret CHAN_L (#ch; 104) <> 0: enddef: rem Console or screen?
:
def fn sd_prwlb(ch)
rem primary link list -> to next primary window
if is_prwin(#ch): ret CHAN_L(#ch; -8): ELSE : ret 0
enddef
:
def fn sd_pprwn(ch)
rem pointer to primary from secondary
if not is_prwin(#ch): ret CHAN_L(#ch; -8): ELSE : ret 0
enddef
:
def fn q_eoff(ch)
if CHAN_L(#ch; 104) = 0: ret -1: rem Not a console
ret CHAN_B%(#ch; 104): rem MSB set if EOF
enddef
:
def fn q_nextq(ch)
if CHAN_L(#ch; 104) = 0: ret -1: rem Not a console
ret CHAN_L(#ch; 104): rem Link to next queue
enddef
:
def fn q_end(ch)
if CHAN_L(#ch; 104) = 0: ret -1: rem Not a console
ret CHAN_L(#ch; 108): rem -> end of queue
enddef
:
def fn q_nextin(ch)
if CHAN_L(#ch; 104) = 0: ret -1: rem Not a console
ret CHAN_L(#ch; 112): rem -> put next byte here
enddef
:
def fn q_nxtout(ch)
if CHAN_L(#ch; 104) = 0: ret -1: rem Not a console
ret CHAN_L(#ch; 116): rem -> get next byte here
enddef
:
def fn q_text$(ch)
loc i, q$
q$ = ''
if CHAN_L(#ch; 104) THEN
for i = CHAN_L(#ch; 116) TO CHAN_L(#ch; 108): q$ = q$ & chr$(peek(i))
endif
ret q$
enddef
:
:
Generated with sb2htm on 2019 Apr 22
©pjwitte March 2oi9
QL Software
