Skip to content

Commit 92a8ec6

Browse files
authored
Merge pull request #70 from orix-software/develop
Develop
2 parents 46f6ce5 + a0dd15c commit 92a8ec6

File tree

14 files changed

+160
-114
lines changed

14 files changed

+160
-114
lines changed

buildr128.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#! /bin/bash
2+
#make
3+
NAME_TO_BUILD=full.128
4+
5+
cat ../../empty-rom/empty-rom.rom > $NAME_TO_BUILD
6+
cat ../../empty-rom/empty-rom.rom >> $NAME_TO_BUILD
7+
cat ../../empty-rom/empty-rom.rom >> $NAME_TO_BUILD
8+
cat ../../empty-rom/empty-rom.rom >> $NAME_TO_BUILD
9+
10+
11+
cat ../../shell/develop/shellus.rom >> $NAME_TO_BUILD
12+
cat basicus2.rom >> $NAME_TO_BUILD
13+
cat kernelus.rom >> $NAME_TO_BUILD
14+
cat ../../empty-rom/empty-rom.rom >> $NAME_TO_BUILD
15+
16+
#cp $NAME_TO_BUILD /mnt/s/devus.r64
17+
18+
19+
#cat ../../shell/develop/shellus.rom >>initromD.all
20+
#cat basicus2.rom >> initromD.all
21+
#cat kernelud.rom >> initromD.all
22+
#cat ../../empty-rom/empty-rom.rom >> initromD.all
23+
24+

buildr64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/bash
22
#make
3-
NAME_TO_BUILD=k2022-4.r64
3+
NAME_TO_BUILD=k2022-5.r64
44

55
cp ../../shell/develop/shellus.rom $NAME_TO_BUILD
66
cat basicus2.rom >> $NAME_TO_BUILD

docs/memmap_ram.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,16 @@
102102
|RAM|Malloc table | $0525-$0575 | 80 |
103103
|RAM|main kernel process struct | $0575-$058B | 22 |
104104
|RAM|BUFEDT | $0590-$05FE | 110 |
105-
|RAM|KERNEL_MEMORY_DRIVER | $05FE-$06A4 | 166 |
105+
|RAM|KERNEL_MEMORY_DRIVER | $05FE-$06A1 | 163 |
106106
# Kernel bank 7
107107
| Type | Name | Range | Size |
108108
| :-------- |:---------------------------- |:------- |:-----|
109-
|ROM|<span style="color:green">FREE</span> |$fbdc-$fff0| 1044 |
109+
|ROM|<span style="color:green">FREE</span> |$fbe0-$fff0| 1040 |
110110
#Bank 0
111111
| Type | Name | Range | Size |
112112
| :-------- |:---------------------------- |:------- |:-----|
113113
|BANK0|BUFBUF | $c080-$c0b6 | |
114114
|BANK0|BUFROU | $c500-$c54e | |
115115
|BANK0|TELEMON_KEYBOARD_BUFFER_BEGIN | $c5c4-$c680 | |
116-
|BANK0|XMALLOC (copy from kernel) | $f898-$f944 | |
117-
|BANK0|X<span style="color:green">FREE</span> (copy from kernel) | $f944-$fbc4 | |
116+
|BANK0|XMALLOC (copy from kernel) | $f89a-$f946 | |
117+
|BANK0|X<span style="color:green">FREE</span> (copy from kernel) | $f946-$fbc6 | |

memmap.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ System will need almost 574 bytes in memory, if we reached KERNEL_MAX_PROCESS, K
2222
kernel_malloc_busy_begin : 2ba
2323
kernel_end_of_variables_before_BUFNOM : 503
2424
kernel_end_of_variables_before_BUFEDT : 58b
25-
kernel_end_of_memory_for_kernel (malloc will start at this adress) : 6a4
25+
kernel_end_of_memory_for_kernel (malloc will start at this adress) : 6a1
2626
|MODIFY:RES:_create_file_pointer
2727
|MODIFY:KERNEL_ERRNO:_create_file_pointer
2828
|CALL:XMALLOC:_create_file_pointer
@@ -207,16 +207,16 @@ CALL:XOPEN:XRM_ROUTINE
207207
|MEMMAP:RAM|Malloc table | $0525-$0575 | 80 |
208208
|MEMMAP:RAM|main kernel process struct | $0575-$058B | 22 |
209209
|MEMMAP:RAM|BUFEDT | $0590-$05FE | 110 |
210-
|MEMMAP:RAM|KERNEL_MEMORY_DRIVER | $05FE-$06A4 | 166 |
210+
|MEMMAP:RAM|KERNEL_MEMORY_DRIVER | $05FE-$06A1 | 163 |
211211
|#MEMMAP: Kernel bank 7
212212
|MEMMAP: Type | Name | Range | Size |
213213
|MEMMAP: :-------- |:---------------------------- |:------- |:-----|
214-
|MEMMAP:ROM|FREE |$fbdc-$fff0| 1044 |
214+
|MEMMAP:ROM|FREE |$fbe0-$fff0| 1040 |
215215
|#MEMMAP:Bank 0
216216
|MEMMAP: Type | Name | Range | Size |
217217
|MEMMAP: :-------- |:---------------------------- |:------- |:-----|
218218
|MEMMAP:BANK0|BUFBUF | $c080-$c0b6 | |
219219
|MEMMAP:BANK0|BUFROU | $c500-$c54e | |
220220
|MEMMAP:BANK0|TELEMON_KEYBOARD_BUFFER_BEGIN | $c5c4-$c680 | |
221-
|MEMMAP:BANK0|XMALLOC (copy from kernel) | $f898-$f944 | |
222-
|MEMMAP:BANK0|XFREE (copy from kernel) | $f944-$fbc4 | |
221+
|MEMMAP:BANK0|XMALLOC (copy from kernel) | $f89a-$f946 | |
222+
|MEMMAP:BANK0|XFREE (copy from kernel) | $f946-$fbc6 | |

run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ cl65 -ttelestrat -C tests/orix-sdk/cfg/telestrat_900.cfg tests/readdir.c tests
1919
ca65 --cpu 6502 -DWITH_SDCARD_FOR_ROOT=1 -DWITH_DEBUG=1 --verbose -s -ttelestrat src/kdebug.asm -o kdebugsd.ld65 --debug-info
2020
ld65 -tnone -DWITH_SDCARD_FOR_ROOT=1 -DWITH_DEBUG=1 kdebugsd.ld65 -o kdebug.rom -Ln kdebugsd.sym -m memmap.txt -vm
2121

22-
cp kernel.rom $ORICUTRON_PATH/roms
23-
cp kdebug.rom $ORICUTRON_PATH/roms
22+
cp kernel.rom $ORICUTRON_PATH/roms
23+
cp kdebug.rom $ORICUTRON_PATH/roms
2424
cp multi $ORICUTRON_PATH/sdcard/bin/a
2525
cp b $ORICUTRON_PATH/sdcard/bin/b
2626
cd $ORICUTRON_PATH

src/build.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.define __DATE__ "2022-09-23 23:46"
1+
.define __DATE__ "2022-10-21 23:47"

src/functions/files/_update_fp_position.asm

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,57 +26,57 @@
2626

2727
ldy #_KERNEL_FILE::f_seek_file
2828

29-
lda (KERNEL_XOPEN_PTR1),y
30-
29+
lda (KERNEL_XOPEN_PTR1),y ; Get first byte
3130
clc
3231
adc XOPEN_RES
32+
sta (KERNEL_XOPEN_PTR1),y ; update byte 1 of the file position
3333
bcc @no_inc_byte2
34-
iny
35-
clc
36-
lda #$01
37-
adc (KERNEL_XOPEN_PTR1),y
38-
dey
34+
35+
ldy #(_KERNEL_FILE::f_seek_file+1)
36+
jsr inc_byte_superior ; byte 2
37+
bcc @no_inc_byte2
38+
39+
ldy #(_KERNEL_FILE::f_seek_file+2)
40+
jsr inc_byte_superior
41+
bcc @no_inc_byte2
42+
43+
ldy #(_KERNEL_FILE::f_seek_file+3)
44+
jsr inc_byte_superior
45+
bcc @no_inc_byte2
46+
47+
3948
@no_inc_byte2:
40-
sta (KERNEL_XOPEN_PTR1),y
4149

42-
iny
50+
51+
ldy #(_KERNEL_FILE::f_seek_file+1)
4352
lda (KERNEL_XOPEN_PTR1),y
4453
adc XOPEN_RES+1
54+
sta (KERNEL_XOPEN_PTR1),y ; update byte 2 of the file position
4555
bcc @no_inc_byte3
46-
iny
47-
clc
48-
lda #$01
49-
adc (KERNEL_XOPEN_PTR1),y
50-
dey
51-
@no_inc_byte3:
5256

53-
sta (KERNEL_XOPEN_PTR1),y
54-
55-
iny
56-
lda (KERNEL_XOPEN_PTR1),y
57-
adc #$00
5857

59-
bcc @no_inc_byte4
60-
61-
iny
62-
clc
63-
lda #$01
64-
adc (KERNEL_XOPEN_PTR1),y
65-
dey
58+
ldy #(_KERNEL_FILE::f_seek_file+2)
59+
jsr inc_byte_superior ; Byte 3
60+
bcc @no_inc_byte3
6661

67-
@no_inc_byte4:
68-
sta (KERNEL_XOPEN_PTR1),y
62+
ldy #(_KERNEL_FILE::f_seek_file+3)
63+
jsr inc_byte_superior ; byte 4
6964

70-
iny
71-
lda (KERNEL_XOPEN_PTR1),y
72-
adc #$00
65+
@no_inc_byte3:
7366

74-
; restore A & X
7567

7668
lda XOPEN_RES
7769
ldx XOPEN_RES+1
7870

7971

8072
rts
8173

74+
inc_byte_superior:
75+
clc
76+
lda #$01
77+
adc (KERNEL_XOPEN_PTR1),y
78+
sta (KERNEL_XOPEN_PTR1),y
79+
rts
80+
81+
8282
.endproc

src/functions/files/xread.asm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@
8989
@loop:
9090
lda CH376_DATA ; read the data
9191
sta (PTR_READ_DEST),y ; send data in the ptr address
92+
.ifdef DEBUG_XREAD
93+
;sta $7000,y ; send DEBUG
94+
.endif
9295
iny ; inc next ptr addrss
9396
cpy TR0 ; do we read enough bytes
9497
bne @loop ; no we read

src/functions/memory/memory_driver.asm

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
; This routine check if IRQ vector is set to $fffe, if yes we continue or else, we proceed to next bank
22
; Also if $FFF7 contains 0, it means that there is no command, then we skip
33

4-
4+
; At the beginning of this routine, we already swapped into the a bank to check
5+
; Bank and twilighte_banking_register are managed in the kernel and call this routines located in the main ram
56
kernel_memory_driver_to_copy:
67
lda VIA2::PRA
78
and KERNEL_TMP_XEXEC ; But select a bank in BNK_TO_SWITCH
@@ -23,17 +24,17 @@ test_debug:
2324
sta RESB+1
2425
; d15E
2526
ldx #$00
26-
2727
read_command_from_bank_driver_mloop:
2828
ldy #$00
2929
read_command_from_bank_driver_next_char:
30-
lda (RES),y
31-
cmp (RESB),y ; Same character?
30+
lda (RES),y ; RES contains the ptr of the string typed by the user when XEXEC is launched
31+
cmp (RESB),y ; Same character? RESB contains the ptr of the command in the rom
3232
beq read_command_from_bank_driver_no_space
33-
cmp #' ' ; space?
33+
cmp #' ' ; Space?
3434
bne command_not_found_no_inc
35-
lda (RESB),y ; Last character of the command name?
36-
read_command_from_bank_driver_no_space: ; FIXME
35+
lda (RESB),y ; Last character of the command name?
36+
37+
read_command_from_bank_driver_no_space:
3738
cmp #$00 ; Test end of command name or EOL
3839
beq read_command_from_bank_driver_command_found
3940
iny
@@ -42,13 +43,20 @@ read_command_from_bank_driver_no_space: ; FIXME
4243

4344
command_not_found:
4445
; read_until_we_reached $00
46+
; this code is to detect the end of the string of the command tested
47+
; For example, if the command launch in RES is "bank" and RESB a ptr to is "ls" string in the current bank, we "iny"
48+
; the value in order to reach EOL of "ls". in that case, we add the length of "ls"+0 to the RESB ptr in order to read the next command
4549
iny
46-
command_not_found_no_inc:
4750

51+
; Theses following lines are here to exit this routine, if we reach y=12, because it's impossible to have a command longer than 12 bytes.
52+
cpy #12
53+
beq exit_to_kernel
4854

55+
command_not_found_no_inc:
4956
lda (RESB),y
5057
beq @add
5158
bne command_not_found
59+
5260
@add:
5361
iny
5462
tya
@@ -59,7 +67,7 @@ command_not_found_no_inc:
5967
read_command_from_bank_driver_do_not_inc:
6068
sta RESB
6169
inx
62-
cpx $FFF7 ; Number of command
70+
cpx $FFF7 ; loop until we reach number of command of the rom
6371
bne read_command_from_bank_driver_mloop
6472
; at this step we did not found the command in the rom
6573
exit_to_kernel:
@@ -70,9 +78,8 @@ exit_to_kernel:
7078
ldy #ENOENT ; error
7179

7280
rts
73-
read_command_from_bank_driver_command_found:
74-
7581

82+
read_command_from_bank_driver_command_found:
7683
; X contains the id of the command to start
7784
lda $FFF3
7885
sta RES
@@ -90,28 +97,33 @@ read_command_from_bank_driver_patch1:
9097
read_command_from_bank_driver_patch2:
9198
sta VEXBNK+2 ; Will store in read_command_from_bank_driver_to_patch
9299

93-
lda VIA2::PRA
94-
ora #%00000111 ; Return to telemon
95-
sta VIA2::PRA
100+
lda #$07 ; Return to telemon
101+
jsr $46a
102+
103+
96104
jsr _XFORK
97105

98106
; we reached max process to launch ?
99107
lda KERNEL_ERRNO
100108
cmp #KERNEL_ERRNO_MAX_PROCESS_REACHED
101109
beq exit_to_kernel ; Yes we reached max process we exit
102110

103-
lda VIA2::PRA
104-
and KERNEL_TMP_XEXEC ; But select a bank in BNK_TO_SWITCH
105-
sta VIA2::PRA
111+
lda KERNEL_TMP_XEXEC
112+
jsr $46A
113+
114+
115+
116+
lda TR0
117+
ldy TR1 ; Send command line in A & Y
106118

107-
lda TR0
108-
ldy TR1 ; Send command line in A & Y
109119
read_command_from_bank_driver_to_patch:
110120
jsr VEXBNK
111121
pha
112-
lda VIA2::PRA
113-
ora #%00000111 ; Return to kernel
114-
sta VIA2::PRA
122+
123+
lda #$07 ; Return to telemon
124+
jsr $46A
125+
126+
115127
pla
116128
ldy #EOK
117129

0 commit comments

Comments
 (0)