flat assembler
Message board for the users of flat assembler.
Index
> DOS > failed dos gui program |
Author |
|
baldr 05 Jan 2013, 12:59
kty11,
You have to revise your code carefully. For example (check.asm): Code: check_top: ;input: al = handle output: bl = 1 or 0 pusha mov ah, [size_of_struct_window] ;;; (1) Are you sure about proper ds value? mul al ;al*ah = ah:al ;;; (2) Wrong comment won't change instruction's behavior: ;;; indeed mul al ::== ax = al*al push cs pop ds ;;; (3) Here you're setting ds, and at (1) just assuming it mov di, window_array add di, ax add di, top_offset ;;; (4) Meaningless: window_array + top_offset == 2*window_array + 0x8001 popa ;;; (5) Restores all GPRs, including di mov bl, [ds:di] ;;; (6) di probably has irrelevant value because of (5) ret |
|||
05 Jan 2013, 12:59 |
|
AsmGuru62 05 Jan 2013, 13:28
Yeah, the code is weird.
In COM file you usually do not handle the segment registers. Since all code and data are in one 64Kb room. However, if you allocate more data at PSP+64Kb and beyond -- you do need to set DS,ES for these areas and then restore them back to PSP, so your data is properly accessed. So, kty11, what is it you are trying to do? Do you want to be able to create buttons in any part of screen and click on them? If so, I'll try to help. But my code style is different from yours. And how come you do not use structures? It will be impossible to do any GUI without them. |
|||
05 Jan 2013, 13:28 |
|
kty11 05 Jan 2013, 14:22
baldr, thank you for your advice.
I don't think I have enough skill for making gui now. and asmguru62, I am happy to be helped. thank you very much for your kindness. but at the moment, it seems I need to read the fine manual or exercise easy one first because I want to learn many from you and others, I need to prepare good questions. (because good questions leads good advice) and to prepare question, I need to read fine manual first... could you suggest me some good resources? as two of you pointed, I didn't even have no idea how to use ds register properly _________________ since 1990 November 4th |
|||
05 Jan 2013, 14:22 |
|
baldr 05 Jan 2013, 17:03
kty11,
Start small. .COM programs are OK for a starter (at least until your program isn't that big). Set up and maintain segment registers (e.g. leave ds==cs and make es==0xA000). Make program with simple graphic output (dots, lines, rectangles, etc.) Use that primitives as a library to draw something visually appealing (this will highlight design flaws and code errors). Refine/refactor source several times (trust me, you'll want to do it real soon). Add some event-driven framework for input handling. Consider object-oriented approach. Bottom-up programming is good to start with, augment it with top-down design and eventually you'll get program that works. Acquire and learn Turbo Debugger 3.2 (AFAIK it's last real-mode version of it), you're getting nowhere without good debugging tool, and TD was one of the best. As a bonus OllyDbg has similar default keymapping. And last, but not least: Google is your friend. There are many mode 13h examples (even here). |
|||
05 Jan 2013, 17:03 |
|
ACP 05 Jan 2013, 21:19
baldr wrote:
Actually you can find Turbo Debugger 5 or Turbo Assembler 5.0 packages. They both works under DOS despite availability of TDW which targets Windows 32bit Windows up to Win95 or so. In your case you need to run TD.EXE for debugging DOS files. |
|||
05 Jan 2013, 21:19 |
|
baldr 05 Jan 2013, 21:53
ACP,
TD 3.2 was real-mode, without need for DPMI stuff to run. More recent TDs require some PM fiddling to run under DOSBox. And why anybody need DPMI to run plain .COM? It has some deficiencies as well. Palettes being the least. I've been told that TD 3.2 can take advantage of TDH386.SYS being loaded in NTVDM and have hardware breakpoints as well. Gotta test it, in a mean time. Real hardcore players take Bochs and its CLI debugger as the best tool ever. |
|||
05 Jan 2013, 21:53 |
|
ACP 05 Jan 2013, 23:04
Don't know about you but I'm running TD 5 under DosBox 0.74 without any fiddling right now. Don't want to argue with you since this is purly academic discussion but you could always use the same DPMI argument and advice to use debug. It is perfectly suitable for debugging COM files don't you agree? Unless you would like to used hardware breakpoints for example to debug more complex code - those too come handy when debugging even COM files.
|
|||
05 Jan 2013, 23:04 |
|
baldr 06 Jan 2013, 05:32
ACP,
Yes, it runs; I stand corrected. Not a much time for DOS debugging though: probably that was true for some earlier DOSBox version (cca. 0.50). Other debuggers that come to my mind are AFD (it was my second one) and QA (perfect for hooking interrupts). And SoftICE as well (probably the most featured, and it has command line too!) DEBUG is fine for anybody that can use it productively; it's just not easy for beginner. |
|||
06 Jan 2013, 05:32 |
|
AsmGuru62 06 Jan 2013, 12:02
DEBUG is ok, but it decodes PUSHA as DB 60h.
|
|||
06 Jan 2013, 12:02 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.