From: Tormod Volden Date: Mon, 6 Apr 2015 10:38:09 +0000 (+0200) Subject: dragon-nx32: Add DWLOAD bootloader X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=de995eebc8d2130aad8e94f46bad99ec1bf0af62;p=FUZIX.git dragon-nx32: Add DWLOAD bootloader Signed-off-by: Tormod Volden --- diff --git a/Kernel/platform-dragon-nx32/README b/Kernel/platform-dragon-nx32/README index 2a7d258e..857951a0 100644 --- a/Kernel/platform-dragon-nx32/README +++ b/Kernel/platform-dragon-nx32/README @@ -17,3 +17,36 @@ Swapping out to disk does not work yet. There is not much 6809 userspace work done. + +Using DriveWire + +For bootstrapping, the fuzix.bin DECB binary must be loaded into +internal RAM and cartridge bank 0. This is currently done over +DriveWire, using a "DWLOAD" program tweaked for FUZIX. The changes +from stock DWLOAD are: +- do not enable interrupts upon execution of the payload +- jmp instead of jsr so that stack is not used +- default name of payload is "fuzix.bin" +- activate cartridge memory when writing payload to RAM +Additionally it is built to run from 0x600 so that FUZIX can +be loaded anywhere from 0x800 and up. + + lwasm --pragma=condundefzero -r -b -odwfuz.bin dwload.asm -DFUZIX -DRAMORG=0x600 +Or for an emulator with Becker port: + lwasm --pragma=condundefzero -r -b -odwfuzb.bin dwload.asm -DFUZIX -DRAMORG=0x600 -DBECKER +For XRoar, just add -load dwfuzb.bin to its invocation, and on the Dragon: + EXEC&H600 + +To make an audio file for loading DWLOAD via the cassette port: + makewav -r -c -odwfuz.wav dwfuz.bin +The makewav utility can be found at toolshed.sf.net +On the Dragon type: CLOADM:EXEC&H600 + +If you already have DWLOAD (in patched BASIC ROM), you can build +the FUZIZ loader as a "dweeb": + lwasm -r -b -oDWFUZ dwload.asm -DFUZIX -DRAMORG=0x600 -DDWEEB +On the Dragon type: DLOAD"DWFUZ" + +Note that if using the DW4 DriveWire server, all files must be padded to +a multiple of 256 bytes! Use for instance Kernel/tools/pad256 + diff --git a/Kernel/platform-dragon-nx32/dwload.asm b/Kernel/platform-dragon-nx32/dwload.asm new file mode 100644 index 00000000..8a28a7e9 --- /dev/null +++ b/Kernel/platform-dragon-nx32/dwload.asm @@ -0,0 +1,468 @@ +******************************************************************** +* dwload implementation for Dragon +* +* Copyright 2014-2015 Tormod Volden +* Copyright 2008 Boisy G. Pitre (parts taken from toolshed/dwdos) +* +* Distributed under the GNU General Public License, version 2 or later. +* +* For patching BASIC ROM (upper 8KB), replacing DLOAD command: +* lwasm --pragma=condundefzero -r -b -odwload.bin dwload.asm -DD32ROM +* +* Standalone, and using Becker interface +* lwasm --pragma=condundefzero -r -b -odwload.bin dwload.asm -DBECKER +* +* Build a "dweeb" for chainloading by a "normal" build: +* lwasm -r -b -odwload.bin dwload.asm -DDWEEB +* +* Example build for other address: +* lwasm -r -b -odwload.bin dwload.asm -DDWEEB -DRAMORG=0x600 +******************************************************************** + + +* dwload temporary RAM storage +noexec equ $10 inhibit exec after loading +bootflag equ $11 zero if run from command line, $55 if autorun on boot +dnum equ $12 assigned drive number from server +sstack equ $1cd backup of original stack +sector equ $1cf counter, used when loading file contents, just below namebuf/DECB header +reqbuf equ namebuf-1 +namebuf equ $1d1 fixed by BASIC read filename function +decbhdr equ namebuf DECB headers get copied in here +startbuf equ namebuf+8 dw input data buffer, can reuse buffer after DECB header slot +endbuf equ startbuf+256 +tmpstack equ $3fc normally enough unused area below here (goes 30 bytes deep) + +* ROM routines used +OUTCH equ $BCAB print char A to screen +OUTCHR equ $B54A print char A to DEVNUM +OUTSTR equ $90E5 print string at X+1 to DEVNUM +OUTNUM equ $957A print number in D to DEVNUM +GETFNAM equ $B7AA read file name and length into $1d1 +OKPRMPT equ $8371 BASIC OK prompt, command loop +IOERROR equ $B84B IO_error +RUNBASIC equ $849F run_basic, enable IRQs etc +BASVECT1 equ $841F reset BASIC vectors, reset stack etc +BASVECT2 equ $83ED initialize BASIC +SYSERR equ $8344 system error +BACKSPC equ $9A89 print a backspace to DEVNUM + + + IFNDEF RAMORG + IFDEF DWEEB +RAMORG equ $0E00 + ELSE +RAMORG equ $7400 + ENDC + ENDC + + IFDEF D32ROM +Top equ $BE7F Dragon 32 unused ROM space + ELSE +Start equ RAMORG + ENDC + +* Entry point from command line (DLOAD or EXEC) + IFDEF D32ROM + org $A049 DLOAD dispatch + ELSE + org Start + + IFDEF DW4 + ldx #goturbo + ldy #1 + lbsr DWWrite + ldx #$A000 +Spint leax -1,x + bne Spint + bra Entry +goturbo fcb $E6 + ENDC + + ENDC +* for later to see that we came from DLOAD command + clr