2021-08-16 02:40:47 +00:00
|
|
|
(import-macros {:sss ! : compile} :ssc.macros)
|
|
|
|
|
|
|
|
#(compile $1
|
2021-09-11 02:55:47 +00:00
|
|
|
(start-symbol boot-8)
|
2021-08-20 03:51:12 +00:00
|
|
|
(org 0x1000)
|
2021-09-11 02:55:47 +00:00
|
|
|
(fn boot-8 ()
|
|
|
|
(asm (clc) (xce) (rep 0x30) ; disable emulation mode, 16-bit index registers
|
|
|
|
(jsr boot)
|
|
|
|
(sec) (xce))) ; re-enter emulation mode
|
|
|
|
|
|
|
|
(org 0x060000)
|
2021-08-16 02:40:47 +00:00
|
|
|
(require ssc.iigs.toolbox)
|
2021-08-20 03:51:12 +00:00
|
|
|
(require ssc.task)
|
2021-08-16 02:40:47 +00:00
|
|
|
|
|
|
|
(global word BootUserID)
|
|
|
|
(global long BootHandle-00)
|
|
|
|
(global long BootHandle-01)
|
|
|
|
(global long BootHandle-e0)
|
|
|
|
(global long BootHandle-e1)
|
2021-09-11 02:55:47 +00:00
|
|
|
(global long BootHandle-06)
|
|
|
|
|
2021-08-16 02:40:47 +00:00
|
|
|
(fn boot ()
|
2021-09-11 02:55:47 +00:00
|
|
|
(asm (phk) (plb)) ; data currently lives in program bank
|
2021-08-21 02:29:21 +00:00
|
|
|
(save-dp-sp 0x0800)
|
2021-08-20 03:51:12 +00:00
|
|
|
(set-task-base 0x0800) ; space for 8 tasks
|
2021-08-21 02:29:21 +00:00
|
|
|
(save-6502-stack)
|
2021-09-11 02:55:47 +00:00
|
|
|
|
2021-08-16 02:40:47 +00:00
|
|
|
; http://www.1000bit.it/support/manuali/apple/technotes/pdos/tn.pdos.27.html
|
|
|
|
; When bootstrapping with no OS, we must reserve
|
|
|
|
(TLStartUp)
|
|
|
|
(LoadOneTool ToolsetMisc 0x0100)
|
|
|
|
(MTStartUp)
|
|
|
|
(set! BootUserID (GetNewID 0x1f00))
|
|
|
|
|
|
|
|
(LoadOneTool ToolsetMemoryManager 0x0100)
|
2021-09-11 02:55:47 +00:00
|
|
|
(set! BootHandle-06 (NewHandle 0xffff BootUserID 0xb017 0x060000))
|
2021-08-16 02:40:47 +00:00
|
|
|
(set! BootHandle-00 (NewHandle 0xb800 BootUserID 0xb017 0x000800))
|
|
|
|
(set! BootHandle-01 (NewHandle 0xb800 BootUserID 0xb017 0x010800))
|
|
|
|
(set! BootHandle-e0 (NewHandle 0x4000 BootUserID 0xb017 0xe02000))
|
|
|
|
(set! BootHandle-e1 (NewHandle 0x8000 BootUserID 0xb017 0xe12000))
|
|
|
|
|
|
|
|
(asm (jsr [(or $2 :main)]))
|
|
|
|
|
|
|
|
(DisposeHandle BootHandle-e1)
|
|
|
|
(DisposeHandle BootHandle-e0)
|
|
|
|
(DisposeHandle BootHandle-01)
|
|
|
|
(DisposeHandle BootHandle-00)
|
2021-09-11 02:55:47 +00:00
|
|
|
(DisposeHandle BootHandle-06)
|
2021-08-16 02:40:47 +00:00
|
|
|
(DeleteID BootUserID)
|
|
|
|
|
|
|
|
(MTShutDown)
|
2021-08-20 03:51:12 +00:00
|
|
|
|
2021-08-21 02:29:21 +00:00
|
|
|
(restore-6502-stack)
|
2021-08-20 03:51:12 +00:00
|
|
|
(restore-dp-sp)
|
2021-09-11 02:55:47 +00:00
|
|
|
(asm (rtl))))
|
2021-08-16 02:40:47 +00:00
|
|
|
|