Use %bp instead of %fs for caching the user input

This commit is contained in:
Hikaru Ikuta 2022-01-06 17:09:33 +09:00
parent cac1923ebf
commit 1af3db75fe

View file

@ -54,7 +54,7 @@ begin: mov $0x8000,%sp # uses higher address as stack
mov $2,%bx mov $2,%bx
main: mov %sp,%cx main: mov %sp,%cx
call NewLine call NewLine
mov %dx,%fs # Clear input lookahead cache mov %dx,%bp # Clear input lookahead cache
call Read call Read
call Eval call Eval
xchg %si,%ax xchg %si,%ax
@ -116,7 +116,7 @@ Print: test %si,%si
NewLine:mov $'\r',%al NewLine:mov $'\r',%al
jmp PutChar jmp PutChar
Read: mov %fs,%dx # Get cached character Read: mov %bp,%dx # Get cached character
call GetToken call GetToken
call GetObject call GetObject
ret ret
@ -150,7 +150,7 @@ Intern: push %cx # Intern(cx,di): ax
GetChar:xor %ax,%ax # GetCharal:dl GetChar:xor %ax,%ax # GetCharal:dl
int $0x16 # get keystroke int $0x16 # get keystroke
mov %ax,%fs # Used for READ mov %ax,%bp # Used for READ
PutChar:mov $0x0e,%ah # prints CP-437 PutChar:mov $0x0e,%ah # prints CP-437
int $0x10 # vidya service int $0x10 # vidya service
cmp $'\r',%al # don't clobber cmp $'\r',%al # don't clobber