flat assembler
Message board for the users of flat assembler.

Index > Main > BIOS TeleType putc/puts trick...

Author
Thread Post new topic Reply to topic
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
I made putc and puts functionality in 14 bytes today Razz
Code:
puts:   ; DS:SI -> string to print
        lodsb   ; ASSUME: DF = 0
        test    al,al
        jz      putc.ret
        push    puts
putc:   ; AL = character to print
        mov     ah,0eh
        xor     bh,bh
        int     10h
  .ret: ret     

Very useful when size matters...

_________________
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.
Post 26 Jun 2010, 01:37
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
hehe, good one. Very Happy
Post 26 Jun 2010, 02:12
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
Size matters... Wink
Post 26 Jun 2010, 04:42
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel
Push/ret! Nice trick.
Post 26 Jun 2010, 08:14
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1288
Location: Paradise Falls
Picnic
Nice trick bitshifter.
Goes down to 10 bytes if undocumented INT 29H is used Smile
Post 26 Jun 2010, 13:55
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
'undocumented INT 29H', whats that? Surprised
Post 26 Jun 2010, 14:08
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1288
Location: Paradise Falls
Picnic
INTERRUPT 29h will write the char in AL to the screen faster than service 02h or 09h of int 21h though is identical (not counting redirection) to service 02h of int 21h (but much faster).

http://www.fysnet.net/undoc.htm
Code:
puts:   ; DS:SI -> string to print
        lodsb   ; ASSUME: DF = 0
        test    al,al
        jz      putc.ret
        push    puts
putc:   ; AL = character to print
        int 29h
  .ret: ret
    
Post 26 Jun 2010, 14:30
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.