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_INPUTNAMELEN 20
#define WWW_CONF_MAX_INPUTVALUELEN 20
#define WWW_CONF_WGET_EXEC(url) exec("wget", url)
#endif /* CONTIKI_CONF_H_ */

View file

@ -32,13 +32,14 @@
;
;---------------------------------------------------------------------
.constructor init_pfs
.destructor done_pfs
.destructor done_pfs
.importzp ptr1
.import popax, _uip_aligned_buf
.export _pfs_open, _pfs_read, _pfs_close
.import popax, _uip_aligned_buf
.export _pfs_open, _pfs_read, _pfs_close
;---------------------------------------------------------------------
pathname := $0280
mli := $BF00
level := $BF94
OPEN_CALL = $C8
READ_CALL = $CA
@ -68,8 +69,11 @@ close_fd: .byte $00 ;REF_NUM
.segment "INIT"
init_pfs:
; Get prefix len of path used to load binary
ldx pathname
; Allow exec() to keep file open
inc level
; Get prefix len of path used to load binary
ldx pathname
: lda pathname,x
cmp #'/'
beq :+
@ -80,6 +84,15 @@ init_pfs:
;---------------------------------------------------------------------
.code
done_pfs:
; Close all file
lda #$00
jsr _pfs_close
; Allow exec() to keep file open
dec level
rts
_pfs_open:
; Pop and store name
jsr popax
@ -131,11 +144,8 @@ _pfs_read:
ldx read_count_out+1
rts
done_pfs:
lda #$00
_pfs_close:
; Store fd
; Store fd
sta close_fd
jsr mli
@ -147,6 +157,6 @@ _pfs_close:
error:
; Return -1
lda #$FF
tax
rts
tax
rts
;---------------------------------------------------------------------