[Coco] Question on MINTED internals

Robert Gault robert.gault at att.net
Wed Dec 23 22:10:57 EST 2015


Neal Crook 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
>

Without knowing what the routine _clrlin does to regD, you can't know whether 
either regA or regB are preserved. Speculation is pointless, so study the 
_clrlin code.

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

The upper left corner of a text screen is 0,0. The code you show does a clear 
line not a clear screen and seems to start at line 24 clearing that and line 25.
Hard why this was chosen since you have not included what type of test is used 
to determine looping to @repeat. From the name, this ought to be a repeating loop.

It is possible that height is not a constant but a variable. That would change 
the interpretation of the fragment you show.

>
> Thanks in advance for any enlightenment
>
> Neal.
>

Your question 3 is the same as question 2, so no answer. :)

Robert



More information about the Coco mailing list