diff --git a/blk/001 b/blk/001 index a160329..1185824 100644 --- a/blk/001 +++ b/blk/001 @@ -10,4 +10,3 @@ MASTER INDEX 620 Sega Master System Recipe 650 AVR assembler 730 8086 assembler 800 8086 boot code 830 PC/AT recipe -850 Zilog SIO driver diff --git a/blk/580 b/blk/580 index 3b21188..ea36c85 100644 --- a/blk/580 +++ b/blk/580 @@ -3,6 +3,6 @@ RC2014 Recipe Support code for the RC2014 recipe. Contains drivers for the ACIA, SD card and AT28 EEPROM. -581 ACIA 590 AT28 EEPROM -595 SPI relay 600 SD card -618 Xcomp unit +581 ACIA 586 Zilog SIO driver +592 AT28 EEPROM 595 SPI relay +600 SD card 618 Xcomp unit diff --git a/blk/584 b/blk/584 new file mode 100644 index 0000000..d8c58e2 --- /dev/null +++ b/blk/584 @@ -0,0 +1,14 @@ +: (key) + ( inc then fetch ) + [ ACIAR> LITN ] C@ 1+ [ ACIA_BUFSZ 1- LITN ] AND + ( As long as R> == W>-1, it means that buffer is empty ) + BEGIN DUP [ ACIAW> LITN ] C@ = NOT UNTIL + DUP [ ACIA( LITN ] @ + C@ ( ridx c ) + SWAP [ ACIAR> LITN ] C! ( c ) +; +: (emit) + ( As long at CTL bit 1 is low, we are transmitting. wait ) + BEGIN [ ACIA_CTL LITN ] PC@ 0x02 AND UNTIL + ( The way is clear, go! ) + [ ACIA_IO LITN ] PC! +; diff --git a/blk/585 b/blk/585 new file mode 100644 index 0000000..6ac8ded --- /dev/null +++ b/blk/585 @@ -0,0 +1,11 @@ +: ACIA$ + H@ [ ACIA( LITN ] ! 0 [ ACIAR> LITN ] C! + 1 [ ACIAW> LITN ] C! ( write index starts one pos later ) + [ ACIA_BUFSZ LITN ] ALLOT +( setup ACIA + CR7 (1) - Receive Interrupt enabled + CR6:5 (00) - RTS low, transmit interrupt disabled. + CR4:2 (101) - 8 bits + 1 stop bit + CR1:0 (10) - Counter divide: 64 ) + 0b10010110 [ ACIA_CTL LITN ] PC! + (im1) ; diff --git a/blk/586 b/blk/586 new file mode 100644 index 0000000..1200569 --- /dev/null +++ b/blk/586 @@ -0,0 +1,5 @@ +Zilog SIO driver + +Declarations at B587 + +Driver load range at B588-B590 diff --git a/blk/587 b/blk/587 index d8c58e2..523a4f7 100644 --- a/blk/587 +++ b/blk/587 @@ -1,14 +1,14 @@ -: (key) - ( inc then fetch ) - [ ACIAR> LITN ] C@ 1+ [ ACIA_BUFSZ 1- LITN ] AND - ( As long as R> == W>-1, it means that buffer is empty ) - BEGIN DUP [ ACIAW> LITN ] C@ = NOT UNTIL - DUP [ ACIA( LITN ] @ + C@ ( ridx c ) - SWAP [ ACIAR> LITN ] C! ( c ) -; -: (emit) - ( As long at CTL bit 1 is low, we are transmitting. wait ) - BEGIN [ ACIA_CTL LITN ] PC@ 0x02 AND UNTIL - ( The way is clear, go! ) - [ ACIA_IO LITN ] PC! -; +0x80 CONSTANT SIO_ACTL 0x81 CONSTANT SIO_ADATA +0x82 CONSTANT SIO_BCTL 0x83 CONSTANT SIO_BDATA +0x20 CONSTANT SIO_BUFSZ ( SZ-1 must be a mask ) +( Address in memory that can be used variables shared + with SIO native words. 4 bytes used. ) +CREATE SIO_MEM SYSVARS 0x70 + , +( Points to SIO buf ) +: SIO( SIO_MEM @ 2+ ; +( Read buf idx Pre-inc ) +: SIOR> SIO_MEM @ ; +( Write buf idx Post-inc ) +: SIOW> SIO_MEM @ 1+ ; +( This means that if W> == R>, buffer is full. + If R>+1 == W>, buffer is empty. ) diff --git a/blk/588 b/blk/588 index 6ac8ded..7b6fcf8 100644 --- a/blk/588 +++ b/blk/588 @@ -1,11 +1,15 @@ -: ACIA$ - H@ [ ACIA( LITN ] ! 0 [ ACIAR> LITN ] C! - 1 [ ACIAW> LITN ] C! ( write index starts one pos later ) - [ ACIA_BUFSZ LITN ] ALLOT -( setup ACIA - CR7 (1) - Receive Interrupt enabled - CR6:5 (00) - RTS low, transmit interrupt disabled. - CR4:2 (101) - 8 bits + 1 stop bit - CR1:0 (10) - Counter divide: 64 ) - 0b10010110 [ ACIA_CTL LITN ] PC! - (im1) ; +( INT handler. Set RST 38 jump ) PC ORG @ 0x39 + ! +AF PUSH, BEGIN, +SIO_ACTL INAi, ( RR0 ) 0x01 ANDi, ( is recv buf full? ) +IFZ, ( nope, exit ) A 0x20 ( CMD 4 ) LDri, SIO_ACTL OUTiA, + AF POP, EI, RETI, THEN, +HL PUSH, +HL SIOW> LDdi, A (HL) LDrr, +HL DECd, (HL) CPr, ( W> == R> ? ) +IFNZ, ( buffer not full ) + ( get wr ptr ) HL SIO( LDd(i), + L ADDr, IFC, H INCr, THEN, L A LDrr, + ( fetch/write ) SIO_ADATA INAi, (HL) A LDrr, + ( advance W> ) SIOW> LDA(i), A INCr, + SIO_BUFSZ 1- ANDi, SIOW> LD(i)A, +THEN, HL POP, JR, AGAIN, diff --git a/blk/854 b/blk/589 similarity index 100% rename from blk/854 rename to blk/589 diff --git a/blk/590 b/blk/590 index 0f8c8d1..b1e6616 100644 --- a/blk/590 +++ b/blk/590 @@ -1,6 +1,12 @@ -AT28 Driver - -Write to an AT28 EEPROM while making sure that proper timing -is followed and verify data integrity. - -Load with "591 LOAD" +: _ [ SIO_ACTL LITN ] PC! ; +: SIO$ + H@ [ SIO( LITN ] ! 0 [ SIOR> LITN ] C! + 1 [ SIOW> LITN ] C! ( write index starts one pos later ) + [ SIO_BUFSZ LITN ] ALLOT + 0x18 _ ( CMD3 ) + 0x24 _ ( CMD2/PTR4 ) 0b11000100 _ ( WR4/64x/1stop/nopar ) + 0x03 _ ( PTR3 ) 0b11000001 _ ( WR3/RXen/8char ) + 0x05 _ ( PTR5 ) 0b11001000 _ ( WR5/TXen/8char ) + 0x21 _ ( CMD2/PTR1 ) 0b00011000 _ ( WR1/Rx INT all chars ) + (im1) +; diff --git a/blk/592 b/blk/592 new file mode 100644 index 0000000..69195a9 --- /dev/null +++ b/blk/592 @@ -0,0 +1,6 @@ +AT28 Driver + +Write to an AT28 EEPROM while making sure that proper timing +is followed and verify data integrity. + +Load with "593 LOAD" diff --git a/blk/591 b/blk/593 similarity index 100% rename from blk/591 rename to blk/593 diff --git a/blk/618 b/blk/618 index f0d294e..1e8eb2f 100644 --- a/blk/618 +++ b/blk/618 @@ -5,7 +5,7 @@ RS_ADDR 0x80 - CONSTANT SYSVARS 212 LOAD ( z80 assembler ) 262 LOAD ( xcomp ) 282 LOAD ( boot.z80.decl ) 270 LOAD ( xcomp overrides ) 283 335 LOADR ( boot.z80 ) -353 LOAD ( xcomp core low ) 583 588 LOADR ( acia ) +353 LOAD ( xcomp core low ) 583 585 LOADR ( acia ) 380 LOAD ( xcomp core high ) (entry) _ ( Update LATEST ) diff --git a/blk/850 b/blk/850 deleted file mode 100644 index 676548c..0000000 --- a/blk/850 +++ /dev/null @@ -1,5 +0,0 @@ -Zilog SIO driver - -Declarations at B851 - -Driver load range at B852-BXXX. diff --git a/blk/851 b/blk/851 deleted file mode 100644 index 523a4f7..0000000 --- a/blk/851 +++ /dev/null @@ -1,14 +0,0 @@ -0x80 CONSTANT SIO_ACTL 0x81 CONSTANT SIO_ADATA -0x82 CONSTANT SIO_BCTL 0x83 CONSTANT SIO_BDATA -0x20 CONSTANT SIO_BUFSZ ( SZ-1 must be a mask ) -( Address in memory that can be used variables shared - with SIO native words. 4 bytes used. ) -CREATE SIO_MEM SYSVARS 0x70 + , -( Points to SIO buf ) -: SIO( SIO_MEM @ 2+ ; -( Read buf idx Pre-inc ) -: SIOR> SIO_MEM @ ; -( Write buf idx Post-inc ) -: SIOW> SIO_MEM @ 1+ ; -( This means that if W> == R>, buffer is full. - If R>+1 == W>, buffer is empty. ) diff --git a/blk/852 b/blk/852 deleted file mode 100644 index 7b6fcf8..0000000 --- a/blk/852 +++ /dev/null @@ -1,15 +0,0 @@ -( INT handler. Set RST 38 jump ) PC ORG @ 0x39 + ! -AF PUSH, BEGIN, -SIO_ACTL INAi, ( RR0 ) 0x01 ANDi, ( is recv buf full? ) -IFZ, ( nope, exit ) A 0x20 ( CMD 4 ) LDri, SIO_ACTL OUTiA, - AF POP, EI, RETI, THEN, -HL PUSH, -HL SIOW> LDdi, A (HL) LDrr, -HL DECd, (HL) CPr, ( W> == R> ? ) -IFNZ, ( buffer not full ) - ( get wr ptr ) HL SIO( LDd(i), - L ADDr, IFC, H INCr, THEN, L A LDrr, - ( fetch/write ) SIO_ADATA INAi, (HL) A LDrr, - ( advance W> ) SIOW> LDA(i), A INCr, - SIO_BUFSZ 1- ANDi, SIOW> LD(i)A, -THEN, HL POP, JR, AGAIN, diff --git a/blk/855 b/blk/855 deleted file mode 100644 index b1e6616..0000000 --- a/blk/855 +++ /dev/null @@ -1,12 +0,0 @@ -: _ [ SIO_ACTL LITN ] PC! ; -: SIO$ - H@ [ SIO( LITN ] ! 0 [ SIOR> LITN ] C! - 1 [ SIOW> LITN ] C! ( write index starts one pos later ) - [ SIO_BUFSZ LITN ] ALLOT - 0x18 _ ( CMD3 ) - 0x24 _ ( CMD2/PTR4 ) 0b11000100 _ ( WR4/64x/1stop/nopar ) - 0x03 _ ( PTR3 ) 0b11000001 _ ( WR3/RXen/8char ) - 0x05 _ ( PTR5 ) 0b11001000 _ ( WR5/TXen/8char ) - 0x21 _ ( CMD2/PTR1 ) 0b00011000 _ ( WR1/Rx INT all chars ) - (im1) -; diff --git a/recipes/rc2014/eeprom/README.md b/recipes/rc2014/eeprom/README.md index 53767e7..1e3301e 100644 --- a/recipes/rc2014/eeprom/README.md +++ b/recipes/rc2014/eeprom/README.md @@ -35,12 +35,12 @@ I don't think you need a schematic. It's really simple. ### Building the binary The binary from the base recipe has almost all it needs to write to EEPROM. The -only thing it needs is the AT28 driver from B590. You could add it to the +only thing it needs is the AT28 driver from B592. You could add it to the `xcomp` unit and rebuild, but the driver is so tiny, you're probably better off loading it at runtime. If your system has mass storage, it's as easy as a LOAD. If it doesn't, you -can use `/tools/exec` to send `blk/591` to the RC2014. +can use `/tools/exec` to send `blk/593` to the RC2014. ## Writing contents to the AT28