Mercurial > hg > Members > kono > nitros9-code
changeset 2646:36b811843ab2
Source now works in ROM mode (but not in RAM mode for some reason??)
author | Boisy Pitre <boisy.pitre@nuance.com> |
---|---|
date | Sun, 04 Mar 2012 21:05:14 -0600 |
parents | 23ad0888c0f0 |
children | 99b7caa4c88a |
files | level1/atari/bootroms/liber809.asm |
diffstat | 1 files changed, 511 insertions(+), 383 deletions(-) [+] |
line wrap: on
line diff
--- a/level1/atari/bootroms/liber809.asm Fri Mar 02 14:41:37 2012 -0600 +++ b/level1/atari/bootroms/liber809.asm Sun Mar 04 21:05:14 2012 -0600 @@ -1,292 +1,441 @@ ***************************************************** -* * Liber809 Boot ROM for the 6809-based Atari XL/XE * Currently DriveWire based * +* Assembled with the 'mamou' assembler from the +* ToolShed Project: http://sourceforge.net/projects/toolshed/ +* +* Assemble with this command line: +* mamou -mr liber809.asm -oliber809.rom +* * (C) 2012 Boisy G. Pitre * - -Level equ 1 - use os9.d - use atari.d - use drivewire.d - use atarivtio.d - -RAMDest EQU $1000 location of routine copied to RAM - - org $F000 +* This ROM code copies itself into RAM then puts the machine +* into All-RAM mode. Then it proceeds to initialize the hardware +* and obtain the 'kick' code from the DriveWire server. +* +* This is how the memory map looks for the bootstrap ROM: +* +* $0000----> ================================== +* | Stack | +* $0500---->|==================================| +* | | +* $0500-$08BF | 40*24 Screen Buffer | +* $08C0-$08FF | Screen management variables | +* | | +* $0900---->|==================================| +* | | +* | . . . . . . . . . . . . | +* | | +* $F400---->|==================================| +* | | +* | Character Set Bitmap | +* | | +* $F800---->|==================================| +* | | +* | Init and Load Code | +* | | +* $FFE0---->|==================================| +* | Screen/SIO Vector Addresses | +* $FFF0---->|==================================| +* | 6809 Vectors | +* |==================================| +* + use atari.d + use drivewire.d -******************************************************* -* ROM CODE -* -* This code is run from ROM -* -* ENTRY POINT! -RESETVct -* mask interrupts, then prepare to copy routine into RAM - orcc #$50 - lds #$0100 - bsr ClearIO +* Version +REVMAJOR equ 0 +REVMINOR equ 1 + + +KICKSTART equ $2000 address to load 'kick' +KICKEND equ KICKSTART+8192 +SCRMEM equ $0500 +SCRMEMEND equ $0500+(40*24) +STACK equ SCRMEM +ROMTOP equ $F400 + +* Organization of Screen Managemnt variables +V.CurRow equ SCRMEMEND+0 +V.CurCol equ SCRMEMEND+1 +V.EscVect equ SCRMEMEND+2 +V.EscCh1 equ SCRMEMEND+4 +V.NODrive equ SCRMEMEND+6 + +BAUD192K EQU $2800 +BAUD384K EQU $1000 +BAUD576K EQU $0800 +BAUD1152K EQU $0400 +BAUDRATE EQU BAUD576K + +* Set the following to 1 to run in All-RAM Mode! +ALLRAM_MODE EQU 0 +RAMLOC equ $1000 + + org ROMTOP - clr D.IRQENSHDW DW routines use this low-mem global, so we clear it - leax Target,pcr - ldu #RAMDest - ldy #TargetL +* Character Set -- must be aligned on a 1K boundary! +CharSet + fcb $00,$00,$00,$00,$00,$00,$00,$00 ;$00 - space + fcb $00,$18,$18,$18,$18,$00,$18,$00 ;$01 - ! + fcb $00,$66,$66,$66,$00,$00,$00,$00 ;$02 - " + fcb $00,$66,$FF,$66,$66,$FF,$66,$00 ;$03 - # + fcb $18,$3E,$60,$3C,$06,$7C,$18,$00 ;$04 - $ + fcb $00,$66,$6C,$18,$30,$66,$46,$00 ;$05 - % + fcb $1C,$36,$1C,$38,$6F,$66,$3B,$00 ;$06 - & + fcb $00,$18,$18,$18,$00,$00,$00,$00 ;$07 - ' + fcb $00,$0E,$1C,$18,$18,$1C,$0E,$00 ;$08 - ( + fcb $00,$70,$38,$18,$18,$38,$70,$00 ;$09 - ) + fcb $00,$66,$3C,$FF,$3C,$66,$00,$00 ;$0A - asterisk + fcb $00,$18,$18,$7E,$18,$18,$00,$00 ;$0B - plus + fcb $00,$00,$00,$00,$00,$18,$18,$30 ;$0C - comma + fcb $00,$00,$00,$7E,$00,$00,$00,$00 ;$0D - minus + fcb $00,$00,$00,$00,$00,$18,$18,$00 ;$0E - period + fcb $00,$06,$0C,$18,$30,$60,$40,$00 ;$0F - / + + fcb $00,$3C,$66,$6E,$76,$66,$3C,$00 ;$10 - 0 + fcb $00,$18,$38,$18,$18,$18,$7E,$00 ;$11 - 1 + fcb $00,$3C,$66,$0C,$18,$30,$7E,$00 ;$12 - 2 + fcb $00,$7E,$0C,$18,$0C,$66,$3C,$00 ;$13 - 3 + fcb $00,$0C,$1C,$3C,$6C,$7E,$0C,$00 ;$14 - 4 + fcb $00,$7E,$60,$7C,$06,$66,$3C,$00 ;$15 - 5 + fcb $00,$3C,$60,$7C,$66,$66,$3C,$00 ;$16 - 6 + fcb $00,$7E,$06,$0C,$18,$30,$30,$00 ;$17 - 7 + fcb $00,$3C,$66,$3C,$66,$66,$3C,$00 ;$18 - 8 + fcb $00,$3C,$66,$3E,$06,$0C,$38,$00 ;$19 - 9 + fcb $00,$00,$18,$18,$00,$18,$18,$00 ;$1A - colon + fcb $00,$00,$18,$18,$00,$18,$18,$30 ;$1B - semicolon + fcb $06,$0C,$18,$30,$18,$0C,$06,$00 ;$1C - < + fcb $00,$00,$7E,$00,$00,$7E,$00,$00 ;$1D - = + fcb $60,$30,$18,$0C,$18,$30,$60,$00 ;$1E - > + fcb $00,$3C,$66,$0C,$18,$00,$18,$00 ;$1F - ? + + fcb $00,$3C,$66,$6E,$6E,$60,$3E,$00 ;$20 - @ + fcb $00,$18,$3C,$66,$66,$7E,$66,$00 ;$21 - A + fcb $00,$7C,$66,$7C,$66,$66,$7C,$00 ;$22 - B + fcb $00,$3C,$66,$60,$60,$66,$3C,$00 ;$23 - C + fcb $00,$78,$6C,$66,$66,$6C,$78,$00 ;$24 - D + fcb $00,$7E,$60,$7C,$60,$60,$7E,$00 ;$25 - E + fcb $00,$7E,$60,$7C,$60,$60,$60,$00 ;$26 - F + fcb $00,$3E,$60,$60,$6E,$66,$3E,$00 ;$27 - G + fcb $00,$66,$66,$7E,$66,$66,$66,$00 ;$28 - H + fcb $00,$7E,$18,$18,$18,$18,$7E,$00 ;$29 - I + fcb $00,$06,$06,$06,$06,$66,$3C,$00 ;$2A - J + fcb $00,$66,$6C,$78,$78,$6C,$66,$00 ;$2B - K + fcb $00,$60,$60,$60,$60,$60,$7E,$00 ;$2C - L + fcb $00,$63,$77,$7F,$6B,$63,$63,$00 ;$2D - M + fcb $00,$66,$76,$7E,$7E,$6E,$66,$00 ;$2E - N + fcb $00,$3C,$66,$66,$66,$66,$3C,$00 ;$2F - O + + fcb $00,$7C,$66,$66,$7C,$60,$60,$00 ;$30 - P + fcb $00,$3C,$66,$66,$66,$6C,$36,$00 ;$31 - Q + fcb $00,$7C,$66,$66,$7C,$6C,$66,$00 ;$32 - R + fcb $00,$3C,$60,$3C,$06,$06,$3C,$00 ;$33 - S + fcb $00,$7E,$18,$18,$18,$18,$18,$00 ;$34 - T + fcb $00,$66,$66,$66,$66,$66,$7E,$00 ;$35 - U + fcb $00,$66,$66,$66,$66,$3C,$18,$00 ;$36 - V + fcb $00,$63,$63,$6B,$7F,$77,$63,$00 ;$37 - W + fcb $00,$66,$66,$3C,$3C,$66,$66,$00 ;$38 - X + fcb $00,$66,$66,$3C,$18,$18,$18,$00 ;$39 - Y + fcb $00,$7E,$0C,$18,$30,$60,$7E,$00 ;$3A - Z + fcb $00,$1E,$18,$18,$18,$18,$1E,$00 ;$3B - [ + fcb $00,$40,$60,$30,$18,$0C,$06,$00 ;$3C - \ + fcb $00,$78,$18,$18,$18,$18,$78,$00 ;$3D - ] + fcb $00,$08,$1C,$36,$63,$00,$00,$00 ;$3E - ^ + fcb $00,$00,$00,$00,$00,$00,$FF,$00 ;$3F - underline + + fcb $00,$18,$3C,$7E,$7E,$3C,$18,$00 ;$60 - diamond card + fcb $00,$00,$3C,$06,$3E,$66,$3E,$00 ;$61 - a + fcb $00,$60,$60,$7C,$66,$66,$7C,$00 ;$62 - b + fcb $00,$00,$3C,$60,$60,$60,$3C,$00 ;$63 - c + fcb $00,$06,$06,$3E,$66,$66,$3E,$00 ;$64 - d + fcb $00,$00,$3C,$66,$7E,$60,$3C,$00 ;$65 - e + fcb $00,$0E,$18,$3E,$18,$18,$18,$00 ;$66 - f + fcb $00,$00,$3E,$66,$66,$3E,$06,$7C ;$67 - g + fcb $00,$60,$60,$7C,$66,$66,$66,$00 ;$68 - h + fcb $00,$18,$00,$38,$18,$18,$3C,$00 ;$69 - i + fcb $00,$06,$00,$06,$06,$06,$06,$3C ;$6A - j + fcb $00,$60,$60,$6C,$78,$6C,$66,$00 ;$6B - k + fcb $00,$38,$18,$18,$18,$18,$3C,$00 ;$6C - l + fcb $00,$00,$66,$7F,$7F,$6B,$63,$00 ;$6D - m + fcb $00,$00,$7C,$66,$66,$66,$66,$00 ;$6E - n + fcb $00,$00,$3C,$66,$66,$66,$3C,$00 ;$6F - o + + fcb $00,$00,$7C,$66,$66,$7C,$60,$60 ;$70 - p + fcb $00,$00,$3E,$66,$66,$3E,$06,$06 ;$71 - q + fcb $00,$00,$7C,$66,$60,$60,$60,$00 ;$72 - r + fcb $00,$00,$3E,$60,$3C,$06,$7C,$00 ;$73 - s + fcb $00,$18,$7E,$18,$18,$18,$0E,$00 ;$74 - t + fcb $00,$00,$66,$66,$66,$66,$3E,$00 ;$75 - u + fcb $00,$00,$66,$66,$66,$3C,$18,$00 ;$76 - v + fcb $00,$00,$63,$6B,$7F,$3E,$36,$00 ;$77 - w + fcb $00,$00,$66,$3C,$18,$3C,$66,$00 ;$78 - x + fcb $00,$00,$66,$66,$66,$3E,$0C,$78 ;$79 - y + fcb $00,$00,$7E,$0C,$18,$30,$7E,$00 ;$7A - z + fcb $00,$18,$3C,$7E,$7E,$18,$3C,$00 ;$7B - spade card + fcb $18,$18,$18,$18,$18,$18,$18,$18 ;$7C - | + fcb $00,$7E,$78,$7C,$6E,$66,$06,$00 ;$7D - display clear + fcb $08,$18,$38,$78,$38,$18,$08,$00 ;$7E - display backspace + fcb $10,$18,$1C,$1E,$1C,$18,$10,$00 ;$7F - display tab + + fcb $00,$36,$7F,$7F,$3E,$1C,$08,$00 ;$40 - heart card + fcb $18,$18,$18,$1F,$1F,$18,$18,$18 ;$41 - mid left window + fcb $03,$03,$03,$03,$03,$03,$03,$03 ;$42 - right box + fcb $18,$18,$18,$F8,$F8,$00,$00,$00 ;$43 - low right window + fcb $18,$18,$18,$F8,$F8,$18,$18,$18 ;$44 - mid right window + fcb $00,$00,$00,$F8,$F8,$18,$18,$18 ;$45 - up right window + fcb $03,$07,$0E,$1C,$38,$70,$E0,$C0 ;$46 - right slant box + fcb $C0,$E0,$70,$38,$1C,$0E,$07,$03 ;$47 - left slant box + fcb $01,$03,$07,$0F,$1F,$3F,$7F,$FF ;$48 - right slant solid + fcb $00,$00,$00,$00,$0F,$0F,$0F,$0F ;$49 - low right solid + fcb $80,$C0,$E0,$F0,$F8,$FC,$FE,$FF ;$4A - left slant solid + fcb $0F,$0F,$0F,$0F,$00,$00,$00,$00 ;$4B - up right solid + fcb $F0,$F0,$F0,$F0,$00,$00,$00,$00 ;$4C - up left solid + fcb $FF,$FF,$00,$00,$00,$00,$00,$00 ;$4D - top box + fcb $00,$00,$00,$00,$00,$00,$FF,$FF ;$4E - bottom box + fcb $00,$00,$00,$00,$F0,$F0,$F0,$F0 ;$4F - low left solid + + fcb $00,$1C,$1C,$77,$77,$08,$1C,$00 ;$50 - club card + fcb $00,$00,$00,$1F,$1F,$18,$18,$18 ;$51 - up left window + fcb $00,$00,$00,$FF,$FF,$00,$00,$00 ;$52 - mid box + fcb $18,$18,$18,$FF,$FF,$18,$18,$18 ;$53 - mid window + fcb $00,$00,$3C,$7E,$7E,$7E,$3C,$00 ;$54 - solid circle + fcb $00,$00,$00,$00,$FF,$FF,$FF,$FF ;$55 - bottom solid + fcb $C0,$C0,$C0,$C0,$C0,$C0,$C0,$C0 ;$56 - left box + fcb $00,$00,$00,$FF,$FF,$18,$18,$18 ;$57 - up mid window + fcb $18,$18,$18,$FF,$FF,$00,$00,$00 ;$58 - low mid window + fcb $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0 ;$59 - left solid + fcb $18,$18,$18,$1F,$1F,$00,$00,$00 ;$5A - low left window + fcb $78,$60,$78,$60,$7E,$18,$1E,$00 ;$5B - display escape + fcb $00,$18,$3C,$7E,$18,$18,$18,$00 ;$5C - up arrow + fcb $00,$18,$18,$18,$7E,$3C,$18,$00 ;$5D - down arrow + fcb $00,$18,$30,$7E,$30,$18,$00,$00 ;$5E - left arrow + fcb $00,$18,$0C,$7E,$0C,$18,$00,$00 ;$5F - right arrow -* copy over the target routine from ROM into RAM -loop@ - lda ,x+ - sta ,u+ - leay -1,y - bne loop@ -* this is our jumping off point into the RAM routine - jmp >RAMDEST+(TargetEntry-Target) - -* clear the I/O space between $D000-$D3FFF -ClearIO - clrb -loop - ldx #$D000 - clr b,x - ldx #$D200 - clr b,x - ldx #$D300 - clr b,x - ldx #$D400 - clr b,x - decb - bne loop - rts +* The display list sets up the ANTIC chip to display the main screen. +DList + fcb $70,$70,$70 3 * 8 blank scanlines + fcb $42 Mode 2 with LMS (Load Memory Scan). Mode 2 = 40 column hires text, next 2 bytes L/H determine screen origin + fdbs SCRMEM origin + fcb 2,2,2,2,2,2,2,2,2,2 + fcb 2,2,2,2,2,2,2,2,2,2 + fcb 2,2,2 +* 23 extra mode 2 lines for total of 24. 240 scanlines can be used for display area, but a hires line cannot be on scanline 240 due to an Antic bug + fcb $41 this is the end of Display List command JVB (Jump and wait for Vertical Blank) + fdbs DList + + +SignOnMsg fcc "Liber809 ROM v" + fcb $30+REVMAJOR + fcc "." + fcb $30+REVMINOR + fcc " - Atari XL/XE" + fcb $0D,$0A + fcc "(C) 2012 Boisy G. Pitre" + fcb $0D,$0A + fcb $0D,$0A + fcb 0 +MemModeMsg + IFNE ALLRAM_MODE + fcc "Running in RAM" + ELSE + fcc "Running in ROM" + ENDC + fcb $0D,$0A + fcb 0 +SIOMsg fcc "SIO speed at " + IFNE BAUDRATE-57600 + fcc "57.6" + ELSE + IFNE BAUDRATE-38400 + fcc "38.4" + ENDC + ENDC + fcc "Kbps" + fcb $0D,$0A +MountMsg fcc "Mounting '" +MountName fcc "kick" +MountNameLen equ *-MountName + fcc "'... " + fcb 00 + +OKMsg fcc "OK" + fcb $0D,$0A + fcb 00 + +LoadingMsg fcc "Loading $" + fcb 00 +Loading2Msg fcc " bytes into location $" + fcb 00 + +FailedMsg fcc "FAIL" + fcb $0D,$0A + fcb 00 + +JumpMsg + fcb $0D,$0A + fcc "Jumping to $" + fcb 00 + +ResetMsg fcc "Press RESET to try again" + fcb 00 ******************************************************* -* RAM CODE -* -* This code is copied to lower RAM and executed there. -* -Target -* org RAMDest -* Character Set -- must be aligned on a 1K boundary! -* This actually gets copied into G.CharSetAddr ($F800) -CharSet - fcb $00,$00,$00,$00,$00,$00,$00,$00 ;$00 - space - fcb $00,$18,$18,$18,$18,$00,$18,$00 ;$01 - ! - fcb $00,$66,$66,$66,$00,$00,$00,$00 ;$02 - " - fcb $00,$66,$FF,$66,$66,$FF,$66,$00 ;$03 - # - fcb $18,$3E,$60,$3C,$06,$7C,$18,$00 ;$04 - $ - fcb $00,$66,$6C,$18,$30,$66,$46,$00 ;$05 - % - fcb $1C,$36,$1C,$38,$6F,$66,$3B,$00 ;$06 - & - fcb $00,$18,$18,$18,$00,$00,$00,$00 ;$07 - ' - fcb $00,$0E,$1C,$18,$18,$1C,$0E,$00 ;$08 - ( - fcb $00,$70,$38,$18,$18,$38,$70,$00 ;$09 - ) - fcb $00,$66,$3C,$FF,$3C,$66,$00,$00 ;$0A - asterisk - fcb $00,$18,$18,$7E,$18,$18,$00,$00 ;$0B - plus - fcb $00,$00,$00,$00,$00,$18,$18,$30 ;$0C - comma - fcb $00,$00,$00,$7E,$00,$00,$00,$00 ;$0D - minus - fcb $00,$00,$00,$00,$00,$18,$18,$00 ;$0E - period - fcb $00,$06,$0C,$18,$30,$60,$40,$00 ;$0F - / - - fcb $00,$3C,$66,$6E,$76,$66,$3C,$00 ;$10 - 0 - fcb $00,$18,$38,$18,$18,$18,$7E,$00 ;$11 - 1 - fcb $00,$3C,$66,$0C,$18,$30,$7E,$00 ;$12 - 2 - fcb $00,$7E,$0C,$18,$0C,$66,$3C,$00 ;$13 - 3 - fcb $00,$0C,$1C,$3C,$6C,$7E,$0C,$00 ;$14 - 4 - fcb $00,$7E,$60,$7C,$06,$66,$3C,$00 ;$15 - 5 - fcb $00,$3C,$60,$7C,$66,$66,$3C,$00 ;$16 - 6 - fcb $00,$7E,$06,$0C,$18,$30,$30,$00 ;$17 - 7 - fcb $00,$3C,$66,$3C,$66,$66,$3C,$00 ;$18 - 8 - fcb $00,$3C,$66,$3E,$06,$0C,$38,$00 ;$19 - 9 - fcb $00,$00,$18,$18,$00,$18,$18,$00 ;$1A - colon - fcb $00,$00,$18,$18,$00,$18,$18,$30 ;$1B - semicolon - fcb $06,$0C,$18,$30,$18,$0C,$06,$00 ;$1C - < - fcb $00,$00,$7E,$00,$00,$7E,$00,$00 ;$1D - = - fcb $60,$30,$18,$0C,$18,$30,$60,$00 ;$1E - > - fcb $00,$3C,$66,$0C,$18,$00,$18,$00 ;$1F - ? - - fcb $00,$3C,$66,$6E,$6E,$60,$3E,$00 ;$20 - @ - fcb $00,$18,$3C,$66,$66,$7E,$66,$00 ;$21 - A - fcb $00,$7C,$66,$7C,$66,$66,$7C,$00 ;$22 - B - fcb $00,$3C,$66,$60,$60,$66,$3C,$00 ;$23 - C - fcb $00,$78,$6C,$66,$66,$6C,$78,$00 ;$24 - D - fcb $00,$7E,$60,$7C,$60,$60,$7E,$00 ;$25 - E - fcb $00,$7E,$60,$7C,$60,$60,$60,$00 ;$26 - F - fcb $00,$3E,$60,$60,$6E,$66,$3E,$00 ;$27 - G - fcb $00,$66,$66,$7E,$66,$66,$66,$00 ;$28 - H - fcb $00,$7E,$18,$18,$18,$18,$7E,$00 ;$29 - I - fcb $00,$06,$06,$06,$06,$66,$3C,$00 ;$2A - J - fcb $00,$66,$6C,$78,$78,$6C,$66,$00 ;$2B - K - fcb $00,$60,$60,$60,$60,$60,$7E,$00 ;$2C - L - fcb $00,$63,$77,$7F,$6B,$63,$63,$00 ;$2D - M - fcb $00,$66,$76,$7E,$7E,$6E,$66,$00 ;$2E - N - fcb $00,$3C,$66,$66,$66,$66,$3C,$00 ;$2F - O - - fcb $00,$7C,$66,$66,$7C,$60,$60,$00 ;$30 - P - fcb $00,$3C,$66,$66,$66,$6C,$36,$00 ;$31 - Q - fcb $00,$7C,$66,$66,$7C,$6C,$66,$00 ;$32 - R - fcb $00,$3C,$60,$3C,$06,$06,$3C,$00 ;$33 - S - fcb $00,$7E,$18,$18,$18,$18,$18,$00 ;$34 - T - fcb $00,$66,$66,$66,$66,$66,$7E,$00 ;$35 - U - fcb $00,$66,$66,$66,$66,$3C,$18,$00 ;$36 - V - fcb $00,$63,$63,$6B,$7F,$77,$63,$00 ;$37 - W - fcb $00,$66,$66,$3C,$3C,$66,$66,$00 ;$38 - X - fcb $00,$66,$66,$3C,$18,$18,$18,$00 ;$39 - Y - fcb $00,$7E,$0C,$18,$30,$60,$7E,$00 ;$3A - Z - fcb $00,$1E,$18,$18,$18,$18,$1E,$00 ;$3B - [ - fcb $00,$40,$60,$30,$18,$0C,$06,$00 ;$3C - \ - fcb $00,$78,$18,$18,$18,$18,$78,$00 ;$3D - ] - fcb $00,$08,$1C,$36,$63,$00,$00,$00 ;$3E - ^ - fcb $00,$00,$00,$00,$00,$00,$FF,$00 ;$3F - underline - - fcb $00,$18,$3C,$7E,$7E,$3C,$18,$00 ;$60 - diamond card - fcb $00,$00,$3C,$06,$3E,$66,$3E,$00 ;$61 - a - fcb $00,$60,$60,$7C,$66,$66,$7C,$00 ;$62 - b - fcb $00,$00,$3C,$60,$60,$60,$3C,$00 ;$63 - c - fcb $00,$06,$06,$3E,$66,$66,$3E,$00 ;$64 - d - fcb $00,$00,$3C,$66,$7E,$60,$3C,$00 ;$65 - e - fcb $00,$0E,$18,$3E,$18,$18,$18,$00 ;$66 - f - fcb $00,$00,$3E,$66,$66,$3E,$06,$7C ;$67 - g - fcb $00,$60,$60,$7C,$66,$66,$66,$00 ;$68 - h - fcb $00,$18,$00,$38,$18,$18,$3C,$00 ;$69 - i - fcb $00,$06,$00,$06,$06,$06,$06,$3C ;$6A - j - fcb $00,$60,$60,$6C,$78,$6C,$66,$00 ;$6B - k - fcb $00,$38,$18,$18,$18,$18,$3C,$00 ;$6C - l - fcb $00,$00,$66,$7F,$7F,$6B,$63,$00 ;$6D - m - fcb $00,$00,$7C,$66,$66,$66,$66,$00 ;$6E - n - fcb $00,$00,$3C,$66,$66,$66,$3C,$00 ;$6F - o - - fcb $00,$00,$7C,$66,$66,$7C,$60,$60 ;$70 - p - fcb $00,$00,$3E,$66,$66,$3E,$06,$06 ;$71 - q - fcb $00,$00,$7C,$66,$60,$60,$60,$00 ;$72 - r - fcb $00,$00,$3E,$60,$3C,$06,$7C,$00 ;$73 - s - fcb $00,$18,$7E,$18,$18,$18,$0E,$00 ;$74 - t - fcb $00,$00,$66,$66,$66,$66,$3E,$00 ;$75 - u - fcb $00,$00,$66,$66,$66,$3C,$18,$00 ;$76 - v - fcb $00,$00,$63,$6B,$7F,$3E,$36,$00 ;$77 - w - fcb $00,$00,$66,$3C,$18,$3C,$66,$00 ;$78 - x - fcb $00,$00,$66,$66,$66,$3E,$0C,$78 ;$79 - y - fcb $00,$00,$7E,$0C,$18,$30,$7E,$00 ;$7A - z - fcb $00,$18,$3C,$7E,$7E,$18,$3C,$00 ;$7B - spade card - fcb $18,$18,$18,$18,$18,$18,$18,$18 ;$7C - | - fcb $00,$7E,$78,$7C,$6E,$66,$06,$00 ;$7D - display clear - fcb $08,$18,$38,$78,$38,$18,$08,$00 ;$7E - display backspace - fcb $10,$18,$1C,$1E,$1C,$18,$10,$00 ;$7F - display tab +* ENTRY POINT! +RESETVct +* mask interrupts and setup the stack + orcc #$50 + lds #STACK + +* clear the I/O space between $D000-$D3FFF +ClearIO + clrb +loop + ldx #$D000 + clr b,x + ldx #$D200 + clr b,x + ldx #$D300 + clr b,x + ldx #$D400 + clr b,x + decb + bne loop + +* setup the PIA +SetupPIA + ldd #$3C*256+$FF set PORTB to port + sta PBCTL + stb PORTB + lda #$38 look at data direction registers in PIA + sta PACTL + sta PBCTL + clr PORTA + stb PORTB + lda #$3C switch back to ports + sta PACTL + sta PBCTL + + IFNE ALLRAM_MODE +* Copy RAMCODE to d then execute it + leax RAMCODE,pcr + ldy #RAMLOC + ldb #RAMCODELEN +loop@ lda ,x+ + sta ,y+ + decb + bne loop@ + jmp >RAMLOC + +RAMCODE +* The following is run from RAM +* Copy ROMTOP-$FFFF from ROM to RAM + ldx #ROMTOP + ldd #%11111111*256+%11111110 A = ROM mode, B = RAM mode +copyloop@ + sta PORTB ROM mode + ldu ,x + stb PORTB RAM mode + stu ,x++ + cmpx #$0000 + bne copyloop@ + jmp >Continue +RAMCODELEN equ *-RAMCODE + ENDC - fcb $00,$36,$7F,$7F,$3E,$1C,$08,$00 ;$40 - heart card - fcb $18,$18,$18,$1F,$1F,$18,$18,$18 ;$41 - mid left window - fcb $03,$03,$03,$03,$03,$03,$03,$03 ;$42 - right box - fcb $18,$18,$18,$F8,$F8,$00,$00,$00 ;$43 - low right window - fcb $18,$18,$18,$F8,$F8,$18,$18,$18 ;$44 - mid right window - fcb $00,$00,$00,$F8,$F8,$18,$18,$18 ;$45 - up right window - fcb $03,$07,$0E,$1C,$38,$70,$E0,$C0 ;$46 - right slant box - fcb $C0,$E0,$70,$38,$1C,$0E,$07,$03 ;$47 - left slant box - fcb $01,$03,$07,$0F,$1F,$3F,$7F,$FF ;$48 - right slant solid - fcb $00,$00,$00,$00,$0F,$0F,$0F,$0F ;$49 - low right solid - fcb $80,$C0,$E0,$F0,$F8,$FC,$FE,$FF ;$4A - left slant solid - fcb $0F,$0F,$0F,$0F,$00,$00,$00,$00 ;$4B - up right solid - fcb $F0,$F0,$F0,$F0,$00,$00,$00,$00 ;$4C - up left solid - fcb $FF,$FF,$00,$00,$00,$00,$00,$00 ;$4D - top box - fcb $00,$00,$00,$00,$00,$00,$FF,$FF ;$4E - bottom box - fcb $00,$00,$00,$00,$F0,$F0,$F0,$F0 ;$4F - low left solid - - fcb $00,$1C,$1C,$77,$77,$08,$1C,$00 ;$50 - club card - fcb $00,$00,$00,$1F,$1F,$18,$18,$18 ;$51 - up left window - fcb $00,$00,$00,$FF,$FF,$00,$00,$00 ;$52 - mid box - fcb $18,$18,$18,$FF,$FF,$18,$18,$18 ;$53 - mid window - fcb $00,$00,$3C,$7E,$7E,$7E,$3C,$00 ;$54 - solid circle - fcb $00,$00,$00,$00,$FF,$FF,$FF,$FF ;$55 - bottom solid - fcb $C0,$C0,$C0,$C0,$C0,$C0,$C0,$C0 ;$56 - left box - fcb $00,$00,$00,$FF,$FF,$18,$18,$18 ;$57 - up mid window - fcb $18,$18,$18,$FF,$FF,$00,$00,$00 ;$58 - low mid window - fcb $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0 ;$59 - left solid - fcb $18,$18,$18,$1F,$1F,$00,$00,$00 ;$5A - low left window - fcb $78,$60,$78,$60,$7E,$18,$1E,$00 ;$5B - display escape - fcb $00,$18,$3C,$7E,$18,$18,$18,$00 ;$5C - up arrow - fcb $00,$18,$18,$18,$7E,$3C,$18,$00 ;$5D - down arrow - fcb $00,$18,$30,$7E,$30,$18,$00,$00 ;$5E - left arrow - fcb $00,$18,$0C,$7E,$0C,$18,$00,$00 ;$5F - right arrow +Continue +* setup POKEY here +SetupPOKEY + lda #3 + sta $D20F ; set POKEY to active + +SetupSerial + ldd #BAUDRATE get POKEY baud rate + std AUDF3 and store it in HW reg + +* B = clock ch. 3 with 1.79 MHz, ch. 4 with ch. 3 + ldd #$23*256+$28 + sta SKCTL + stb AUDCTL set audio control + + ldu #SCRMEMEND + lbsr VTIOInit + + leax SignOnMsg,pcr + lbsr WriteString + + leax MemModeMsg,pcr + lbsr WriteString + + leax SIOMsg,pcr + lbsr WriteString -* The display list sets up the ANTIC chip to display the main screen. -* It is copied to the Atari Screen Area in low memory (see atari.d) -* The size of this code MUST be <= G.DListSize -DList - fcb $70,$70,$70 3 * 8 blank scanlines - fcb $42 Mode 2 with LMS (Load Memory Scan). Mode 2 = 40 column hires text, next 2 bytes L/H determine screen origin - fdbs G.ScrStart+(G.Cols*0) origin - fcb 2,2,2,2,2,2,2,2,2,2 - fcb 2,2,2,2,2,2,2,2,2,2 - fcb 2,2,2 -* 23 extra mode 2 lines for total of 24. 240 scanlines can be used for display area, but a hires line cannot be on scanline 240 due to an Antic bug - fcb $41 this is the end of Display List command JVB (Jump and wait for Vertical Blank) - fdbs G.CharSetAddr -DListSz equ *-DList - - -* DriveWire read/write routines for SIO are here - use dwread.asm - - use dwwrite.asm - -UpCopySz equ *-CharSet - -SignOn fcc "Liber809 Boot ROM for the Atari XL/XE" - fcb $0D,$0A - fcc "Copyright (C) 2012 Boisy G. Pitre" - fcb $0D,$0A - fcc 00 +* Tell DW Server we want to mount the named object + lda #OP_NAMEOBJ_MOUNT + ldb #MountNameLen + pshs d + leax ,s + ldy #$0002 + lbsr DWWrite + leax MountName,pcr + ldy #MountNameLen + lbsr DWWrite + + leax ,s + ldy #$0001 + lbsr DWRead + puls d + lbcs MountFailed + tsta + lbeq MountFailed + sta V.NODrive,u + leax OKMsg,pcr + lbsr WriteString + +* Object is mounted... now load 8192 bytes starting at KICKSTART + leax LoadingMsg,pcr + lbsr WriteString -* setup the stack and the Atari hardware -TargetEntry -* Put Atari into All RAM mode - lbsr SetupPIA first, setup PIA - clr $D40E - clr $D20E - lda #%11111110 $8000-$CFFF, $D800-$FFFF RAM!!! - sta PORTB -* copy CharSet into G.CharSetAddr - leax CharSet,pcr - ldu #G.CharSetAddr - ldy #UpCopySz -copy@ - ldd ,x++ - std ,u++ - leay -1,y - bne copy@ - - lbsr SetupPOKEY - lbsr SetupSerial - ldu #$400 - lbsr VTIOInit - - leax SignOn,pcr - lbsr WriteString + ldd #KICKEND + subd #KICKSTART + lbsr WriteHexWord + + leax Loading2Msg,pcr + lbsr WriteString -* Acquire! - ldx #$8000 - ldy #$0000 - lda #OP_READEX + ldd #KICKSTART + lbsr WriteHexWord + + tfr d,x + ldy #$0000 + lda #OP_READEX ReadLoop * Send Read Command - cmpy #$0050 - bne keepon - leax $800,x - leay 8,y skip sectors $50-$57 ($D000-$D7FFF) -keepon - pshs a,x,y - pshs y - ldy #$0000 - pshs a,y - leax ,s - ldy #$0005 - lbsr DWWrite - leas 5,s +* cmpy #$0050 +* bne keepon +* leax $800,x +* leay 8,y skip sectors $50-$57 ($D000-$D7FFF) +*keepon + pshs a,x,y + pshs y put LSN bits 15-0 on stack + clr ,-s put LSN bits 23-16 on stack ($00) + ldy #$0000 + ldb V.NODrive,u + pshs d put OP code and drive # on stack + leax ,s + ldy #$0005 + lbsr DWWrite + leas 5,s * Get Sector Data - ldy #$100 - ldx 1,s - clra - lbsr DWRead - bcc sendcrc - puls a,x,y - bra ReRead + ldy #$100 + ldx 1,s + clra + lbsr DWRead + bcc sendcrc + puls a,x,y + bra ReRead * Send CRC sendcrc @@ -317,67 +466,43 @@ puls a,x,y leax $100,x leay 1,y - cmpx #$0000 + cmpx #KICKEND bne ReadLoop ldx -2,x - leax JumpMsg,pcr - lbsr WriteString +* leax JumpMsg,pcr +* lbsr WriteString - jmp [>$FFFE] + leax JumpMsg,pcr + lbsr WriteString -JumpMsg fcb $0D,$0A - fcc "Jumping into Kernel..." - fcb 0 + ldd #KICKSTART + lbsr WriteHexWord + + jmp >KICKSTART -readerr +MountFailed + leax FailedMsg,pcr + lbsr WriteString -green clra -gl@ inca - sta COLBK - lbrn $0000 - cmpx ,s - bra gl@ + leax ResetMsg,pcr + lbsr WriteString + +Loop4Ever bra Loop4Ever + +* Test snippet used to debug code +*green clra +*gl@ inca +* sta COLBK +* lbrn $0000 +* cmpx ,s +* bra gl@ -SetupPIA - LDA #$38 ;LOOK AT DATA DIRECTION REGISTERS IN PIA - STA PACTL - STA PBCTL - LDA #0 ;MAKE ALL INPUTS - STA PORTA - LDA #$FF ;MAKE ALL OUTPUTS - STA PORTB - LDA #$3C ;BACK TO PORTS - STA PACTL - STA PBCTL - rts -* setup POKEY here -SetupPOKEY - lda #3 - sta $D20F ; set POKEY to active - rts -SetupSerial -BAUD192K EQU $2800 -BAUD384K EQU $1000 -BAUD576K EQU $0800 -BAUD1152K EQU $0400 - - ldd #BAUD576K get POKEY baud rate - std AUDF3 and store it in HW reg - - lda #$23 - sta SKCTL - - lda #$28 clock ch. 3 with 1.79 MHz, ch. 4 with ch. 3 - sta AUDCTL set audio control - rts - VTIOInit - stu >D.KbdSta store devmem ptr pshs u leax ChkSpc,pcr @@ -389,35 +514,21 @@ std V.CurRow,u * Clear screen memory - ldy #G.DList - pshs y - ldy #G.ScrStart + ldx #SCRMEM + ldy #40*24 ldd #$0000 clearLoop@ - std ,y++ - cmpy ,s + std ,x++ + leay -2,y bne clearLoop@ - puls u G.DList address is aleady in U -* copy the display list into our memory area to the globa location in low RAM - leax DList,pcr - ldy #DListSz -dlcopy@ - ldd ,x++ - std ,u++ - leay -2,y - bne dlcopy@ -* patch last word to be address of start of DList (byte swap for ANTIC) - leau -DListSz,u - tfr u,d - exg a,b - std DListSz-2,u - * tell the ANTIC where the dlist is + ldd #DList + exg a,b std DLISTL * tell the ANTIC where the character set is (page aligned, currently in Krn) - lda #G.CharSetAddr>>8 + lda #ROMTOP>>8 sta CHBASE * set background color @@ -440,45 +551,53 @@ lda #$02 sta CHACTL - IFNE KEYBOARD -* install keyboard ISR - ldd #IRQST POKEY IRQ status address - leay IRQSvc,pcr pointer to our service routine - leax IRQPkt,pcr F$IRQ requires a 3 byte packet - ldu ,s use our saved devmem as ISR static - os9 F$IRQ install the ISR - bcs initex - -* set POKEY to active - lda #3 - sta SKCTL - -* tell POKEY to enable keyboard scanning - lda #%11000000 - pshs cc - orcc #IntMasks - ora D.IRQENSHDW - sta D.IRQENSHDW - puls cc - sta IRQEN - ENDC - -* clear carry and return - clrb initex puls u,pc +HexTable fcc "0123456789ABCDEF" + +* D = hex value to write +WriteHexWord + pshs d,x,y + leax HexTable,pcr + lsra + lsra + lsra + lsra + lda a,x + bsr WriteChar + lda ,s + anda #$0F + lda a,x + bsr WriteChar + ldb 1,s + lsrb + lsrb + lsrb + lsrb + lda b,x + bsr WriteChar + ldb 1,s + andb #$0F + lda b,x + bsr WriteChar + puls d,x,y,pc + * X = nul-terminated string to write WriteString +loop@ lda ,x+ beq done - pshs x bsr WriteChar - puls x bra WriteString done rts WriteChar + pshs d,x + bsr Write1 + puls d,x,pc + +Write1 bsr hidecursor ldx V.EscVect,u @@ -495,7 +614,7 @@ mul addb V.CurCol,u adca #0 - ldx #G.ScrStart + ldx #SCRMEM leax d,x puls a sta ,x @@ -512,7 +631,7 @@ IFNE SCROLL deca set A to G.Rows - 1 pshs d save off Row/Col - ldx #G.ScrStart get start of screen memory + ldx #SCRMEM get start of screen memory ldy #G.Cols*(G.Rows-1) set Y to size of screen minus last row scroll_loop ldd G.Cols,x get two bytes on next row @@ -589,7 +708,7 @@ lda V.CurRow,u ldb #G.Cols mul - ldx #G.ScrStart + ldx #SCRMEM leax d,x lda #G.Cols clrloop@ clr ,x+ @@ -623,7 +742,7 @@ mul addb V.CurCol,u adca #0 - ldx #G.ScrStart + ldx #SCRMEM leax d,x clr 1,x @@ -640,7 +759,7 @@ mul addb V.CurCol,u adca #0 - ldx #G.ScrStart + ldx #SCRMEM leax d,x lda #$00 sta ,x @@ -690,18 +809,27 @@ IRQVct SWIVct NMIVct - rti + rti -* End of our RAM-based routine -TargetL equ *-Target +* DriveWire read/write routines for SIO are here + use dwread.asm + + use dwwrite.asm + + fill $FF,$FFE0-* +* I/O Entry points +DWIORENT fdb DWRead +DWIOWENT fdb DWWrite +WRCHARENT fdb WriteChar +WRSTRENT fdb WriteString * 6809 Vectors - these go at the very last 16 bytes of ROM - fill $FF,$FFF0-* - fdb $0000 Reserved - fdb SWI3Vct SWI3 - fdb SWI2Vct SWI2 - fdb FIRQVct /FIRQ - fdb IRQVct /IRQ - fdb SWIVct SWI - fdb NMIVct /NMI - fdb RESETVct /RESET + fill $FF,$FFF0-* + fdb $0000 Reserved + fdb SWI3Vct SWI3 + fdb SWI2Vct SWI2 + fdb FIRQVct /FIRQ + fdb IRQVct /IRQ + fdb SWIVct SWI + fdb NMIVct /NMI + fdb RESETVct /RESET