diff --git a/ethernet/Makefile b/ethernet/Makefile index 16f9a796..b8f956ba 100644 --- a/ethernet/Makefile +++ b/ethernet/Makefile @@ -2,7 +2,10 @@ DOS33 = ../dos33fs-utils/dos33 TXT2BAS = ../asoft_basic-utils/tokenize_asoft MAKEB = ../dos33fs-utils/make_b -all: ethernet.dsk memcpy.o +all: ethernet.dsk + +memcpy: memcpy.o + ld65 -o memcpy memcpy.o -t none memcpy.o: memcpy.s ca65 -o memcpy.o memcpy.s -l memcpy.lst @@ -29,4 +32,5 @@ ethernet.dsk: SETUP.BAS \ $(DOS33) -y ethernet.dsk BSAVE -a 0x4000 ./c/vmw_logo.png clean: - rm -f *~ *.BAS R.TXT *.o *.lst + rm -f *~ *.BAS R.TXT *.o *.lst memcpy + diff --git a/ethernet/ethernet.dsk b/ethernet/ethernet.dsk index e5591fe8..7a680598 100644 Binary files a/ethernet/ethernet.dsk and b/ethernet/ethernet.dsk differ diff --git a/ethernet/memcpy.s b/ethernet/memcpy.s index 03990e76..492f9752 100644 --- a/ethernet/memcpy.s +++ b/ethernet/memcpy.s @@ -1,20 +1,66 @@ .define EQU = PTR EQU $06 +PTRH EQU $07 - lda #0 +WRAPL EQU $08 +WRAPH EQU $09 + +SIZEL EQU $0A +SIZEH EQU $0B + +tx_copy: + + lda #0 ; always copying from 0x4000 sta PTR lda #$40 sta PTR+1 - ldx #8 + ldx #SIZEH ; number of 256-byte blocks + beq copy_remainder ; if none, skip ahead + ldy #0 -copy_loop: +copy256: lda (PTR),y - sta $5000 + sta $C0B7 ; change based on uthernet slot + + cmp WRAPH,x + bne nowrap256 + + cmp WRAPL,y + bne nowrap256 + + lda #$40 + sta $C0B5 + lda #$00 + sta $C0B6 ; wrap tx buffer address to 0x4000 + +nowrap256: + iny + bne copy256 + + inc PTR+1 ; update 16-bit pointer + dex ; finish a 256 byte block + bne copy256 + + ldx #SIZEL +copy_remainder: + lda (PTR),y + sta $C0B7 ; change based on uthernet slot + + cmp WRAPL,y + bne nowrap_r + + lda #$40 + sta $C0B5 + lda #$00 + sta $C0B6 ; wrap tx buffer address to 0x4000 + +nowrap_r: iny - bne copy_loop dex - bne copy_loop + bne copy_remainder rts + + diff --git a/ethernet/webserver.bas b/ethernet/webserver.bas index 652479f3..150f6b3f 100644 --- a/ethernet/webserver.bas +++ b/ethernet/webserver.bas @@ -28,6 +28,15 @@ 33 POKE DP,192:POKE DP,168:POKE DP,8:POKE DP,15 40 PRINT "UTHERNET II READY: 192.168.8.15" ' +' Setup Memcpy routine +' +50 FOR I=0 TO 72: READ X: POKE 768+I,X:NEXT I +51 DATA 169,0,133,6,169,64,133,7,162,11,240,36,160,0,177,6 +52 DATA 141,183,192,213,9,208,15,217,8,0,208,10,169,64,141,181 +53 DATA 192,169,0,141,182,192,200,208,229,230,7,202,208,224,162,10 +54 DATA 177,6,141,183,192,217,8,0,208,10,169,64,141,181,192,169 +55 DATA 0,141,182,192,200,202,208,232,96 +' ' Setup Socket 0 ' 100 REM *** Setup Socket 0 @@ -210,10 +219,11 @@ ' ' Check for buffer wraparound ' -1942 BW=0 +1942 BW=0:BO=0 1945 IF (SI+TA>=24576) THEN BW=1:BO=24576-TA:PRINT "TX BUFFER WRAPAROUND IN ";BO ' ' Write data to TX buffer +' First write header ' 2000 T%=TA/256 2005 POKE HA,T%: POKE LA,TA-(T%*256) @@ -222,6 +232,9 @@ 2017 IF BW=0 THEN GOTO 2020 2018 BO=BO-1: IF BO=0 THEN POKE HA,64:POKE LA,0:BW=0 2020 NEXT I +' +' Write disk part +' 2025 FOR I=1 TO FS 2026 C=C+1: IF C=50 THEN PRINT ".";:C=0 2030 POKE DP,PEEK(16383+I) @@ -230,6 +243,13 @@ 2035 NEXT I 2040 PRINT ' +' The above is slow +' Intead use our machine language routine +' +'2025 B%=BO/256:POKE 9,B%:POKE 8,BO-(B%*256) +'2027 B%=FS/256:POKE 11,B%:POKE 10,FS-(B%*256) +'2030 CALL 768 +' ' Update TX write ptr ' 2050 REM ** UPDATE TX WRITE PTR