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

Atari coding BBS
 
Re: Loading PRG's from intro's
Posted by: Bod/STAX Jan,17.2005-18:10 

Hi there!

There are two ways you can do this. The first way is when you exit your intro, just before you quit insert this code:

pea env(pc)
pea env(pc)
move.l fname,-(sp)
clr.w -(sp)
move.w #$4b,-(sp)
trap #1
add.l #12,sp
tst.l d0
bmi.s load_error

clr.w -(sp)
trap #1

fname dc.l 0 ; pointer to filename

load_error: ; put load error code here.

The problem with doing things this way is that if your intro uses 100kb RAM you'll have 100kb less memory to load the intro in. The second and best way is to do the following:

1. Assemble the following code to disk:

fname equ $800

opt o+,p+

move.l 4(sp),a3
move.l $c(a3),d0
add.l $14(a3),d0
add.l $1c(a3),d0
add.l #$100,d0
move.l d0,-(sp)
move.l a3,-(sp)
clr.w -(sp)
move.w #$4a,-(sp)
trap #1
add.l #12,sp
tst.l d0
bmi.s exit

bsr vsync
lea blank_pal(pc),a0
bsr.s set_pal

lea text(pc),a0
bsr.s print_text

bsr vsync
lea pal(pc),a0
bsr.s set_pal

pea env(pc)
pea env(pc)
pea fname
clr.w -(sp)
move.w #$4b,-(sp)
trap #1
add.l #12,sp
tst.l d0
bmi.s load_error

pea reset_comp(pc)
move.w #38,-(sp)
trap #14
addq.w #6,sp

reset_comp move.l $4.w,a0
jmp (a0)

load_error bsr.s vsync
lea blank_err(pc),a0
bsr.s set_pal

lea error_text(pc),a0
bsr.s print_text

bsr.s vsync
lea err_pal(pc),a0
bsr.s set_pal

move.w #1,-(sp)
trap #1
addq.w #2,sp

bsr.s vsync
lea pal(pc),a0
bsr.s set_pal

lea cls(pc),a0
bsr.s print_text

exit clr.w -(sp)
trap #1

set_pal pea (a0)
move.w #6,-(sp)
trap #14
addq.w #6,sp
rts

print_text pea (a0)
move.w #9,-(sp)
trap #1
addq.w #6,sp
rts

vsync move.w #$25,-(sp)
trap #14
addq.w #2,sp
rts

blank_pal dcb.w 16,$777
pal dc.w $777,$000,$000,$000,$000,$000,$000,$000
dc.w $000,$000,$000,$000,$000,$000,$000,$000
blank_err dcb.w 16,$700
err_pal dc.w $700,$000,$000,$000,$000,$000,$000,$000
dc.w $000,$000,$000,$000,$000,$000,$000,$000
env dc.l 0
cls dc.b 27,"E",0
text dc.b 27,"E"
dc.b 27,"Y",32+6,32+12,"- PLEASE WAIT -"
dc.b 27,"Y",32+7,32+8,"LOADING AND DECRUNCHING",0
error_text dc.b 27,"E"
dc.b 27,"Y",32,32+9,"*** LOADING ERROR! ***",13,10,13,10
dc.b "The program you have attempted to load",13,10
dc.b "is either corrupt or missing from this",13,10
dc.b "disk. In either case get yourself",13,10
dc.b "another copy.",13,10,13,10
dc.b "Any key to exit...",0
end

2. Copy your intro into the auto folder and then copy the above assembled code into the auto folder (this should ALWAYS be the second program to be executed from there).

3. Just before you exit your intro copy the name of the intro's path+filename to the address at 'fname' (in this case $800) including '0' terminate byte and exit as normal.

4. The above code will be loaded and will pick up the filename from $800 and load and run it.

Because the above code only wastes a few bytes you'll have virtualy all the RAM free to run the intro.

Hope this helps. :)







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

Topic Posted by  Date 
Loading PRG's from intro's Scheme Jan,17.2005-16:51
  Re: Loading PRG's from intro's Bod/STAX Jan,17.2005-18:10
    Re: Loading PRG's from intro's Bod/STAX Jan,17.2005-18:13
      Re: BOD/Stax Scheme Jan,18.2005-23:17
        Re: BOD/Stax Bod/STAX Jan,19.2005-20:37
  Re: Loading PRG's from intro's Shw / D-Bug Jan,17.2005-18:21
    Re: Loading PRG's from intro's Scheme Jan,17.2005-21:20
      Re: Loading PRG's from intro's MUG U.K(tm) Jan,18.2005-17:08
        Re: Loading PRG's from intro's Anonymous Jan,18.2005-23:13
          Re: Loading PRG's from intro's Scheme Jan,18.2005-23:15
            Re: Loading PRG's from intro's boris Jan,19.2005-02:00


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