Mercurial > hg > Members > kono > nitros9-code
changeset 1237:767df8dd8f3d
REL is backported from NitrOS-9 to OS-9 Level Two
author | boisy |
---|---|
date | Fri, 01 Aug 2003 03:17:57 +0000 |
parents | 8508d75c91e0 |
children | 481618f41f1d |
files | level2/coco3/bootfiles/makefile level2/coco3_6309/bootfiles/makefile level2/modules/makefile level2/modules/rel.asm |
diffstat | 4 files changed, 232 insertions(+), 188 deletions(-) [+] |
line wrap: on
line diff
--- a/level2/coco3/bootfiles/makefile Fri Aug 01 03:17:40 2003 +0000 +++ b/level2/coco3/bootfiles/makefile Fri Aug 01 03:17:57 2003 +0000 @@ -9,7 +9,7 @@ DEPENDS = ./Makefile -KERNEL_STOCK = $(MD)/rel $(MD)/boot_1773_6ms $(MD)/os9p1 +KERNEL_STOCK = $(MD)/rel_32 $(MD)/boot_1773_6ms $(MD)/os9p1 # OS-9 disk bootfile to allow booting from WD1773 disk controller BOOTFILE_VDG = $(MD)/os9p2 $(MD)/ioman $(MD)/init \
--- a/level2/coco3_6309/bootfiles/makefile Fri Aug 01 03:17:40 2003 +0000 +++ b/level2/coco3_6309/bootfiles/makefile Fri Aug 01 03:17:57 2003 +0000 @@ -9,7 +9,7 @@ DEPENDS = ./Makefile -KERNEL_STOCK = $(MD)/rel $(MD)/boot_1773_6ms $(MD)/os9p1 +KERNEL_STOCK = $(MD)/rel_32 $(MD)/boot_1773_6ms $(MD)/os9p1 # OS-9 disk bootfile to allow booting from WD1773 disk controller BOOTFILE_VDG = $(MD)/os9p2 $(MD)/ioman $(MD)/init \
--- a/level2/modules/makefile Fri Aug 01 03:17:40 2003 +0000 +++ b/level2/modules/makefile Fri Aug 01 03:17:57 2003 +0000 @@ -18,7 +18,7 @@ BOOTERS = boot_1773_6ms boot_1773_30ms \ boot_burke boot_idelba boot_rampak boot_wd1002 -BOOTTRACK = rel $(BOOTERS) os9p1 +BOOTTRACK = rel_32 rel_40 rel_80 $(BOOTERS) os9p1 KERNEL = os9p2 os9p3_perr os9p4_regdump SYSMODS = ioman init cc3go_h0 cc3go_dd CLOCKS = clock_elim clock_disto2 clock_disto4 clock_bnb \ @@ -52,16 +52,25 @@ # The following macros represent a collection of modules for various # kernel tracks and bootfile configurations. # -KERNEL_1773 = rel boot_1773 os9p1 -KERNEL_RAMPAK = rel $(TPB)/boot_rampak os9p1 -KERNEL_KENTON = rel $(TPB)/boot_kenton os9p1 -KERNEL_IDE = rel $(TPB)/boot_ide os9p1 +KERNEL_1773 = rel_32 boot_1773 os9p1 +KERNEL_RAMPAK = rel_32 $(TPB)/boot_rampak os9p1 +KERNEL_KENTON = rel_32 $(TPB)/boot_kenton os9p1 +KERNEL_IDE = rel_32 $(TPB)/boot_ide os9p1 ALLOBJS = $(BOOTTRACK) $(KERNEL) $(SYSMODS) $(CLOCKS) $(RBF) $(SCF) $(PIPE) all: $(ALLOBJS) # Special cases +rel_32: rel.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aWidth=32 + +rel_40: rel.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aWidth=40 + +rel_80: rel.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aWidth=80 + boot_1773_6ms: boot_1773.asm $(AS) $< $(ASOUT)$@ $(AFLAGS) -aSTEP=0
--- a/level2/modules/rel.asm Fri Aug 01 03:17:40 2003 +0000 +++ b/level2/modules/rel.asm Fri Aug 01 03:17:57 2003 +0000 @@ -1,36 +1,34 @@ ******************************************************************** -* Rel - OS-9 Level Two relocation module +* REL - Relocation routine * * $Id$ * -* Ed. Comments Who YY/MM/DD +* Edt/Rev YYYY/MM/DD Modified by +* Comment * ------------------------------------------------------------------ -* 5 Original version by Tandy/Microware -* 6 Added instruction to put into ALL-RAM mode BGP 98/10/10 -* for ROM based kernels. -* Added more comments from version provided by BGP 98/10/21 -* Curtis Boyle +* 5/5 2003/07/31 Boisy G. Pitre +* Back ported NitrOS-9 REL to OS-9 Level Two. nam REL - ttl OS-9 Level Two relocation module + ttl Relocation routine - ifp1 + ifp1 use defsfile - endc + endc -ScStart equ $8000 screen start in memory +ScStart equ $8008 screen start in memory XX.Size equ 6 number of bytes before REL actually starts Offset equ Bt.Start+XX.Size -tylg set Systm+Objct +tylg set Systm+Objct atrv set ReEnt+rev -rev set $01 -edition set 6 +rev set $05 +edition set 5 ******************************************************************** * Any changes to the next 3 lines requires changes in XX.Size, above fcc /OS/ sync bytes - bra Start+XX.Size execution start + bra Start+XX.Size execution start fdb $1205 filler bytes mod eom,name,tylg,atrv,start,size @@ -41,190 +39,227 @@ name fcs /REL/ fcb edition -* OS-9 boot message (Setup for a 32 column screen) +L001F fcb $6C MMU, IRQ, Vector page, SCS + fcb $00 map type 0 + fcb $00 no FIRQ + fcb $00 no IRQ + fdb $0900 timer + fcb $00 unused + fcb $00 unused + IFEQ TkPerSec-50 + fcb $0B 50Hz refresh, alphanumeric display, 8 lines/char row + ELSE + fcb $03 60Hz refresh, alphanumeric display, 8 lines/char row + ENDC + + IFEQ Width-80 + fcb $34 200 lines, 80 column mode, no attribute byte (monochrome) + fcb $3F white border + ENDC + + IFEQ Width-40 + fcb $24 200 lines, 40-col, no attribute byte + fcb $3F white border + ENDC -BootMsg fcc /OS/ - fcb $79 - fcb $60 - fcc /BOOT/ + IFEQ Width-32 + fcb $20 200 lines, 32-col, no attribute byte + fcb $00 black border + ENDC + + fcb $00 display in lower 512k bank + fcb $00 vertical fine scroll set to 0 + fcb Bt.Block*4 display block where-ever + fcb $01 offset 8 bytes + fcb $00 no horizontal scroll -* Fail message +crash + lda #'* signal a crash error + jsr <D.BtBug + tfr b,a save error code + jsr <D.BtBug and dump this out, too + clrb + fcb $8C skip 2 bytes -FailMsg fcc /FAILED/ +reset equ * later on, have reset different from start? +start ldb #$FF negative - do complete boot + clr >$FFDF added for OS-9 ROM Kit boots +BGP+ -* GIME register default values +start1 orcc #IntMasks turn off IRQ's + clr >$FF03 turn off SAM IRQ's + clra make A=0 for later + IFNE H6309 + tfr 0,dp set direct page to $0000 + ELSE + tfr a,dp + ENDC + clr <D.CBStrt cold boot start: don't re-boot on reset + clr >$FFA0 map in block 0 + lds #$1FFF set stack to the end of the block + stb ,-s save status of start, $00=cold, $01=warm +* This is done so I can tell what went on in the direct page if there's +* a crash. 0(crash) 1(reset) -1(startup) + beq Cont --don't clear out direct page is it's a crash + ldb #$20 start out at $20 + tfr d,x here, too +L0072 sta ,x+ clear out the direct page + incb Boot won't be using any of it! + bne L0072 BUT RAMMER/MD DOES!!! + inc <D.Speed 0+1=1; high speed +Cont clrb --make sure B=0 + stb >$FFD9 set to high speed + leay <L001F,pcr point to the video setup data + ldx #$0090 set video mapping + deca now D=$FF00, versus STU >-$0100,x (saves 1 byte) +L0084 ldu ,y++ get the bytes + stu d,x save in the hardware + stu ,x++ and in the direct page + cmpx #$00A0 end of video hardware yet? + bcs L0084 -CC3Regs fcb $EC CC2, MMU, IRQ, Vector page, SCS - fcb $00 map type 0 - fcb $00 no FIRQ - fcb $00 no IRQ - fdb $0900 timer - fcb $00 unused - fcb $00 unused - IFEQ TkPerSec-50 - fcb $08 50Hz refresh + IFEQ Width-32 + ldd #$1200 color 0=$12, 1=$00 i.e. black on green + ELSE + ldd #$3F00 color 0=$3F, 1=$00, i.e. black on white + ENDC + std >$FFB0 set only the first two palettes, B=$00 already + lda #Bt.Block + sta >$FFA4 map in the block + + ldx #$8000 start of the block + IFNE H6309 + ldq #Bt.Flag*65536+8 ELSE - fcb $00 60Hz refresh + ldd #Bt.Flag + ENDC + tst ,s check status : 0(crash) 1(reset) -1(startup) + bmi StoreQ if NOT a crash or reset, start at the start... + cmpd ,x are they the same? + beq MoveTxt don't bother clearing the screen if it's there +StoreQ + IFNE H6309 + stq ,x otherwise save the bytes on-screen + ELSE + std ,x + ldd #8 + std 2,x ENDC - fcb $00 - fcb $00 - fcb $00 - fdb $0FE0 - fcb $00 - fcb $00 + + leax 8,x point to the start of the screen in memory + IFNE H6309 + ldw #$2000-8 clear out the entire block of memory + leau <L00E0,pcr point to $20, a space + tfm u,x+ clear out the screen + ELSE + ldd #$2000-8 + ldu #$2020 +ClrLoop stu ,x++ + subd #$0002 + bne ClrLoop + ENDC -* Palette register default colors +MoveTxt leau <L0011,pcr point to OS-9 Welcome Message + bsr Move1 E=$00 already from TFM above... +* 0 = crash +* 1 = reset +* -1 = startup + ldb ,s+ check state of boot + bne L00E2 if OK, continue +* U=<L0019 already from TFM above (call to L00FD) + bsr Move1 move it on-screen, E=$00 already + clr >$FF40 turn off disk drives +L00E0 bra L00E0 loop forever + +Move1 ldy ,u++ get where to put the text + IFNE H6309 +Move ldf ,u+ get the size of the block to move +L00FD tfm u+,y+ + ELSE +Move clra + ldb ,u+ + tfr d,x +L00FD lda ,u+ + sta ,y+ + leax -1,x + bne L00FD + ENDC + rts + +L0011 fdb ScStart+(11*Width)+((Width-L1)/2) + fcb L1 length of the text below + IFNE NitrOS9 +T1 fcc /Welcome to NitrOS-9!/ + ELSE +T1 fcc /Welcome to OS-9!/ + ENDC +L1 equ *-T1 -DefPals fcb $12 green - fcb $36 - fcb $09 blue - fcb $24 red - fcb $3F white - fcb $1B cyan - fcb $2D magenta - fcb $26 - fcb $00 black - fcb $12 green - fcb $00 black - fcb $3F white - fcb $00 black - fcb $12 green - fcb $00 black - fcb $26 + fdb ScStart+(13*Width)+((Width-LFail)/2) + fcb LFail length of the 'FAILED' string +TFail fcc /FAILED/ +LFail equ *-TFail + +* saves 2 bytes over leax <L00E2,pc, cmpx #Bt.Start +L00E2 tfr pc,d get the address at which we're executing + cmpa #$26 the bootfile starts out at $2600 + bne L0101 if not at $26xx, continue with booting + ldu #$2600 else move rel, Boot, OS9p1 over + IFNE H6309 + ldw #$1200 size of track 34 boot file + ELSE + ldx #$1200 + ENDC + ldy #Bt.Start where to put it + bsr L00FD 1 byte smaller than tfm in place + jmp >Offset+L0101 -* CC crash routine (This gets moved to direct page) +BtDebug pshs cc,d,x save the register + orcc #IntMasks turn IRQ's off + ldb #Bt.Block block to map in + stb >$FFA0 map the boot screen into block 0 + ldx >$0002 where to put the bytes + sta ,x+ put the character on-screen + stx >$0002 save updated address + clr >$FFA0 map block 0 in again + puls cc,d,x,pc restore X and exit + +L0101 + lda #$7E RTS + sta <D.BtBug + leax <BtDebug,pc point to debug routine + stx <D.BtBug+1 -CrashRtn clr >Dat.Task go to map type 0 - called by CC3Go from map 1 + leau <R.Crash,pcr point to D.Crash, D.CBStart + ldy #D.Crash move it over + bsr Move E=$00 from call to L00FD above. + IFNE NitrOS9 + ldmd #$03 go to native mode, FIRQ saves all registers + inc <D.MDREG 0+1=1; set MD shadow register (clr'd from above) + ENDC + +* leax <eom,pcr point to the end of REL +* ldd M$Size,x get size of the next module +* leax d,x skip Boot, point to OS9p1 + ldx #$F000 we KNOW where OS9p1 starts in memory + ldd M$Exec,x get execution start address + jmp d,x jump to it + +* D.Crash +R.Crash fcb $10 size of the data to move over +L003F clr >$FF91 go to map type 0 - called by CC3Go from map 1 jmp >Offset+crash -* CC3 warmstart - fcb $00 warm start flag fdb $0074 go to $0074, next routine + * reset vector: map ROMs out and go to REL in the default DECB block map, -* which is still block $3F at the top of memory +* which is still block $3F at the top fo memory nop required for the ROMs to believe it's a reset vector - clr >$FFDF go to all RAM mode +* clr >$FFDF go to all RAM mode jmp >Offset+reset and re-start the boot -crash - fcb $C6,$01,$20,$07,$4F - fcb $53,$20,$5B,$12,$05 - -****************************** -* -* Main entry point -* - -reset -start clr $FFDF ALL RAM MODE (for ROM-based kernels) ++BGP - clrb - orcc #IntMasks turn off IRQ's - clr >PIA0Base+3 turn off SAM IRQ's - clra - tfr a,dp set direct page to $0000 - sta <D.CbStrt - sta DAT.Regs map in block 0 - lds #$1FFF set stack to the end of the block - pshs b set first byte of stack to 0 - ldb #D.Clock get length of system direct page to initialize - ldx #D.Tasks get start of system direct page -L0072 sta ,x+ clear out the direct page - decb done? - bne L0072 no, keep going till done - inca - sta <D.Speed hi speed - sta >$FFD9 set to high speed - leau CC3Regs,pcr point to the video setup data - ldx #D.HINIT set video mapping -L0084 ldd ,u++ get the bytes - std -256,x save in the hardware - std ,x++ and in the direct page - cmpx #D.Speed end of video hardware yet? - bcs L0084 - -* set up palettes - - leau >DefPals,pcr point to palette data - ldy #PalAdr point to GIME palette start - ldb #16 get length of data - bsr CopyRtn move table - - lda #$3E - sta >$FFA4 map in the block - ldx #ScStart start of the block - clrb get length of screen - ldu #$6060 clear out screen mem -L00A9 stu ,x++ save data - decb done? - bne L00A9 no, keep going - -* print 'OS9 BOOT' - - ldy #ScStart+$010C get screen address for print - leau BootMsg,pcr point to boot message - ldb #8 get length of data - bsr CopyRtn print it - -* setup VDG hardware to point at $4000 +Pad fill $39,$127-* - ldb #5 get length of screen init - ldx #$FFC6 get start register to set up screen -L00BF sta ,x++ set SAM bits - decb done? - bne L00BF no, keep going - sta 1,x set last couple of bits - sta 3,x - ldb ,s can we continue? (first byte should be 0) - beq L00DD yes, continue boot - -* boot failed - - ldy #ScStart+$014D get screen address - leau >FailMsg,pcr point to 'Failed' message - ldb #$06 get length of data - bsr CopyRtn show failed message - clr >$FF40 shut off disk motor -Hang bra Hang dead loop forever - -L00DD leax >L00DD,pcr get pointer to where we are in memory - cmpx #$ED00 warm start? - bcc JmpOS9P1 yep... - ldu #$2600 else copy at $2600... - ldx #$1200 $1200 bytes... - ldy #$ED00 ...to $ED00 - bsr L00F8 - jmp >Offset+JmpOS9P1 jump to OS9p1! - -* Copies B bytes from ,U to ,Y - -CopyRtn clra - tfr d,x -L00F8 ldb ,u+ - stb ,y+ - leax -1,x - bne L00F8 - rts - -* Setup Crash routine - -JmpOS9P1 leau >CrashRtn,pcr get pointer to crash routine - ldb #16 get length of crash routine - ldy #D.Crash point to crash routine area - bsr CopyRtn move it - -* Execute Boot module - - leax <eom,pcr point to start of boot - ldd M$Size,x get size of Boot - leax d,x move past it - ldd M$Exec,x get execution offset to OS9p1 - jmp d,x execute it - -* Fill the rest to put Boot at proper address - -Filler fill $39,$12A-3-* - - emod + emod eom equ * - end + end