view bootman/bootman.as @ 2958:77500452de1c

bootman: Rename assembler files to .as
author Tormod Volden <debian.tormod@gmail.com>
date Sun, 09 Feb 2014 22:53:29 +0100
parents bootman/bootman.a@9b435e747ff2
children ee6df245e208
line wrap: on
line source

         NAM    bootman
         TTL    Boot Manager

BOOTTRACK equ   0


         PSECT  bootman,$11,$80,0,0,entry

         VSECT
         ENDSECT

TOP      EQU   $FE00

* The entry point of the boot manager
* Entry: stack is set up, U points to static storage
         csect
sectptr  rmb    2
         endsect

entry    lbsr   mach_init   initialize the machine we're running on
         leas   entry,pcr   set up stack
         leau   entry-256,pcr set up static storage
         leax   entry-512,pcr set up sector buffer pointer
         stx    sectptr,u
         leax   welcome,pcr
         bsr    writestr

* start booter calling
bootup
         leax   cfg_boot,pcr
         ldy    ,x             get address of booter
         beq    bootup         if 0, try again

* call booter's get info entry
         leax   attempt,pcr
         bsr    writestr
         jsr    12,y
         bsr    writestr
         leax   crlf,pcr
         bsr    writestr

loop     bra    loop


attempt  fcc     "Attempting to boot from "
         fcb     0
welcome  fcc     "NitrOS-9 Boot Manager"
crlf     fcb     13,10
         fcb     0

* Helpful routines

* writestr - write string to output handler
* Entry:
*   X = address of string (nul terminated)
* Preserves:
*   Y
writestr:
         pshs    y
         leay    llio,pcr
writeloop
         lda     ,x+
         beq     writedone
         jsr     3,y
         bra     writeloop
writedone
         puls    y,pc
         
         endsect