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

@ -32,13 +32,14 @@
; ;
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.constructor init_pfs .constructor init_pfs
.destructor done_pfs .destructor done_pfs
.importzp ptr1 .importzp ptr1
.import popax, _uip_aligned_buf .import popax, _uip_aligned_buf
.export _pfs_open, _pfs_read, _pfs_close .export _pfs_open, _pfs_read, _pfs_close
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
pathname := $0280 pathname := $0280
mli := $BF00 mli := $BF00
level := $BF94
OPEN_CALL = $C8 OPEN_CALL = $C8
READ_CALL = $CA READ_CALL = $CA
@ -68,8 +69,11 @@ close_fd: .byte $00 ;REF_NUM
.segment "INIT" .segment "INIT"
init_pfs: init_pfs:
; Get prefix len of path used to load binary ; Allow exec() to keep file open
ldx pathname inc level
; Get prefix len of path used to load binary
ldx pathname
: lda pathname,x : lda pathname,x
cmp #'/' cmp #'/'
beq :+ beq :+
@ -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,11 +144,8 @@ _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
jsr mli jsr mli
@ -147,6 +157,6 @@ _pfs_close:
error: error:
; Return -1 ; Return -1
lda #$FF lda #$FF
tax tax
rts rts
;--------------------------------------------------------------------- ;---------------------------------------------------------------------