0

i'm writing a program in MASM 6.0 using assembly to run it in MS-DOS i've a main screen where users create some images/blocks and i have a help screen when user press F1, i use all memory in a buffer to manage the file and block memory. I use .model small, so i've just 64kb of data size. When user press f1 i need to clear screen to show help texts....

how can i save user's screen before show help and after plot it again... when user quits help screen...

file's buffer has 40000 bytes... so i can't save screen at data

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
  • 3
    Allocate memory from DOS. – Jester Aug 09 '23 at 23:17
  • 2
    Agree with Jesters comments. There are other ways of doing things as well. For instance you could use the COMPACT memory model which is one Code Segment and multiple data segments. If you are writing all the code in assembly using different models to make an EXE doesn't change much but does allow one to a different approach. In this [SO Answer](https://stackoverflow.com/a/56747280/3857942). At the bottom of the answer there is a section _A version that should work with most releases of MASM/JWASM/TASM would look like:_ . There is some MASM code that uses COMPACT and has 2 64KiB data segments. – Michael Petch Aug 10 '23 at 04:04
  • 1
    if you do not want to allocate memory you could use VGA VRAM you know in video mode you have gfx 64K page at `A000h` and in text mode at `B800h` so you can use that for temporary storage (skipping first 80x25x2 bytes if you want to preserve text screen)... also you could use VGA BIOS to page in other parts of VGA VRAM which is not used by selected video mode and transfer your stuff there ... see [Graphics mode in assembly 8086](https://stackoverflow.com/a/48664419/2521214) and look at the VESA bullet you could use that kind of page switching to get advantage of VESA VRAM ... – Spektre Aug 10 '23 at 07:01
  • 1
    for some inspiration see this: [What is the best way to move an object on the screen?](https://stackoverflow.com/a/29579522/2521214) is ancient asm game of mine it uses DOS int 21h for memory allocation look for `getm` in the code it has also own keyboard handler, lib for file access routines and combines both text (for menus) and video mode (for game) ... if I see it right `in: ah=48h; bx=size; int 21h; out: ax=address; CY set if error` – Spektre Aug 10 '23 at 07:16
  • @Spektre i've used segment B000h ... Are there any problem? it works, but i don't know it has any problem write at b000h – Mario Augusto Aug 12 '23 at 13:40
  • push ds mov ax,0b000h mov ds,ax xor di,di mov cx,64000 atua: mov al,es:[di] mov ds:[di],al inc di loop atua pop ds invoke pos,0,0 invoke blc,320,200,0 invoke ajuda push ds mov ax,0b000h mov ds,ax xor di,di mov cx,64000 atua2: mov al,ds:[di] mov es:[di],al inc di loop atua2 pop ds jmp rt – Mario Augusto Aug 12 '23 at 13:40
  • How to change "page" in 13h mode.... 320x200x256? .... or can i use B000h like a temporary buffer? – Mario Augusto Aug 12 '23 at 13:42
  • 1
    @MarioAugusto both `A000h` and `B800h` segments are mapped to VGA so yes you can use both as buffers at will (once you change video mode the corresponding buffer is cleared anyway) ... I see no problem there other than the memory throughoutput is different in comparison to normal RAM gfx memory on old VGA HW tends to have fast write and slow read ... on new emulated VGA god knows ... for the transfer you can use `rep movsb/w/d` instead of loop – Spektre Aug 12 '23 at 13:57
  • Yes, thank you... yeah i will use rep movsw... i've used loop to test it... with b800h i can't.. it didnt work,... so ive used b000h – Mario Augusto Aug 12 '23 at 14:13
  • no b800h... i've used b000h – Mario Augusto Aug 26 '23 at 00:57

0 Answers0