hardware:doku:techrefguide:anhanga
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende ÜberarbeitungLetzte ÜberarbeitungBeide Seiten der Revision | ||
hardware:doku:techrefguide:anhanga [19/09/2007 20:09] – typos uxt | hardware:doku:techrefguide:anhanga [19/09/2010 22:09] – internen Link korrigiert uxt | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ===== ANHANG A: .RUN PROGRAMM BEISPIEL ===== | ||
- | |||
- | Abschnitt 3.6 hebt die wichtigsten Entwicklungsbedingungen hervor, die zu berücksichtigen sind wenn man .RUN Programme schreibt.\\ | ||
- | |||
- | Auf der Emulator-Diskette befinden sich folgende Dateien:\\ | ||
- | |||
- | |RNRN.ASM|Assembler .RUN Programm| | ||
- | |MAIN.C|C .RUN Programm Beispiel| | ||
- | |RU_C.ASM|C Header| | ||
- | |Build.BAT|Erzeugt Programm unter Verwendung von Turbo C Tools| | ||
- | |||
- | Die obigen Dateien illustrieren zwei Programme die Atari Portfolios .RUN Funktion verwenden.\\ | ||
- | |||
- | RNRN ist ein Assemblerprogramm das die ursprünglichen Aufrufparameter und dann drei Zahlen ausgibt.\\ | ||
- | |||
- | MAIN illustriert ein in C geschriebenes .RUN Programm. RU_C.ASM ist der nötige " | ||
- | |||
- | |||
- | Bemerkungen bezüglich der Verbindung zwischen " | ||
- | |||
- | Für " | ||
- | |||
- | RU_C.ASM ist der Header der für die Verbindung zu einem " | ||
- | |||
- | Der RU_C.ASM Header funktioniert mit Turbo C und kann als Leitfaden zur Modifikation anderer " | ||
- | |||
- | Die meisten " | ||
- | |||
- | Kontaktieren sie Atari bezüglich RUN Startup Codes für die unterschiedlichen C Compiler.\\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | <code asm> | ||
- | TITLE RNRN.ASM | ||
- | |||
- | comment * | ||
- | (c) Copyright DIP, 1989 | ||
- | |||
- | Example .RUN program | ||
- | |||
- | For Appendix 1 of DIP Pocket PC Technical Reference Manual | ||
- | |||
- | * | ||
- | |||
- | DGROUP group _text, | ||
- | |||
- | STACKSIZE equ 400 ; | ||
- | |||
- | ; code segment. | ||
- | _text segment public byte ' | ||
- | assume cs: | ||
- | |||
- | org 0 ; IP is 0 on entry. | ||
- | |||
- | ; | ||
- | ; rnrn_main ; | ||
- | ; ; | ||
- | ; RUN command test routine. ; | ||
- | ; On entry, DS, SS and ES all point to the PSP in RAM. ; | ||
- | ; CS is a ptr into the credit card, so may actually be in ROM! ; | ||
- | ; When this routine is executed, the whole of RAM is allocated to the ; | ||
- | ; process. ; | ||
- | ; ; | ||
- | ; Parameters: | ||
- | ; | ||
- | ; Returns: | ||
- | ; | ||
- | ; | ||
- | |||
- | rnrn_main proc near | ||
- | |||
- | mov bx, | ||
- | mov ah, | ||
- | int 21h | ||
- | jc rnrn_err ; | ||
- | |||
- | mov bx, | ||
- | sub bx, | ||
- | add bx, | ||
- | mov cl,4 | ||
- | shr bx, | ||
- | add bx, | ||
- | mov ah, | ||
- | int 21h ; | ||
- | jc rnrn_err ; | ||
- | |||
- | mov ss, | ||
- | mov sp, | ||
- | |||
- | push es ; | ||
- | |||
- | mov cx, | ||
- | sub cx, | ||
- | |||
- | mov si, | ||
- | push cs | ||
- | pop ds ; source is on memory card. | ||
- | xor di,di | ||
- | mov es, | ||
- | cld | ||
- | |||
- | rep movsb ; | ||
- | |||
- | pop es ; restore PSP ptr. | ||
- | |||
- | mov si,5dh | ||
- | mov cx,11 | ||
- | |||
- | rnrn_fcb1: | ||
- | mov dl, | ||
- | inc si | ||
- | mov ah,2 | ||
- | int 21h ; | ||
- | loop rnrn_fcb1 | ||
- | |||
- | mov si,6dh | ||
- | mov cx,11 | ||
- | |||
- | rnrn_fcb2: | ||
- | mov dl, | ||
- | inc si | ||
- | mov ah,2 | ||
- | int 21h ; | ||
- | loop rnrn_fcb2 | ||
- | |||
- | push ss | ||
- | pop ds ; DS is ptr to data in RAM. | ||
- | |||
- | mov al, | ||
- | call rnrn_disp ; | ||
- | |||
- | inc _rnrn_val | ||
- | |||
- | mov al, | ||
- | call rnrn_disp ; | ||
- | |||
- | mov rnrn_unin, | ||
- | mov al, | ||
- | call rnrn_disp ; | ||
- | |||
- | xor al, | ||
- | jmp short rnrn_end | ||
- | |||
- | rnrn_err: | ||
- | mov dx, | ||
- | push cs | ||
- | pop ds ; write directly from ROM card! | ||
- | mov ah, | ||
- | int 21h ; | ||
- | mov al, | ||
- | |||
- | rnrn_end: | ||
- | push ax ; | ||
- | |||
- | mov ah, | ||
- | int 21h | ||
- | |||
- | pop ax ; get errorlevel code back. | ||
- | mov ah, | ||
- | int 21h | ||
- | |||
- | rnrn_main endp | ||
- | |||
- | |||
- | ; | ||
- | ; rnrn_disp ; | ||
- | ; ; | ||
- | ; Display the value in AL with a trailing space. ; | ||
- | ; ; | ||
- | ; Parameters: | ||
- | ; AL Value to print, less than 100. ; | ||
- | ; Returns: | ||
- | ; | ||
- | ; | ||
- | rnrn_disp proc near | ||
- | aam ; convert to two numbers. | ||
- | add ax, | ||
- | push ax ; | ||
- | |||
- | mov dl,ah | ||
- | mov ah, | ||
- | int 21h | ||
- | |||
- | pop dx | ||
- | mov ah, | ||
- | int 21h | ||
- | |||
- | mov dl,' | ||
- | mov ah, | ||
- | int 21h | ||
- | |||
- | ret | ||
- | rnrn_disp endp | ||
- | |||
- | _text ends | ||
- | |||
- | |||
- | ; initialised and uninitialised RAM data. | ||
- | ; this is para since the segment will start at zero when it is copied | ||
- | ; over into RAM. | ||
- | _data segment public para ' | ||
- | rnrn_dstart label byte | ||
- | |||
- | public _rnrn_val | ||
- | _rnrn_val db 42 | ||
- | |||
- | rnrn_dend label byte | ||
- | rnrn_ustart label byte ; | ||
- | |||
- | rnrn_unin db ? | ||
- | |||
- | rnrn_uend label byte ; | ||
- | ; the stack is added on here, after initialised and uninitialised data. | ||
- | _data ends | ||
- | |||
- | |||
- | _cdata segment public byte ' | ||
- | |||
- | ; initialised data which doesn' | ||
- | rnrn_mem db " | ||
- | |||
- | _cdata ends | ||
- | end rnrn_main | ||
- | |||
- | </ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | |||
- | <code C> | ||
- | /* MAIN.C | ||
- | |||
- | Copyright DIP Ltd, 1989 | ||
- | |||
- | DIP Pocket PC RUN file ' | ||
- | */ | ||
- | |||
- | char buf[2]; | ||
- | |||
- | char *str=" | ||
- | |||
- | unsigned int __brklvl; | ||
- | |||
- | int main() | ||
- | { | ||
- | puts(str); | ||
- | |||
- | buf[0]=' | ||
- | buf[1]=0; | ||
- | |||
- | puts(& | ||
- | |||
- | return(0); | ||
- | } | ||
- | |||
- | void _exit() | ||
- | /* | ||
- | Dummy exit function required for the Turboc libraries. | ||
- | */ | ||
- | {} | ||
- | |||
- | </ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | |||
- | <code asm> | ||
- | |||
- | TITLE RU_C.ASM | ||
- | |||
- | comment * | ||
- | Copyright DIP Ltd., 1989 | ||
- | |||
- | ' | ||
- | |||
- | Memory usage: | ||
- | |||
- | -------------------------------------------- High memory ------- | ||
- | SP: Stack | ||
- | ---------------------------------------------------------------- | ||
- | Uninitialised data | ||
- | ---------------------------------------------------------------- | ||
- | DS/ | ||
- | ---------------------------------------------------------------- | ||
- | ES: PSP | ||
- | -------------------------------------------- Low memory -------- | ||
- | * | ||
- | |||
- | ; | ||
- | |||
- | ; code and fixed data (less than 64k). | ||
- | _TEXT | ||
- | _TEXT ENDS | ||
- | |||
- | ; code ends (marker segment) | ||
- | _TEXTEND | ||
- | _TEXTEND | ||
- | |||
- | ; initialised data transferred into RAM. | ||
- | _DATA | ||
- | _DATA ENDS | ||
- | |||
- | ; uninitialised data which is allocated space in RAM. | ||
- | _BSS SEGMENT WORD PUBLIC ' | ||
- | _BSS ENDS | ||
- | |||
- | ; uninitialised data end (marker segment). | ||
- | _BSSEND SEGMENT BYTE PUBLIC ' | ||
- | _BSSEND ENDS | ||
- | |||
- | DGROUP GROUP _DATA, | ||
- | |||
- | ASSUME | ||
- | |||
- | extrn _main: | ||
- | |||
- | STACKSIZE equ 128 ; | ||
- | |||
- | ; At the start, SS, DS and ES all point to the program segment prefix. | ||
- | ; CS is a ptr into the memory card. | ||
- | |||
- | _TEXT | ||
- | |||
- | org 0 ; ip is zero on entry. | ||
- | |||
- | start proc near ; | ||
- | ; terminate. | ||
- | |||
- | mov dx, | ||
- | add dx,10h | ||
- | mov ds,dx | ||
- | |||
- | mov bx, | ||
- | add bx, | ||
- | |||
- | push bx ; | ||
- | |||
- | shr bx,1 | ||
- | shr bx,1 | ||
- | shr bx,1 | ||
- | shr bx,1 | ||
- | add bx, | ||
- | |||
- | mov ah,4ah | ||
- | int 21h ; | ||
- | jc abort ; | ||
- | |||
- | pop bx ; get calc'd p back. | ||
- | mov ax,ds | ||
- | mov ss, | ||
- | mov sp,bx | ||
- | |||
- | push ds | ||
- | pop es ; target is allocated RAM after PSP. | ||
- | |||
- | push cs | ||
- | pop ds ; source is memory card. | ||
- | |||
- | mov si, offset _TEXT: | ||
- | add si, 0Fh ; round up to 1st byte in data. | ||
- | and si, 0FFF0h ; data is para aligned on the card. | ||
- | ; ds:si is ptr to start of init data. | ||
- | xor di, | ||
- | ; es:di is ptr to alloc' | ||
- | mov cx, offset DGROUP: | ||
- | inc cx ; round up: ensure last byte is copied. | ||
- | shr cx,1 | ||
- | |||
- | cld | ||
- | rep movsw ; | ||
- | |||
- | push es | ||
- | pop ds ; DS back to ptr to RAM. | ||
- | |||
- | mov di, | ||
- | mov cx, | ||
- | sub cx, | ||
- | xor al, | ||
- | rep stosb | ||
- | |||
- | call _main ; | ||
- | |||
- | mov ah, | ||
- | int 21h | ||
- | |||
- | abort: | ||
- | mov ax, | ||
- | int 21h | ||
- | start endp | ||
- | |||
- | _TEXT ENDS | ||
- | |||
- | |||
- | _TEXTEND | ||
- | etext label byte ; | ||
- | _TEXTEND | ||
- | |||
- | _DATA | ||
- | public _errno | ||
- | _errno dw 0 | ||
- | _DATA ENDS | ||
- | |||
- | _BSS SEGMENT | ||
- | bdata label | ||
- | _BSS ENDS | ||
- | |||
- | _BSSEND SEGMENT | ||
- | edata label | ||
- | _BSSEND ENDS | ||
- | |||
- | end start | ||
- | </ | ||
- | |||
hardware/doku/techrefguide/anhanga.txt · Zuletzt geändert: 19/09/2010 00:09 (Externe Bearbeitung)