Leverage the recently added exec() cmdline support in the cc65 C library for the Apple ][.

This commit is contained in:
Oliver Schmidt 2015-04-26 21:45:33 +02:00
parent a824722862
commit 9aee07c9ad
2 changed files with 22 additions and 11 deletions

View file

@ -64,5 +64,6 @@
#define WWW_CONF_MAX_FORMACTIONLEN 20 #define WWW_CONF_MAX_FORMACTIONLEN 20
#define WWW_CONF_MAX_INPUTNAMELEN 20 #define WWW_CONF_MAX_INPUTNAMELEN 20
#define WWW_CONF_MAX_INPUTVALUELEN 20 #define WWW_CONF_MAX_INPUTVALUELEN 20
#define WWW_CONF_WGET_EXEC(url) exec("wget", url)
#endif /* CONTIKI_CONF_H_ */ #endif /* CONTIKI_CONF_H_ */

View file

@ -39,6 +39,7 @@
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
pathname := $0280 pathname := $0280
mli := $BF00 mli := $BF00
level := $BF94
OPEN_CALL = $C8 OPEN_CALL = $C8
READ_CALL = $CA READ_CALL = $CA
@ -68,6 +69,9 @@ close_fd: .byte $00 ;REF_NUM
.segment "INIT" .segment "INIT"
init_pfs: init_pfs:
; Allow exec() to keep file open
inc level
; Get prefix len of path used to load binary ; Get prefix len of path used to load binary
ldx pathname ldx pathname
: lda pathname,x : lda pathname,x
@ -80,6 +84,15 @@ init_pfs:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.code .code
done_pfs:
; Close all file
lda #$00
jsr _pfs_close
; Allow exec() to keep file open
dec level
rts
_pfs_open: _pfs_open:
; Pop and store name ; Pop and store name
jsr popax jsr popax
@ -131,9 +144,6 @@ _pfs_read:
ldx read_count_out+1 ldx read_count_out+1
rts rts
done_pfs:
lda #$00
_pfs_close: _pfs_close:
; Store fd ; Store fd
sta close_fd sta close_fd