Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Re: Get VBCC+VASM+VLINK to work?
Posted by: Sdw Aug,13.2013-21:51 

Alright, some progress. I now have managed to set up things so that I actually can build a TOS-executable that seems to start. Here's my makefile:

OBJECTS = main.c \
asm_util.68k \
asm_routines.68k

TARGET = output.tos

CFLAGS = -O=-1 -cpu=68000 -fpu=none
ASFLAGS =
LDFLAGS =

INCDIR =
LIBDIR =

LIBS =

#-- Stuff below was earlier in a separate config file --------------------------

CC = vbccm68k
AS = vasmm68k_mot
LD = vlink

# Add includes and libraries.
#
INCDIR := $(INCDIR) ./ "$(VBCC)/targets/m68k-atari/include"

LIBDIR := $(LIBDIR) ./ "$(VBCC)/targets/m68k-atari/lib"

# Strip everything if there's no debug infos
ifeq ($(findstring -g, $(CFLAGS)), -g)
else
LDFLAGS := $(LDFLAGS) -s
endif

CFLAGS := -c99 -quiet -maxoptpasses=200 $(addprefix -I, $(INCDIR)) -D__VBCC__ $(CFLAGS)
ASFLAGS := -quiet -nosym -Faout -phxass $(ASFLAGS) $(addprefix -I, $(INCDIR))
LDFLAGS := $(addprefix -L,$(LIBDIR)) \
$(addprefix -l,$(LIBS)) \
-Bstatic -bataritos -Cvbcc $(LDFLAGS)

LINKOBJ = $(patsubst %.c, %.o, $(OBJECTS))
LINKOBJ := $(patsubst %.68k, %.o, $(LINKOBJ))

DELOBJ1 = $(patsubst %.c, %.asm, $(OBJECTS))
DELOBJ1 := $(patsubst %.68k, %.o, $(DELOBJ1))
DELOBJ2 = $(patsubst %.c, %.o, $(OBJECTS))
DELOBJ2 := $(patsubst %.68k, , $(DELOBJ2))

OBJC = $(patsubst %.c, %.o, $(OBJECTS))
OBJASM = $(patsubst %.68k, %.o, $(OBJECTS))

all: $(TARGET)

$(TARGET): $(OBJC) $(OBJASM)
$(LD) $(LDFLAGS) -o $(TARGET) $(LINKOBJ)

%.o : %.c
$(CC) $(CFLAGS) $<
$(AS) $(ASFLAGS) -o $@ $*.asm

%.o : %.68k
$(AS) $(ASFLAGS) -o $@ $<

clean:
-rm -f $(TARGET)
-rm -f *.asm #-rm -f $(DELOBJ1)
-rm -f *.o #-rm -f $(DELOBJ2)


Now if I do a something like

int main()
{
while(1);
}

And run that exe, I get a blank screen with a flashing cursor. I suspect that this is OK, I am in an infinite loop, but there is still some OS stuff running in IRQs.

The next setp is to take over the system so that I can mess around with the gfx-registers etc. If i try to do that from my C-code, I only get some strange "bomb" symbols.

When running pure asm, I got some init code from someone on these boards that does something like this:

_startup:
pea _main ;Run demo in supervisor
move.w #$26,-(sp) ;supexec()
trap #14 ;
addq.l #6,sp ;
clr.w -(sp) ;pterm()
trap #1 ;
_main:
move.l #$0fff0ff0,d0
this:
move.l d0,$ffff8240.w
add.l #1,d0
jmp this

If i link in this into my project, and then do this in my main.c

int main()
{
startup();
}

The assembly code runs as it should and changes the background color continuously.
However, if I replace the "jmp this" with an "rts", I don't seem to get control back to my C-code, if I add a while(1); for example after the startup(), I never seem to get there, I just go straight back to the OS.

So, I seem to be on the right path, I just need to get the right way to initialize the system for "demo-mode", that is, all OS crap disabled.
Can anoyne please assist?







[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
Get VBCC+VASM+VLINK to work? Sdw Aug,13.2013-00:22
  Re: Get VBCC+VASM+VLINK to work? Sdw Aug,13.2013-21:51
    Re: Get VBCC+VASM+VLINK to work? AdamK Aug,13.2013-22:28
      Re: Get VBCC+VASM+VLINK to work? PeP Aug,16.2013-07:59
    Re: Get VBCC+VASM+VLINK to work? Sdw Aug,13.2013-23:09
      Re: Get VBCC+VASM+VLINK to work? AdamK Aug,14.2013-06:59
        Re: Get VBCC+VASM+VLINK to work? Sdw Aug,14.2013-11:44
          Re: Get VBCC+VASM+VLINK to work? mikro Aug,14.2013-23:40
            Re: Get VBCC+VASM+VLINK to work? sqward Aug,16.2013-12:57
              Re: Get VBCC+VASM+VLINK to work? ggn Aug,16.2013-17:30
                Re: Get VBCC+VASM+VLINK to work? PeP Aug,19.2013-11:33
  Re: Get VBCC+VASM+VLINK to work? Orion_ Aug,14.2013-01:08
    Re: Get VBCC+VASM+VLINK to work? Sdw Aug,14.2013-11:45


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson