you might find the following useful that should give you relevant information on how display memory is organized (to be assembled using GWASS)
This is just a quick and dirty coded piece of program to read the contents of the channel definition block of a con_ channel. Note when using PE, the first $16 bytes are used differently (and the channel definition block is not fuilly displayed)
Code: Select all
***************************************************************************
* SD_EXTOP test
* Eval the current screen start adress, linelength and masks
* from the device descriptor in QPC2
*
* Floating point conversion does not seem to work and destroys
***************************************************************************
SMS_FRJB equ 5
OPW.WIND equ $c4
UT.CON equ $c6
IOB.FBYT equ $01
UT.WTEXT equ $d0
SD.EXTOP equ $9
SD.CLEAR equ $20
SD.TAB equ $11
CN_ITOHL equ $fe
CN_ITOHW equ $FC
CN_ITOHB equ $fa
CN_FTOD equ $f0
data 20000
***************************************************************************
* A macro to simplify label printing
***************************************************************************
printitemL macro string,offset
move.l chanId(a6),a0
lea \1,a1 ; string into a1
bsr printStr
move.w #20,d1
bsr printTab
lea \2,a1
bsr hexOutL
lea linefeed,a1
move.l chanId(a6),a0
bsr printStr
endm
printitemW macro string,offset
move.l chanId(a6),a0
lea \1,a1 ; string into a1
bsr printStr
move.w #20,d1
bsr printTab
lea \2,a1
bsr hexOutW
lea linefeed,a1
move.l chanId(a6),a0
bsr printStr
endm
printitemB macro string,offset
move.l chanId(a6),a0
lea \1,a1 ; string into a1
bsr printStr
move.w #20,d1
bsr printTab
lea \2,a1
bsr hexOutB
lea linefeed,a1
move.l chanId(a6),a0
bsr printStr
endm
printitemF macro string,offset
move.l chanId(a6),a0
lea \1,a1 ; string into a1
bsr printStr
move.w #20,d1
bsr printTab
lea \2,a1
bsr floatOut
lea linefeed,a1
move.l chanId(a6),a0
bsr printStr
endm
start: bra.s realstart
dc.w $4afb
dc.w 13
dc.b 'SD_EXTOP Test'
ds.w 0
realstart lea.l (a6,a4.l),a6 ; point a6 to beginning of data space
move.l #$12345678,dummy(a6)
bsr openConsole
bsr clrScr
bsr printBanner
bsr waitKey
bsr clrScr
move.w #-1,d3
lea.l chn_len(a6),a1 ; target buffer as parameter
move.l chanId(a6),a0
lea.l xtop,a2
move.l #SD.EXTOP,d0
trap #3
tst.l d0
bne ende
bsr printTable
bsr waitKey
ende move.l #-1,d1
move.l d0,d3
move.l #SMS_FRJB,d0
trap #1
* The following routine is intended to be called as part of a device driver
* by IOW.XTOP
xtop move.l a0,a4 ; source
move.l a1,a3 ; destination
move.l (a4),d0 ; this would pick the length
move.l $100,d0 ; not sure wether PE leaves the length
subq.l #1,d0
xtoplp move.b (a4)+,(a3)+
dbra d0,xtoplp
move.l #0,d0 ; no error
rts
printBanner lea.l banner,a1
bsr printStr
rts
printTable
printItemL chn_lenS,chn_len
printItemL chn_drvrS,chn_drvr
printItemL chn_ownrS,chn_ownr
printItemL chn_rflgS,chn_rflg
printItemW chn_tagS,chn_tag
printItemB chn_statS,chn_stat
printItemB chn_actnS,chn_actn
printItemL chn_jbwtS,chn_jbwt
printItemW sd_xminS,sd_xmin
printItemW sd_yminS,sd_ymin
printItemW sd_xsizeS,sd_xsize
printItemW sd_ysizeS,sd_ysize
printItemW sd_borwdS,sd_borwd
printItemW sd_xposS,sd_xpos
printItemW sd_yposS,sd_ypos
printItemW sd_xincS,sd_xinc
printItemW sd_yincS,sd_yinc
printItemL sd_font1S,sd_font1
printItemL sd_font2S,sd_font2
printItemL sd_scrbS,sd_scrb
printItemL sd_pmaskS,sd_pmask
printItemL sd_smaskS,sd_smask
printItemL sd_imaskS,sd_imask
printItemB sd_cattrS,sd_cattr
printItemB sd_curfS,sd_curf
printItemB sd_pcolrS,sd_pcolr
printItemB sd_scolrS,sd_scolr
printItemB sd_icolrS,sd_icolr
printItemB sd_bcolrS,sd_bcolr
printItemB sd_nlstaS,sd_nlsta
printItemB sd_fmodS,sd_fmod
; printItemF sd_yorgS,sd_yorg
; printItemF sd_xorgS,sd_xorg
; printItemF sd_scalS,sd_scal
printItemW sd_linelS,sd_linel
rts
* Opens a console channel
openConsole:
lea conName,a0
lea cparmBlk,a1
move.w UT.CON,a2
jsr (a2)
move.l a0,chanId(a6)
rts
* Waits for a keypress
waitkey move.l d1,-(sp)
move.l chanid(a6),a0
moveq #-1,d3
move.l #IOB.FBYT,d0
trap #3
move.l (sp)+,d1
rts
* Prints a string whose adress (length word) is in a1 to the console
printStr move.l #-1,d3
move.l chanId(a6),a0
move.w UT.WTEXT,a2
jsr (a2)
rts
clrScr move.l #SD.CLEAR,d0
move.l chanId(a6),a0
move.l #-1,d3
trap #3
rts
printTab move.l #SD.TAB,d0
move.l chanId(a6),a0
move.l #-1,d3
trap #3
rts
*****************************************************************************
* Print a number in Hex
* The value should be at (a1,a6.l)
* buffer needs to be in (a0,a6.l)
* CN_ITOHL will not handle the string length word!
*****************************************************************************
hexOutL lea buflen,a0 ; must be relative to a6
addq #2,a0 ; point to start of char buffer
move.l a0,d4 ; remember the start
move.w CN_ITOHL,a2
jsr (a2)
sub.l d4,a0
move.w a0,buflen(a6)
lea buflen(a6),a1
bsr printStr
rts
hexOutW lea buflen,a0 ; must be relative to a6
addq #2,a0 ; point to start of char buffer
move.l a0,d4 ; remember the start
move.w CN_ITOHW,a2
jsr (a2)
sub.l d4,a0
move.w a0,buflen(a6)
lea buflen(a6),a1
bsr printStr
rts
hexOutB lea buflen,a0 ; must be relative to a6
addq #2,a0 ; point to start of char buffer
move.l a0,d4 ; remember the start
move.w CN_ITOHB,a2
jsr (a2)
sub.l d4,a0
move.w a0,buflen(a6)
lea buflen(a6),a1
bsr printStr
rts
floatOut lea buflen,a0 ; must be relative to a6
addq #2,a0 ; point to start of char buffer
move.l a0,d4 ; remember the start
move.w CN_ftod,a2
jsr (a2)
sub.l d4,a0
move.w a0,buflen(a6)
lea buflen(a6),a1
bsr printStr
rts
banner dc.w bannerEnd-*-2
dc.b 'This program gives some insight into SMSQ/Es channel definition',$0a
dc.b 'block. The program invokes an SD.EXTOP routine and dumps the ',$0a
dc.b 'block onto the screen.',$0a
dc.b 'This gives insight into all the attributes of a channel definition',$0a
dc.b $0a
dc.b 'Please press any key to continue',$0a
bannerEnd
conName dc.w conNEnd-*-2
dc.b 'con_512x512a10x10_32'
conNEnd ds.b 0
cparmBlk dc.b 224,2 ; red border, width 2
dc.b 4,0 ; black on green
dc.w 512
dc.w 512
dc.w 100
dc.w 100
linefeed dc.w 1
dc.b $0a
chn_lenS dc.w chn_LenE-*-2
dc.b "chn_len:"
chn_lenE ds.b 0
chn_drvrS dc.w chn_drvrE-*-2
dc.b "chn_drvr:"
chn_drvrE ds.b 0
chn_ownrS dc.w chn_ownrE-*-2
dc.b "chn_ownr:"
chn_ownrE ds.b 0
chn_rflgS dc.w chn_rflgE-*-2
dc.b "chn_rflg:"
chn_rflgE ds.b 0
chn_tagS dc.w chn_tagE-*-2
dc.b "chn_tag:"
chn_tagE ds.b 0
chn_statS dc.w chn_statE-*-2
dc.b "chn_stat:"
chn_statE ds.b 0
chn_actnS dc.w chn_actnE-*-2
dc.b "chn_actn:"
chn_actnE ds.b 0
chn_jbwtS dc.w chn_jbwtE-*-2
dc.b "chn_jbwt:"
chn_jbwtE ds.b 0
sd_xminS dc.w sd_xminE-*-2
dc.b "sd_xmin:"
sd_xminE ds.b 0
sd_yminS dc.w sd_yminE-*-2
dc.b "sd_ymin:"
sd_yminE ds.b 0
sd_xsizeS dc.w sd_xsizeE-*-2
dc.b "sd_xsize:"
sd_xsizeE ds.b 0
sd_ysizeS dc.w sd_ysizeE-*-2
dc.b "sd_ysize:"
sd_ysizeE ds.b 0
sd_borwdS dc.w sd_borwdE-*-2
dc.b "sd_borwd:"
sd_borwdE ds.b 0
sd_xposS dc.w sd_xposE-*-2
dc.b "sd_xpos:"
sd_xposE ds.b 0
sd_yposS dc.w sd_yposE-*-2
dc.b "sd_ypos:"
sd_yposE ds.b 0
sd_xincS dc.w sd_xincE-*-2
dc.b "sd_xinc:"
sd_xincE ds.b 0
sd_yincS dc.w sd_yincE-*-2
dc.b "sd_yinc:"
sd_yincE ds.b 0
sd_font1S dc.w sd_font1E-*-2
dc.b "sd_font1:"
sd_font1E ds.b 0
sd_font2S dc.w sd_font2E-*-2
dc.b "sd_font2:"
sd_font2E ds.b 0
sd_scrbS dc.w sd_scrbE-*-2
dc.b "sd_scrb:"
sd_scrbE ds.b 0
sd_pmaskS dc.w sd_pmaskE-*-2
dc.b "sd_pmask:"
sd_pmaskE ds.b 0
sd_smaskS dc.w sd_smaskE-*-2
dc.b "sd_smask:"
sd_smaskE ds.b 0
sd_imaskS dc.w sd_imaskE-*-2
dc.b "sd_imask:"
sd_imaskE ds.b 0
sd_cattrS dc.w sd_cattrE-*-2
dc.b "sd_cattr:"
sd_cattrE ds.b 0
sd_curfS dc.w sd_curfE-*-2
dc.b "sd_curf:"
sd_curfE ds.b 0
sd_pcolrS dc.w sd_pcolrE-*-2
dc.b "sd_pcolr:"
sd_pcolrE ds.b 0
sd_scolrS dc.w sd_scolrE-*-2
dc.b "sd_scolr:"
sd_scolrE ds.b 0
sd_icolrS dc.w sd_icolrE-*-2
dc.b "sd_icolr:"
sd_icolrE ds.b 0
sd_bcolrS dc.w sd_bcolrE-*-2
dc.b "sd_bcolr:"
sd_bcolrE ds.b 0
sd_nlstaS dc.w sd_nlstaE-*-2
dc.b "sd_nlsta:"
sd_nlstaE ds.b 0
sd_fmodS dc.w sd_fmodE-*-2
dc.b "sd_fmod:"
sd_fmodE ds.b 0
sd_yorgS dc.w sd_yorgE-*-2
dc.b "sd_yorg:"
sd_yorgE ds.b 0
sd_xorgS dc.w sd_xorgE-*-2
dc.b "sd_xorg:"
sd_xorgE ds.b 0
sd_scalS dc.w sd_scalE-*-2
dc.b "sd_scal:"
sd_scalE ds.b 0
sd_linelS dc.w sd_linelE-*-2
dc.b "sd_linel:"
sd_linelE ds.b 0
rs_set -$18
chanId rs.l 1
dummy rs.l 2 ; to have something to play around with
buflen rs.w 1 ; string length
buffer rs.b 80 ; buffer for converted hex characters
chn_len rs.l 1 ; Length of channel definition block
chn_drvr rs.l 1 ; adress of driver linkage
chn_ownr rs.l 1 ; owner job of this channel
chn_rflg rs.l 1 ; pointer to channel closed flag
chn_tag rs.w 1 ; channel tag
chn_stat rs.b 1 ; Channel status
chn_actn rs.b 1 ; channel action
chn_jbwt rs.l 1 ; Job waiting for IO
chn_end
sd_xmin rs.w 1 ; Window top left hand side
sd_ymin rs.w 1
sd_xsize rs.w 1 ; window size
sd_ysize rs.w 1 ;
sd_borwd rs.w 1 ; border width
sd_xpos rs.w 1 ; cursor position
sd_ypos rs.w 1 ;
sd_xinc rs.w 1 ; cursor increment
sd_yinc rs.w 1 ;
sd_font1 rs.l 1 ; font address 1
sd_font2 rs.l 1 ; font adress 2
sd_scrb rs.l 1 ; base adress of screen
sd_pmask rs.l 1 ; paper color mask
sd_smask rs.l 1 ; strip color mask
sd_imask rs.l 1 ; ink color mask
sd_cattr rs.b 1 ; character attributes
sd_curf rs.b 1 ; cursor flag
sd_pcolr rs.b 1 ; paper color byte (valid for SMSQ?)
sd_scolr rs.b 1 ; strip color byte
sd_icolr rs.b 1 ; ink color byte
sd_bcolr rs.b 1 ; border color byte
sd_nlsta rs.b 1 ; new line status
sd_fmod rs.b 1 ; fill mode
sd_yorg rs.b 6 ; graphics window y origin (float)
sd_xorg rs.b 6 ; graphics window x origin (float)
sd_scal rs.b 6 ; scale factor (float)
sd_fbuf rs.l 1 ; pointer to fill buffer
sd_fuse rs.l 1 ; pointer to user defined fill vectors
sd_linel rs.w 1 ; scanline length in bytes