flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Tutorials and Examples > BTDClock: a simple Win32 GUI Program | 
| Author | 
 | 
| yeohhs 13 Dec 2017, 07:57 Sorry, this program is no longer available. Last edited by yeohhs on 02 Dec 2020, 04:32; edited 2 times in total | |||
|  13 Dec 2017, 07:57 | 
 | 
| fasmnewbie 13 Dec 2017, 09:23 Nice! Camana nak letak color kat text. Mana kod nak ubah? | |||
|  13 Dec 2017, 09:23 | 
 | 
| fasmnewbie 13 Dec 2017, 13:23 Thanks for the clue. Sekarang tengah cari font digital. nak ubah appearance n size. Nanti siap aku share. | |||
|  13 Dec 2017, 13:23 | 
 | 
| revolution 13 Dec 2017, 13:25 Erm, Malay language? Looks somewhat familiar from a project I did about 12 years ago. Ah the memories. | |||
|  13 Dec 2017, 13:25 | 
 | 
| fasmnewbie 13 Dec 2017, 17:41 revolution wrote: Erm, Malay language? Looks somewhat familiar from a project I did about 12 years ago. Ah the memories.  | |||
|  13 Dec 2017, 17:41 | 
 | 
| revolution 13 Dec 2017, 17:49 fasmnewbie wrote: Or did u spend some time down here? It is one of the few languages I've heard that I was actually able to pick-up without really trying hard. Although having not used for 12 years now I've forgotten most of it again.  | |||
|  13 Dec 2017, 17:49 | 
 | 
| yeohhs 13 Dec 2017, 21:52 fasmnewbie wrote: Nanti siap aku share. Baik. | |||
|  13 Dec 2017, 21:52 | 
 | 
| yeohhs 13 Dec 2017, 22:01 revolution wrote: Looks somewhat familiar from a project I did about 12 years ago. Ah the memories.  I love my asm coding memories all the way back to 2003 when I started with SpAsm/RosAsm. Then I moved on to Flat Assembler, which is even more awesome. | |||
|  13 Dec 2017, 22:01 | 
 | 
| MHajduk 14 Dec 2017, 00:04 Hi yeohhs.
 I think that the sources are quite neat and many people here could take it as an example of good coding techniques. After a quick review of the source I have found a place in the code that, in my opinion, could be optimized a bit. I mean here the 'GetTime' procedure. Here is your original code: Code: proc GetTime,TimeBuffer,TimeFormat local mst:MYSYSTEMTIME,\ dHour:DWORD,dMinute:DWORD,dSecond:DWORD invoke GetLocalTime, addr mst xor eax, eax mov ax,word[mst.wHour] mov [dHour],eax ;mov [dHour],0 xor eax, eax mov ax,word[mst.wMinute] mov [dMinute],eax ;mov [dMinute],0 xor eax, eax mov ax,word[mst.wSecond] mov [dSecond],eax ;mov [dSecond],0 .if [TimeFormat] = 0 cinvoke wsprintfA,[TimeBuffer],TimeFmt0,[dHour],[dMinute],[dSecond] .elseif [TimeFormat] = 1 cinvoke wsprintfA,[TimeBuffer],TimeFmt1,[dHour],[dMinute],[dSecond] .elseif [TimeFormat] = 2 .if [dHour] > 12 sub [dHour],12 cinvoke wsprintfA,[TimeBuffer],TimeFmt2PM,[dHour],[dMinute],[dSecond] .elseif [dHour] = 12 cinvoke wsprintfA,[TimeBuffer],TimeFmt2PM,[dHour],[dMinute],[dSecond] .elseif [dHour] = 0 add [dHour],12 cinvoke wsprintfA,[TimeBuffer],TimeFmt2AM,[dHour],[dMinute],[dSecond] .else cinvoke wsprintfA,[TimeBuffer],TimeFmt2AM,[dHour],[dMinute],[dSecond] .endif .endif ret endp Code: proc GetTime, TimeBuffer, TimeFormat push ebx ecx edx local mst:MYSYSTEMTIME,\ dHour:DWORD, dMinute:DWORD, dSecond:DWORD invoke GetLocalTime, addr mst xor eax, eax mov ax, word[mst.wHour] mov [dHour], eax xor eax, eax mov ax, word[mst.wMinute] mov [dMinute], eax xor eax, eax mov ax, word[mst.wSecond] mov [dSecond], eax .if [TimeFormat] = 0 mov ebx, TimeFmt0 .elseif [TimeFormat] = 1 mov ebx, TimeFmt1 .elseif [TimeFormat] = 2 .if [dHour] >= 12 mov ebx, TimeFmt2PM .else mov ebx, TimeFmt2AM .endif mov eax, [dHour] ; Transformation from the 24h format to the 12h format ; f: Z -> {1,2,3, ..., 12} ; f(x) = (x - 1) mod 12 + 1 ; ; or equivalently ; f(x) = (x + 11) mod 12 + 1 ; add eax, 11 xor edx, edx mov ecx, 12 div ecx inc edx mov [dHour], edx .endif cinvoke wsprintfA, [TimeBuffer], ebx, [dHour], [dMinute], [dSecond] pop edx ecx ebx ret endp   i.e. in other words  | |||
|  14 Dec 2017, 00:04 | 
 | 
| yeohhs 14 Dec 2017, 03:03 MHajduk wrote: 
 Hi MHajduk, I hope the sources are readable. Thanks for your optimized code. It's elegant. By the way, I visited your website. It's interesting. | |||
|  14 Dec 2017, 03:03 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.