synch up some old checkins from the laptop

This commit is contained in:
Vince Weaver 2016-11-30 21:27:34 -05:00
parent b85932220a
commit 9e2239d871
4 changed files with 180 additions and 32 deletions

View File

@ -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;
}

99
ksp/applesoft/Makefile Normal file
View File

@ -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

View File

@ -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
sta (FILEML),y
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 "