Jump to content
IGNORED

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


Larry

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.
  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...

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
Link to comment
Share on other sites

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

 

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.

  • Like 1
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 6 years later...

; 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

Hi JAC!,

 

thanks for your example, I wanted to consult to use it in mads that I have to change?

 

since I made some changes but it does not work, a POKE 842,12:POKE 710,0 is not executed

 

regards

Edited by ascrnet
  • Like 2
Link to comment
Share on other sites

.byte "E:" must be 'E:' instead.

* = ... word ... must be run test

 

just change that and I left it like that

editor 
	.byte 'E:',$9b

line	
	.byte "POKE 842,12:POKE 710,0"
lineend

	run start

prints the line in basic and the cursor goes down many times, but the line is not executed. there is my doubt that I am doing wrong or that I am missing. :?

Link to comment
Share on other sites

Shouldn't you disable screen DMA before enabling the BASIC ROM?

What if the screen memory or display list happens to be in the A000-BFFF area?

 

I deactivated it to see what happened on the screen with the basic

I use the A000 memory as recommended.

 

regards

Link to comment
Share on other sites

Missing character is because of the direct screen write on top of the cursor, so it gets stomped by the space that's already saved by the Display Handler in OLDCHR. That's a moot issue though because the text needs to be drawn two lines down. Honestly, I wouldn't use direct screen writes, just do one big put command to draw the text and move the cursor back up with control chars.

  • Like 2
Link to comment
Share on other sites

I really like the HATABS idea that Jon suggested - it sticks to programming etiquette and you could use a counter or special EOF character to instruct the handler to put things back to default. Plus you don't need any screen trickery to hide what's going on.

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...