Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jedeoric committed Jan 27, 2024
1 parent 27aaf29 commit 4e1b94a
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 6 deletions.
21 changes: 20 additions & 1 deletion docs/ca65todoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
line_out = line_out + '\n'
else:
line_out = ''.join(inst[0:])
line_out = '***Example***\n\n' + line_out.replace(';;@','')
line_out = '\n***Example***\n\n' + line_out.replace(';;@','')

elif ';;@`' in inst[0]:
line_out = ' '.join(inst[0:])
Expand All @@ -123,6 +123,24 @@
elif inst[0] == ';;@param':
line_out = '* '+ '*'+inst[1] + '* ' + ' '.join(inst[2:])

elif ';;@modify' in inst[0]:
if def_modify_found == False:
line_out = '\n***Modify***\n\n'
def_modify_found = True
else:
line_out = ""

if inst[0] == ';;@modifyMEM_':
memory = inst[0] .split('_')
line_out = line_out + '*' + memory[1] + ' '.join(inst[1:])

if inst[0] == ';;@modifyA':
line_out = line_out + '* Accumulator' + ' '.join(inst[1:])
if inst[0] == ';;@modifyX':
line_out = line_out + '* X Register' + ' '.join(inst[1:])
if inst[0] == ';;@modifyY':
line_out = line_out + '* Y Register' + ' '.join(inst[1:])

elif ';;@input' in inst[0]:
if def_input_found == False:
line_out = '***Input***\n\n'
Expand Down Expand Up @@ -317,6 +335,7 @@
def_proc = True
def_return_found = False
def_input_found = False
def_modify_found = False

# Ne prend pas en compte un éventuel commentaire sur la ligne .proc
# TODO: Ajouter un @brief pour le prendre en compte?
Expand Down
62 changes: 61 additions & 1 deletion docs/code/assembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ If ch376 is present, it will return $AA

* Accumulator : $AA if it's OK


***Example***

```ca65
Expand All @@ -35,6 +36,7 @@ create a folder

* Accumulator : ch376 status values


***Example***

```ca65
Expand Down Expand Up @@ -64,6 +66,7 @@ perform a disk mount

* Accumulator : ch376 status values


***Example***

```ca65
Expand All @@ -89,6 +92,7 @@ Close file

* Accumulator : 'ch376 status' value


***Example***

```ca65
Expand All @@ -109,6 +113,7 @@ create file

* Accumulator : ch376 status value


***Example***

```ca65
Expand All @@ -129,11 +134,14 @@ Erase file

* Accumulator : ch376 status value


***Example***

```ca65
jsr ch376_file_erase
; check accumulator here ch376_wait_response had been launched by ch376_file_erase
; Check accumulator here :
; Ch376_wait_response had been launched
; By ch376_file_erase
```


Expand All @@ -149,11 +157,13 @@ open file

* Accumulator : 'ch376 status' value


***Example***

```ca65
jsr ch376_file_erase
; check accumulator here ch376_wait_response had been launched by ch376_file_open
rts
```


Expand All @@ -169,11 +179,13 @@ Get usb descr device

* Accumulator : ch376 status values


***Example***

```ca65
jsr ch376_get_descr
; check accumulator here ch376_wait_response had been launched by ch376_get_descr
rts
```


Expand All @@ -198,6 +210,7 @@ get version

* Accumulator : ch376 firmware version


***Example***

```ca65
Expand All @@ -218,6 +231,7 @@ Get lib version

* Accumulator : ch376 lib version


***Example***

```ca65
Expand All @@ -240,6 +254,7 @@ Get lib version

reset CH376


***Example***

```ca65
Expand All @@ -265,6 +280,7 @@ Seek file. Performs a wait_response

* Accumulator : ch376 status values


***Example***

```ca65
Expand All @@ -286,6 +302,7 @@ Seek file. Performs a wait_response

set usb address


***Example***

```ca65
Expand All @@ -304,6 +321,7 @@ set config for usb device
***Input***

* Accumulator : config value

***Example***

```ca65
Expand All @@ -323,6 +341,7 @@ set file_name

* Accumulator : Low ptr adress of the string, terminated by 0
* Y Register : High ptr adress of the string, terminated by 0

***Example***

```ca65
Expand All @@ -345,6 +364,7 @@ set usb_address
***Input***

* Accumulator : The address to set

***Example***

```ca65
Expand All @@ -364,12 +384,15 @@ Set usb mode
***Input***

* Accumulator : The usb mode to set

***Example***

```ca65
lda #CH376_USB_MODE_HOST_RESET
jsr ch376_set_usb_mode
rts
```



## ch376_set_usb_speed
Expand All @@ -381,12 +404,15 @@ Set usb mode
***Input***

* Accumulator : The speed for usb

***Example***

```ca65
lda #$02
jsr ch376_set_usb_speed
rts
```



## ch376_wait_response
Expand All @@ -400,10 +426,44 @@ Perform wait_response. It's not needed to call because some commands already per

* Accumulator : "ch376 status" value (or return 1 if usb controller does not respond)


***Example***

```ca65
jsr ch376_wait_response
rts
```



## ch376_wr_usb_data

***Description***

Send data to usb device. First byte must be the the length to send

***Input***

* Accumulator : Low byte of ptr data
* Y Register : High byte of ptr data

***Modify***

* Accumulator
* Y Register
* X Register

***Example***

```ca65
lda #<data
ldy #>data
jsr ch376_wr_usb_data
rts
data:
; length, set port feature, set feature, port_power,0, Id port, 0, 0, 0
.byte 8,$23,3,8,0,1,0,0
```



8 changes: 8 additions & 0 deletions docs/code/c.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,11 @@ Perform wait_response
"ch376 status" values


## void ch376_wr_usb_data(char *data);

***Description***

Send data to usb device. First byte must be the the length to send



4 changes: 3 additions & 1 deletion src/_ch376_file_erase.s
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
;;@returnsA ch376 status value
;;@```ca65
;;@` jsr ch376_file_erase
;;@` ; check accumulator here ch376_wait_response had been launched by ch376_file_erase
;;@` ; Check accumulator here :
;;@` ; Ch376_wait_response had been launched
;;@` ; By ch376_file_erase
;;@```
lda #CH376_FILE_ERASE
sta CH376_COMMAND
Expand Down
3 changes: 2 additions & 1 deletion src/_ch376_file_open.s
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
;;@```ca65
;;@` jsr ch376_file_erase
;;@` ; check accumulator here ch376_wait_response had been launched by ch376_file_open
;;@` rts
;;@```
lda #CH376_FILE_OPEN
sta CH376_COMMAND
jmp _ch376_wait_response
jmp ch376_wait_response
.endproc
3 changes: 2 additions & 1 deletion src/_ch376_get_descr.s
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.include "telestrat.inc"
.include "include/ch376.inc"

.import gch376_wait_response
.import ch376_wait_response

.export _ch376_get_descr
.export ch376_get_descr
Expand All @@ -18,6 +18,7 @@
;;@```ca65
;;@` jsr ch376_get_descr
;;@` ; check accumulator here ch376_wait_response had been launched by ch376_get_descr
;;@` rts
;;@```
ldx #CH376_CMD_GET_DESCR
stx CH376_COMMAND
Expand Down
1 change: 1 addition & 0 deletions src/_ch376_set_usb_speed.s
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
;;@` lda #$02
;;@` jsr ch376_set_usb_speed
;;@` rts
;;@```
ldx #CH276_SET_USB_SPEED ;
stx CH376_COMMAND
sta CH376_DATA
Expand Down
2 changes: 1 addition & 1 deletion src/_ch376_wait_response.s
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

.include "telestrat.inc"
.include "include/ch376.inc"

Expand All @@ -17,6 +16,7 @@
;;@```ca65
;;@` jsr ch376_wait_response
;;@` rts
;;@```
ldy #$FF

loop3:
Expand Down
47 changes: 47 additions & 0 deletions src/_ch376_wr_usb_data.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.include "telestrat.inc"
.include "include/ch376.inc"

.export _ch376_wr_usb_data
.export ch376_wr_usb_data

.proc _ch376_wr_usb_data
;;@proto void ch376_wr_usb_data(char *data);
;;@brief Send data to usb device. First byte must be the the length to send
.endproc

.proc ch376_wr_usb_data
;;@brief Send data to usb device. First byte must be the the length to send
;;@inputA Low byte of ptr data
;;@inputY High byte of ptr data
;;@modifyA
;;@modifyY
;;@modifyX
;;@modifyMEM_RES
;;@```ca65
;;@` lda #<data
;;@` ldy #>data
;;@` jsr ch376_wr_usb_data
;;@` rts
;;@`data:
;;@` ; length, set port feature, set feature, port_power,0, Id port, 0, 0, 0
;;@` .byte 8,$23,3,8,0,1,0,0
;;@```

sta RES
sty RES+1
ldx #CH376_WR_USB_DATA
stx CH376_COMMAND
ldy #$00

lda (RES),y
tax ; Get the length

@L1:
lda (RES),y
sta CH376_DATA
iny
dex
bne @L1

rts
.endproc

0 comments on commit 4e1b94a

Please sign in to comment.