My OLD/NEW boot front end

Anything QL Software or Programming Related.
User avatar
tofro
Font of All Knowledge
Posts: 2700
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: My OLD/NEW boot front end

Post by tofro »

Paul,
polka wrote:and decided to buy QPC2 to complement my "real" QL and Daniele's Qemulator.
definitively a good decision. I don't know Qemulator, but QPC2 (and QPCPrint, should you decide to go that way) are the two finest pieces of Windows software I have.
polka wrote: But for some reasons that I still have to analyse, this SuperBasic program - working all right on real QLs and with Qemulator - does not with QPC2 !!!
What exactly is the problem? SMSQ/E SBasic is somewhat more picky in some places than SuperBASIC used to be. It especially doesn't like unnamed END REPeat and END DEFine statements.
polka wrote: Questions :
Adrian Dickens and QDOS/QPTR reference guide - Jochen Merz & al.) of Qdos traps, etc. might be still valid with SMSQ/E ?
All of your QL books/manuals should 99.9% apply to SBasic and SMSQ/E as well. Differences are small (like the one mentioned above).

For more documentation, you should definitely have a look at
http://www.kilgus.net/smsqe/development.html
There's the complete QDOS/SMSQ Reference Manual (Which points out the differences between QDOS and SMSQ/E, at least for Assembler programmers, very clearly) to be had there as well as the QPTR Manuals for programming the Extended Environment in Assembler.

While the above is mostly related to assembler programming, make sure you get the Basic-related stuff from the same source at
http://www.kilgus.net/qpc/downloads.html
(QPC Manual, Keywords and Concepts sections for SBasic, in "Original QL" style)

Have fun!

Cheers,
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
polka
Trump Card
Posts: 196
Joined: Mon Mar 07, 2011 11:43 am

Re: My OLD/NEW boot front end

Post by polka »

Thank you for your answer and the links.

In the fisrt one I found documents that confirm and complement the 2 reference books (actually binders) that I already had acquired (a long time ago) from J.M.S. : very useful !

The download link gives access to 4 manuals that were part of my QPC2 CD, and that describe the Sbasic concepts and keywords.

Besides, what I will try to find out by "cowboy style hacking" is the "video" memory maps and the way the display information is physically coded - maybe first only for the QL 4/8 color display modes. If these maps are fixed and localisable through system variables, it will let me port whole screen graphic tools that I developped for the QL, with better picture resolution (I already had wirh QPC, but they tell that the new sreen driver is completely different).

BYE Paul


May the FORTH be with you !
POLKa
User avatar
tofro
Font of All Knowledge
Posts: 2700
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: My OLD/NEW boot front end

Post by tofro »

Paul,
so you already had everything you need!

The main reason why you won't find much information about physical layout of screen memory is - Those guys want to educate you to write portable programs. ;)

If you want to play around with QPC graphics, you might want to look at the following:
  • The QPC_QLSCREMU keyword gives you the chance to have QPC emulate a QL display in mode 4 or 8 in the top left corner of a high-res display. Most of your existing experiments for the original QL should work in this mode
  • The sd.extop/iow.xtop system trap allows you to query the system for screen related information. Your code then runs as if it were part of the screen driver and has access to the channel definition block with information about window data, screen base adress, length of a scanline in bytes and so on. This allows you to access physical screen memory in a fairly portable manner
  • The other portable way to access the screen more or less directly is through the pointer environmant and sprites/bitmaps that you can supply for the various screen modes. But this is an entirely different matter
  • Also make sure you read through the "display.txt" file from the above link to Marcel's site - This has important information about new system calls to access GD2 screens not included in the other documentation sets.
  • And your next stop should be Dilwyn's site on the section about SMSQ/E and GD2-related information. There's a wealth of documents obtainable that should give you a head start: http://www.dilwyn.me.uk/docs/smsqegd2/index.html
  • And, a last hint, if you're really adventureous: Have a look into SMSQ/E source code - The file ...keys_con holds the format of the device driver definition block and the channel definition block of con channels. There's a lot of information to pick from there if you like
    Have even more fun!
    Tobias


    ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
    User avatar
    tofro
    Font of All Knowledge
    Posts: 2700
    Joined: Sun Feb 13, 2011 10:53 pm
    Location: SW Germany

    Re: My OLD/NEW boot front end

    Post by tofro »

    Paul,
    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)

    Cheers
    Tobias

    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
    


    ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
    User avatar
    polka
    Trump Card
    Posts: 196
    Joined: Mon Mar 07, 2011 11:43 am

    Re: My OLD/NEW boot front end

    Post by polka »

    Thanks a lot ! I will analyse this... and try to port it to Forth assembler.

    Bye, Paul


    May the FORTH be with you !
    POLKa
    User avatar
    tofro
    Font of All Knowledge
    Posts: 2700
    Joined: Sun Feb 13, 2011 10:53 pm
    Location: SW Germany

    Re: My OLD/NEW boot front end

    Post by tofro »

    polka wrote:... and try to port it to Forth assembler.
    Stop scaring me ;)


    ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
    User avatar
    polka
    Trump Card
    Posts: 196
    Joined: Mon Mar 07, 2011 11:43 am

    Re: My OLD/NEW boot front end

    Post by polka »

    A lot of people seem impressed (scared ?) by Forth, they shouldn't !

    As for assembler use in Forth, it's a classic extension, but only ComputerOne Forth supports it, SuperForth does not, there is just a half page paragraph in their manual about machine code programming. And SuperForth monopolizes many more registers than ComputerOne Forth.

    Anyway, most of the time assembler is not even useful in Forth, because plain Forth runs almost as fast. With ComputerOne Forth, I coded two implementations of my Conway's LIFE program, one using an assembler word for plotting one pixel, and one plotting a cell of 6 pixels in plain Forth ; calling six times the assembler routine or calling just once the Forth one takes approximately the same time.

    Did you try to install SuperForth and play with my Conway's LIFE that I ported onto it ? (other thread)

    It's worth watching, especially on emulators running at fastest speed, but even on a 7.5MHz real QL, it's quite a show (indeed, compared with SuperBasic).

    Bye Paul


    May the FORTH be with you !
    POLKa
    User avatar
    tofro
    Font of All Knowledge
    Posts: 2700
    Joined: Sun Feb 13, 2011 10:53 pm
    Location: SW Germany

    Re: My OLD/NEW boot front end

    Post by tofro »

    polka wrote:A lot of people seem impressed (scared ?) by Forth, they shouldn't !
    Well, it's not that I'm really scared - But some people's brains seem (like mine) not being made to think in reverse. Forth and I have been confronted with each other some 15 years ago and we never really made friends ;).

    Even today, I seem to be battling with anything stack based (like the QDOS RI.EXEC calls that I always seem to manage to get wrong in the first place) :oops:

    But nevermind, your LIFE programs look quite impressive to me. I might even go get me some Forth system installed to try it out some day.

    Cheers,
    Tobias


    ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
    Post Reply