diff --git a/applecorn.po b/applecorn.po index 4755c0d..851fdc3 100644 Binary files a/applecorn.po and b/applecorn.po differ diff --git a/applecorn.s b/applecorn.s index 6d1806f..1b4800f 100644 --- a/applecorn.s +++ b/applecorn.s @@ -10,7 +10,7 @@ XC ; 65c02 - ORG $4000 ; Load addr of loader in main memory + ORG $2000 ; Load addr of loader in main memory ; Clear of first HGR frame buffer * Monitor routines @@ -40,8 +40,31 @@ RSTV EQU $3F2 * IRQ vector A2IRQV EQU $3FE +* ProDOS Global Page equates * MLI entry point MLI EQU $BF00 +* Device Addresses +DEVADR01 EQU $BF10 +DEVADR32 EQU $BF26 +* Device List +DEVNUM EQU $BF30 +DEVCNT EQU $BF31 +DEVLST EQU $BF32 +* Date & time +PRODOSDATE EQU $BF90 +PRODOSTIME EQU $BF92 +* Machine ID byte +MACHID EQU $BF98 +* Versioning bytes +IBAKVER EQU $BFFC +IVERSION EQU $BFFD +* System BitMap locations +P8BMAP0007 EQU $BF58 +P8BMAP080F EQU $BF59 +P8BMAP2027 EQU $BF5C +P8BMAP282F EQU $BF5D +P8BMAP3037 EQU $BF5E +P8BMAP383F EQU $BF5F * IO Buffer for reading file (1024 bytes) IOBUF0 EQU $0C00 ; For loading/saving, OSFILE, *. @@ -200,6 +223,6 @@ MAINZP MAC PUT AUXMEM.MISC * Automatically save the object file: - SAV APPLECORN + SAV APLCORN.SYSTEM diff --git a/auxmem.init.s b/auxmem.init.s index efb11b4..ade8173 100644 --- a/auxmem.init.s +++ b/auxmem.init.s @@ -209,7 +209,7 @@ BYTE00 BEQ BYTE00A ; OSBYTE 0,0 - generate error RTS ; %000x1xxx host type, 'A'pple BYTE00A BRK DB $F7 -HELLO ASC 'Applecorn MOS 2022-09-24' +HELLO ASC 'Applecorn MOS 2022-10-08-SYS' DB $00 ; Unify MOS messages GSSPEED DB $00 ; $80 if GS is fast, $00 for slow diff --git a/freq_table b/freq_table new file mode 100755 index 0000000..c118515 --- /dev/null +++ b/freq_table @@ -0,0 +1,19 @@ +#!/usr/bin/python3 + +# +# Make a table of Ensoniq frequency values (high and low bytes) +# Corresponding to the frequency values used in BBC Micro +# SOUND statements. +# + +base=123.47 / 10.0 + +print("\nFREQHIGH"); +for i in range(0,256): + v = 2**(i/48)*base + print(" DB >{:.0f}".format(v * 10)) + +print("\nFREQLOW"); +for i in range(0,256): + v = 2**(i/48)*base + print(" DB <{:.0f}".format(v * 10)) diff --git a/m32build b/m32build index 1ff67e3..c0c57b2 100755 --- a/m32build +++ b/m32build @@ -4,6 +4,6 @@ # merlin32 -v applecorn.s -cp APPLECORN APPLECORN#064000 -cadius deletefile applecorn.po /APPLECORN/APPLECORN -cadius addfile applecorn.po /APPLECORN APPLECORN#064000 +cp APLCORN.SYSTEM APLCORN.SYSTEM#FF2000 +cadius deletefile applecorn.po /APPLECORN/APLCORN.SYSTEM +cadius addfile applecorn.po /APPLECORN APLCORN.SYSTEM#FF2000 diff --git a/mainmem.freq.s b/mainmem.freq.s new file mode 100644 index 0000000..a5b1b81 --- /dev/null +++ b/mainmem.freq.s @@ -0,0 +1,522 @@ +* MAINMEM.FREQ.S +* (c) Bobbi 2022 GPLv3 +* +* Table of frequency values for Ensoniq +* Generated by freq_table script +* + +FREQHIGH + DB >1235 + DB >1253 + DB >1271 + DB >1289 + DB >1308 + DB >1327 + DB >1346 + DB >1366 + DB >1386 + DB >1406 + DB >1427 + DB >1447 + DB >1468 + DB >1490 + DB >1511 + DB >1533 + DB >1556 + DB >1578 + DB >1601 + DB >1624 + DB >1648 + DB >1672 + DB >1696 + DB >1721 + DB >1746 + DB >1772 + DB >1797 + DB >1823 + DB >1850 + DB >1877 + DB >1904 + DB >1932 + DB >1960 + DB >1988 + DB >2017 + DB >2047 + DB >2077 + DB >2107 + DB >2137 + DB >2168 + DB >2200 + DB >2232 + DB >2264 + DB >2297 + DB >2331 + DB >2365 + DB >2399 + DB >2434 + DB >2469 + DB >2505 + DB >2542 + DB >2579 + DB >2616 + DB >2654 + DB >2693 + DB >2732 + DB >2772 + DB >2812 + DB >2853 + DB >2895 + DB >2937 + DB >2979 + DB >3023 + DB >3067 + DB >3111 + DB >3157 + DB >3202 + DB >3249 + DB >3296 + DB >3344 + DB >3393 + DB >3442 + DB >3492 + DB >3543 + DB >3595 + DB >3647 + DB >3700 + DB >3754 + DB >3808 + DB >3864 + DB >3920 + DB >3977 + DB >4035 + DB >4093 + DB >4153 + DB >4213 + DB >4275 + DB >4337 + DB >4400 + DB >4464 + DB >4529 + DB >4595 + DB >4662 + DB >4729 + DB >4798 + DB >4868 + DB >4939 + DB >5011 + DB >5084 + DB >5157 + DB >5232 + DB >5309 + DB >5386 + DB >5464 + DB >5544 + DB >5624 + DB >5706 + DB >5789 + DB >5873 + DB >5959 + DB >6045 + DB >6133 + DB >6222 + DB >6313 + DB >6405 + DB >6498 + DB >6593 + DB >6688 + DB >6786 + DB >6884 + DB >6985 + DB >7086 + DB >7189 + DB >7294 + DB >7400 + DB >7507 + DB >7617 + DB >7727 + DB >7840 + DB >7954 + DB >8070 + DB >8187 + DB >8306 + DB >8427 + DB >8549 + DB >8674 + DB >8800 + DB >8928 + DB >9058 + DB >9190 + DB >9323 + DB >9459 + DB >9596 + DB >9736 + DB >9878 + DB >10021 + DB >10167 + DB >10315 + DB >10465 + DB >10617 + DB >10772 + DB >10928 + DB >11087 + DB >11248 + DB >11412 + DB >11578 + DB >11747 + DB >11917 + DB >12091 + DB >12267 + DB >12445 + DB >12626 + DB >12810 + DB >12996 + DB >13185 + DB >13377 + DB >13571 + DB >13769 + DB >13969 + DB >14172 + DB >14378 + DB >14587 + DB >14800 + DB >15015 + DB >15233 + DB >15455 + DB >15680 + DB >15908 + DB >16139 + DB >16374 + DB >16612 + DB >16854 + DB >17099 + DB >17348 + DB >17600 + DB >17856 + DB >18116 + DB >18379 + DB >18646 + DB >18918 + DB >19193 + DB >19472 + DB >19755 + DB >20043 + DB >20334 + DB >20630 + DB >20930 + DB >21234 + DB >21543 + DB >21857 + DB >22174 + DB >22497 + DB >22824 + DB >23156 + DB >23493 + DB >23835 + DB >24181 + DB >24533 + DB >24890 + DB >25252 + DB >25619 + DB >25992 + DB >26370 + DB >26754 + DB >27143 + DB >27538 + DB >27938 + DB >28344 + DB >28757 + DB >29175 + DB >29599 + DB >30030 + DB >30467 + DB >30910 + DB >31359 + DB >31816 + DB >32278 + DB >32748 + DB >33224 + DB >33707 + DB >34198 + DB >34695 + DB >35200 + DB >35712 + DB >36231 + DB >36758 + DB >37293 + DB >37835 + DB >38386 + DB >38944 + DB >39510 + DB >40085 + DB >40668 + DB >41260 + DB >41860 + DB >42469 + DB >43086 + DB >43713 + DB >44349 + DB >44994 + DB >45648 + DB >46312 + DB >46986 + DB >47669 + DB >48363 + DB >49066 + +FREQLOW + DB <1235 + DB <1253 + DB <1271 + DB <1289 + DB <1308 + DB <1327 + DB <1346 + DB <1366 + DB <1386 + DB <1406 + DB <1427 + DB <1447 + DB <1468 + DB <1490 + DB <1511 + DB <1533 + DB <1556 + DB <1578 + DB <1601 + DB <1624 + DB <1648 + DB <1672 + DB <1696 + DB <1721 + DB <1746 + DB <1772 + DB <1797 + DB <1823 + DB <1850 + DB <1877 + DB <1904 + DB <1932 + DB <1960 + DB <1988 + DB <2017 + DB <2047 + DB <2077 + DB <2107 + DB <2137 + DB <2168 + DB <2200 + DB <2232 + DB <2264 + DB <2297 + DB <2331 + DB <2365 + DB <2399 + DB <2434 + DB <2469 + DB <2505 + DB <2542 + DB <2579 + DB <2616 + DB <2654 + DB <2693 + DB <2732 + DB <2772 + DB <2812 + DB <2853 + DB <2895 + DB <2937 + DB <2979 + DB <3023 + DB <3067 + DB <3111 + DB <3157 + DB <3202 + DB <3249 + DB <3296 + DB <3344 + DB <3393 + DB <3442 + DB <3492 + DB <3543 + DB <3595 + DB <3647 + DB <3700 + DB <3754 + DB <3808 + DB <3864 + DB <3920 + DB <3977 + DB <4035 + DB <4093 + DB <4153 + DB <4213 + DB <4275 + DB <4337 + DB <4400 + DB <4464 + DB <4529 + DB <4595 + DB <4662 + DB <4729 + DB <4798 + DB <4868 + DB <4939 + DB <5011 + DB <5084 + DB <5157 + DB <5232 + DB <5309 + DB <5386 + DB <5464 + DB <5544 + DB <5624 + DB <5706 + DB <5789 + DB <5873 + DB <5959 + DB <6045 + DB <6133 + DB <6222 + DB <6313 + DB <6405 + DB <6498 + DB <6593 + DB <6688 + DB <6786 + DB <6884 + DB <6985 + DB <7086 + DB <7189 + DB <7294 + DB <7400 + DB <7507 + DB <7617 + DB <7727 + DB <7840 + DB <7954 + DB <8070 + DB <8187 + DB <8306 + DB <8427 + DB <8549 + DB <8674 + DB <8800 + DB <8928 + DB <9058 + DB <9190 + DB <9323 + DB <9459 + DB <9596 + DB <9736 + DB <9878 + DB <10021 + DB <10167 + DB <10315 + DB <10465 + DB <10617 + DB <10772 + DB <10928 + DB <11087 + DB <11248 + DB <11412 + DB <11578 + DB <11747 + DB <11917 + DB <12091 + DB <12267 + DB <12445 + DB <12626 + DB <12810 + DB <12996 + DB <13185 + DB <13377 + DB <13571 + DB <13769 + DB <13969 + DB <14172 + DB <14378 + DB <14587 + DB <14800 + DB <15015 + DB <15233 + DB <15455 + DB <15680 + DB <15908 + DB <16139 + DB <16374 + DB <16612 + DB <16854 + DB <17099 + DB <17348 + DB <17600 + DB <17856 + DB <18116 + DB <18379 + DB <18646 + DB <18918 + DB <19193 + DB <19472 + DB <19755 + DB <20043 + DB <20334 + DB <20630 + DB <20930 + DB <21234 + DB <21543 + DB <21857 + DB <22174 + DB <22497 + DB <22824 + DB <23156 + DB <23493 + DB <23835 + DB <24181 + DB <24533 + DB <24890 + DB <25252 + DB <25619 + DB <25992 + DB <26370 + DB <26754 + DB <27143 + DB <27538 + DB <27938 + DB <28344 + DB <28757 + DB <29175 + DB <29599 + DB <30030 + DB <30467 + DB <30910 + DB <31359 + DB <31816 + DB <32278 + DB <32748 + DB <33224 + DB <33707 + DB <34198 + DB <34695 + DB <35200 + DB <35712 + DB <36231 + DB <36758 + DB <37293 + DB <37835 + DB <38386 + DB <38944 + DB <39510 + DB <40085 + DB <40668 + DB <41260 + DB <41860 + DB <42469 + DB <43086 + DB <43713 + DB <44349 + DB <44994 + DB <45648 + DB <46312 + DB <46986 + DB <47669 + DB <48363 + DB <49066 diff --git a/mainmem.init.s b/mainmem.init.s index 93d2ca2..efaab4e 100644 --- a/mainmem.init.s +++ b/mainmem.init.s @@ -26,7 +26,7 @@ SETPRFX LDA #GPFXCMD DW GSPFXPL LDX DRVBUF1 ; was $0300 BNE RTSINST - LDA $BF30 + LDA DEVNUM STA ONLNPL+1 ; Device number JSR MLI DB ONLNCMD @@ -55,40 +55,40 @@ RTSINST LDA CMDPATH * Disconnect /RAM ramdrive to avoid aux corruption * Stolen from Beagle Bros Extra K -DISCONN LDA $BF98 +DISCONN LDA MACHID AND #$30 CMP #$30 BNE :S1 - LDA $BF26 - CMP $BF10 + LDA DEVADR32 + CMP DEVADR01 BNE :S2 - LDA $BF27 - CMP $BF11 + LDA DEVADR32+1 + CMP DEVADR01+1 BEQ :S1 -:S2 LDY $BF31 -:L1 LDA $BF32,Y +:S2 LDY DEVCNT +:L1 LDA DEVLST,Y AND #$F3 CMP #$B3 BEQ :S3 DEY BPL :L1 BMI :S1 -:S3 LDA $BF32,Y +:S3 LDA DEVLST,Y STA DRVBUF2+1 ; was $0302 -:L2 LDA $BF33,Y - STA $BF32,Y +:L2 LDA DEVLST+1,Y + STA DEVLST,Y BEQ :S4 INY BNE :L2 -:S4 LDA $BF26 +:S4 LDA DEVADR32 STA DRVBUF1 ; was $0300 - LDA $BF27 + LDA DEVADR32+1 STA DRVBUF2 ; was $0301 - LDA $BF10 - STA $BF26 - LDA $BF11 - STA $BF27 - DEC $BF31 + LDA DEVADR01 + STA DEVADR32 + LDA DEVADR01+1 + STA DEVADR32+1 + DEC DEVCNT :S1 RTS * Reset handler - invoked on Ctrl-Reset diff --git a/mainmem.ldr.s b/mainmem.ldr.s index d329443..051e0cb 100644 --- a/mainmem.ldr.s +++ b/mainmem.ldr.s @@ -11,6 +11,66 @@ * to aux memory starting at AUXMOS1 and jumps to it. * (Note that the MOS code will copy itself to $D000.) +SYSTEM LDX #$FF ; Init stack pointer + TXS + + LDA #$00 + STA IBAKVER ; Minimum compatible P8 version + LDA #$01 + STA IVERSION ; Version of .SYSTEM program + + SED ; Check for 65C02 + LDA #$99 + CLC + ADC #$01 + CLD + BPL GOODCPU + JMP UNSUPPORTED + +GOODCPU LDA MACHID + AND #$F2 ; Clear bits 0,2,3 + CMP #$B2 ; Are we on a //e or //c w/ 80col and 128K or a IIgs? + BEQ SUPPORTED ; Supported machine + JMP UNSUPPORTED ; Unsupported machine + +SUPPORTED LDA #$DF ; Protect pages $0,$1,and $3-$7 + STA P8BMAP0007 + LDA #$F0 ; Protect pages $8-$B + STA P8BMAP080F + LDA #$FF ; Protect HGR1 + STA P8BMAP2027 + STA P8BMAP282F + STA P8BMAP3037 + STA P8BMAP383F + JMP START + +UNSUPPORTED JSR HOME + LDX #$00 +UNSUPLP LDA UNSUPMSG,X + BEQ UNSUPWAIT + JSR COUT1 + INX + BNE UNSUPLP +UNSUPWAIT STA $C010 +UNSUPKEY LDA $C000 + BPL UNSUPKEY + STA $C010 + + JSR MLI + DB QUITCMD + DW UNSUPQPARM +UNSUPQPARM DB $04,$00,$00,$00,$00,$00,$00 + +UNSUPMSG ASC "APPLECORN REQUIRES AN APPLE IIGS, APPLE", 8D + ASC "//C, OR ENHANCED APPLE //E WITH AN", 8D + ASC "80-COLUMN CARD AND AT LEAST 128K", 8D, 8D + ASC "PRESS ANY KEY TO QUIT TO PRODOS", 00 + +PADDING ASC '***THISISPROTOTYPECODE***' + DS $4000-* + +; Original APPLECORN.BIN code starts here + START JSR CROUT JSR SETPRFX JSR DISCONN diff --git a/mainmem.misc.s b/mainmem.misc.s index 2a49cc3..0f64219 100644 --- a/mainmem.misc.s +++ b/mainmem.misc.s @@ -133,13 +133,13 @@ CRTFILE JSR MLI ; GET_TIME STA CREATEPL+2 LDA #$C3 ; Open permissions STA CREATEPL+3 - LDA $BF90 ; Current date + LDA PRODOSDATE ; Current date STA CREATEPL+8 - LDA $BF91 + LDA PRODOSDATE+1 STA CREATEPL+9 - LDA $BF92 ; Current time + LDA PRODOSTIME ; Current time STA CREATEPL+10 - LDA $BF93 + LDA PRODOSTIME+1 STA CREATEPL+11 JSR MLI DB CREATCMD