-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
601 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
include ../../Make.config | ||
|
||
TARGET = aquarius | ||
|
||
SUBDIRS = fcntl | ||
CLEANDIRS = $(SUBDIRS:%=%-clean) | ||
|
||
ASMFILES = $(wildcard *.asm) | ||
OBJECTS = $(ASMFILES:.asm=.o) | ||
|
||
all: dirs subdirs-all $(addprefix obj/$(TARGET)/,$(OBJECTS)) | ||
|
||
|
||
subdirs-all: $(SUBDIRS) | ||
|
||
subdirs-clean: $(SUBDIRS_CLEAN) | ||
|
||
|
||
clean: subdirs-clean | ||
$(RM) -r obj | ||
$(RM) zcc_opt.def *.err *.o | ||
$(RM) */*.o | ||
$(RM) */*/*.o | ||
|
||
subdirs-clean: $(CLEANDIRS) | ||
|
||
obj/$(TARGET)/%.o: %.asm | ||
@$(ASSEMBLER) -DFOR$(TARGET) -I../.. -Oobj/$(TARGET) $^ | ||
|
||
dirs: | ||
@mkdir -p obj/$(TARGET) | ||
|
||
.PHONY: subdirs-all $(SUBDIRS) $(SUBDIRS_CLEAN) | ||
|
||
$(SUBDIRS): | ||
$(MAKE) -C $@ all | ||
|
||
$(CLEANDIRS): | ||
$(MAKE) -C $(@:%-clean=%) clean | ||
$(RM) */*.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Makefile for +3 file support | ||
# | ||
# $Id: Makefile,v 1.9 2016-07-02 15:41:39 dom Exp $ | ||
|
||
include ../../../Make.config | ||
|
||
CFILES = $(wildcard *.c) | ||
AFILES = $(wildcard *.asm) | ||
OBJECTS = $(CFILES:.c=.o) $(AFILES:.asm=.o) | ||
|
||
all: $(OBJECTS) | ||
|
||
%.o: %.c | ||
$(ZCC) +aquarius $(CFLAGS) -c -o $@ $< | ||
|
||
%.o: %.asm | ||
$(ZCC) +aquarius $(CFLAGS) -c -o $@ $< | ||
|
||
|
||
clean: | ||
$(RM) *.o* zcc_opt.def $(OUTPUT_DIRECTORY)/p3.lib | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
|
||
#include <fcntl.h> | ||
|
||
|
||
int chdir(const char *d) __smallc __naked | ||
{ | ||
#asm | ||
INCLUDE "fcntl.def" | ||
EXTERN asm_strlen | ||
|
||
ld a,ESPCMD_CHDIR | ||
call __esp_send_cmd | ||
ld hl,2 | ||
add hl,sp | ||
ld a,(hl) | ||
inc hl | ||
ld h,(hl) | ||
ld l,a | ||
push hl | ||
call asm_strlen | ||
ld bc,hl | ||
inc bc | ||
pop hl | ||
call __esp_send_bytes | ||
call __esp_read_byte | ||
ld l,a | ||
ld h,0 | ||
ret | ||
#endasm | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <fcntl.h> | ||
|
||
|
||
int close(int fd) __smallc __naked | ||
{ | ||
#asm | ||
INCLUDE "fcntl.def" | ||
|
||
ld a,ESPCMD_CLOSE | ||
call __esp_send_cmd | ||
ld hl,2 | ||
add hl,sp | ||
ld a,(hl) | ||
call __esp_send_byte | ||
call __esp_read_byte | ||
ld l,a | ||
ld h,0 | ||
ret | ||
#endasm | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
|
||
|
||
|
||
SECTION code_clib | ||
|
||
PUBLIC __esp_send_cmd | ||
PUBLIC __esp_send_byte | ||
PUBLIC __esp_send_bytes | ||
PUBLIC __esp_read_bytes | ||
PUBLIC __esp_read_byte | ||
|
||
INCLUDE "target/aquarius/def/aqplus.def" | ||
|
||
; Send byte = a | ||
MACRO SENDBYTE | ||
LOCAL l1 | ||
ex af,af | ||
l1: | ||
in a,(PORT_ESPCTRL) | ||
and 2 | ||
jr nz,l1 | ||
ex af,af | ||
out (PORT_ESPDATA),a | ||
ENDM | ||
|
||
MACRO READBYTE | ||
LOCAL l1 | ||
ex af,af | ||
l1: | ||
in a,(PORT_ESPCTRL) | ||
and 1 | ||
jr z,l1 | ||
ex af,af | ||
in a,(PORT_ESPDATA) | ||
ENDM | ||
|
||
__esp_read_byte: | ||
READBYTE | ||
ret | ||
|
||
__esp_send_byte: | ||
SENDBYTE | ||
ret | ||
|
||
; Send a command | ||
; a = command to send | ||
__esp_send_cmd: | ||
ex af,af | ||
ld a,0x83 | ||
out (PORT_ESPCTRL),a | ||
ex af,af | ||
SENDBYTE | ||
ret | ||
|
||
; Send a block of data | ||
; hl = block | ||
; bc = count | ||
__esp_send_bytes: | ||
ld a,b | ||
or c | ||
ret z | ||
ld a,(hl) | ||
SENDBYTE | ||
inc hl | ||
dec bc | ||
jr __esp_send_bytes | ||
|
||
; Read a block of data | ||
; hl = block | ||
; bc = count | ||
__esp_read_bytes: | ||
ld a,b | ||
or c | ||
ret z | ||
READBYTE | ||
ld (hl),a | ||
inc hl | ||
dec bc | ||
jr __esp_read_bytes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
|
||
INCLUDE "target/aquarius/def/aqplus.def" | ||
|
||
EXTERN __esp_send_cmd | ||
EXTERN __esp_send_byte | ||
EXTERN __esp_send_bytes | ||
EXTERN __esp_read_byte | ||
EXTERN __esp_read_bytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
|
||
#include <fcntl.h> | ||
#include <sys/stat.h> | ||
|
||
int mkdir(char *d, int mode) __smallc __naked | ||
{ | ||
#asm | ||
INCLUDE "fcntl.def" | ||
EXTERN asm_strlen | ||
|
||
ld a,ESPCMD_MKDIR | ||
call __esp_send_cmd | ||
ld hl,4 | ||
add hl,sp | ||
ld a,(hl) | ||
inc hl | ||
ld h,(hl) | ||
ld l,a | ||
push hl | ||
call asm_strlen | ||
ld bc,hl | ||
inc bc | ||
pop hl | ||
call __esp_send_bytes | ||
call __esp_read_byte | ||
ld l,a | ||
ld h,0 | ||
ret | ||
#endasm | ||
} |
Oops, something went wrong.