Hi All,
I post here sat.s , a little linux-asm-program. It is not very spectacular,
but nice for watching to. ;-)
Comments, improvements, suggestions are more then welcome.
( Maybe adding a littlebit of color ;-)
At this moment, I like to find a way to keep the speed of the program the
same for all types of computers, independently of how much system resources
are taken away by other programs. Someone an idea?
___ sat.s _________________________________________________________________
.include "/home/jan/assembler/include/ncurses.asm"
.globl main
main:
_initscr
_locate $1,$0
_printw $titel
_locate $46,$0
_printw $pd
_locate $32,$12
_printw $world
movl $0,%esi
lus:
movb tabel(%esi),%dl # %dl = X(%esi)
incl %esi
movb tabel(%esi),%cl # %cl = Y(%esi)
incl %esi
cmpb $242,%cl
jne n242_1
movl $0,%esi
jmp lus
n242_1:
movl %esi,%edi
redo:
movb tabel(%edi),%dh # %dh = X(%esi + 1)
incl %edi
movb tabel(%edi),%ch # %ch = Y(%esi + 1)
cmpb $242,%ch
jne n242_2
movl $0,%edi
jmp redo
n242_2:
movl $leeg,%ebp
call print_item
movl $linux,%ebp
movb %ch,%cl
movb %dh,%dl
call print_item
movl $2000000,%ecx
w8:
loop w8
_refresh
jmp lus
_endwin
ret
print_item:
pushal
movzbl %cl,%eax
movzbl %dl,%ebx
_locate %ebx,%eax
_printw %ebp
popal
ret
linux:
.string "Linux"
leeg:
.string " "
world:
.string "World Domination"
titel:
.string "sat.s - 1997 Jan Wagemakers -"
pd:
.string "Donated to the Public Domain :-)"
tabel:
.include "cirkel.dat"
.byte 242,242
.END
___________________________________________________________________________
___ cirkel.dat ____________________________________________________________
.byte 72 , 12
.byte 71 , 13
.byte 69 , 15
.byte 66 , 17
.byte 62 , 18
.byte 56 , 20
.byte 51 , 21
.byte 44 , 21
.byte 38 , 21
.byte 31 , 21
.byte 24 , 21
.byte 18 , 20
.byte 13 , 19
.byte 8 , 17
.byte 5 , 16
.byte 3 , 14
.byte 2 , 12
.byte 2 , 10
.byte 3 , 8
.byte 6 , 7
.byte 10 , 5
.byte 15 , 4
.byte 20 , 3
.byte 27 , 2
.byte 33 , 2
.byte 40 , 2
.byte 47 , 2
.byte 53 , 3
.byte 59 , 4
.byte 63 , 5
.byte 67 , 7
.byte 70 , 8
.byte 71 , 10
___________________________________________________________________________
___ /home/jan/assembler/include/ncurses.asm _______________________________
# ncurses.asm - donated to the public domain by Jan Wagemakers
-
# afgeleid van onderstaand C-programma
# #include
#
# int main(void)
# {
# initscr(); /* Init the curses libraries */
# move(10, 2); /* Place the cursor at X: 2, Y: 10 */
# printw("Hello, World !"); /* Print anything */
# refresh(); /* This places the "Hello, World !" on the physical screen
*/
# getch(); /* Wait for keypress */
# endwin(); /* deinit the curses libraries. */
# return 0;
# }
#
# Vermits ikzelf bitter weinig van C ken kan volgende uitleg niet helemaal
# korrekt zijn. Korrekties zijn dus meer dan welkom :-)
# Dus, om via ncurses op een welbepaalde plaats op het scherm iets af te
# drukken roep je onderstaande macro's aan :
# 1. _initscr
# 2. _locate x y (x,y = scherm-koordinaten)
# 3. _printw message
# 4. _refresh
# 5. _endwin (end win.... klinkt leuk he ;-)
.MACRO _initscr
# start _initscr
call initscr
# end _initscr
.ENDM
.MACRO _locate x y
# start _locate x y
pushl \x
pushl \y
movl stdscr,%eax
pushl %eax
call wmove
addl $12,%esp
# end _locate x y
.ENDM
.MACRO _printw message
# start _print message
pushl \message
call printw
addl $4,%esp
# end _printw message
.ENDM
.MACRO _refresh
# start _refresh
movl stdscr,%eax
pushl %eax
call wrefresh
addl $4,%esp
# end _refresh
.ENDM
.MACRO _endwin
# start _endwin
call endwin
# end _endwin
.ENDM
___________________________________________________________________________
as sat.s -o sat.o
gcc sat.o -o sat -lncurses
sat
Have a nice day, All. - Jan Wagemakers -
.!. Front 242 : Welcome to paradise.
--- Terminate 4.00/Pro
(2:292/8133.23)
---------------
* Origin: - Belgi‰/Belgium - Internet : JanW@mail.dma.be
|