From 9e2239d871622281ca21aff446e056305e8beed6 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 30 Nov 2016 21:27:34 -0500 Subject: [PATCH] synch up some old checkins from the laptop --- {webserver => ethernet/c}/Makefile | 0 {webserver => ethernet/c}/testarp.c | 11 ++- ksp/applesoft/Makefile | 99 +++++++++++++++++++++++++++ ksp/asm/ksp.s | 102 +++++++++++++++++++--------- 4 files changed, 180 insertions(+), 32 deletions(-) rename {webserver => ethernet/c}/Makefile (100%) rename {webserver => ethernet/c}/testarp.c (50%) create mode 100644 ksp/applesoft/Makefile diff --git a/webserver/Makefile b/ethernet/c/Makefile similarity index 100% rename from webserver/Makefile rename to ethernet/c/Makefile diff --git a/webserver/testarp.c b/ethernet/c/testarp.c similarity index 50% rename from webserver/testarp.c rename to ethernet/c/testarp.c index 9f9cbc5b..d6f53491 100644 --- a/webserver/testarp.c +++ b/ethernet/c/testarp.c @@ -5,14 +5,23 @@ int main(int argc, char **argv) { char *device_name,errbuf[PCAP_ERRBUF_SIZE]; + pcap_t *handle; + device_name=pcap_lookupdev(errbuf); if (device_name==NULL) { - fprintf(stderr,"Can't find default device\n"); + fprintf(stderr,"Can't find default device %s\n",errbuf); return -1; } printf("Using device: %s\n", device_name); + handle=pcap_open_live(device_name, BUFSIZ, 1, 1000, errbuf); + if (handle==NULL) { + fprintf(stderr,"Couldn't open device %s: %s\n", + device_name,errbuf); + return -1; + } + return 0; } diff --git a/ksp/applesoft/Makefile b/ksp/applesoft/Makefile new file mode 100644 index 00000000..ec415671 --- /dev/null +++ b/ksp/applesoft/Makefile @@ -0,0 +1,99 @@ +PCX2HGR = ../../hgr-utils/pcx2hgr +DOS33 = ../../dos33fs-utils/dos33 +TXT2BAS = ../../asoft_basic-utils/tokenize_asoft +SHAPETABLE = ../../hgr-utils/shape_table + +all: ksp.dsk + +ACMPLX.BAS: acmplx.bas + $(TXT2BAS) < acmplx.bas > ACMPLX.BAS + +CONTRACT.BAS: contract.bas + $(TXT2BAS) < contract.bas > CONTRACT.BAS + +FLIGHT.BAS: flight.bas + $(TXT2BAS) < flight.bas > FLIGHT.BAS + +KSP.BAS: ksp.bas + $(TXT2BAS) < ksp.bas > KSP.BAS + +LAUNCH.BAS: launch.bas + $(TXT2BAS) < launch.bas > LAUNCH.BAS + +LOADING.BAS: loading.bas + $(TXT2BAS) < loading.bas > LOADING.BAS + +PHYSICS.BAS: physics.bas + $(TXT2BAS) < physics.bas > PHYSICS.BAS + +VAB.BAS: vab.bas + $(TXT2BAS) < vab.bas > VAB.BAS + +LOAD_KSP.BAS: load_ksp.bas + $(TXT2BAS) < load_ksp.bas > LOAD_KSP.BAS + +ROCKET.SHAPE: ../ship2.table + $(SHAPETABLE) -b < ../ship2.table > ROCKET.SHAPE + +VAB.SHAPE: ../ship.table + $(SHAPETABLE) -b < ../ship.table > VAB.SHAPE + + +ksp.dsk: ACMPLX.BAS \ + CONTRACT.BAS \ + FLIGHT.BAS \ + KSP.BAS \ + ROCKET.SHAPE \ + VAB.SHAPE \ + LOAD_KSP.BAS \ + LAUNCH.BAS GLOBE.HGR LAUNCHPAD.HGR ORBIT_TOP.HGR ORBIT_RIGHT.HGR \ + LOADING.BAS LOADING.HGR SQUAD.HGR TITLE.HGR \ + PHYSICS.BAS \ + VAB.BAS VAB.HGR + $(DOS33) -y ksp.dsk SAVE B LOADING.HGR + $(DOS33) -y ksp.dsk SAVE B SQUAD.HGR + $(DOS33) -y ksp.dsk SAVE B TITLE.HGR + $(DOS33) -y ksp.dsk SAVE A VAB.BAS + $(DOS33) -y ksp.dsk SAVE B VAB.HGR + $(DOS33) -y ksp.dsk SAVE A LOADING.BAS + $(DOS33) -y ksp.dsk SAVE A ACMPLX.BAS + $(DOS33) -y ksp.dsk SAVE A LAUNCH.BAS + $(DOS33) -y ksp.dsk SAVE B GLOBE.HGR + $(DOS33) -y ksp.dsk SAVE B LAUNCHPAD.HGR + $(DOS33) -y ksp.dsk SAVE B ORBIT_RIGHT.HGR + $(DOS33) -y ksp.dsk SAVE B ORBIT_TOP.HGR + $(DOS33) -y ksp.dsk SAVE A PHYSICS.BAS + $(DOS33) -y ksp.dsk SAVE A FLIGHT.BAS + $(DOS33) -y ksp.dsk SAVE A CONTRACT.BAS + $(DOS33) -y ksp.dsk SAVE A KSP.BAS + $(DOS33) -y ksp.dsk SAVE A LOAD_KSP.BAS + $(DOS33) -y ksp.dsk SAVE B ROCKET.SHAPE + $(DOS33) -y ksp.dsk SAVE B VAB.SHAPE + + +LAUNCHPAD.HGR: ../launchpad.pcx + $(PCX2HGR) ../launchpad.pcx > LAUNCHPAD.HGR + +ORBIT_TOP.HGR: ../orbit_top.pcx + $(PCX2HGR) ../orbit_top.pcx > ORBIT_TOP.HGR + +ORBIT_RIGHT.HGR: ../orbit_right.pcx + $(PCX2HGR) ../orbit_right.pcx > ORBIT_RIGHT.HGR + +GLOBE.HGR: ../globe.pcx + $(PCX2HGR) ../globe.pcx > GLOBE.HGR + +LOADING.HGR: ../loading.pcx + $(PCX2HGR) ../loading.pcx > LOADING.HGR + +SQUAD.HGR: ../squad.pcx + $(PCX2HGR) ../squad.pcx > SQUAD.HGR + +TITLE.HGR: ../title.pcx + $(PCX2HGR) ../title.pcx > TITLE.HGR + +VAB.HGR: ../vab.pcx + $(PCX2HGR) ../vab.pcx > VAB.HGR + +clean: + rm -f *~ *.HGR *.SHAPE *.BAS diff --git a/ksp/asm/ksp.s b/ksp/asm/ksp.s index f59c9633..624abb6e 100644 --- a/ksp/asm/ksp.s +++ b/ksp/asm/ksp.s @@ -66,6 +66,39 @@ ; W = Which astronaut ; X/Y = temp X/Y ; ZX/ZY= Vx0 and Vy0 + +.define EQU = + +LOCATE_FILEM_PARAM EQU $3DC +LOCATE_RWTS_PARAM EQU $3E3 +FILEMANAGER EQU $3D6 + +; Zero Page + +;; For the disk-read code +RWTSH EQU $F1 +RWTSL EQU $F0 +DOSBUFH EQU $EF +DOSBUFL EQU $EE +FILEMH EQU $ED +FILEML EQU $EC + +;; DOS Constants +OPEN EQU $01 +CLOSE EQU $02 +READ EQU $03 +WRITE EQU $04 +DELETE EQU $05 +CATALOG EQU $06 +LOCK EQU $07 +UNLOCK EQU $08 +RENAME EQU $09 +POSITION EQU $0A +INIT EQU $0B +VERIFY EQU $0C + + + ; ; Clear screen ; 10 HOME:HGR:D$=CHR$(4) @@ -491,38 +524,45 @@ ;9320 GOTO 9010 BLOAD: - jsr find_free_dos_buffer - rts + jsr LOCATE_FILEM_PARAM ; load file manager param list + ; Y=low, A=high - ; See Beneath Apple DOS -find_free_dos_buffer: - lda $3D2 ; dos load point - sta $1 - ldy #0 - sty $0 -gbuf0: - lda ($0),Y - pha + sta FILEMH ; store pointer in page0 + sty FILEML + + ldy #7 ; file type in offset 7 + lda #4 ; binary file + sta (FILEML),y + + iny ; filename pointer in offset 8 + lda #filename iny - lda ($0),Y - sta $1 - pla - sta $0 - bne gbuf ; got one - lda $1 - beq nbuf ; no buffers -gbuf: - ldy #0 ; get filename - lda ($0),Y - beq gotbuf ; it's free - ldy #36 ; it's not free - bne gbuf0 ; get next buffer -gotbuf: - clc ; indicate got buffer - rts -nbuf: - sec ; indicate not free - rts + sta (FILEML),y + + ldx #1 ; open existing file + + jsr open + + jsr read + + jsr close + +open: +read: +close: + + +; --- string with high-bit set, null-terminated +.macro aschiz str + .repeat .strlen (str), c + .byte .strat (str, c) | $80 + .endrep + .byte 0 +.endmacro + +.data +filename: aschiz "LOADING.HGR " -