Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
jedeoric committed Nov 21, 2023
1 parent 1e5a0c9 commit d3803fe
Show file tree
Hide file tree
Showing 22 changed files with 190 additions and 235 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023.3
2023.4
27 changes: 14 additions & 13 deletions docs/memmap_ram.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Page 0
# Memmap
## Page 0
|Type | Name | Range | Size |
| :------- |:----------------------------- |:----------- |:-----|
|RAM|RES | $00-$01 | 2 |
Expand Down Expand Up @@ -44,7 +45,7 @@
|RAM|<span style="color:green">FREE</span> | $35-$3F | |
|RAM|ADCLK | $40-$41 | 2 |
|RAM|TIMEUS | $42-$43 | 2 |
|RAM|TIMEUD | $44-$45 | 2 |
|RAM|TIMEUD (used in cc65 clock function)| $44-$45 | 2 |
|RAM|HRSX | $46-$46 | 1 |
|RAM|HRSY | $47-$47 | 1 |
|RAM|<span style="color:green">FREE</span> | $48-$48 | 1 |
Expand All @@ -62,7 +63,7 @@
|RAM|INDRS | $5B-$5B | 1 |
|RAM|<span style="color:green">FREE</span> | $5C-$5F | 2 |
|RAM|<span style="color:green">FREE</span> | $8C-$FF | 115 |
# Page 2
## Page 2
|Type | Name | Range | Size |
| :------- |:----------------------------- |:----------- |:-----|
|RAM|KERNEL_ERRNO | $0200-$0200 | 1 |
Expand All @@ -87,7 +88,7 @@
|RAM|ADSCRH | $021C-$021F | 4 |
|RAM|SCRX | $0220-$0220 | 1 |
|RAM|BUSY_BANK_TABLE_RAM | $0221-$0224 | 3 |
|RAM|SCRY | $0224-$0228 | 1 |
|RAM|SCRY | $0224-$0227 | 4 |
|RAM|SCRDX | $0228-$0228 | 1 |
|RAM|SCRFX | $022C-$022C | 1 |
|RAM|SCRFY | $0234-$0234 | 1 |
Expand All @@ -100,7 +101,7 @@
|RAM|FLGSCR | $0248-$024C | 4 |
|RAM|CURSCR | $024C-$024D | 1 |
|RAM|<span style="color:green">FREE</span> | $024D-$0256 | 11 |
|RAM|SCRTXT | $0256-$025C | 604 |
|RAM|SCRTXT | $0256-$0260 | 4 |
|RAM|SCRHIR (not used) | $025C-$0260 | 4 |
|RAM|SCRTRA | $0262-$0266 | 6 |
|RAM|KBDCOL | $0268-$0270 | 8 |
Expand All @@ -117,36 +118,36 @@
|RAM|HRSPAT | $02AA-$02AA | 1 |
|RAM|IOTAB | $02AE-$02B1 | X |
|RAM|KERNEL_ADIOB | $02B2-$02B9 | 8 |
|RAM|kernel_malloc_free_chunk_size_low | $02BA-$02C3 | 10 |
|RAM|kernel_malloc_free_chunk_size | $02BA-$02C3 | 10 |
|RAM|kernel_xmalloc_call | $02C4-$02EB | 39 |
|RAM|FLGRST | $02EE-$02EE | 1 |
|RAM|CSRND | $02EF-$02EF | 1 |
|RAM|kernel_xmalloc_call | $02C4-$02EB | 39 |
|RAM|<span style="color:green">FREE</span> | $02EC-$02ED | 2 |
|RAM|VNMI | $02F4-$02F7 | 3 |
|RAM|ADIODB_VECTOR | $02F7-$02FA | 3 |
|RAM|IRQVECTOR | $02FA-$02FD | 3 |
|RAM|VAPLIC | $02FD-$0300 | 3 |
# Page 3
## Page 3
|Type | Name | Range | Size |
| :------- |:----------------------------- |:----------- |:-----|
|IO |VIA1 | $0300-$030F | |
# Page 4
## Page 4
|Type | Name | Range | Size |
| :------- |:----------------------------- |:----------- |:-----|
|RAM|page4 overlay_access | $0419-$0436 | 54 |
# Page 5&6
## Page 5&6
|Type | Name | Range | Size |
| :------- |:----------------------------- |:----------- |:-----|
|RAM|BUFNOM | $0517-$0525 | 14 |
|RAM|<span style="color:green">FREE</span> | $0517-$0525 | 14 |
|RAM|Malloc table | $0525-$0579 | 84 |
|RAM|main kernel process struct | $0579-$058F | 22 |
|RAM|BUFEDT | $0590-$05FE | 110 |
|RAM|KERNEL_MEMORY_DRIVER | $05FE-$06A1 | 163 |
# Kernel bank 7
## Kernel bank 7
| Type | Name | Range | Size |
| :-------- |:---------------------------- |:------- |:-----|
|ROM|<span style="color:green">FREE</span> |$feea-$fff0| 262 |
#Bank 0
##Bank 0
| Type | Name | Range | Size |
| -------- | ---------------------------- | ------- |-----|
|BANK0|BUFBUF | $c080-$c0b6 | 54 |
Expand Down
24 changes: 13 additions & 11 deletions memmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ int KERNEL_MALLOC_FREE_CHUNK_MAX=0x5;
|MODIFY:RESB:XWRITEBYTES_ROUTINE
|MODIFY:TR0:XFSEEK_ROUTINE
|MODIFY:TR7:XFSEEK_ROUTINE
|MODIFY:TR7:XFSEEK_ROUTINE
|MODIFY:TR4:XFSEEK_ROUTINE
|MODIFY:RESB:XFSEEK_ROUTINE
|MODIFY:RES:XFSEEK_ROUTINE
Expand Down Expand Up @@ -140,7 +141,8 @@ CALL:XOPEN:XRM_ROUTINE
|MODIFY:KERNEL_ERRNO:XMALLOC_ROUTINE
|MODIFY:RES:XFREE_ROUTINE
|MODIFY:KERNEL_XFREE_TMP:XFREE_ROUTINE
|#MEMMAP: Page 0
|#MEMMAP: Memmap
|##MEMMAP: Page 0
|MEMMAP:Type | Name | Range | Size |
|MEMMAP: :------- |:----------------------------- |:----------- |:-----|
|MEMMAP:RAM|RES | $00-$01 | 2 |
Expand Down Expand Up @@ -204,7 +206,7 @@ CALL:XOPEN:XRM_ROUTINE
|MEMMAP:RAM|INDRS | $5B-$5B | 1 |
|MEMMAP:RAM|FREE | $5C-$5F | 2 |
|MEMMAP:RAM|FREE | $8C-$FF | 115 |
|#MEMMAP: Page 2
|##MEMMAP: Page 2
|MEMMAP:Type | Name | Range | Size |
|MEMMAP: :------- |:----------------------------- |:----------- |:-----|
|MEMMAP:RAM|KERNEL_ERRNO | $0200-$0200 | 1 |
Expand Down Expand Up @@ -268,31 +270,31 @@ CALL:XOPEN:XRM_ROUTINE
|MEMMAP:RAM|ADIODB_VECTOR | $02F7-$02FA | 3 |
|MEMMAP:RAM|IRQVECTOR | $02FA-$02FD | 3 |
|MEMMAP:RAM|VAPLIC | $02FD-$0300 | 3 |
|#MEMMAP: Page 3
|##MEMMAP: Page 3
|MEMMAP:Type | Name | Range | Size |
|MEMMAP: :------- |:----------------------------- |:----------- |:-----|
|MEMMAP:IO |VIA1 | $0300-$030F | |
|#MEMMAP: Page 4
|##MEMMAP: Page 4
|MEMMAP:Type | Name | Range | Size |
|MEMMAP: :------- |:----------------------------- |:----------- |:-----|
|MEMMAP:RAM|page4 overlay_access | $0419-$0436 | 54 |
|#MEMMAP: Page 5&6
|##MEMMAP: Page 5&6
|MEMMAP:Type | Name | Range | Size |
|MEMMAP: :------- |:----------------------------- |:----------- |:-----|
|MEMMAP:RAM|BUFNOM | $0517-$0525 | 14 |
|MEMMAP:RAM|FREE | $0517-$0525 | 14 |
|MEMMAP:RAM|Malloc table | $0525-$0579 | 84 |
|MEMMAP:RAM|main kernel process struct | $0579-$058F | 22 |
|MEMMAP:RAM|BUFEDT | $0590-$05FE | 110 |
|MEMMAP:RAM|KERNEL_MEMORY_DRIVER | $05FE-$06A1 | 163 |
|#MEMMAP: Kernel bank 7
|##MEMMAP: Kernel bank 7
|MEMMAP: Type | Name | Range | Size |
|MEMMAP: :-------- |:---------------------------- |:------- |:-----|
|MEMMAP:ROM|FREE |$feea-$fff0| 262 |
|#MEMMAP:Bank 0
|MEMMAP:ROM|FREE |$fee8-$fff0| 264 |
|##MEMMAP:Bank 0
|MEMMAP: Type | Name | Range | Size |
|MEMMAP: -------- | ---------------------------- | ------- |-----|
|MEMMAP:BANK0|BUFBUF | $c080-$c0b6 | 54 |
|MEMMAP:BANK0|BUFROU | $c500-$c54e | |
|MEMMAP:BANK0|TELEMON_KEYBOARD_BUFFER_BEGIN | $c5c4-$c680 | |
|MEMMAP:BANK0|XMALLOC (copy from kernel) | $fb9c-$fc48 | |
|MEMMAP:BANK0|XFREE (copy from kernel) | $fc48-$fecd | |
|MEMMAP:BANK0|XMALLOC (copy from kernel) | $fb9a-$fc46 | |
|MEMMAP:BANK0|XFREE (copy from kernel) | $fc46-$fecb | |
2 changes: 2 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ cp tests/test_kernel $ORICUTRON_PATH/sdcard/bin/test

cp tests/kopened $ORICUTRON_PATH/sdcard/bin/

cp autoboot $ORICUTRON_PATH/sdcard/etc/

cd $ORICUTRON_PATH
./oricutron
#-r :bp.txt
Expand Down
16 changes: 0 additions & 16 deletions src/functions/files/XOPEN.asm
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
.out .sprintf("|MODIFY:KERNEL_XOPEN_PTR1:XOPEN_ROUTINE")




; INPUT
; this routine use :
; RES, A X Y, XOPEN_SAVE XOPEN_FLAGS, XOPEN_RES_SAVE, XOPEN_SAVEA
Expand Down Expand Up @@ -288,13 +286,9 @@

@file_not_found:
; Checking if filesys is found
; jmp @exit_open_with_null

lda FILESYS_BANK
beq @filesys_bank_not_found



@filesys_bank_not_found:
; When we have file not found, do we have O_CREATE flag ?
lda XOPEN_FLAGS
Expand All @@ -308,15 +302,12 @@
cmp #O_WRONLY
beq @exit_open_with_null ; yes, return NULL


lda XOPEN_FLAGS ; Get flags
and #O_RDONLY
cmp #O_RDONLY
bne @could_be_created


@exit_open_with_null:

lda KERNEL_XOPEN_PTR1
ldy KERNEL_XOPEN_PTR1+1
jsr XFREE_ROUTINE
Expand Down Expand Up @@ -350,16 +341,10 @@
and #O_WRONLY
cmp #O_WRONLY
beq @write_only
; not write
;bne @open_and_register_fp


@write_only:
@open_and_register_fp:


; Register fp in process struct

; store pointer in process struct
ldx kernel_process+kernel_process_struct::kernel_current_process ; Get current process

Expand Down Expand Up @@ -431,7 +416,6 @@

; not found
@found_fp_slot:

lda kernel_process+kernel_process_struct::kernel_current_process ; Get the current process
sta kernel_process+kernel_process_struct::kernel_fd,x ; and store in fd slot the id of the process
; stx TR7 ; save FD id
Expand Down
19 changes: 6 additions & 13 deletions src/functions/files/xclose.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.export XCLOSE_ROUTINE

.proc XCLOSE_ROUTINE
; A & Y contains fd
; A contains FD
; Calls XFREE
.out .sprintf("|MODIFY:RESB:XCLOSE_ROUTINE")
.out .sprintf("|MODIFY:TR7:XCLOSE_ROUTINE")
Expand All @@ -16,30 +16,22 @@
.endif

; Try to found FP
;ldx #$00
; kernel_process+kernel_process_struct::kernel_fd contient un tableau où la position 0 est le FD 3 (car on commence à 3 avec stin- 0 , stdout, stderr)

; kernel_process+kernel_process_struct::kernel_fd,x contient 0 si le FD n'est pas connu
; si c'est différent de 0, alors cela contient le process concerné

; $580
sec
sbc #KERNEL_FIRST_FD

sta TR7

; Cheking if we tries to close a fp greater than the max allowed

; Checking if we tries to close a fp greater than the max allowed
cmp #KERNEL_MAX_FP
bcs @exit



tax
lda kernel_process+kernel_process_struct::kernel_fd,x ;
lda kernel_process+kernel_process_struct::kernel_fd,x ; A contient l'id du process, X contient l'id du FD retranché de 3
bne @found_fp_slot


.ifdef WITH_DEBUG
jsr kdebug_save
txa
Expand All @@ -60,8 +52,8 @@
pla
.endif

txa
asl
txa ; Transfert fd 'id slot'
asl ; Multiply
tax
; remove fp from main struct

Expand All @@ -85,6 +77,7 @@
sty RESB+1

ldy #kernel_one_process_struct::fp_ptr

@try_to_find_a_free_fp_for_current_process:
lda (RESB),y

Expand Down
7 changes: 3 additions & 4 deletions src/functions/files/xread.asm
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
; Modify : RES, PTR_READ_DEST, TR0

; [OUT] PTR_READ_DEST updated


; [OUT] A could contains 0 or the CH376 state
; [OUT] Y contains the last size of bytes
; Compute with update_position
; [OUT] A contains the last size of bytes (low)
; [OUT] X contains the last size of bytes (high)
;jmp XREADBYTES_ROUTINE


Expand Down
47 changes: 25 additions & 22 deletions src/functions/graphics/xabox.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

; TRACE UN RECTANGLE ABSOLU


;Principe:Par un procédé très astucieux, on va tracer les 4 traits (en absolu)
; joignant les 4 points. Voila bien la seule astuce inutile ! Il aurait
; été 100 (pourquoi pas 1000 !?) fois plus simple, puisque le rectangle
Expand All @@ -11,40 +12,42 @@
; Notez également l'utilisation de l'absolu,X plutot que du page 0,X en
; $E850... tss tss !



XABOX_ROUTINE:
ldy #$06 ; on place les 4 paramètres (poids faible seulement)
ldy #$06 ; On place les 4 paramètres (poids faible seulement)
ldx #$03
LE830
lda HRS1,Y ; de HRSx
sta DECFIN,X ; dans $06-7-8-9
lda HRS1,y ; de HRSx
sta DECFIN,x ; dans $06-7-8-9
dey
dey
dex
bpl LE830
LE83A:
ldx #$03 ; on va tracer 4 traits
ldx #$03 ; on va tracer 4 traits
LE83C:
stx DECDEB+1 ; dans $05 <----------------------------------------
lda table_for_rect,X ; on lit le code coordonn?es I
sta DECDEB ; dans $04 I
ldx #$06 ; on va extraire 8 bits I
lda table_for_rect,x ; on lit le code coordonn?es I
sta DECDEB ; dans $04 I
ldx #$06 ; on va extraire 8 bits I
LE845:
lda #$00 ; A=0 <---------------------------------------- I
sta HRS1+1,X ; poids fort HRSx ? 0 et positif I I
lsr DECDEB ; on sort 2 bits I I
rol ; dans A I I
lsr DECDEB ; I I
rol ; I I
tay ; et Y I I
lda $0006,Y ; on lit la coordonnée correspondante I I
sta HRS1,X ; et on stocke dans HRSx I I
dex ; I I
dex ; I I
bpl LE845 ; on fait les 4 coordonnées ADRAW ------------- I
lda #$00 ; A=0 <---------------------------------------- I
sta HRS1+1,c ; poids fort HRSx ? 0 et positif I I
lsr DECDEB ; on sort 2 bits I I
rol ; dans A I I
lsr DECDEB ; I I
rol ; I I
tay ; et Y I I
lda $0006,y ; on lit la coordonnée correspondante I I
sta HRS1,x ; et on stocke dans HRSx I I
dex ; I I
dex ; I I
bpl LE845 ; on fait les 4 coordonnées ADRAW ------------- I
jsr XDRAWA_ROUTINE ; on trace le trait en absolu I
ldx DECDEB+1 ; I
dex ; I
bpl LE83C ; et on fait 4 traits ------------------------------
ldx DECDEB+1 ; I
dex ; I
bpl LE83C ; et on fait 4 traits ------------------------------
rts
table_for_rect:
.byt $26,$67,$73,$32
2 changes: 1 addition & 1 deletion src/functions/graphics/xdrawa.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

; TRACE DE TRAIT EN ABSOLU

; Action:on calcule dX et dY les d?placements dans HRS1 et HRS2 et on trace en
; Action:on calcule dX et dY les deplacements dans HRS1 et HRS2 et on trace en
; relatif. En entr?e, comme ADRAW dans HRSx.

.proc XDRAWA_ROUTINE
Expand Down
Loading

0 comments on commit d3803fe

Please sign in to comment.