flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > DOS > Show Registers (16-bit) | 
  
| Author | 
  | 
              
| 
                  
                   jatos 31 May 2007, 21:50 
                  Thanks for that. This program is something I really wanted! 
_________________ Jamie  | 
              |||
                  
  | 
              
| 
                  
                   Picnic 11 Jun 2007, 19:50 
                  Be well jatos!
 
                Here is another script i wrote in fasm. It displays memory contents. It's my first attempt to use a macro. Code: MACRO PUTC [ARG] { LOCAL EXIT IF ARG EQTYPE '' | ARG EQTYPE 0 MOV DL,ARG ELSE CMP DL,20H JAE EXIT MOV DL,'.' END IF EXIT: MOV AH,2 INT 21H } MACRO INIT REGAX,REGSI,REGDI { MOV AX,REGAX MOV SI,REGSI MOV DI,REGDI MOV ES,AX MOV BX,TABLE } ORG 100H INIT 1234H,100H,200H ;SEGMENT ADDRESS,STARTING ADDRESS,ENDING ADDRESS CALL DUMP RET DUMP: PUTC 13,10 MOV DX,ES CALL HEXWORD PUTC ':' MOV DX,SI CALL HEXWORD PUTC ' ' MOV CX,16 PUSH SI @@: MOV DL,[ES:SI] INC SI CALL HEXBYTE PUTC ' ' LOOP @B POP SI MOV CX,16 PUTC ' ' @@: MOV DL,[ES:SI] INC SI PUTC DL LOOP @B CMP SI,DI JL DUMP RET HEXWORD: XCHG DH,DL CALL HEXBYTE XCHG DH,DL CALL HEXBYTE RET HEXBYTE: MOV AL,DL SHR AL,4 XLATB MOV AH,0EH INT 10H MOV AL,DL AND AL,0FH XLATB MOV AH,0EH INT 10H RET TABLE DB '0123456789ABCDEF'  | 
              |||
                  
  | 
              
| 
                  
                   m 30 Jun 2007, 10:57 
                  Cooool eh! 
                 | 
              |||
                  
  | 
              
| 
                  
                   rugxulo 01 Jul 2007, 21:54 
                  Code: ; use FASMD and press F9 to assemble / run, then Alt+F5 to see screen ; ; EDIT: fixed to be 8086 compatible ; ; 30 bytes (could it be smaller??) org 100h mov ax,0BEEFh call hexword ret hexword: mov cx,4 .begin: push cx mov cl,4 rol ax,cl pop cx push ax and al,0Fh cmp al,10 sbb al,69h das int 29h pop ax loop .begin .ret: ret  | 
              |||
                  
  | 
              
| 
                  
                   Picnic 10 Jan 2008, 20:08 
                  Again the 16-bit registers for anyone interested.
 
                Code: ; Display 16-bit registers showr: pusha pushf push sp ss es ds cs bp si di dx cx bx ax mov si,regstr mov cl,12 .reg: lodsb int 29h lodsb int 29h lodsb int 29h mov ch,4 pop ax ; ax bx cx dx .. .digit: rol ax,4 push ax and al,0fh cmp al,10 sbb al,69h das int 29h pop ax dec ch jnz .digit mov al,' ' int 29h loop .reg mov al,13 int 29h mov al,10 int 29h popf popa ret regstr db 'AX=BX=CX=DX=DI=SI=BP=CS=DS=ES=SS=SP='  | 
              |||
                  
  | 
              
| 
                  
                   edfed 12 Jan 2008, 01:36 
                  good, thimis, good good good!  
        and for somebody interrested for non dos dependance: 
  | 
              |||||||||||
                  
  | 
              
| 
                  
                   Picnic 13 Jan 2008, 13:08 
                  Thank you edfed. 
 
                P.S I used code from rugxulo's post above as it appears.  | 
              |||
                  
  | 
              
| 
                  
                   Slai 22 Jan 2008, 20:21 
                  rugxulo I do not get why do you use
 
                push cx mov cl,4 rol ax,cl pop cx instead of just "rol ax, 4", but you can save few bites this way.  | 
              |||
                  
  | 
              
| 
                  
                   Slai 22 Jan 2008, 20:28 
                  rugxulo your code helped me to improve my ShowHex macro with the push/pop ax, thanks! And I learned from you about the int 29h, does that work on all PCs ? 
                 | 
              |||
                  
  | 
              
| 
                  
                   LocoDelAssembly 22 Jan 2008, 20:51 
                  Quote: 
 Because "rol reg, imm8" is not available in 8086 (except for "rol reg, 1").  | 
              |||
                  
  | 
              
| 
                  
                   DOS386 23 Jan 2008, 01:31 
                  > Because "rol reg, imm8" is not available in 8086 (except for "rol reg, 1").
 
Code: push cx mov cl,4 rol ax,cl pop cx Great ^^^ code, if you need obfuscation or save 2 bytes Code: rol ax,1 ; This eats 2 BYTES !!! rol ax,1 rol ax,1 rol ax,1 Would be the "bloated" 8086-compatible solution _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug  | 
              |||
                  
  | 
              
| 
                  
                   edfed 23 Jan 2008, 23:38 
                  Code: push cx si mov si,roller mov cl,[si] rol ax,cl pop si cx can be modular too. use more bytes, but for memory programable rol, it's good.  | 
              |||
                  
  | 
              
| 
                  
                   LocoDelAssembly 23 Jan 2008, 23:47 
                  And what was the problem with     
                Code: push cx mov cl, [roller] rol ax, cl pop cx  | 
              |||
                  
  | 
              
| 
                  
                   rugxulo 25 Jan 2008, 03:48 
                  First of all, sorry, thimis, about silently updating the code without PM'ing you or something. Yeah, when I initially posted the code using rol ax,4, I forgot about 8086-compatible code, which doesn't really waste much of anything and runs everywhere. So I personally prefer compatibility in such a case. 
                 | 
              |||
                  
  | 
              
| 
                  
                   edfed 25 Jan 2008, 04:26 
                  the problem was that si can be defined before, and the last 3 instructions used in a loop.
 
                Code: push si mov si,[roller] ;assume esi never changed for all but the index of roller ... push cx mov cl,[si] rol ax,cl pop cx ... inc si push cx mov cl,[si] rol ax,cl pop cx pop si ... roller db 5,4,3,2,1,4,3,4,3,4,0  | 
              |||
                  
  | 
              
| 
                  
                   Picnic 25 Jan 2008, 20:23 
                  rugxulo wrote: First of all, sorry, thimis, about silently updating the code without PM'ing you or something. No problem rugxulo, i was aware about this compatibility issue.  | 
              |||
                  
  | 
              
| 
                  
                   LocoDelAssembly 18 May 2009, 22:04 
                  For the Windows version see http://board.flatassembler.net/topic.php?t=10183 
                 | 
              |||
                  
  | 
              
| 
                  
                   bitshifter 02 Nov 2012, 09:36 
                  rugxulo wrote: 
 Sorry to revive an old (but interesting) thread. Anyway, yes it can be smaller, by 2 bytes (28 vs 30)... Code: org 0x0100 use16 main: mov dx,0xBEEF call hexword ;mov ah,0x08 ;int 0x21 ret hexword: mov cx,0x0404 .again: rol dx,cl mov al,dl and al,0x0F cmp al,0x0A sbb al,0x69 das int 0x29 dec ch jnz .again ret _________________ Coding a 3D game engine with fasm is like trying to eat an elephant, you just have to keep focused and take it one 'byte' at a time.  | 
              |||
                  
  | 
              
| 
                  
                   ght2142 03 Nov 2012, 09:53 
                  I must say Picnic, I am impressed.  
                 | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.