English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 24 January 2019, 16:32   #1
Fireball
Registered User
 
Join Date: Jan 2019
Location: Werne
Posts: 8
Question My "Hello World" Text will not be printed to cli

Hello amiga coders,

I'm a beginner in 64k assembler and I hope someone can help me to solve my problem.

I would like to print a simple text like "hello world" to the cli.
But my program crash if I run it.

I think I have problems to get an output handle cause the value in d0 is zero after jsr Output(a6).

During debugging my machine freeze at jsr Write(a6) and I have to reboot my machine.

I have no idea what I did wrong. :-(

Thank you in advance
Fireball

Code:
; Asm - One
SysBase         = 4     
LVOOpenLibrary  = -552 
LVCloseLibrary  = -414  

LVOOutput       = -60   
LVOWrite        = -48   


main:
    ; open lib
    lea dosname,a1 
    moveq  #0,d0      
    move.l SysBase,a6  
    jsr LVOOpenLibrary(a6)  
    tst.l d0       
    beq fini           
    move.l d0, DOSBase 
    
    ; Get output handle
    move.l DOSBase, a6  
    jsr LVOOutput(a6)   
    move.l d0,d4          ; <-- I think here is my problem cause d0 is zero

    ; print text
    move.l d4,d1        
    move.l #string, d2 
    moveq #20, d3       
    move.l DOSBase, a6 
    jsr LVOWrite(a6)      ; <--- The Program stops here in debugger

    ; close lib
    move.l DOSBase, a1 
    move.l SysBase, a6 
    jsr LVCloseLibrary(a6)         

fini: 
    rts

; Data
DOSBase dc.l 0
dosname dc.b "dos.library",0
string dc.l "Hello Amiga Coders!",10
Fireball is offline  
Old 24 January 2019, 16:43   #2
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,187
Should string be declared as bytes instead of longs?
Samurai_Crow is offline  
Old 24 January 2019, 17:26   #3
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
One of the many problems with ASM-One is that it executes your program as a simple subroutine. If you started ASM-One from the Workbench then your program runs inside ASM-One's own Workbench process, and so it has no default output.

The simplest solution is to just write your program to disk and run it from the CLI.
Leffmann is offline  
Old 24 January 2019, 17:33   #4
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,515
Or run asmone from shell

EDIT: yeah, serioiusly, it is better to test using plain executable first.
Toni Wilen is offline  
Old 24 January 2019, 21:38   #5
Fireball
Registered User
 
Join Date: Jan 2019
Location: Werne
Posts: 8
Thank you for your response. I think then I will get a guru. :-)
Fireball is offline  
Old 24 January 2019, 21:57   #6
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
yes, if Output returns 0, you don't have a console. Build an exe and run it from CLI.

now:

dc.l => dc.b

and don't write more than data size.

Asm is not easy. Good luck!
jotd is offline  
Old 28 January 2019, 23:53   #7
Fireball
Registered User
 
Join Date: Jan 2019
Location: Werne
Posts: 8
Solution

Thank you for your support. I have fixed the problem.

Code:
string dc.b "Hello Amiga Coders!",0
Then I have build an executable file which prints my hello to all amiga coders. :-)

Next step read somthing from cli and print it to the screen.

Best regards

Fireball
Fireball 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
"Voices8" 8 Channel Soundtracker "DemoSongI" song - "This is the Amiga with 8 Voices" DemosongIHunter request.Music 45 23 May 2022 20:07
"Detokenising" source code (resetting back to plain text) earok Coders. Blitz Basic 4 29 October 2017 22:48
"Another World 2" and "Flashback 2" on PSP john4p Retrogaming General Discussion 34 26 April 2011 18:52
Cli program to "execute" .info files olesio support.Apps 4 05 September 2010 19:19
Capitan Zbik, "new" polish text adventure game in Amos s2325 Retrogaming General Discussion 1 04 April 2009 22:13

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 18:05.

Top

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