English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 28 September 2022, 09:43   #1
REAKTOR BEAR
Registered User
 
Join Date: Mar 2021
Location: SWEDEN
Posts: 40
Output to CLI

I've read that "dos.lib" has a function to output text to CLI, but where can we find documentation or an example?

User starts demo from CLI.... CLI says: "Demo now loading..."
But how to do it?
REAKTOR BEAR is offline  
Old 28 September 2022, 10:25   #2
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,214
dos/Printf() does that for you, from kick 2.0 onwards. Otherwise, for older kickstarts, you have to go through Output() to get the output handle, and Write() to send the characters manually, and you have to perform argument substitution manually as well.
Thomas Richter is offline  
Old 28 September 2022, 10:31   #3
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,038
If you like cryptic asm :P, example for KS1.x via _LVOutput() can be found here: http://eab.abime.net/showthread.php?t=106742&page=25
a/b is offline  
Old 28 September 2022, 11:15   #4
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
Easiest way is to open v36+ dos.library and call PutStr (unformatted) or VPrintf (formatted).
meynaf is offline  
Old 28 September 2022, 18:16   #5
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,098
If 1.X compatibility is required it's still not too bad. Outputting a simple string:
Code:
        ; a6=dos.library
        jsr     _LVOOutput(a6)
        move.l  d0,d1 ; console output handle
        move.l  #msg,d2
        move.l  #msgend-msg,d3
        jsr     _LVOWrite(a6)
        ...
msg:    dc.b 'Demo now loading...'
msgend:
Or VPrintf replacement (beware of buffersize):
Code:
        ;d1=fmt,d2=args,a6=dos.library
buffersize=80
Printf:
        movem.l d2-d3/a2-a4,-(sp)
        move.l  a6,a4
        move.l  $4.w,a6
        move.l  d1,a0
        move.l  d2,a1
        lea     .storechar(pc),a2
        lea     -buffersize(a7),a7
        move.l  a7,a3
        jsr     _LVORawDoFmt(a6)
        move.l  a3,d2
        moveq   #-1,d3
.strlen:
        tst.b   (a3)+
        dbeq    d3,.strlen
        not.l   d3
        move.l  a4,a6
        jsr     _LVOOutput(a6)
        move.l  d0,d1
        jsr     _LVOWrite(a6)
        lea     buffersize(a7),a7
        movem.l (sp)+,d2-d3/a2-a4
        rts
.storechar:
        move.b  d0,(a3)+
        rts
paraj is offline  
Old 29 September 2022, 09:33   #6
REAKTOR BEAR
Registered User
 
Join Date: Mar 2021
Location: SWEDEN
Posts: 40
Thanks a lot everyone, we will try the Thomas solution, it seems to be the simplest... "dos/Printf()" ... "and for older kickstarts Output() to get the output handle, and Write()"
REAKTOR BEAR is offline  
Old 29 September 2022, 09:37   #7
REAKTOR BEAR
Registered User
 
Join Date: Mar 2021
Location: SWEDEN
Posts: 40
Quote:
Originally Posted by Thomas Richter View Post
dos/Printf() does that for you, from kick 2.0 onwards. Otherwise, for older kickstarts, you have to go through Output() to get the output handle, and Write() to send the characters manually, and you have to perform argument substitution manually as well.
What variable (D0,D1,D2) do we pass to doslib Output(), to optain the handle of the CLI window? is that: move.b "CON:",0,0 .. or something else?
REAKTOR BEAR is offline  
Old 29 September 2022, 10:32   #8
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
Quote:
Originally Posted by REAKTOR BEAR View Post
What variable (D0,D1,D2) do we pass to doslib Output(), to optain the handle of the CLI window? is that: move.b "CON:",0,0 .. or something else?
Output returns the current output handle for the process - it takes no input. If the process was started by a CLI, and the output wasn't redirected, you will get the handle of the console..

Last edited by hooverphonique; 29 September 2022 at 13:56.
hooverphonique is offline  
Old 29 September 2022, 11:03   #9
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
https://eab.abime.net/showthread.php...58#post1320158
malko is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
CLI help npagonis73 support.Other 30 06 October 2020 18:12
for..each statement in CLI pieter1976 support.Other 10 09 January 2020 22:15
CLI help DeafDaz request.Other 3 10 August 2011 01:16
CLI Syntax Greaser New to Emulation or Amiga scene 1 08 October 2006 10:14

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:50.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.14506 seconds with 14 queries