Skip to content

Commit

Permalink
Modifié readln pour accepter les minuscules rend la touche caps lock …
Browse files Browse the repository at this point in the history
…effective

Modifié le décompilateur pour éliminer les espaces inutiles
  • Loading branch information
Picatout committed Aug 7, 2023
1 parent b2c1383 commit 0078a3b
Show file tree
Hide file tree
Showing 7 changed files with 352 additions and 352 deletions.
Binary file modified build/stm8s207k8/pomme_1.bin
Binary file not shown.
609 changes: 304 additions & 305 deletions build/stm8s207k8/pomme_1.ihx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions compiler.asm
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ parse_symbol:
addw x,#1 ; keep space for token identifier
ldw (FIRST_CHAR,sp),x
symb_loop:
call to_upper
ld (x), a
incw x
ld a,([in.w],y)
Expand Down
58 changes: 36 additions & 22 deletions decompiler.asm
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,26 @@ tok_to_name:
9$: _drop VSIZE
ret

;------------------------------------
; check if token need space
; before or after it
; input:
; A token index
; output:
; C set need space
;------------------------------------
need_space:
cp a,#DELIM_LAST+1
jrmi 9$
cp a,#SYMB_LAST+1
jrmi 8$
cp a,#OP_REL_LAST+1
jrmi 9$
8$: scf
ret
9$: rcf
ret

;-------------------------------------
; decompile tokens list
; to original text line
Expand Down Expand Up @@ -234,28 +254,17 @@ decomp_loop:
jrne 9$
jp decomp_exit
9$:
call strlen
cp a,#2
jrpl 10$
ld a,(PREV_BC,sp)
cp a,#VAR_IDX
jreq 92$
cp a,#LITW_IDX
jreq 92$
cp a,#STR_VAR_IDX
jrne 94$
92$:
ld a,#BS
call putc
94$:
ld a,(x)
call putc
jra decomp_loop
10$:
call puts
prt_space:
ld a,(LAST_BC,sp)
call need_space
jrc prt_space
jp decomp_loop
prt_space:
ld a,(y)
call need_space
jrnc 1$
call space
jp decomp_loop
1$: jp decomp_loop
; print variable name
variable: ; VAR_IDX
ld a,(y)
Expand All @@ -270,8 +279,13 @@ variable: ; VAR_IDX
; print literal integer
lit_word: ; LITW_IDX
_get_word
call print_int
jp decomp_loop
call print_int
ld a,(y)
call need_space
jrc 1$
ld a,#BS
call putc
1$: jp decomp_loop
; print comment
comment: ; REM_IDX
ld a,#''
Expand Down
10 changes: 9 additions & 1 deletion journal.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
### 2023-08-06

* tag V1.0R11

* Modifié readln pour accepter les minuscules/majuscules et le compilateur pour mettre en majuscules est mots réservés.

* Modifié le décompilateur pour éliminer les espaces inutiles.

### 2023-08-05

* V1.0R10

* Modifié commande BASIC **CLS** pour ajouter un délais de 5 msec pour laisser le temps au terminal d'effacer l'écran.
* Modifié commande BASIC **CLS** pour ajouter un délais de 4 msec pour laisser le temps au terminal d'effacer l'écran.

### 2023-08-04

Expand Down
2 changes: 0 additions & 2 deletions p1Basic.asm
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ P1BASIC::
; reset hardware stack
ldw x,#STACK_EMPTY
ldw sp,x
; upper case letters
bset sys_flags,#FSYS_UPPER
call reset_basic
; initialize operation pending stack
_rst_pending
Expand Down
24 changes: 2 additions & 22 deletions terminal.asm
Original file line number Diff line number Diff line change
Expand Up @@ -700,16 +700,6 @@ skip_display:
ld (CPOS,sp),a
jp update_cursor
10$:
cp a,#CTRL_L
jrne 11$
bres sys_flags,#FSYS_UPPER
jp skip_display
11$:
cp a,#CTRL_U
jrne 12$
bset sys_flags,#FSYS_UPPER
jp skip_display
12$:
cp a,#CTRL_O
jrne 13$
; toggle between insert/overwrite
Expand Down Expand Up @@ -781,7 +771,6 @@ readln_quit:
ld a,(LL,sp)
_drop VSIZE
popw y
bset sys_flags,#FSYS_UPPER
ret

;--------------------------
Expand Down Expand Up @@ -905,7 +894,6 @@ MAX_LEN=60
VSIZE=CHAR
readln:
_vars VSIZE
bset sys_flags,#FSYS_UPPER
ld (LN_LEN,sp),a
ld (CPOS,sp),a
ldw x,#tib
Expand Down Expand Up @@ -953,18 +941,10 @@ readln:
jrne 4$
bres flags,#FAUTO
ld a,#CR
clr tib
clr (LN_LEN,sp)
jra 9$
4$:
cp a,#CTRL_L
jrne 5$
bres sys_flags,#FSYS_UPPER
jra 1$
5$:
cp a,#CTRL_U
jrne 6$
bset sys_flags,#FSYS_UPPER
jra 1$
6$:
cp a,#ESC
jrne 1$
call process_esc
Expand Down

0 comments on commit 0078a3b

Please sign in to comment.