Autor Thema: VESA-Tutorial (noch sehr primitiv)  (Gelesen 21610 mal)

Another Stupid Coder

  • Beiträge: 749
    • Profil anzeigen
Gespeichert
« am: 08. February 2005, 20:30 »
Hallo, ich wollte nur mal eine 1. Version meines VESA-Tutorials präsentieren, welches natürlich noch ausgebaut wird, ich wollte nur mal fragen wir ihr es so findet und was ich noch ändern sollte :)
URL: http://www.8ung.at/paulhaerle/Vesa.doc
Ich habe es einmal nach "Das Magazin" gepostet, da ich denke, dass es eine Form von Docu ist und insofern auch was mit dem Magazin zu tun hat :)

The-Programmerfish

  • Beiträge: 434
    • Profil anzeigen
Gespeichert
« Antwort #1 am: 08. February 2005, 21:57 »
Nett :D

Aber eine stinknormale HTML- und/oder PDF-Version wäre mir wesentlich lieber.

Ansonsten find ichs wie gesagt ganz lustig.
<- Verhasst, Verdammt, Vergöttert

Another Stupid Coder

  • Beiträge: 749
    • Profil anzeigen
Gespeichert
« Antwort #2 am: 08. February 2005, 23:06 »
Hm...HTML sieht dann so scheiße aus und PDF hats nicht gerade mit den Umlauten..

TeeJay

  • Beiträge: 630
    • Profil anzeigen
    • http://www.jay-code.de
Gespeichert
« Antwort #3 am: 08. February 2005, 23:31 »
Als schnellen Einstieg finde ich echt gut gelungen. Jedoch hast du ein paar kleine Fehler die vielleicht etwas verwirrung stiften könnten :)

Du schreibst:
"Die Funktion dazu hat die Nummer “0x4F00” welche im Prozessorregister “ax” stehen sollte."

Das ist zwar nicht falsch, aber du solltest vielleicht schon schreiben, das der Wert im AX-Register stehen MUSS und nicht SOLL :)
Weil im BX-Register wird er wohl nix bringen. Und jemand der nit so fit ist könnte vielleicht meinen das es egal ist in welchem Register der Wert steht. Ist vielleicht etwas kleinlich aber das viel mir halt auf.

Ansonsten finde ich das Tut wirklich gelungen :)
Hoffe man liest weiteres von dir.
----------------------
Redakteur bei LowLevel

Another Stupid Coder

  • Beiträge: 749
    • Profil anzeigen
Gespeichert
« Antwort #4 am: 08. February 2005, 23:56 »
Danke :)
Also morgen kommen: HTML & PDF-Versionen (ich entscheide mich dann für eines von beiden als entgültige Version)
Das "sollte" wird in ein "muss" umgeändert, ist richtig, dass es so sein sollte :)

Ansonsten schreibe ich gerne noch weitere, muss nur wieder ein gutes Thema finden und mir darüber informieren :)

Another Stupid Coder

  • Beiträge: 749
    • Profil anzeigen
Gespeichert
« Antwort #5 am: 09. February 2005, 13:55 »
http://www.8ung.at/paulhaerle/Vesa.htm <-- Ist die neue HTML-Version. Wäre nett wenn man das auf die Lowlevel-Seite stellen könnte dann brauche ich den Platz nicht (die CSS-Datei sollte http://www.8ung.at/paulhaerle/Style.css sein) ich mache es auch gerne selbst wenn Roshl mir ein passwort gibt :) Fortsetzung folgt... :)

Roshl

  • Beiträge: 1 128
    • Profil anzeigen
    • http://www.lowlevel.net.tc
Gespeichert
« Antwort #6 am: 09. February 2005, 14:25 »
Ich gebe dir auch gere ein PW wenn du eins willst^^
Aber meine css-Datei werde ich nicht ändern^^ da wirst du dich dann wohl an die Lowlevel-Farben anpassen müssen, oder es auf deinem Server belassen müssen^^ Aber ich glaube das es nicht so tragisch wäre das anzupassen^^ müsstest lediglich die html-tags durch entsprechende bb-tags ersetzen, meld dich per PN nochmal;)
[schild=1]Wieder ein wertvoller(?) Beitrag von Roshl[/schild]

T-Head

  • Beiträge: 157
    • Profil anzeigen
    • http://www.t-head.de.vu/
Gespeichert
« Antwort #7 am: 14. February 2005, 15:43 »
Hi,

mal ne kleine Frage an ASC, ist das Tuturial für jeden Assembler geeignet, bei FASM, kommt bei mir immer ne Fehalermeldung!

Another Stupid Coder

  • Beiträge: 749
    • Profil anzeigen
Gespeichert
« Antwort #8 am: 14. February 2005, 16:36 »
Das Tutorial ist ansich im NASM-Style verfasst, aber mit reinkopieren wird es ohnehin nicht funktionieren, da es versucht ein Grundwissen zu bilden. Aber einiges dazwischen fehlt, zum Beispiel ein Code der schaut ob die Funktion geklappt hat und vorallem der Code um in den PMode zu schalten. Und wenn du das Tutorial verstanden hast, sollte es absolut kein Problem sein, FASM-Code zu schreiben.

T-Head

  • Beiträge: 157
    • Profil anzeigen
    • http://www.t-head.de.vu/
Gespeichert
« Antwort #9 am: 15. February 2005, 13:00 »
Hi,

der Fehler ligt er an denen beiden Zeilen:

VbeReserved times 222 db 0
VbeOEMData times 256 db 0


Wenn ichs allerdings so schreib:

VbeReserved db 0
VbeOEMData db 0


geht!  :P

Roshl

  • Beiträge: 1 128
    • Profil anzeigen
    • http://www.lowlevel.net.tc
Gespeichert
« Antwort #10 am: 15. February 2005, 14:56 »
FASM kennt die times-anweisung nicht, die musst du durch ein FASM-Äquilvalent ersetzen. Es ist aber wichtig, dass ein times ähnliches Gebilde dort steht, oder du definierst einfach soviele variablen wie platz gebraucht wird^^
times 222 db 0 heisst, dass an dieser stelle 222 Nullbytes eingefügt werden, damit wird speicher für die Struktur gesichert, einfach durch weglassen der times wird das nichts
[schild=1]Wieder ein wertvoller(?) Beitrag von Roshl[/schild]

T-Head

  • Beiträge: 157
    • Profil anzeigen
    • http://www.t-head.de.vu/
Gespeichert
« Antwort #11 am: 15. February 2005, 19:43 »
Hi,

es kommt aber kein Fehler mehr! Und es wecheselt auch in den Video_Modus, den ich abgegeben habe! Nur die Ausgabe geht dann nich mehr!  :cry:

Roshl

  • Beiträge: 1 128
    • Profil anzeigen
    • http://www.lowlevel.net.tc
Gespeichert
« Antwort #12 am: 16. February 2005, 14:30 »
ja die bereiche überschneiden sich dann, und überschrieben sich gegenseitig^^
[schild=1]Wieder ein wertvoller(?) Beitrag von Roshl[/schild]

clemensoft

  • Beiträge: 92
    • Profil anzeigen
    • http://www.clemensoft.de
Gespeichert
« Antwort #13 am: 28. February 2005, 17:58 »
Hier mal passend zum Thema die (ungetestete) C-Version des VESA-Software-Treibers für den Framebuffer-Modus
@Roshl, kannst du unter Codenschnipsel eintragen, ist GPL.

src\mods\graph\vesa\ncc_vesapixel.c

long pixelpos(unsigned long x, unsigned long y, unsigned long w);
void setpixel(unsigned long x, unsigned long y, nc_color c);
void ncvesa_init(long w, long h, char* framebuffer,long bits);
typedef struct{
unsigned char r,
unsigned char g,
unsigned char b} nc_colorTAG nc_color;

long ncvesa_bits=0;
char* ncvesa_fbaddr=0;
long ncvem_w=0;
long ncvem_h=0;


/*16-Bit-Farben
/°5°\/°°6°\/°5°\
RRRRRGGGGGGBBBBB
BBBBBBBBBBBBBBBB*/
void ncvesa_init(long w, long h, char* framebuffer,long bits)
{
ncvem_w=w;
ncvem_h=h;
ncvesa_bits=bits;
ncvesa_fbaddr=framebuffer;
}

void setpixel(unsigned long x, unsigned long y, nc_color c)
{
char* pixeladdr=pixelpos(x,y,ncvem_w)+ncvesa_fbaddr;
if(ncvesa_bits==32)
{
*pixeladdr=c.r;
pixeladdr++;
*pixeladdr=c.g;
pixeladdr++;
*pixeladdr=c.b;
pixeladdr++;
*pixeladdr=0;
}
if(ncvesa_bits==24)
{
*pixeladdr=c.r;
pixeladdr++;
*pixeladdr=c.g;
pixeladdr++;
*pixeladdr=c.b;
}
if(ncvesa_bits==16)
{
short* hpixeladdr=pixeladdr;
*hpixeladdr=(r/8)+((g/4)*16)+((b)/8)*2048);
}

}

char* pixelpos(long x, long y, long w)
{
return((char*)(y*w)+x);
}

clemensoft

  • Beiträge: 92
    • Profil anzeigen
    • http://www.clemensoft.de
Gespeichert
« Antwort #14 am: 28. February 2005, 21:42 »
Für asm-freaks das ganze noch mal in Assembler. GCC hat ein Argument, das ihn dazu bringt, VERSTÄNDLICHEN assembler auszuspucken (-masm=intel). Jetzt nur noch die unterstriche weg, den rest hab ich schon gemacht:

align 4
_ncvesa_bits:
resb 4
align 4
_ncvesa_fbaddr:
resb 4
align 4
_ncvem_w:
resb 4
align 4
_ncvem_h:
resb 4
_ncvesa_init:
push ebp
mov ebp, esp
mov eax, DWORD PTR [ebp+8]
mov DWORD PTR _ncvem_w, eax
mov eax, DWORD PTR [ebp+12]
mov DWORD PTR _ncvem_h, eax
mov eax, DWORD PTR [ebp+20]
mov DWORD PTR _ncvesa_bits, eax
mov eax, DWORD PTR [ebp+16]
mov DWORD PTR _ncvesa_fbaddr, eax
pop ebp
ret
_setpixel:
push ebp
mov ebp, esp
push ebx
sub esp, 36
mov eax, DWORD PTR _ncvem_w
mov DWORD PTR [esp+8], eax
mov eax, DWORD PTR [ebp+12]
mov DWORD PTR [esp+4], eax
mov eax, DWORD PTR [ebp+8]
mov DWORD PTR [esp], eax
call _pixelpos
add eax, DWORD PTR _ncvesa_fbaddr
mov DWORD PTR [ebp-8], eax
mov eax, DWORD PTR [ebp-8]
mov DWORD PTR [ebp-12], eax
cmp DWORD PTR _ncvesa_bits, 32
jne L3
mov edx, DWORD PTR [ebp-12]
movzx eax, BYTE PTR [ebp+16]
mov BYTE PTR [edx], al
lea eax, [ebp-12]
inc DWORD PTR [eax]
mov edx, DWORD PTR [ebp-12]
movzx eax, BYTE PTR [ebp+17]
mov BYTE PTR [edx], al
lea eax, [ebp-12]
inc DWORD PTR [eax]
mov edx, DWORD PTR [ebp-12]
movzx eax, BYTE PTR [ebp+18]
mov BYTE PTR [edx], al
lea eax, [ebp-12]
inc DWORD PTR [eax]
mov eax, DWORD PTR [ebp-12]
mov BYTE PTR [eax], 0
L3:
cmp DWORD PTR _ncvesa_bits, 24
jne L4
mov edx, DWORD PTR [ebp-12]
movzx eax, BYTE PTR [ebp+16]
mov BYTE PTR [edx], al
lea eax, [ebp-12]
inc DWORD PTR [eax]
mov edx, DWORD PTR [ebp-12]
movzx eax, BYTE PTR [ebp+17]
mov BYTE PTR [edx], al
lea eax, [ebp-12]
inc DWORD PTR [eax]
mov edx, DWORD PTR [ebp-12]
movzx eax, BYTE PTR [ebp+18]
mov BYTE PTR [edx], al
L4:
cmp DWORD PTR _ncvesa_bits, 16
jne L2
mov eax, DWORD PTR [ebp-12]
mov DWORD PTR [ebp-16], eax
mov ebx, DWORD PTR [ebp-16]
movzx eax, BYTE PTR [ebp+18]
shr al, 3
movzx eax, al
mov edx, eax
sal edx, 7
movzx eax, BYTE PTR [ebp+17]
shr al, 2
movzx eax, al
lea eax, [eax+edx]
mov ecx, eax
sal ecx, 4
movzx eax, BYTE PTR [ebp+16]
shr al, 3
movzx dx, al
mov eax, ecx
add eax, edx
mov WORD PTR [ebx], ax
L2:
add esp, 36
pop ebx
pop ebp
ret

_pixelpos:
push ebp
mov ebp, esp
mov eax, DWORD PTR [ebp+12]
imul eax, DWORD PTR [ebp+16]
add eax, DWORD PTR [ebp+8]
pop ebp
ret

Roshl

  • Beiträge: 1 128
    • Profil anzeigen
    • http://www.lowlevel.net.tc
Gespeichert
« Antwort #15 am: 01. March 2005, 17:11 »
Ich finde AT&T Asm-Syntax auch verständlich^^
Aber du kannst das mal schön brav selbst als Codeschnippsel einfügen, ich will ja nicht als Autor davon dastehen^^ melde dich mal über PN für'n Account
[schild=1]Wieder ein wertvoller(?) Beitrag von Roshl[/schild]

freecrac

  • Beiträge: 86
    • Profil anzeigen
Gespeichert
« Antwort #16 am: 18. January 2011, 15:35 »
Diese pure 16 Bit DOS Anwendung demonstiert wie man einen Vesamode mit einer Auflösung von 1024 x 768 x 32 mit eigener Refreshrate von 100hz benutzt und demonstiert wie man den linearen Framebuffer mit hardware triple buffering benutzt.
Damit ein Zugriff auf den linearen Framebuffer ermöglicht wird bevorzuge ich den Unrealmode/Bigrealmode.
Damit der Unrealmode/Bigrealmode benutzt werden kann, müssen alle Memmorymanager wie emm386.exe in in unserer config.sys vorher entfernt, oder mit einem vorangestelltem REM deaktiviert werden. Nach dem Neubooten kann die Anwendung gestartet werden.

Ziel der Anwendung:
Wenn die Anwendung ohne Fehlermeldung startet, dann schaltet die Anwendung in den Vesamode und beginnt damit einige Bälle über den Bildschirm zu bewegen und wenn sie einen Bildrand erreichen, dann wechseln sie ihre Richtung. Zum Beenden der Anwendung und zum Zurückschalten nach DOS in den Textmode(3) bitte eine Taste auf der Tastatur drücken.

Minimale System Anforderung:
Betriebssystem: DOS 5, 6, oder DOS 7 (Teil von Windows98/ME)
(Arbeitet nicht unter Windows(DOSbox) und nicht mit einem Memmorymanager wie emm386.exe zusammen.)
MMX-CPU (getestet auf AMD Palomino 1800+@1550mhz und auf AMD Tbred 2700+@2100mhz; Socket A mainboard mit AGP)
Voll arbeitendes Vesa 3 Bios (getestet auf MSI NVIDIA Geforce 4 TI 4200 64MB AGPx4 // gescheitert mit Powercolor ATI x800 pro(VBE3 256MB AGPx8))
CRT-Monitor mit DDC und 96 khz (gettestet auf 19" Samsung 940p und auf 19" SAMTRON 96P)

Benutze Quellen:
"Public documents" von vesa.org(registrieren und/oder einloggen):
EEDIDguideV1.pdf
vbe3.pdf

Weil die Länge eines Beitrages auf 20000 Zeichen begrenzt ist und der Code aber nicht vollständig hinein passt, darum Teile ich den Code in mehrere Teile und poste die nächsten Teile des Codes in nachfolgenden Beiträgen. Alle Teile des Codes müssen vor dem Assemblieren in eine Datei zusammgefügt werden.

...

This pure 16 Bit DOS aplication demonstrate how to use a vesamode with a resolution of 1024 x 768 x 32 with an own refreshrate of 100hz and additionaly it demonstrate how to use the linear framebuffer with hardware triple buffering.
To enable an access to the linear framebuffer i prefer the unrealmode/bigrealmode.
For to use the unrealmode/bigrealmode we have to remove/REM any memmory manager like emm386.exe in our config.sys before.
After rebooting without it we can start the aplication.

Goal of the aplication:
If the application starts without any error message, then the application switch into the vesamode and begin to move some
balls across the screen and if they reached a border of the screen, then they turn their direction.
For to terminate the application and to switch back to DOS in the textmode(3) please press any key on your keyboard.

Minimum system requirements:
Operating system: DOS 5, 6, or DOS 7 (a part of Windows98/ME)
(not working under windows(DOSbox) and not working with a memmory manager like emm386.exe)
MMX-CPU (tested on AMD Palomino 1800+@1550mhz and on AMD Tbred 2700+@2100mhz; Socket A mainboard with AGP)
Fully working vesa 3 Bios (tested on MSI NVIDIA Geforce 4 TI 4200 64MB AGPx4 // failed with Powercolor ATI x800 pro(VBE3 256MB AGPx8))
CRT-Monitor with DDC and 96 khz (tested on 19" Samsung 940 and on 19" SAMTRON 96P)

Used resources:
Public documents from vesa.org(register and/or login):
EEDIDguideV1.pdf
vbe3.pdf

Because the limitation of  20000 letter for one posting and for the circumstance that the code is larger, i split the code in some parts. I post the next parts of the code in the following postings. All parts of the code must be merge into one file before assemble it.

First part of the code:
;--------------------------------------------------------------------------------------------------------------
; I have written this sourcecode for MASM 5.
; Example for to generate a 16 bit executable for a pure DOS-enviroment:
; MASM /Z FILENAME.asm,FILENAME.obj,,
; LINK /CP:1 FILENAME.obj,FILENAME.exe,,,
;--------------------------------------------
; Legal situation: No personalised spiritual ownership or liquidication rights for usement,
; or for spreading out aviable, because all ideas are (at all hazards) only a small part of the
; heritage of our common human culture and nobody can progress an idea without to make a use
; of our all intergenerational relationships beginning from our roots thousands of years ago.
;--------------------------------------------
; Freeware and a wide-ranging transparency in the world helps a lot for to establish a social freedom and a gracefull living.
; But additional We have to act very soon for to feed all humans and to stop the immiseration in the world.
; Over one billion of humans are very hungry today, yesterday, the day before yesterday............
; They all will die very painfully, if we can´t stop that with the highest ermergency now.
;---------------------------------------------------------------------------------------------------------------
.MODEL SMALL                           ; We want a small aplication
.386P                                  ; Enable protectmode instructions
.387                                   ; Enable FPU instructions
;--------------------------------------
    MaxX         =       1024          ; Horizontal resolution of the requested vesamode
    MaxY         =        768          ; Vertical resolution

    MAXHZ        =        160          ; CRT-Monitor: HZ
    MAXKHZ       =         96          ; KHZ

    KreiFa       =   00FFDD00h         ; Circel Color
    Vring        =   00030400h         ; Color decrement
    Groesse      =        02Dh         ; Radius of the ball (2Dh)
    XPos         =     Groesse         ; Position of the ball
    YPos         =     Groesse

    Anzahl       =         35h         ; Number of Objects (max.255)
    HFarb        =    0 ; 0100A03h     ; Background Color

    Max_X        =   (MaxX-(XPos*2))-9 ; Max and min
    Max_Y        =    MaxY-(YPos*2)    ;  X/Y Position
    Min_X        =         9           ;   of the movement area
    Min_Y        =         9

    IRQs_Port    =         21h         ; Port-Adress: IRQ-Controller
    Tast_Port    =         60h         ; Port-Adress: Keyboard-Controller
    Stat_Port    =         64h         ; Port-Adress: Keyboard-Status
    Cmos_Port    =         70h         ; Port-Adress: Bios-Cmos-Chip

    Cr           =         0Dh         ; Carriage Return
    Lf           =         0Ah         ; Line Feed

    Ausri        =         16          ; Bytes for code alignment
;----------------------------------------------------------------------------
  CODE SEGMENT use16 'CODE'
 assume cs:CODE,ds:DATEN,ss:STAPEL
 org 100h
;--------------------------------------
START:    mov      eax, 1              ; Request for feature flags
       DB 0Fh, 0A2h                    ; CPUID instruction
          test     edx, 00800000h      ;  is MMX feature flag(bit 23) set?
          jz  NOMMX

          mov      ax, DATEN           ; Store relative Segmentadress of the Datasegment
    mov      ds, ax              ;  into DS-Segmentregister
    mov      es, ax              ;  into ES-Segmentregister
    mov      di, OFFSET VINF     ; Buffer(512 Bytes) for VESA-Info
    mov      ax, 4F00h           ; Function 0
    int    10h                   ; Get up to 512 Bytes es:di (Datasegment:VINF)
    cmp      ax, 4Fh             ;  succsesfull ?
    jnz NOVESA                   ;   else error: no Vesabios aviable
    cmp     Byte PTR[di+5], 3    ; Compare major version number of Vesa
    jb  NOVESA3                  ;  lesser than Version 3 ?
    lfs      si, [di+0Eh]        ; Get pointer of Modelist in FS:SI
MODE:     mov      cx, fs:[si]         ; Get Modenumber
    lea      si, [si+2]          ; Increase Offset of modelist (instead of add si,2)
    cmp      cx, 0FFFFh          ; End of list ?
    jz  NOMODE
          add      cx, 4000h + 800h    ; VESAnumber + linear + CRTC
    mov      ax, 4F01h           ; Get Mode Info
          mov      di, OFFSET MINF     ; Buffer(256 Bytes) for Mode Info
    int    10h
    cmp      ax, 4Fh
    jnz NOVESA
    cmp     Word PTR[di+12h], MaxX
          jnz MODE
          cmp     Word PTR[di+14h], MaxY
          jnz MODE
    cmp     BYTE PTR[di+19h],20h ; 32 Bits per pixel?
          jnz MODE
    and     BYTE PTR[di], 80h    ; Linear access enable ?
          jz  NOLIN
    mov      eax,[di+28h]
          and      eax, eax            ; Linear Offset to the framebuffer aviable ?
          jz  NOLIN
          mov      bp, cx              ; Store the modenumber
;--------------------------------------
          mov      ax, 4F0Bh           ; Get/set Pixel-Clock
          mov      dx, cx
          xor      bl, bl              ; Get
          mov      ecx, DWORD PTR[PIXCLOC]
          int    10h
          cmp      ax, 4Fh
          jnz NOCLOC                   ; Error: No pixelcloc
          mov      DWORD PTR[PIXCLOC], ecx
;--------------------------
          xor      eax, eax            ; Calculate Refreshrate
          mov      ax, [CRTC]          ; Horizontal Total
          xor      ebx, ebx
          mov      bx, [VERTOTA]       ; Vertikal Total
          mul      ebx
          mov      ebx, eax
          mov      eax, ecx            ; Pixelcloc
          mov      esi, 10
          xor      edx, edx
          div      esi
          xor      edx, edx
          div      ebx
          mov      [REFRATE], ax       ; RefreshRate=Pixelcloc/(HTotal*Vtotal)
;--------------------------------------
       mov      ax, 4F15h           ; DDC - INSTALLATION CHECK
    mov      bl, 0               ;  for to get the monitor information
    int    10h
    cmp      ax, 4Fh
    jnz NODDC
    mov      ax, 4F15h           ; DDC - READ EDID
    mov      bl, 1
    xor      cx, cx
    xor      dx, dx
    mov      di, OFFSET EDID
    int    10h
    mov      eax, 0FD000000h     ; Text-identifier V/H range
    mov      bx, 36h
    cmp      [di+bx], eax        ; di+36h detailed timing #1
    jz  short H1
    lea      bx, [bx+12h]        ;  (add bx,12h)
    cmp      [di+bx], eax        ; di+48h detailed timing #2
    jz  short H1
    lea      bx, [bx+12h]
    cmp      [di+bx], eax        ; di+5Ah detailed timing #3
    jz  short H1
    lea      bx, [bx+12h]
    cmp      [di+bx], eax        ; di+6Ch detailed timing #4
    jnz NODDC
H1:       cmp     BYTE PTR[di+bx+6], MAXHZ
          jb  NOHZ
    cmp     BYTE PTR[di+bx+8], MAXKHZ
          jb  NOKHZ
;--------------------------------------
          mov      ax, 4F02h           ; Switch to the requested vesamode
          mov      bx, bp              ;  with an access to the linear framebuffer
          mov      di, OFFSET CRTC     ;  and with an own Video-Timing(..refreshrate)
          int    10h
          cmp      ax, 4Fh
          jnz NOMODE                   ; ERROR: No Vesamode
;-----------------Switch to the unrealmode----------------------------------
          cli                          ; Dissable software-Interrupts
          mov      al, 2               ; Dissable IRQ 1
          out      IRQs_Port, al

          in       al, Cmos_Port       ; Dissable Non-Mask-Interrupts(NMIs)
          or       al, 80h
          out      Cmos_Port, al

          call ESEG                    ; Switch to the Unrealmode(Enhance segment)
          mov      ax, DATEN
          mov      ds, ax

          in       al, Cmos_Port       ; Enable NMI's
          and      al, 7Fh
          out      Cmos_Port, al
          sti                          ; Enable Software-Interrupts
;-----------------------------------------------------------------------------
; Create an Offset table of startadresses of any line of the screen (linear framebuffer)
;-----------------------------------------------------------------------------
          call PIXOFF                  ; ...placed in the beginning of the data segment
;----------------------------------------------------------------------------
          finit                        ; Paint a ball
          mov     DWORD PTR[XM], XPos
          mov     DWORD PTR[YM], YPos
          mov     DWORD PTR[COL], KreiFa
          mov      ecx, 1              ; Radius
RUND:     call KREIS                   ;  Root-Circle
          lea      ecx, [ecx+1]        ; inc ecx
          sub     DWORD PTR[COL], Vring ; Color decreasing
          cmp      ecx, Groesse
          jnz RUND
;--------------------------------------
          call TABELLE                 ; Create a sprite-table of any colored pixel of the the screen
;--------------------------------------
          mov      si, OFFSET BALL     ; Clear the screen from the ball
          xor      eax, eax            ; Color black
OBJLO:    mov      ebx, [si]           ; Get the Offset
          lea      si, [si+8]          ; add si, 8
          mov      [ebx], eax          ; To the screen
          cmp      si, bp              ;  End of table ?
          jb  OBJLO
;-------------------------set all balls to the screen-----------------------
          mov      si, OFFSET SX0      ; Offset of Position-Table
          mov      di, OFFSET STEP0X   ; Offset of Stepper-Table

HIN:      mov      ebx, [si]           ; Get X-Position
          mov      eax, [di]           ; Get X-Stepper
          mov      ecx, [si+4]         ; Get Y-Position
          mov      edx, [di+4]         ; Get Y-Stepper

          shl      ebx, 2              ; X * 4 Byte (true color)
          shl      eax, 2              ; X-Stepper * 4 Byte (true color)
          mov      ecx, [ecx*4]        ; Get line
          mov      edx, [edx*4]        ; Get Stepper-line
          sub      ecx, DWORD PTR[PIXTAB] ; Substract linear screen-Offset
          sub      edx, DWORD PTR[PIXTAB] ; Substract linear screen-Offset

          mov      [si], ebx           ; Write X back
          mov      [si+4], ecx         ; Write Y back as line
          lea      si, [si+8]          ; add si,8
          mov      [di], eax           ; Write back X-Stepper
          mov      [di+4], edx         ; Write back Y-Step as Step-line
          lea      di, [di+8]          ; add di,8
          cmp      si, Anzahl*8+OFFSET SX0
          jb  HIN
;--------------------------------------
          mov      edx, DWORD PTR[PICAKT] ; Get the actual adress of the framebuffer
;--------------------------------------
          mov      bx, OFFSET HINFAR   ; Background color
       DB 0Fh, 6Fh, 7                  ; MOVQ mm0, [bx]
;----------------------------------------------------------------------------
       DB  0EAh                        ; Clear Prefetch-buffer:
       DW  (OFFSET ACTION)             ; The following lines create
       DW  (SEG ACTION)                ;  the opcode of "JMP FAR CS:ACTION"
;----------------------------------------------------------------------------
;                          M  A  i  N  -  R  O  U  T  I  N  E
;----------------------------------------------------------------------------

Dirk
« Letzte Änderung: 02. February 2011, 10:40 von freecrac »

freecrac

  • Beiträge: 86
    • Profil anzeigen
Gespeichert
« Antwort #17 am: 18. January 2011, 15:38 »
;----------------------------------------------------------------------------
;                          M  A  i  N  -  R  O  U  T  I  N  E
;----------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri ; Code-Alignment
;---------------------------------------------------------------------------
ACTION:   mov      ebx, edx              ; Movement and checking if a ball
          mov      ecx, DWORD PTR[PICLEN] ;  reached a border
          mov      si, OFFSET SX0        ; Offset of Position-Table
          mov      di, OFFSET STEP0X     ; Offset of Stepper-Table
          add      ebx, DWORD PTR[PIXTAB]
          shr      ecx, 3
                                         ; Beginning with to clear the screen
CLEAN:  DB 67h, 0Fh, 7Fh, 3              ; MOVQ [ebx], mm0
          lea      ebx, [ebx+8]          ; add bx,8
          dec      ecx
          jnz CLEAN
;----------------------------------------------------------------------------
ALL:      mov      ebx, [si]             ; Get X-Position
          cmp     BYTE PTR[di+S_Len], 1  ; Compare Plus/Minus-XFlag
          jz  short FRAGX1               ;  if minus, then jump

FRAGX0:   cmp      ebx, Max_X * 4        ; Compare X-Position with max.-X
          jb  short MAKEX0               ;  if less, then jump
          mov     BYTE PTR[di+S_Len], 1  ; Set Minus-XFlag
MAKEX1:   sub      ebx, [di]             ; X - XStepper
          jmp  short ALLX
;--------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;--------------------------------------
FRAGX1:   cmp      ebx, Min_X * 4        ; Compare X-Position with min.-X
          ja  short MAKEX1               ;  if above, the jump
          mov     BYTE PTR[di+S_Len], 0  ; Set Plus-XFlag
MAKEX0:   add      ebx, [di]             ; X + XStepper
ALLX:     mov      [si], ebx             ; save X-Position
;----------------------------------------------------------------------------
          mov      ecx, [si+4]           ; Get line
          cmp     BYTE PTR[di+S_Len+1],1 ; Compare Plus/Minus-line-Flag
          jz  short FRAGY1               ;  if minus, then jump

FRAGY0:   cmp      ecx, Max_Y * (MaxX*4) ; Compare line with max.line
          jb  short MAKEY0               ;  if lesser, then jump
          mov     BYTE PTR[di+S_Len+1],1 ; Set Minus-lineflag
MAKEY1:   sub      ecx, [di+4]           ; Line - linestepper
          jmp  short ALLY
;--------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;--------------------------------------
FRAGY1:   cmp      ecx, Min_Y * (MaxX*4) ; Compare line with min.line
          ja  short MAKEY1               ;  if above, then jump
          mov     BYTE PTR[di+S_Len+1],0 ; Plus-YFlag setzen
MAKEY0:   add      ecx, [di+4]           ; Line + linestepper
ALLY:     mov      [si+4], ecx           ; Save new line

          lea      si, [si+8]            ; Increase Table-Offset (Position)
          add      ecx, ebx              ; Line plus X
          mov      [RETTSI], si
          mov      si, OFFSET BALL       ; Table-Offset start
          add      ecx, edx
OBJECT:   mov      ebx, [si]             ; Get Sprite-Offset from Table
          mov      eax, [si+4]           ; Get color from Table
          lea      si, [si+8]            ; Increase Table-Offset
          mov      [ebx+ecx], eax        ; Color to the screen
          cmp      si, bp                ;  End of Table ?
          jb  OBJECT

          mov      si, [RETTSI]
          lea      di, [di+8]            ; Increase Table-Offset (Stepper)
          cmp      si, Anzahl*8+OFFSET SX0 ; Table-End ?
          jb  ALL
;--------------Switch the screen adress using triple buffering------------
          cmp      BYTE PTR[FLAG], 0
          jz  short ASUK

BSUK:     mov      ecx, edx             ; Display-Start-Adress
          mov      bx, 4                ; Wait until Display shedule
          mov      ax, 4F07h
          int 10h
          and      cx, cx
          jnz BSUK
;--------------------------------------
ASUK:     mov      ecx, edx             ; Display-Start-Adress
          add      edx, DWORD PTR[PICLEN] ; Get new Adress
          mov      bx, 2                ; Shedule new Display-Start-Adress
          mov      ax, 4F07h
          int 10h

          mov     BYTE PTR[FLAG], 1
          cmp      edx, DWORD PTR[PICMAX]
          jna short NODO
          xor      edx, edx
;---------------------------------------------------------------------------
NODO:     in       al, Stat_Port       ; Get Keyboad-Status
          test     al, 1               ; Input buffer empty?
          jz  ACTION                   ;  else repeat movement
     test     al, 20h
    jnz ACTION                   ; PS2-Mouse will be ignored
;----------------------------------------------------------------------------
;-----------------------End of main-routine----------------------------------
;----------------------------------------------------------------------------
          in       al, Tast_Port       ; Get key
          cli
          xor      al, al              ; Enable IRQ 1
          out      IRQs_Port, al
          sti

          mov      ax, 3               ; Switch into Text-Mode
          int    10h
          xor      cl, cl              ; No ERROR

          mov      ah, 1               ; Clear Keyboard buffer
          int    16h
;-------------------------------------
       DB 0Fh, 0Eh                     ; 0Fh, 77h EMMS // 0Fh, 0Eh FEMMS
;-------------------------------------
HOME:     mov      al, cl              ; Get the ERRORLEVEL
          mov      ah, 4Ch             ; Jump back to DOS
          int    21h
;----------------------------------------------------------------------------
;                         ERROR Messages
;----------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;---------------------------------------------------------------------------
NOMODE:   mov      cl, 1
          mov      dx, OFFSET ERTEX1   ; NO VESA MODE

ERROUT:   mov      ah, 9               ; Text output
          int    21h
          jmp HOME
;----------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;---------------------------------------------------------------------------
NOLIN:    mov      cl, 2
          mov      dx, OFFSET ERTEX2   ; No linear Offset
          jmp ERROUT
;----------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;---------------------------------------------------------------------------
NOMMX:    mov      cl, 3
          mov      dx, OFFSET ERTEX3   ; No MMX-CPU
          jmp ERROUT
;---------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;---------------------------------------------------------------------------
NOVESA:   mov      cl, 4
          mov      dx, OFFSET ERTEX4   ; No Vesa
          jmp ERROUT
;---------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;---------------------------------------------------------------------------
NOVESA3:  mov      cl, 5
          mov      dx, OFFSET ERTEX5   ; No VESA 3
          jmp ERROUT
;---------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;---------------------------------------------------------------------------
NODDC:    mov      cl, 6
          mov      dx, OFFSET ERTEX6   ; No DDC
          jmp ERROUT
;---------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;---------------------------------------------------------------------------
NOKHZ:    mov      cl, 7
          mov      dx, OFFSET ERTEX7   ; Less than 96 khz
          jmp ERROUT
;---------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;---------------------------------------------------------------------------
NOHZ:     mov      cl, 8
          mov      dx, OFFSET ERTEX8   ; Less than 160 hz
          jmp ERROUT
;---------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;---------------------------------------------------------------------------
NOCLOC:   mov      cl, 9
          mov      dx, OFFSET ERTEX9   ; No Pixelcloc
          jmp ERROUT
;----------------------------------------------------------------------------
;                     GDT for the Protected Mode
;----------------------------------------------------------------------------

Dirk
« Letzte Änderung: 18. January 2011, 15:52 von freecrac »

freecrac

  • Beiträge: 86
    • Profil anzeigen
Gespeichert
« Antwort #18 am: 18. January 2011, 15:40 »
;----------------------------------------------------------------------------
;                     GDT for the Protected Mode
;----------------------------------------------------------------------------
 org START + ((($-START)/64)*64)+64
;----------------------------------------------------------------------------
GDTZEIGER DW ?      ; Lenght of the GDT
          DW ?      ; Adress low -Word:SEGMENTE
          DW ?      ; Adress high-Word:SEGMENTE
          DW 0      ; reserved

SEGMENTE  DW 0      ; Bits: 0-15 Seg.lenght(Bit0-15)
          DW 0      ; Bits: 0-15 Basis-Adress Deskriptor-Table
          DB 0      ; Bits:16-23 Basis-Adress Deskriptor-Table
          DB 0      ; Bits: 0- 7 Access rights
          DB 0      ; Bits: 0- 3 Seg.lenght(Bit16-19)/Bit7:1=4KByte/0=1Byte
          DB 0      ; Bits:24-31 Basis-Adress Deskriptor-Table

;-------------------------------------------- Selektor    Segmente
       DW 0FFFFh ; Segmentlenght  Bits: 0-15  --------  -----------
       DW 0      ; Adress low     Bits: 0-15  ¦ 08h  ¦  ¦Code (CS)¦
       DB 0      ; Adress high    Bits:16-23  +------+  +---------+
       DB 9Ah    ; Access rights
       DB 0      ; Seg.Länge Bits:16-19 im Bit0-3 /Bit7:1=4KByte/0=1Byte
       DB 0      ; Seg.Adress     Bits:24-31
;--------------------------------------------- Selektor    Segmente
       DW 0FFFFh ; Segmentlenght  Bits: 0-15  --------  ------------
       DW 0      ; Adress low     Bits: 0-15  ¦ 10h  ¦  ¦Stack (SS)¦
       DB 0      ; Adress high    Bits:16-23  +------+  +----------+
       DB 92h    ; Access rights
       DB 0      ; Seg.Lenght Bits:16-19 im Bit0-3 /Bit7:1=4KByte/0=1Byte
       DB 0      ; Seg.Adress     Bits:24-31
;--------------------------------------------- Selektor    Segmente
       DW 0FFFFh ; Segmentlenght  Bits: 0-15  -------- ---------------
       DW 0      ; Seg.Adress     Bits: 0-15  ¦  18h ¦ ¦(DS,ES,FS,GS)¦
       DB 0      ; Seg.Adress     Bits:16-23  +------+ +-------------+
       DB 92h    ; Access rights
       DB 0FFh   ; Seg.Lenght Bits:16-19 im Bit0-3//Bit7:1=4KByte/0=1Byte
       DB 0FFh   ; Seg.Adress     Bits:24-31
;---------------------------------------------------
        SEGMENTE_END label WORD
        Gdt_Groesse equ (OFFSET SEGMENTE_END - SEGMENTE -1)
;----------------------------------------------------------------------------
;----------------------------Subroutines-------------------------------------
;----------------------------------------------------------------------------
;              Switch into the UN-/BIG-/FLAT-REALMODE
;----------------------------------------------------------------------------
; Set for the DS(,ES,FS,GS)-Register a new segmentlenght of 00FFFFFFh.
; For that we switch into the Protected Mode und back to the (Un)Realmode.
;----------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;----------------------------------------------------------------------------
ESEG:     xor      eax, eax
          mov      ax, cs
          mov      ds, ax
          shl      eax, 4                        ; EAX is now physical
          mov      ebx, eax                      ; Segmentstartadresse
          mov     WORD PTR[SEGMENTE+0Ah], ax     ;  into the Deskriptors
          mov     WORD PTR[SEGMENTE+12h], ax     ;  for CS
          ror      eax, 10h                      ;  and SS store into
          mov     BYTE PTR[SEGMENTE+0Ch], al     ;  the GDT
          mov     BYTE PTR[SEGMENTE+14h], al
          xor      eax, eax                      ; EAX null
          mov      ax, OFFSET SEGMENTE           ; 16-Bit-Offset
          add      ebx, eax                      ; GDT-Adress in
          mov     WORD PTR[GDTZEIGER], Gdt_Groesse ; GDT-Deskriptor
          mov     DWORD PTR[GDTZEIGER+2], ebx

          pushf                                  ; Save Flags
          lgdt    FWORD PTR[GDTZEIGER]           ; Load GDT
          mov      dx, ss                        ; Save SS
          mov      eax, cr0                      ; Controlword 0 to EAX
          or       al, 1                         ; Protected Mode on
          mov      cr0, eax
                                                 ; clear Prefetch-Buffer
          DB  0EAh                               ; The following lines
          DW  (OFFSET PMODE)                     ; create the opcode for:
          DW  8                                  ; "JMP FAR CS:PMODE"
;------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;------------------------------------------------
PMODE:    mov      ax, 10h                       ; Limit SS-Selektor to 64KB
          mov      ss, ax
          mov      ax, 18h
          mov      ds, ax                        ; Enhance DS(,ES,FS,GS)-Segment
;          mov      es, ax                       ;  to 4 GB
;          mov      fs, ax
;          mov      gs, ax

          mov      eax, cr0                      ; Controlword 0 to EAX
          and      eax, not 1                    ; Protected Mode off
          mov      cr0, eax
                                                 ; Clear Prefetch-Buffer
          DB  0EAh                               ; The following lines
          DW  (OFFSET RMODE)                     ; create the opcode for:
AKTSEG    DW  (SEG RMODE)                        ; JMP FAR CS:RMODE
;------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;------------------------------------------------
RMODE:    mov      ss, dx                        ; restore SS
          popf                                   ; get Flags
;----------------------------------------------------------------------------
;           Swith  the  21. Adressbit on.
;----------------------------------------------------------------------------
BIT_FREI: call W_8042            ;-->>----------+  Wait for 8042
          jnz BACK               ;->--------+   ¦
          mov      al, 0D1h      ;          ¦   ¦  Write command
          out      Stat_Port, al ;          ¦   ¦
          call W_8042            ;   -->>---Ï---¦  Ready to recieve ?
          jnz BACK               ;->--------¦   ¦
          mov      al, 0DFh      ;          ¦   ¦  Yes, set line 20 on
          out      Tast_Port, al ;          ¦   ¦
;-------------------------------------------¦---¦---------------
;           Wait til  the   8042 ¦   is     ¦   ¦ ready.
;-------------------------------------------¦---¦---------------
W_8042:   xor      cx, cx        ;<<--------Ï---+
STATUS:   in       al, Stat_Port ;<----+    ¦      Read Status
          and      al, 2         ;     ¦    ¦       Buffer full ?
          loopnz STATUS          ;->---+    ¦      til no or timeout
BACK:     ret                    ;<---------+
;----------------------------------------------------------------------------
;            Spuare Root Circle (XM,YM,COL)
;----------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;----------------------------------------------------------------------------
KREIS:    mov      eax, ecx
          mul      eax                 ; Radius * Radius
          xor      edi, edi            ; Looping start
          mov      esi, eax
          xor      eax, eax

RUNDE:    mov      ebp, esi
          mul      eax                 ; X * X
          sub      ebp, eax            ; R * R - X * X
          mov     DWORD PTR[Y], ebp

          fild     [Y]                 ; Load Integer to ST(0)
          fsqrt                        ; Spuare root
          fistp    [Y]                 ; Integer save and pop

          mov      ebp, DWORD PTR[Y]
          call HALB                    ; Set 4 Pixel
          mov      eax, edi            ; Switch X with Y
          mov      edi, ebp
          mov      ebp, eax            ; Next Axes
          call HALB                    ; Set 4 Pixel

          lea      ebp, [ebp+1]        ; inc ebp / increase Loop-Counter
          mov      edi, ebp            ; Restore X
          cmp      ecx, ebp            ; Radiant reached ?
          jnz RUNDE
          ret
;--------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;--------------------------------------
HALB:     mov      edx, DWORD PTR[XM]  ; Right below
          mov      ebx, DWORD PTR[YM]
          add      edx, edi            ; X-Pos
          add      ebx, ebp            ; Y-Pos
          call PIXEL
          mov      edx, DWORD PTR[XM]  ; Left below
          mov      ebx, DWORD PTR[YM]
          sub      edx, edi            ; X-Pos
          add      ebx, ebp            ; Y-Pos
          call PIXEL
          mov      edx, DWORD PTR[XM]  ; Right above
          mov      ebx, DWORD PTR[YM]
          add      edx, edi            ; X-Pos
          sub      ebx, ebp            ; Y-Pos
          call PIXEL
          mov      edx, DWORD PTR[XM]  ; Left above
          mov      ebx, DWORD PTR[YM]
          sub      edx, edi            ; X-Pos
          sub      ebx, ebp            ; Y-Pos

PIXEL:    shl      edx, 2              ; X *l 4 Byte (true color)
          add      edx, [ebx*4]        ; X plus line-Offset
          mov      ebx, DWORD PTR[COL]
          mov      [edx], ebx          ; Color to the screen
          mov      [edx+4], ebx        ;  and the pixel beside too
          ret
;----------------------------------------------------------------------------
; Create a Sprite-TABLE (Offset, Color) of the content of the screen
;----------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;----------------------------------------------------------------------------
TABELLE:  mov      eax, DWORD PTR[XMAX]
          xor      esi, esi
          shr      eax, 2              ; X divide by 4 Byte (32Bit true color)
          mov      di, OFFSET BALL     ; Table-Offset
          mov      esi, [esi]          ; linear screen-Offset
          mul     DWORD PTR[YMAX]
          mov      ecx, eax

MAKETAB:  mov      eax, [esi]          ; Get the color of the pixel
          and      eax, eax            ;  empty/black ?
          jz  short LEER
          mov      [di], esi           ; Store Sprite-Offset in Table
          mov      [di+4], eax         ; Store Color in Table
          lea      di, [di+8]          ; Increase Table-Offset (add di,8)
LEER:     lea      esi, [esi+4]        ; Increase screen-Offset (add esi,4)
          dec      ecx
          jnz MAKETAB
          mov      bp, di              ; End of table
          ret
;----------------------------------------------------------------------------
; Create an Offset table of startadresses of any horizontal line of the screen
;----------------------------------------------------------------------------
 org START + ((($-START)/Ausri)*Ausri)+Ausri
;--------------------------------------
PIXOFF:   mov      si, OFFSET MINF     ; Get the Offset of Mode info
          xor      ebx, ebx
          mov      bx, ds              ; Get the actual adress of the data segment
          mov      eax, [si+28h]       ; Get the 32 Bit adress of the linear frambuffer
          shl      ebx, 4              ; Convert Data-Segment to a 32Bit-Offset
          xor      di, di              ; and substract it from the adress of the linear frambuffer
          sub      eax, ebx            ; = Adress of the first line is now "ds:Reg32"
          xor      edx, edx
          mov      dx, [si+32h]        ; Get the lenght of a line (Xmax*BytejePixel)
          mov      [XMAX], dx
          mov      cx, [si+14h]        ; Get Ymax
          mov      [YMAX], cx
          shl      cx, 2               ; Max_Y * 4 Byte (32Bit true color)

AGAIN:    mov      [di], eax           ; Store linear Offset of the framebuffer in the table
          lea      di, [di+4]          ; Increase Offset of table  (add di,4)
          lea      eax, [eax+edx]      ; Add Max_X to the address (add eax,edx)
          cmp      di, cx              ;  End of Table (Max_Y*4) ?
          jb  AGAIN
          ret
  CODE ends
;----------------------------------------------------------------------------
;                          D A T A - S e g m e n t
;----------------------------------------------------------------------------

Dirk

freecrac

  • Beiträge: 86
    • Profil anzeigen
Gespeichert
« Antwort #19 am: 18. January 2011, 15:41 »
;----------------------------------------------------------------------------
;                          D A T A - S e g m e n t
;----------------------------------------------------------------------------
  DATEN SEGMENT use32 'DATA'
 org 0
;--------------------------------------
PIXTAB DD MaxY+Ausri dup (0) ; Offset table of startadresses of any line of the screen(linear framebuffer)
;----------------------------------------------------------------------------
;                            Position - Table
;----------------------------------------------------------------------------
SX0    DD 122, 197                     ; X, Y
       DD 373, 347
       DD 493, 276
       DD 363, 143
       DD 323, 316
       DD 235, 192
       DD 273, 226
       DD 107, 226
       DD 422, 373
       DD 112, 347
       DD 133, 266
       DD 471, 343
       DD 423, 366
       DD 227, 230
       DD 143, 157
       DD 376, 322

       DD 212, 101
       DD 442, 226
       DD 293, 129
       DD 371, 123
       DD 323, 325
       DD 167, 292
       DD 223, 172
       DD 226, 145
       DD 113, 222
       DD 167, 166
       DD 133, 134
       DD 442, 292
       DD 252, 270
       DD 323, 350
       DD 262, 374
       DD 270, 151

       DD 166, 213
       DD 233, 154
       DD 123, 222
       DD 126, 274
       DD 060, 257
       DD 226, 313
       DD 418, 177
       DD 357, 153
       DD 458, 270
       DD 185, 035
       DD 248, 113
       DD 463, 366
       DD 370, 132
       DD 254, 267
       DD 239, 134
       DD 445, 262

       DD 454, 334
       DD 279, 257
       DD 146, 323
       DD 238, 267
       DD 143, 134
       DD 236, 377
       DD 139, 334
       DD 475, 258
       DD 454, 154
       DD 136, 337
       DD 484, 253
       DD 177, 266
       DD 224, 143
       DD 397, 127
       DD 448, 345
       DD 188, 123

       DD 442, 332
       DD 323, 176
       DD 472, 123
       DD 194, 379
       DD 046, 124
       DD 227, 111
       DD 144, 124
       DD 359, 165
       DD 177, 246
       DD 151, 342
       DD 178, 168
       DD 132, 149
       DD 427, 236
       DD 214, 013
       DD 361, 345
       DD 323, 176

       DD 249, 336
       DD 179, 144
       DD 439, 123
       DD 438, 347
       DD 288, 248
       DD 343, 158
       DD 228, 346
       DD 183, 253
       DD 347, 288
       DD 233, 235
       DD 198, 286
       DD 153, 147
       DD 297, 273
       DD 336, 231
       DD 479, 150
       DD 243, 287

       DD 257, 165
       DD 111, 122
       DD 389, 258
       DD 358, 285
       DD 224, 127
       DD 082, 122
       DD 266, 311
       DD 114, 351
       DD 321, 275
       DD 433, 159
       DD 240, 154
       DD 496, 160
       DD 148, 038
       DD 224, 369
       DD 312, 134
       DD 167, 126

       DD 278, 173
       DD 533, 436
       DD 356, 291
       DD 490, 352
       DD 369, 111
       DD 230, 134
       DD 477, 177
       DD 319, 443
       DD 553, 399
       DD 236, 266
       DD 474, 130
       DD 397, 127
       DD 238, 169
       DD 142, 186
       DD 171, 383
       DD 599, 138

       DD 368, 437
       DD 124, 424
       DD 597, 259
       DD 165, 197
       DD 143, 270
       DD 459, 349
       DD 159, 459
       DD 427, 427
       DD 215, 135
       DD 180, 180
       DD 377, 377
       DD 245, 145
       DD 473, 173
       DD 308, 408
       DD 483, 283
       DD 525, 125

       DD 412, 312
       DD 242, 142
       DD 293, 293
       DD 571, 371
       DD 423, 323
       DD 467, 267
       DD 183, 283
       DD 326, 126
       DD 313, 413
       DD 267, 267
       DD 533, 133
       DD 248, 188
       DD 358, 458
       DD 183, 383
       DD 162, 162
       DD 370, 170

       DD 434, 134
       DD 357, 157
       DD 123, 123
       DD 477, 167
       DD 534, 134
       DD 477, 177
       DD 264, 124
       DD 458, 138
       DD 154, 244
       DD 137, 237
       DD 193, 353
       DD 376, 276
       DD 543, 443
       DD 427, 227
       DD 145, 345
       DD 523, 123

       DD 338, 158
       DD 473, 425
       DD 196, 283
       DD 443, 394
       DD 558, 343
       DD 430, 134
       DD 414, 362
       DD 331, 185
       DD 561, 232
       DD 434, 321
       DD 376, 255
       DD 598, 388
       DD 114, 145
       DD 140, 243
       DD 537, 189
       DD 375, 434

       DD 225, 257
       DD 178, 283
       DD 157, 125
       DD 296, 158
       DD 372, 435
       DD 484, 192
       DD 543, 134
       DD 439, 212
       DD 338, 166
       DD 367, 288
       DD 133, 143
       DD 196, 313
       DD 429, 124
       DD 122, 448
       DD 585, 127
       DD 145, 173

       DD 534, 134
       DD 157, 157
       DD 323, 323
       DD 177, 167
       DD 134, 134
       DD 277, 177
       DD 164, 134
       DD 558, 358
       DD 254, 154
       DD 287, 137
       DD 493, 153
       DD 476, 376
       DD 243, 143
       DD 527, 127
       DD 445, 245
       DD 123, 223

       DD 138, 258
       DD 373, 225
       DD 396, 383
       DD 143, 194
       DD 258, 443
       DD 330, 134
       DD 414, 262
       DD 531, 185
       DD 361, 132
       DD 334, 121
       DD 476, 155
       DD 198, 288
       DD 114, 145
       DD 240, 343
       DD 137, 389
       DD 275, 134

       DD 525, 157
       DD 478, 183
       DD 557, 325
       DD 296, 258
       DD 572, 135
       DD 484, 192
       DD 343, 134
       DD 239, 212
       DD 138, 266
       DD 467, 388
       DD 233, 143
       DD 196, 313
       DD 529, 174
       DD 422, 148
       DD 385, 157
       DD 245, 173
;---------------------------------------------------------------------------
;                              Stepper - Table
;---------------------------------------------------------------------------
STEP0X DD 1, 1                  ; Number of Pixel for movement in horizontal
       DD 1, 2                  ;  and vertical direction (Step X,Y)
       DD 2, 1
       DD 2, 4
       DD 3, 1
       DD 6, 6
       DD 7, 5
       DD 8, 4
       DD 9, 3
       DD 2, 8
       DD 1, 6
       DD 5, 2
       DD 1, 3
       DD 2, 4
       DD 3, 5
       DD 4, 6

       DD 8, 1
       DD 1, 2
       DD 8, 3
       DD 1, 9
       DD 9, 1
       DD 2, 2
       DD 2, 3
       DD 2, 7
       DD 6, 1
       DD 8, 8
       DD 3, 3
       DD 7, 7
       DD 4, 1
       DD 2, 7
       DD 4, 3
       DD 4, 2

       DD 1, 1
       DD 1, 2
       DD 1, 3
       DD 2, 3
       DD 2, 1
       DD 2, 2
       DD 2, 2
       DD 2, 1
       DD 3, 1
       DD 6, 2
       DD 3, 3
       DD 3, 3
       DD 4, 1
       DD 2, 2
       DD 4, 3
       DD 4, 6

       DD 1, 1
       DD 1, 2
       DD 1, 2
       DD 1, 4
       DD 2, 1
       DD 2, 2
       DD 3, 3
       DD 2, 4
       DD 3, 1
       DD 3, 3
       DD 3, 2
       DD 3, 1
       DD 4, 5
       DD 2, 2
       DD 4, 3
       DD 1, 2

       DD 3, 1
       DD 1, 2
       DD 1, 3
       DD 2, 4
       DD 2, 1
       DD 2, 2
       DD 2, 3
       DD 2, 4
       DD 3, 1
       DD 3, 2
       DD 3, 3
       DD 3, 4
       DD 4, 1
       DD 3, 2
       DD 4, 3
       DD 2, 2

       DD 1, 1
       DD 1, 2
       DD 1, 3
       DD 1, 2
       DD 2, 1
       DD 1, 2
       DD 2, 3
       DD 2, 2
       DD 1, 1
       DD 3, 2
       DD 3, 3
       DD 1, 1
       DD 2, 1
       DD 3, 2
       DD 1, 3
       DD 1, 2

       DD 1, 1
       DD 1, 2
       DD 1, 3
       DD 1, 3
       DD 3, 1
       DD 2, 2
       DD 2, 1
       DD 2, 1
       DD 5, 1
       DD 3, 2
       DD 3, 3
       DD 3, 1
       DD 3, 1
       DD 3, 2
       DD 2, 3
       DD 4, 1

       DD 1, 1
       DD 1, 2
       DD 1, 3
       DD 3, 4
       DD 2, 1
       DD 1, 5
       DD 2, 3
       DD 2, 4
       DD 3, 1
       DD 3, 2
       DD 1, 3
       DD 2, 3
       DD 3, 1
       DD 1, 2
       DD 1, 3
       DD 2, 1

       DD 1, 1
       DD 1, 1
       DD 1, 3
       DD 1, 2
       DD 2, 1
       DD 2, 2
       DD 2, 3
       DD 2, 3
       DD 1, 1
       DD 3, 2
       DD 3, 3
       DD 3, 3
       DD 1, 1
       DD 4, 1
       DD 4, 3
       DD 4, 2

       DD 3, 1
       DD 1, 2
       DD 1, 3
       DD 1, 3
       DD 2, 1
       DD 2, 2
       DD 5, 3
       DD 2, 1
       DD 3, 1
       DD 3, 2
       DD 3, 3
       DD 5, 3
       DD 4, 1
       DD 5, 2
       DD 4, 1
       DD 1, 2

       DD 1, 1
       DD 1, 5
       DD 1, 3
       DD 1, 3
       DD 2, 1
       DD 2, 2
       DD 5, 1
       DD 1, 4
       DD 1, 1
       DD 5, 2
       DD 3, 5
       DD 3, 4
       DD 4, 1
       DD 1, 2
       DD 4, 3
       DD 3, 5

       DD 1, 1
       DD 1, 1
       DD 3, 3
       DD 1, 4
       DD 2, 3
       DD 2, 1
       DD 2, 3
       DD 2, 4
       DD 3, 1
       DD 3, 2
       DD 5, 3
       DD 3, 1
       DD 1, 3
       DD 3, 5
       DD 4, 3
       DD 1, 2

       DD 1, 1
       DD 1, 2
       DD 1, 3
       DD 1, 4
       DD 2, 1
       DD 5, 1
       DD 2, 3
       DD 3, 4
       DD 3, 3
       DD 1, 2
       DD 3, 3
       DD 3, 4
       DD 4, 1
       DD 3, 2
       DD 1, 3
       DD 2, 4

       DD 1, 5
       DD 1, 2
       DD 5, 3
       DD 1, 2
       DD 2, 1
       DD 2, 2
       DD 2, 5
       DD 2, 3
       DD 3, 1
       DD 3, 3
       DD 3, 3
       DD 3, 1
       DD 2, 1
       DD 3, 5
       DD 2, 3
       DD 4, 2

       DD 1, 1
       DD 3, 1
       DD 1, 3
       DD 1, 3
       DD 2, 1
       DD 5, 2
       DD 2, 3
       DD 2, 1
       DD 3, 3
       DD 3, 2
       DD 3, 3
       DD 3, 3
       DD 5, 1
       DD 1, 2
       DD 2, 3
       DD 4, 2

       DD 1, 1
       DD 1, 2
       DD 1, 3
       DD 1, 4
       DD 2, 1
       DD 5, 2
       DD 2, 3
       DD 2, 4
       DD 3, 1
       DD 3, 2
       DD 3, 5
       DD 2, 1
       DD 3, 1
       DD 2, 2
       DD 1, 3
       DD 2, 2
;----------------------
S_Len = ($-STEP0X)
;--------------------------------------
; Table of direction-flags for movement
;--------------------------------------
W0     DB (Anzahl+1)* 8 DUP(0)         ; plus(0) / minus(1) für X,Y
;--------------------------------------
BALL   DB 0CC00h dup (22h)             ; Sprite-Table: Offset32, Farbe32
;--------------------------------------
PICAKT DD MaxX*4*MaxY                  ; Actual adress of the framebuffer
PICLEN DD MaxX*4*MaxY                  ; Screen lenght
PICMAX DD MaxX*4*MaxY*2                ; Max adress
;--------------------------------------
RETTSI DW 0, 0                         ; I don´t like to push the SI-register on the stack
;--------------------------------------
HINFAR DD HFarb, HFarb                 ; Background Color
;--------------------------------------
;            C i r c l e
;--------------------------------------
Y      DD 0                            ; Double-Word for FPU: sqr

XM     DD 0                            ; X Position
YM     DD 0                            ; Y Position

COL    DD 0                            ; Color

XMAX   DW 0, 0
YMAX   DW 0, 0
;--------------------------------------
EDID   DB 80h dup (55h)                ; Buffer for DDC-Monitor-Info
;--------------------------------------
VINF   DB 512 dup (0AAh)               ; Buffer for Vesa-Info(4F00h)
MINF   DB 256 dup (044h)               ; Buffer for Mode Info(4F01h)
;--------------------------------------
CRTC    DW 1456                        ; Horizontal Total       in Pixel
HORIANF DW 1122                        ; Horizontal  Sync-Start in Pixel
HORIEND DW 216                         ; Horizontal  Sync-End   in Pixel
VERTOTA DW 814                         ; Vertical   Total       in Lines
VERTANF DW 768                         ; Vertical    Sync-Start in Lines
VERTEND DW 42                          ; Vertical    Sync-End   in Lines
DOIFLAG DB 04h                         ; Flag (interlaced,doubleScan,polarity)
PIXCLOC DD 118309000                   ; Pixel clock in hz
REFRATE DW 10000                       ; Refresh-Rate in 0.01 hz
;---------------------
        DB 40 dup (0)
;--------------------------------------
FLAG    DB 0                           ; Used for triple buffering adress switching
;--------------------------------------
ERTEX1 DB Cr, Lf, "No Video-Mode", Cr, Lf, "$"
ERTEX2 DB Cr, Lf, "No lineare offset", Cr, Lf, "$"
ERTEX3 DB Cr, Lf, "No MMX-CPU", Cr, Lf, "$"
ERTEX4 DB Cr, Lf, "No Vesa-Bios", Cr, Lf, "$"
ERTEX5 DB Cr, Lf, "No VESA 3 -Bios", Cr, Lf, "$"
ERTEX6 DB Cr, Lf, "No DDC", Cr, Lf, "$"
ERTEX7 DB Cr, Lf, "Less than 96 khz", Cr, Lf, "$"
ERTEX8 DB Cr, Lf, "Less than 160 hz", Cr, Lf, "$"
ERTEX9 DB Cr, Lf, "No pixelcloc", Cr, Lf, "$"
;--------------------------------------
  DATEN ends
;----------------------------------------------------------------------------
 STAPEL SEGMENT use16 STACK 'STACK'
       DB 10h dup (0)
 STAPEL ends
;----------------------------------------------------------------------------
 end

Dirk

 

Einloggen