Jump to content



1

Source (or explanation) of Autorun.Sys for Basic?


14 replies to this topic

#1 Larry OFFLINE  

Larry

    Stargunner

  • 1,731 posts
  • Location:U.S. -- Midwest

Posted Fri Feb 10, 2012 6:12 AM

There are many Autorun.Sys files that run Basic programs at boot-up, but I cannot find one with the source code so I could better understand what is going on.

Does anyone have one (or a link) that has commented source code or could add some comments as to what is happening in the prog?

Thanks,
Larry

#2 Rybags OFFLINE  

Rybags

    Quadrunner

  • 10,314 posts
  • Location:Australia

Posted Fri Feb 10, 2012 6:28 AM

There's a few ways you could do it.

1. Put RUN "program.bas" onscreen then either set forced input on (AUX1=$0D) or put a Return into the keypress buffer. To keep the user in the dark as to what's going on you could set the text colour = background colour and disable key/Break processing.

2. "Inject" the program into memory, set Basic's zero-page pointers appropriately and call the routine in Basic ROM to run the program.

3. Do a direct call to the Basic ROM with the RUN "program.bas" parameter set up.

The Basic Source book might have more info. As for programs to do this sort of thing, there'd be dozens of them around.

Edited by Rybags, Fri Feb 10, 2012 6:29 AM.


#3 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 5,410 posts
  • Jumping through hOOPs...
  • Location:United Kingdom

Posted Fri Feb 10, 2012 6:30 AM

Here are a couple with commented source code. The basic (no pun intended) idea is to intercept the CIO when the "Ready" prompt is printed or when BASIC asks the screen editor for a new line. It's probably possible to use "forced read" mode, but I think the idea in these examples is that the CIO get byte routine is temporarily redefined to simply pull the name of the BASIC program a character at a time and return it to the screen editor, so BASIC thinks the user actually typed it.

#4 Larry OFFLINE  

Larry

    Stargunner

  • 1,731 posts
  • Location:U.S. -- Midwest

Posted Fri Feb 10, 2012 7:48 AM

Thanks Guys!

Googling did no good for me on this one, but I did find another good explanation with source code in Analog #66 (Nov. 1988) page 68: "Autorun.Sys Secrets." The gist of it is what you said FJC.

Article is found in the scans here: http://analog.katorlegaz.com/

-Larry

#5 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 5,410 posts
  • Jumping through hOOPs...
  • Location:United Kingdom

Posted Fri Feb 10, 2012 8:30 AM

I Googled "Atari autorun.sys basic" and the wiki article was top of the second page of results. :)

#6 Larry OFFLINE  

Larry

    Stargunner

  • 1,731 posts
  • Location:U.S. -- Midwest

Posted Fri Feb 10, 2012 9:17 AM

I went 3 pages deep and at least didn't see it. It seems like they do not always come up in the same order (except paid results). I did find a Compute! article listed that looked promising, but Atari Magazines doesn't have that issue's text --just the index for that issue.
-Larry

#7 Rybags OFFLINE  

Rybags

    Quadrunner

  • 10,314 posts
  • Location:Australia

Posted Fri Feb 10, 2012 9:35 AM

I reckon you won't get much tighter than the one Jon linked to.

Maybe alter it to disable the Break key, other than that it looks ready to roll.

Or you could have it use an external file as the input rather than the imbedded text.

#8 JAC! OFFLINE  

JAC!

    Moonsweeper

  • 472 posts
  • Always looking for GFX and MSX for my demos
  • Location:Lebach, Germany

Posted Fri Feb 10, 2012 10:37 AM

Here mine which uses case 1 Rybags mentioned.
It also works correctly if BASIC was disabled before which is something many modfied OS do by default (experienced user do automatically because they don't expect BASIC programs ;.)


; Switches on BASIC, re-opens the editor, checks the RBAM and autoruns "AUTORUN.BAS"
; Save executable as "AUTORUN.SYS"
; JAC! - 2010


iocb = $340 ;IOCB base address
iocom = iocb+2 ;IOCB command
ioadr = iocb+4 ;IOCB buffer address
ioaux1 = iocb+10 ;IOCB auxilary byte 1
ioaux2 = iocb+11 ;IOCB auxilary byte 1

ciov = $e456 ;CIO vector

open = $03 ;Command: OPEN
close = $0c ;Command: CLOSE

rw = 12
rwauto = 13

* = $600

start
cld
clc
lda $d301 ;Enable BASIC
and #$fd
sta $d301

ldx #0 ;Channel 0

lda #close ;Close editor
sta iocom,x
jsr ciov

lda #open ;Open editor to ensure memtop is correct
sta iocom,x
lda #<editor
sta ioadr,x
lda #>editor
sta ioadr+1,x
lda #rw ;read and write
sta ioaux1,x
lda #0
sta ioaux2,x
jsr ciov

lda #rwauto ;Switch to automatic input mode
sta ioaux1,x


lda #0 ;Screen off, will be switch on by the next GRAPHICS statement
sta 559

wait lda 20 ;Wait until screen is off
cmp 20
beq wait

ldx #[lineend-line]-1
ldy #[lineend-line]-1+2
copyline
lda line,x
sta (88),y
dey
dex
bpl copyline
rts



editor .byte "E:",$9b

; Disable automatic input mode
line .sbyte "POKE 842,12:RUN ",34,"D1:AUTORUN.BAS",34
lineend


* = $2e0
.word test


#9 Rybags OFFLINE  

Rybags

    Quadrunner

  • 10,314 posts
  • Location:Australia

Posted Fri Feb 10, 2012 10:57 AM

You'd need to set the Ramtop ($6A) OS variable there. If Basic is off then it = $C0 and you'd need to set to $A0.

A quick/dirty way to Close an IOCB is to set the Dev Index (ICHID $340) to $FF.

Edited by Rybags, Fri Feb 10, 2012 10:59 AM.


#10 Larry OFFLINE  

Larry

    Stargunner

  • 1,731 posts
  • Location:U.S. -- Midwest

Posted Fri Feb 10, 2012 2:23 PM

Thanks, Jac!

Nicely commented and easy to follow! That's just the kind of assembler code I need! ;)

-Larry

#11 JAC! OFFLINE  

JAC!

    Moonsweeper

  • 472 posts
  • Always looking for GFX and MSX for my demos
  • Location:Lebach, Germany

Posted Fri Feb 10, 2012 2:36 PM

As Rybags mentioned:

lda $d301 ;Enable BASIC
and #$fd
sta $d301

lda #>$a000 ; Set RAMTOP to begin of BASIC ROM $a000
sta $6a


Edited by JAC!, Fri Feb 10, 2012 2:36 PM.


#12 russg OFFLINE  

russg

    Dragonstomper

  • 523 posts
  • Location:Cleveland, Ohio

Posted Sat Feb 18, 2012 4:03 PM

There's a really neat program called 'fast fingers' that makes an autorun.sys that
types anything you want. It is from Antic 1984, February. You run the BASIC
program, type what you want to happen at bootup, and then hit CNTRL-3 to save
it to AUTORUN.SYS.

Attached Files


Edited by russg, Sat Feb 18, 2012 4:04 PM.


#13 russg OFFLINE  

russg

    Dragonstomper

  • 523 posts
  • Location:Cleveland, Ohio

Posted Sun Feb 19, 2012 7:15 AM

View Postrussg, on Sat Feb 18, 2012 4:03 PM, said:

There's a really neat program called 'fast fingers' that makes an autorun.sys that
types anything you want. It is from Antic 1984, February. You run the BASIC
program, type what you want to happen at bootup, and then hit CNTRL-3 to save
it to AUTORUN.SYS.
It doesn't have to be AUTORUN.SYS, you can re-name it anything you want if you
just want to 'type' something often ie. it is a normal binary load.

Edited by russg, Sun Feb 19, 2012 7:16 AM.


#14 Larry OFFLINE  

Larry

    Stargunner

  • 1,731 posts
  • Location:U.S. -- Midwest

Posted Mon Feb 20, 2012 5:42 PM

Thanks, Russ. I remember this program from Antic many years ago. ____ Chamberlin, author (or something like that) according to my rusty memory. (?)
(I didn't look it up, if by chance I'm right...)
-Larry

View Postrussg, on Sun Feb 19, 2012 7:15 AM, said:

View Postrussg, on Sat Feb 18, 2012 4:03 PM, said:

There's a really neat program called 'fast fingers' that makes an autorun.sys that
types anything you want. It is from Antic 1984, February. You run the BASIC
program, type what you want to happen at bootup, and then hit CNTRL-3 to save
it to AUTORUN.SYS.
It doesn't have to be AUTORUN.SYS, you can re-name it anything you want if you
just want to 'type' something often ie. it is a normal binary load.


#15 russg OFFLINE  

russg

    Dragonstomper

  • 523 posts
  • Location:Cleveland, Ohio

Posted Mon Feb 20, 2012 6:13 PM

Thanks, Russ. I remember this program from Antic many years ago. ____ Chamberlin, author (or something like that) according to my rusty memory. (?)
(I didn't look it up, if by chance I'm right...)
-Larry
Right, Craig Chamberlain. It is easy to read the article, if you download the Antic torrent,
pdfs and atrs. I'm not going to post the 113 megabyte pdf of the 02/84 Antic.
( I also have the original magazine, but it is easier to look in the torrent and dig it out
than dig it out of my Antic boxes.)

Edited by russg, Mon Feb 20, 2012 6:14 PM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users