[Coco] Question on MINTED internals

Neal Crook foofoobedoo at gmail.com
Thu Dec 31 13:04:23 EST 2015


This piece of the startup code provides the answer to my question:


            lda        #1
            ldb        #SS.ScSiz
            os9        I$GetStt    ; get screen dimensions
            lbcs    _abort
            stx        width,u
            sty        height,u
            lda        width+1,u
            ldb        height+1,u
            mul
            std        scrsize,u    ; compute screen size
            leax    buffer,u
            stx        scrbuf,u
            leax    d,x
            stx        membuf,u    ; compute memory buffer
            dec        height+1,u    ; *****

For (eg) a 32-char, 16-line terminal, the values 32, 16 are used to compute
the screen and memory buffer sizes and then (line marked ****) the value of
height is decremented from 16 to 15. Now the original code makes sense to
me (per comments added below)

1: _rename     pshs    a,b,x,y
2: @repeat     clra
3:             ldb     <height+1
4:             decb
5:             lbsr    _gotoxy     ; x=0,y=14 - penultimate line
6:             lbsr    _clrlin
7:             ldb     <height+1
8:             lbsr    _gotoxy     ; x=0,y=15 - last line
9:             lbsr    _clrlin

Neal.

On 24 December 2015 at 19:57, Cocodemus <retrocanada76 at gmail.com> wrote:

> Check the gotoxy function.
>
> Sent from my iPhone
>
> > On Dec 24, 2015, at 2:42 AM, Neal Crook <foofoobedoo at gmail.com> wrote:
> >
> > thanks to Robert, Dave and Coco Demus for their comments and explanations
> >
> >>> If you think your way is better, then go for it.
> > no, I was simply trying to understand the (your) intent; your explanation
> > makes perfect sense.
> >
> > My remaining confusion is this.. looking in term_vdg.asm I see szx=32,
> > szy=16 which will result in width being 32 and height being 16. If rows
> and
> > columns are numbered from 0, the valid rows are 0..15. The way I read
> this
> > code, it clear lines with row=15 (bottom row) and row=16 (no such row).
> > What am I missing here?
> >
> > thanks,
> >
> > Neal.
> >
> >
> >> On 24 December 2015 at 07:21, CoCo Demus <retrocanada76 at gmail.com>
> wrote:
> >>
> >> Hi,
> >>
> >> Why ? Well, this code clears line 24 and 25 and displays at line 25 the
> >> message: Rename/Save as: so If I did like you said I would still need to
> >> incb after the last _clrlin because I want a clear line separating the
> text
> >> and the message. This is more a code style, I wasn't trying to do a
> extreme
> >> optimization in the code. If you think your way is better, than go for
> it.
> >>
> >> cheers
> >>
> >>> On Wed, Dec 23, 2015 at 3:32 PM, Neal Crook <foofoobedoo at gmail.com>
> wrote:
> >>>
> >>> Here's my contribution towards raising the technical tone of the
> >>> conversation...
> >>>
> >>> I am working on a port of Luis Antoniosi's MINTED editor to produce a
> >>> version that uses ANSI control sequences. The idea is that it would
> work
> >>> across an rs232 link from a terminal emulator to a real Coco or (and
> more
> >>> importantly for me) work on a virtual terminal on my NitrOS9 multicomp
> >>> system.
> >>>
> >>> Here's a fragment of the original source code (I added the line numbers
> >> for
> >>> reference):
> >>>
> >>> 1: _rename     pshs    a,b,x,y
> >>> 2: @repeat     clra
> >>> 3:             ldb     <height+1
> >>> 4:             decb
> >>> 5:             lbsr    _gotoxy
> >>> 6:             lbsr    _clrlin
> >>> 7:             ldb     <height+1
> >>> 8:             lbsr    _gotoxy
> >>> 9:             lbsr    _clrlin
> >>>
> >>> Assume that the output device is 80 col by 25 row and the height is
> >> stored
> >>> as a 16-bit value, so
> >>> that line 3 loads "25" into B.
> >>>
> >>> The call in line 5 has A=0, B=24
> >>> The call in line 8 has A=0 (assuming A is preserved), B=25
> >>>
> >>> Questions:
> >>>
> >>> 1/ why not do this:
> >>>
> >>> 1: _rename     pshs    a,b,x,y
> >>> 2: @repeat     clra
> >>> 3:             ldb     <height+1
> >>> 4:
> >>> 5:             lbsr    _gotoxy
> >>> 6:             lbsr    _clrlin
> >>> 7:             decb
> >>> 8:             lbsr    _gotoxy
> >>> 9:             lbsr    _clrlin
> >>>
> >>> 2/ is the corner of the screen 0,0 or 1,1 (or something else? I'm
> puzzled
> >>> by the A=0, B=25 which seems contradictory)
> >>>
> >>> 3/ is the corner (0,0 or whatever) the top-left corner or some other
> >>> corner?
> >>>
> >>> (For reference, an ANSI screen has the top-left corner as 1,1)
> >>>
> >>> Thanks in advance for any enlightenment
> >>>
> >>> Neal.
> >>>
> >>> --
> >>> Coco mailing list
> >>> Coco at maltedmedia.com
> >>> https://pairlist5.pair.net/mailman/listinfo/coco
> >>
> >> --
> >> Coco mailing list
> >> Coco at maltedmedia.com
> >> https://pairlist5.pair.net/mailman/listinfo/coco
> >
> > --
> > Coco mailing list
> > Coco at maltedmedia.com
> > https://pairlist5.pair.net/mailman/listinfo/coco
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list