home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,354 of 4,675   
   bilsch to All   
   it should print junk6789 but prints only   
   24 Apr 18 02:48:52   
   
   From: king621@nospicedham.comcast.net   
      
   The boot sector jumps to this code.   
   It should print junk6789 but prints only j   
   Why it not print junk6789 ?   TIA.   Bill S.   
      
   bits 16   
   org 0x7e00   
      
   SECTION  .data   
      
      
   pbuf    times 80 db 0   
   string	db 'junk'   
   scbufc  dw 320              ;byte count of screen buffer   
      
   times 512-($-$$) db 'k'   
      
   SECTION   .text   
              mov ax,0xb800   
              mov es,ax   
              mov di,1   
   loop1:    mov byte[es:di],0x0f     ;bg=0=blk fg=0xf=wht   
              inc di   
              inc di   
              cmp di,3999     ;4000=25x80x2, 2 = char + bgfg   
              jbe loop1   
              mov ax,ds   
              mov es,ax   
              mov si,pbuf   
              mov di,string			   
   lup8:     mov al,[di]   
              mov byte[si],al   
              inc si   
              inc di   
              cmp di,4   
              jbe lup8   
              mov ax,0x6789   
              push ax   
              mov ax,4   
              push ax           ;# of hex digits to convert   
              call hxout   
              inc si   
              mov byte[si],0    ;0-terminate   
              mov si,pbuf			   
              call prstr   
              jmp $   
      
   hxout:    pop dx   
              pop cx            ;# of digits to convert   
              pop ax            ;4 digits   
              push dx           ;save return addr   
   xo4:      rol ax,4          ;put hi hex digit on right   
              push ax           ;save rol'd ax   
              and al,0x0f   
              add al,'0'        ;0 thru 9   
              cmp al,'9'   
              jbe xo5   
              add al,0x7        ;A thru F   
   xo5:      inc si   
              mov byte[si],al	   
              pop ax   
              dec cx   
              jnz xo4   
              ret	   
      
   prstr:    push es   
              push di   
              mov ax,0xb800   
              mov es,ax   
              mov di,word[scbufc]	   
   prstr1:   mov al,[si]   
              cmp al,0   
              je dun3		   
              mov [es:di],al   
              inc di   
              inc di   
              inc si   
              jmp prstr1   
   dun3:     mov ax,di   
              mov dl,160          ;160=2x80,  2 = bgfg + char   
              div dl              ;ah has remainder   
              sub dl,ah           ;result is pad   
              movzx ax,dl         ;zero-extend dl   
              add word[scbufc],ax   
              pop di   
              pop es		   
              ret   
      
   times 512-($-$$) db 'm'   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca