| Author |
| Thread |
 |
|
edfed
Joined: 20 Feb 2006
Posts: 1681
Location: MARSeille (France) |
input. in fool.
before to start any serious project, you shall have a serious quality of libraries and accessing methods.
the keyboard is the way we use to code, write a document, and so on.
then, one of the fisrt thing to do, is a method to access the keyboard.
input text from keyboard.
- very important function.
this little function is able to add chars, according to a codepage inside the system.
one dword in the input object gives the codepage to use.
Code: |
|
input:
.call=0
.buffer=4
.bufferend=8
.cursor=12
.pagecode=16
.cnt=20 ; these four cnt will disapear ones the synch will be established.
.cnt0=21
.cnt1=22
.cnt2=23
.curcode=24
.oldcode=25
.curkey=26
.oldkey=27
;esi=curent
;edi=parent
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov ecx,[esi+.cursor]
mov al,[key+key.cur]
mov [esi+.curcode],al
mov byte[esi+.curkey],0
cmp al,[esi+.oldcode]
je .nochange
mov ah,[esi+.cnt1]
mov [esi+.cnt],ah
cmp al,[esi+.oldkey]
je @f
mov ah,[esi+.cnt0]
mov [esi+.cnt],ah
@@:
inc byte[esi+.cnt]
mov [esi+.curkey],al
mov [esi+.oldkey],al
.nochange:
dec byte[esi+.cnt]
jne @f
mov byte[esi+.oldcode],0
jmp .exit?
@@:
mov [esi+.oldcode],al
.exit?:
movzx eax,byte[esi+.curkey]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
or al,al
jle .end
test byte[key+key.status],key.altgr?
je .shift
add eax,256
jmp @f
.shift:
mov bl,[key+key.status]
test bl,key.shiftled + key.shift?
je @f
mov bh,bl
shr bl,4
shr bh,2
and bh,1
cmp bl,bh
je @f
add eax,128
@@:
mov ebx,[esi+.pagecode]
lea eax,[eax*2+ebx]
movzx ebx,word[eax]
or ebx,ebx
je .end
cmp ebx,'bs'
je .bs
@@:
mov al,[ebx]
or al,al
je @f
mov [ecx],al
inc ecx
inc ebx
jmp @b
@@:
.end:
mov [esi+.cursor],ecx
ret
.bs:
test byte[key+key.status],key.ctrl?
jne .linebs
mov byte[ecx],0
dec ecx
cmp ecx,[esi+.buffer]
jnl .notabove
mov ecx,[esi+.buffer]
.notabove:
cmp word[ecx],0ah
je @f
cmp word[ecx],0dh
je @f
jmp .normalbs
@@:
mov byte[ecx],0
dec ecx
jnl .normalbs
mov ecx,0
.normalbs:
mov byte[ecx],0
jmp .end
.linebs:
dec ecx
cmp ecx,[esi+.buffer]
jl .reset
mov byte[ecx],0
@@:
mov al,[ecx]
cmp al,'/'
je @f
mov byte[ecx],0
cmp al,' '
je .end
cmp ecx,[esi+.buffer]
je .end
dec ecx
jmp @b
@@:
inc ecx
jmp .end
.reset:
mov ecx,[esi+.buffer]
jmp .end
|
|
if i post it, it is again to share my experience, for beginners. they will have some guidance, for me, i'll laungh a lot when i'll read it again in a long time...  , and for experts, if they want to give me some advices...
globally, this input is ok. it can be used as independant edit zones.
For a text editor, it will simply edit lines per lines, each displayable line will be converted as an input object.
one line on the screen ==> one input.
all the rest of the text will be a linked list.
link will be for each lines. inside lines, there will not be links, just shift the chars in case of insert, delete. i think about a ctrl + suppr to delete the "word" after the cursor, as ctrl backspace.
_____________________________________________________________________
_____________________________________________________________________
the backup of the first version of the shell.
this one is an application to help in the conception of fool. each applications gives me more ideas of what is needed.
contain an hello world example. 
| Description: |
this is just a prototype of shell based on fool. |
 Download |
| File name: |
shell.zip |
| File size: |
73.64 KB |
| Downloaded: |
2 Time(s) |
|
_________________ The Self Moderation is Good!
Last edited by edfed on 20 May 2008, 21:54; edited 8 times in total
|
24 Apr 2008, 17:30 |
|
edfed
Joined: 20 Feb 2006
Posts: 1681
Location: MARSeille (France) |
as i am building a shell, i want to have some ideas form fasm users.
what commands and syntax do you prefer?
the shell will permit to explore trees, edit trees, execute programs, and the best, execute commands like a script. then, as i am not informatician, and used to the GUI, i invite you to list some good stuff you want to see in this shell.
don't speak about DOS or LINUX commands, just about What do you prefer to have for intuitive use. it can be inspirated from existing command lines, but i'd prefer to have a really new vision of shell, more asm oriented.
for example:
Quote: |
|
existing commands:
x, exit, q, quit to exit teh shell
help, h toggle the global help file
keymap toogle the keymap
rdtsc toogle the rdtsc application
null point the reply to null char
color %n% ,c %n% to change the color
path, p to set the comand line with the current path.
|
|
i have a little idea about the navigation, a sort of intuitive command, not cd or ls oriented, but directlly edit the desired path and hit enter
the comand path used to remember the current path in comand line.
and to change the current node, just change teh path and hit enter.
it will be updated in the path buffer, and remembered with path command.
existing comands are not definitive, for example, the x, q, quit commands can be reassigned.
About the syntax, what about the fasm syntax?
Code: |
|
function operand1,operand2,operand3,operand4,.,.,...
|
|
for example;
box x,y,xl,yl,c
will create a new box in the current path.
the path is a reference in the tree.
the tree begin at [desk], [desk] hold the start of the tree.
[desk] is a value used by main, contained in the system memory of the application.
an application will be affected to each 1 MegaBytes, oriented in a V86 mode, supporting the vesa high resolution as a composition of little screen.
all screens will be decomposed in smaller screens.
then, it is a tree.
a visual file system.
the problem now is ot create new objects in this struture.
|
25 Apr 2008, 22:43 |
|
|
|