1. Help on basic assembler learning

Hi there,

before entering EUPHORIA & Assembler I like to study a little
pure assembler coding.This means MASM & LINK.My problem :
I like to call function 1Ch INT 21 to get the clustersize =

and available cluster.I'm trying,since hours,to put reg CX =

and AX on the screen,the response is PC hangs.So maybe there is =

someone down the list who could give me a simple example.This
would really help me to get my self-esteem back in order.
Anyhow thanks in advance.

Karlheinz =

P.S. I downloaded all libs etc from Compuserve and Altavista,
     all to complicated for beginners. =

new topic     » topic index » view message » categorize

2. Re: Help on basic assembler learning

At 14:12 19-05-98 -0400, you wrote:
>Hi there,
>
>before entering EUPHORIA & Assembler I like to study a little
>pure assembler coding.This means MASM & LINK.My problem :
>I like to call function 1Ch INT 21 to get the clustersize
>and available cluster.I'm trying,since hours,to put reg CX
>and AX on the screen,the response is PC hangs.So maybe there is
>someone down the list who could give me a simple example.This
>would really help me to get my self-esteem back in order.
>Anyhow thanks in advance.
>
>Karlheinz
>P.S. I downloaded all libs etc from Compuserve and Altavista,
>     all to complicated for beginners.
>

here is a function that return the cluster size in bytes. It assume that each
sector is 512 bytes, which I think is the case for regular PC drives.

include machine.e

function GetClusterSize(integer drive)
sequence registers
  if (drive >= 'A') and (drive <= 'Z') then
        drive = drive - 'A' + 1
  elsif (drive >= 'a') and (drive <= 'z') then
        drive = drive - 'a' + 1
  elsif  (drive < 0) or (drive > 26) then
    return -1 -- bad drive
  end if
  registers = repeat(0,10)
  registers[REG_AX] = #1C00
  registers[REG_DX] = drive
  registers = dos_interrupt(#21,registers)
  return remainder(registers[REG_AX],256)*512
end function
printf(1,"current drive cluster size is %d bytes\n", GetClusterSize(0))
printf(1,"drive a: cluster size is %d bytes\n", GetClusterSize('a'))




Jacques Deschenes
Baie-Comeau, Quebec
Canada
desja at globetrotter.qc.ca

new topic     » goto parent     » topic index » view message » categorize

3. Re: Help on basic assembler learning

Good morning Jacques from Mannheim,

your Routine runs fine !.Thanks for that.

But I'm trying to do in real assembler,ex. with MASM & LINK.

For example :
prognam  cluster
        .
        .
        mov AH,36H    ;or 1CH,1BH
        int 21H
---> how to put reg AX and CX (after multiplication) on screen ??
        .
        .
prognam ends
        end

So,one more time,thanks for your quick help.

Regards Karlheinz =

new topic     » goto parent     » topic index » view message » categorize

4. Re: Help on basic assembler learning

At 02:41 AM 5/20/98 -0400, you wrote:
>Good morning Jacques from Mannheim,
>
>your Routine runs fine !.Thanks for that.
>
>But I'm trying to do in real assembler,ex. with MASM & LINK.
>
>For example :
>prognam  cluster
>        .
>        .
>        mov AH,36H    ;or 1CH,1BH
>        int 21H
>---> how to put reg AX and CX (after multiplication) on screen ??
>        .
>        .
>prognam ends
>        end
>

Well, you'll have a choice: you could call the dos console out routine,
or you could write direct to screen memory. Either way,
you'll first have to convert the values in the registers into readable form.

;subroutine to convert a binary number to a text string
;
; input:
;    ax = number to convert
;    ds:bx = pointer to end of buffer to store text in
;    cx = number of digits to convert
;
; output: none
;
; registers destroyed: ax,bx,cx,dx,si
;
ConvertNumberToString  PROC
   mov si, 10  ; divide by
ConvertLoop:
   sub dx,dx   ; convert ax to doubleword in dx:ax
   div  si        ; divide by 10
   add dl,'0'   ; convert remainder to a text char
   mov [bx],dl  ; store digit in the string
   dec bx       ; decrement the location of the next digit in string
   loop ConvertLoop ; do the next digit
   ret
ConvertNumberToString  ENDP
;
; subroutine to print a string to the display using dos function
;
; input: ds:bx points to string
; output: none
;
; registers destroyed: none
;
PrintString PROC
  push ax    ; save these registers
  push dx
  mov ah, 9 ; dos function call
  mov dx,bx ; point to the string to print
  int 21h      ; call dos interrupt
  pop dx
  pop ax     ; restore the registers
  ret
PrintString ENDP
----
Assembly programming is like hitting yourself with a large stick.
You do it because it feels so good when you stop.

Regards,
Irv Mullins

new topic     » goto parent     » topic index » view message » categorize

5. Re: Help on basic assembler learning

Hi Irv,

thanks for the help.With your last phrase about ASSEMBLER coding you
hit the nail right on the head.I found out that I'm using a too large
stick !.My problem is still how to get it running.Is there a possibility
that you have a short code example in your bag of tricks,ready to run ??.=

If I'm asking to much ,just .....

Anyway,thanks in advance.You could make somebody a bit calmer.
As I can see,all of you are Assembler Gurus.

Regards Karlheinz =

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu