Skip to content

Commit

Permalink
project tree reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
Baron-von-Riedesel committed Feb 10, 2020
1 parent 2ac536e commit 1923fac
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 27 deletions.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions README.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 7 additions & 8 deletions src/DOS64STB.asm
Expand Up @@ -516,7 +516,7 @@ backtoreal proc
mov ds,ax
mov es,ax
mov ss,ax
movzx esp,wStkBot
mov sp,wStkBot

mov eax,cr0
and eax,7ffffffeh ; disable protected-mode & paging
Expand Down Expand Up @@ -578,7 +578,7 @@ call_rmode proc
mov es, ax
shl bx,2
mov ecx,ss:[bx]
mov dword ptr [esp].RMCS.regIP, ecx
mov [adjust], ecx ;use the adjust var to temporarily store CS:IP
mov bx, wStkBot
sub bx, 40h
sub wStkBot,(8+6+4+4) ;saved RSP, 6 bytes unused, RMCS SS:SP, RMCS CS:IP
Expand All @@ -589,7 +589,7 @@ call_rmode proc
@@:
mov ax,ds
mov ss,ax
movzx esp,bx
movzx esp,bx ;clear highword ESP, [ESP] is used below!

;--- disable paging & protected-mode
mov eax,cr0
Expand All @@ -610,8 +610,7 @@ call_rmode proc
pop ds
pop fs
pop gs
pop dword ptr cs:[adjust] ;use this field temporarily
lss sp,[esp]
lss sp,[esp+4]
push cs:wFlags
push DGROUP
push offset backtopm
Expand Down Expand Up @@ -1279,13 +1278,13 @@ pcall_rmode label ptr far16
dw offset call_rmode
dw SEL_CODE16
back_to_long::

xor eax,eax
mov ss,eax
mov edx,DGROUP
shl edx,4
lea esi,[esp+edx]
xor eax,eax
mov ss,eax
mov rsp,[esi+38h]
sti
mov rdi,[rsp]
cld
movsq ;copy 2Ah bytes back, don't copy CS:IP & SS:SP fields
Expand Down
52 changes: 39 additions & 13 deletions src/MON64.asm
Expand Up @@ -100,28 +100,55 @@ c_cmd proc
ret
c_cmd endp

;--- enter address (for d cmd)
;--- get a line of characters
;--- rbx->buffer
;--- esi=size of buffer

a_cmd proc
invoke printf, CStr(<"enter start address for d cmd: ">)
mov rdi, 0
lea rbx, buffer
getline proc
xor edi, edi
dec esi
nextkey:
mov ah,1
int 21h
cmp al,0dh
jz enter_pressed
cmp al,08h
jz backspace_pressed
mov [rbx+rdi],al
inc rdi
cmp rdi,lbuffer-1
inc edi
cmp edi,esi
jnz nextkey
invoke printf,CStr(lf)
mov dl,0dh
mov ah,2
int 21h
jmp enter_pressed
backspace_pressed:
mov dl,20h
mov ah,2
int 21h
cmp edi,0
jz nextkey
dec edi
mov dl,08h
mov ah,2
int 21h
jmp nextkey
enter_pressed:
mov byte ptr [rbx+rdi],0
ret
getline endp

;--- enter address (for d cmd)

a_cmd proc
invoke printf, CStr(<"enter start address for d cmd: ">)
lea rbx, buffer
mov esi, lbuffer
call getline
and edi,edi ;at least 1 digit entered?
jz done
mov byte ptr [rbx+rdi],0
xor edi,edi
xor rsi,rsi
xor esi,esi
.while byte ptr [rbx+rdi]
mov al,byte ptr [rbx+rdi]
sub al,'0'
Expand All @@ -143,13 +170,12 @@ enter_pressed:
jz @F
invoke printf, CStr(<"hint: magnitude of address > 48 bits, exceeds paging capacity",lf>)
@@:
mov [address],rsi
mov address,rsi
done:
invoke printf, CStr(lf)
ret
error:
lea rsi, [buffer]
invoke printf, CStr(<lf,"%s?",lf>), rsi
invoke printf, CStr(<lf,"%s?",lf>), addr buffer
ret

a_cmd endp
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Expand Up @@ -2,7 +2,7 @@
# NMake makefile, makes dos64stb.bin and mon64.exe
# needs JWasm and a 64-bit linker (MS link used here).

ODIR=Release
ODIR=..\build

all: $(ODIR) $(ODIR)\mon64.exe

Expand Down
2 changes: 1 addition & 1 deletion src/TestC.mak
Expand Up @@ -2,7 +2,7 @@
# NMake makefile, makes TestC.exe
# needs JWasm and MSVC 64-bit

ODIR=Release
ODIR=..\build

all: $(ODIR) $(ODIR)\TestC.exe

Expand Down

0 comments on commit 1923fac

Please sign in to comment.