flat assembler
Message board for the users of flat assembler.

Index > Main > Character Table

Author
Thread Post new topic Reply to topic
Picnic



Joined: 05 May 2007
Posts: 1288
Location: behind the arc
Picnic
Hi all,

I need the character table you see below and i'm asking for a smaller method.
All suggestions are welcome.

Code:

                        ;       db '000102030405060708090A0B0C0D0E0F'
                        ;       db '101112131415161718191A1B1C1D1E1F'
                        ;       db '202122232425262728292A2B2C2D2E2F'
                        ;       db '303132333435363738393A3B3C3D3E3F'
                        ;       db '404142434445464748494A4B4C4D4E4F'
                        ;       db '505152535455565758595A5B5C5D5E5F'
                        ;       db '606162636465666768696A6B6C6D6E6F'
                        ;       db '707172737475767778797A7B7C7D7E7F'
                        ;       db '808182838485868788898A8B8C8D8E8F'
                        ;       db '909192939495969798999A9B9C9D9E9F'
                        ;       db 'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'
                        ;       db 'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'
                        ;       db 'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'
                        ;       db 'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'
                        ;       db 'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'
                        ;       db 'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'            
            
            cld
            xor cx, cx
            mov ax, '00'
            mov di, Table
            mov cl, 16
.A:         mov ch, 16
.B:         stosw
            inc ah
            cmp ah, ':'
            jnz .C
            add ah, 7
.C:         dec ch
            jnz .B
            mov ah, '0'
            inc al
            cmp al, ':'
            jnz .D
            add al, 7
.D:         loop .A


            Table rb 512
    


Last edited by Picnic on 26 Jun 2010, 18:53; edited 1 time in total
Post 26 Jun 2010, 17:49
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
With less code you're implicitly saying small binary as well?
Post 26 Jun 2010, 17:59
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1288
Location: behind the arc
Picnic
LocoDelAssembly yes, any kind of optimization.
Post 26 Jun 2010, 18:58
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
Just to make clear why I was asking:
Code:
Table:
SYMBOLS equ 0 1 2 3 4 5 6 7 8 9 A B C E D F

match sym, SYMBOLS{
      irps j, sym\{
           irps k, sym\\{
                db \\`j, \\`k
           \\}
      \}
}    
But certainly it will take more space.
Post 26 Jun 2010, 19:19
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1288
Location: behind the arc
Picnic
more space indeed, however it's a small nice macro. Razz

A second try, better i think.
Code:
            std
            mov di, Table+512-1
            mov al, 15
.A:         mov ah, 15
.B:         push ax
            mov cx, 2
.B0:        rol ax, 8
            cmp al, 10
            sbb al, 69h
            das
            stosb
            loop .B0
            pop ax
            dec ah
            jge .B
            dec al
            jge .A

    
Post 26 Jun 2010, 23:14
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 YouTube, Twitter.

Website powered by rwasa.