There are several bugs in the code. Like pointed out by others, you must either move.l #label,reg or lea label,areg to get ptr to label.
Further your CON: string had a bug, it must be:
'CON:0/100/640/100/TesttextWindow',0
not
'CON:0/100/640/100 TesttextWindow',0
Your code printed '\0' char to console. This is not deadly, but causes confusion if you ever use the same method to stdout, and the output is redirected to file. Better learn to avoid it. Linefeeds were missing, too.
Also, your code was lacking all error checking, which I also added. Finally, your libopen LVO was really OldOpenLibrary, that is no longer supported. You must use OpenLibrary (-552).
Here's a working (tested) example:
; simple conwindow example
RETURN_OK EQU 0
RETURN_FAIL EQU 20
MODE_OLDFILE EQU 1005
MODE_NEWFILE EQU 1006
_LVOOpenLibrary EQU -552
_LVOCloseLibrary EQU -414
_LVOOpen EQU -30
_LVOClose EQU -36
_LVOWrite EQU -48
_LVOIoErr EQU -132
_LVODelay EQU -198
main:
moveq #RETURN_FAIL,d7
bsr init
tst.l d0 ; worked?
beq exit
lea testtext1(pc),a0
bsr conputstr
lea testtext2(pc),a0
bsr conputstr
moveq #4,d0 ; wait 4 secs
bsr sleep
bsr cleanup
moveq #RETURN_OK,d7 ; all ok
exit:
move.l d7,d0
rts
; in: void
; out: d0.l success indicator, 0 for error, != 0 for success
init:
movem.l d2/a6,-(sp)
move.l 4,sysbase
move.l sysbase(pc),a6
lea dosname(pc),a1 ; open dos.library
moveq #33,d0
jsr _LVOOpenLibrary(a6)
move.l d0,dosbase
beq initerror
move.l dosbase(pc),a6 ; open console
lea consolename(pc),a0
move.l a0,d1
move.l #MODE_NEWFILE,d2
jsr _LVOOpen(a6)
move.l d0,conhandle
beq initerror
moveq #1,d0 ; success!
bra initpop
initerror:
bsr cleanup
moveq #0,d0 ; error!
initpop:
movem.l (sp)+,d2/a6
rts
; in: void
; out: void
cleanup:
move.l a6,-(sp)
move.l dosbase(pc),d0 ; dos open?
beq nodosbase
move.l d0,a6
move.l conhandle(pc),d1 ; con handle open?
beq noconhandle
jsr _LVOClose(a6)
clr.l conhandle
noconhandle:
move.l sysbase(pc),a6
move.l dosbase(pc),a1
jsr _LVOCloseLibrary(a6)
clr.l dosbase
nodosbase:
move.l (sp)+,a6
rts
; in: a0.l = null terminating string to output
; out: void
conputstr:
movem.l d2-d3/a6,-(sp)
move.l a0,d2
moveq #-1,d3
cps_strlen:
addq.l #1,d3
tst.b (a0)+
bne cps_strlen
; d3 str len, excluding terminating null
move.l dosbase(pc),a6
move.l conhandle(pc),d1
jsr _LVOWrite(a6)
movem.l (sp)+,d2-d3/a6
rts
; in: d0.w = number of seconds to sleep
; out: void
sleep:
move.l a6,-(sp)
move.l dosbase,a6
move.w d0,d1
mulu.w #50,d1
jsr _LVODelay(a6)
move.l (sp)+,a6
rts
dosname: dc.b 'dos.library',0
consolename: dc.b 'CON:0/100/640/100/TesttextWindow',0
testtext1: dc.b 'This thing works dude!!!',10,0
testtext2: dc.b $9b,'4;31;40m'
dc.b 'underline'
dc.b $9b,'3;33;40m',$9b,'5;20H'
dc.b '** Hey Dammit !! **',10,0
CNOP 0,2
sysbase: ds.l 1
dosbase: ds.l 1
conhandle: ds.l 1