Author Topic: A very old MS-DOS program  (Read 270 times)

clamicun

  • Member
  • **
  • Posts: 234
A very old MS-DOS program
« on: July 16, 2017, 12:10:58 AM »
ASCII.exe
I found this MS-DOS program on a very old diskette.
Must be from 1989 or 1990. No source code.

Works correctly until 126. Then it gets a bit weird. Unicode, ascii type WCHAR ??
Had the idea to rewrite it with MASM, to be able to use the mouse (that is to scroll up and down).

Tried all possibilities to write the line with wsprintf.

text_out  db "DEZ WERT: %03u       Ascii symbol: %C        HEX WERT: %02Xh",0
INVOKE wsprintf,offset buffer,offset text_out,number,number,number.
Works from 32 to 126, gets weird too after 126.

The first 31. No chance. The ascii symbol is mostly '?'. How did I do that 27 year ago.
Olly debugger is not accepting the Dos program ?

Any ideas ?
 

nidud

  • Member
  • *****
  • Posts: 1354
    • https://github.com/nidud/asmc
Re: A very old MS-DOS program
« Reply #1 on: July 16, 2017, 12:28:00 AM »
ASCII.exe
I found this MS-DOS program on a very old diskette.
Must be from 1989 or 1990. No source code.

Works correctly until 126.

Assuming you running WinXP-32?

Quote
Then it gets a bit weird. Unicode, ascii type WCHAR ??
Had the idea to rewrite it with MASM, to be able to use the mouse (that is to scroll up and down).

Tried all possibilities to write the line with wsprintf.

No need for that. Chars above 128 is not Unicode.

Quote
Works from 32 to 126, gets weird too after 126.

Any ideas ?

Right-click the menu-line->Properties and change the font. TrueType fonts cant handle these clyps. If you running XP Alt-Enter (full screen) should also work.

clamicun

  • Member
  • **
  • Posts: 234
Re: A very old MS-DOS program
« Reply #2 on: July 16, 2017, 02:33:39 AM »
nidud,

Assuming you running WinXP-32?
No, 2 computers Win7-32 and Win7-64


No need for that. Chars above 128 is not Unicode.

??? . Yes I know, but what to do ?
The old MS-Dos does it, but I don't how


Right-click the menu-line->Properties and change the font. TrueType fonts cant handle these clyps. If you running XP Alt-Enter (full screen) should also work.
???

The font is defined in my new prog.

INVOKE CreateFont,20,0,0,0,700,0,0,0,ANSI_CHARSET,\
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\
DEFAULT_QUALITY,DEFAULT_PITCH,offset Font

HSE

  • Member
  • ****
  • Posts: 522
  • <AMD>< 7-32>
Re: A very old MS-DOS program
« Reply #3 on: July 16, 2017, 03:09:51 AM »
Hi Clamicum!!

You can see Jimg's "ascii chart" posted few weeks ago.

Regards.

clamicun

  • Member
  • **
  • Posts: 234
Re: A very old MS-DOS program
« Reply #4 on: July 17, 2017, 02:11:49 AM »
HSE,
yes thanks.

You can see Jimg's "ascii chart" posted few weeks ago.
He has the same problem. Doesn't show the first 31.
Instead he shows the description ... Null char, start of Heading, start ofText ...
Most tables do that, but there are symbols in some examples. 

nidud

  • Member
  • *****
  • Posts: 1354
    • https://github.com/nidud/asmc
Re: A very old MS-DOS program
« Reply #5 on: July 17, 2017, 05:02:00 AM »
No, 2 computers Win7-32 and Win7-64

So you're able to run a DOS program in the 32-bit OS then I suppose.

Quote
Quote
TrueType fonts cant handle these glyph's (sic).

???

There is a tread about this problem here:
http://masm32.com/board/index.php?topic=2344.msg26000#msg26000

Quote
The font is defined in my new prog.

INVOKE CreateFont,20,0,0,0,700,0,0,0,ANSI_CHARSET,\
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\
DEFAULT_QUALITY,DEFAULT_PITCH,offset Font

This is a modified version of this test case which illustrate the problem. It assumes you install the font in the link above.
Code: [Select]
;
; Build: asmc -pe -D__PE__ test.asm
;
include windows.inc

.data
Lucida db "Lucida Console 1..8: ", 1,2,3,4,5,6,7,8,0
Doszip db "Doszip Console 1..8: ", 1,2,3,4,5,6,7,8,0

.code

WndProc proc hWnd:HWND, message:UINT, wParam:WPARAM, lParam:LPARAM

    local wmId, wmEvent
    local ps:PAINTSTRUCT
    local hdc:HDC
    local rect:RECT
    local hFont:HFONT

    .switch message
   
      .case WM_PAINT
       
        mov hdc,BeginPaint(hWnd, &ps)
           
        mov hFont,CreateFont(32,0,0,0,FW_DONTCARE,FALSE,TRUE,FALSE,DEFAULT_CHARSET,OUT_OUTLINE_PRECIS,
                CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, VARIABLE_PITCH, "Lucida Console")
        SelectObject(hdc, hFont)           
        SetRect(&rect, 100,100,700,200)
        DrawText(hdc, &Lucida, -1, &rect, DT_NOCLIP)
           
        mov hFont,CreateFont(32,0,0,0,FW_DONTCARE,FALSE,TRUE,FALSE,DEFAULT_CHARSET,OUT_OUTLINE_PRECIS,
                CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, VARIABLE_PITCH, "Doszip Console")
        SelectObject(hdc, hFont)           
        SetRect(&rect, 100,200,700,200)
        DrawText(hdc, &Doszip, -1, &rect, DT_NOCLIP)
           
        DeleteObject(hFont)
        EndPaint(hWnd, &ps)
        xor eax,eax
        .endc
       
      .case WM_DESTROY
        PostQuitMessage(0)
        xor eax,eax
        .endc
      .default
        DefWindowProc(hWnd, message, wParam, lParam)
    .endsw
    ret
WndProc endp

WinMain proc WINAPI hInstance: HINSTANCE,
     hPrevInstance: HINSTANCE,
         lpCmdLine: LPSTR,
          nShowCmd: SINT

    local wc:WNDCLASSEX
    local msg:MSG
    local hwnd:HANDLE

    mov wc.cbSize,SIZEOF WNDCLASSEX
    mov wc.style,CS_HREDRAW or CS_VREDRAW
    mov wc.lpfnWndProc,WndProc

    mov ecx,hInstance
    xor eax,eax
    mov wc.cbClsExtra,eax
    mov wc.cbWndExtra,eax
    mov wc.hInstance,ecx
    mov wc.hbrBackground,COLOR_WINDOW+1
    mov wc.lpszMenuName,eax

    lea eax,@CStr("WndClass")
    mov wc.lpszClassName,eax
    mov wc.hIcon,LoadIcon(0, IDI_APPLICATION)
    mov wc.hIconSm,eax
    mov wc.hCursor,LoadCursor(0, IDC_ARROW)

    RegisterClassEx(&wc)

    mov eax,CW_USEDEFAULT
    mov hwnd,CreateWindowEx(0, "WndClass", "Window", WS_OVERLAPPEDWINDOW,
        eax, eax, eax, eax, 0, 0, hInstance, 0)

    ShowWindow(hwnd, SW_SHOWNORMAL)
    UpdateWindow(hwnd)

    .while GetMessage(&msg, 0, 0, 0)
        TranslateMessage(&msg)
        DispatchMessage(&msg)
    .endw
    mov eax,msg.wParam
    ret

WinMain endp

WinStart proc
    mov ebx,GetModuleHandle(0)
    ExitProcess(WinMain(ebx, 0, GetCommandLineA(), SW_SHOWDEFAULT))
WinStart endp

    end WinStart

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4750
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: A very old MS-DOS program
« Reply #6 on: July 17, 2017, 12:16:46 PM »
Solving the problem is simple, use "terminal" font. It has all of the old high ASCII characters.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

aw27

  • Member
  • ****
  • Posts: 605
Re: A very old MS-DOS program
« Reply #7 on: July 18, 2017, 12:01:29 AM »
Works correctly until 126. Then it gets a bit weird. Unicode, ascii type WCHAR ??
Had the idea to rewrite it with MASM, to be able to use the mouse (that is to scroll up and down).

Tried all possibilities to write the line with wsprintf.

text_out  db "DEZ WERT: %03u       Ascii symbol: %C        HEX WERT: %02Xh",0
INVOKE wsprintf,offset buffer,offset text_out,number,number,number.
Works from 32 to 126, gets weird too after 126.

The first 31. No chance. The ascii symbol is mostly '?'. How did I do that 27 year ago.
Olly debugger is not accepting the Dos program ?

Any ideas ?

You can feed multibytes to a function that expects Unicode (wsprintf).

This works:
Code: [Select]
.386
.model flat, stdcall
option casemap :none 

includelib \masm32\lib\msvcrt.lib
printf proto C :vararg
includelib \masm32\lib\kernel32.lib
ExitProcess proto :dword

.data
text_out  db "DEZ WERT: %03u       Ascii symbol: %C        HEX WERT: %02Xh",13,10,0

.code

main proc

mov ebx, 0
.while ebx<256
INVOKE printf, offset text_out,ebx,bl,ebx
inc ebx
.endw

invoke ExitProcess, 0
main endp

end main




« Last Edit: July 19, 2017, 03:58:56 PM by aw27 »

clamicun

  • Member
  • **
  • Posts: 234
Re: A very old MS-DOS program
« Reply #8 on: July 19, 2017, 07:36:18 AM »
Everything's ok.
Some advice ?