*************************************** * * * P O R T F O L I O N E W S * * * * Internet newsletter for * * Atari Portfolio users and fans * * * *************************************** No 4 July 27, 1995 HOT NEWS: * PORTFOLIO NEWS WILL BE PUBLISHED WITH INTERNATIONAL PAGES IN ENGLISH MORE INFO ON THE CONTENT AND SUBCRIPTION WILL BE E-MAILED SOON * PORTFOLIO IN GERMANY: THERE WILL BE A PORTFOLIO CLUB IN GERMANY (MAYBE FROM AUGUST), WITH ITS OWN BBS, PRINTED NEWSLETTER AND 50-80 ACTIVE MEMBERS. CONTACT ADDRESS: WOLF-THEO HOLL NEUE MARKT STRASSE 16 D- 47051 DUISBURG TEL./ FAX ++ 49 203 299 880 * RE:PORT WILL END IT IS SURE THAT RE:PORT PUBLISHED BY DAVE STEWARD WILL END IN AUGUST. THE OLD ISSUES ARE STILL AVAILABLE. * PLEASE - SUPPORT OUR PF NET ACTIVITIES WE HAVE A LIMITED MEASURE OF TIME, SO WE ARE LOOKING FOR ANY TEXTS AND YOUR VIEW TO BE PUBLISHED AND SENT TO EVERYBODY PLEASE - TRY TO HELP US *************************************************************** *************************************************************** PORTFOLIO FONT DEFINITION There is a need to define a standard for font files used in graphic based programs on Portfolio. There are already many types of *.fnt standards, but they are usually designed for desktop PC's and no program using them works on Portfolio. The following standard has been developed for Portfolio. It is designed to work with graphic routines distributed by Portfolio Club in the Czech Republic. Character definition 1. Character is a bit map of individual bits that when displayed on the screen make a symbol or a letter. 2. The size of a character is defined as a number of horizontal and a number of vertical bits. 3. The minimal size is 1x1 bit. (But it makes no sense.) 4. The maximal size is 16x64 bits. 5. The bit map of any character is stored in bytes or words. (One word is made of 2 consecutive bytes). If the number of horizontal bits is 8 or less, then the bit map is stored in bytes. If the number of horizontal bits is bigger than 8 then the bit map is stored in words. 6. The total number bytes or words needed to store one character is the same as the number of vertical rows. Examples: 4x6 character is saved in 6 bytes 6x6 character is saved in 6 bytes 6x8 character is saved in 8 bytes 8x8 character is saved in 8 bytes 12x12 character is saved in 24 bytes 12x16 character is saved in 32 bytes 16x16 character is saved in 32 bytes 16x27 character is saved in 54 bytes FONT FILE DEFINTION ------------------- The font file has a following structure: offset in file size meaning ------------------------------------------------ 0 2 PF - font recognition character 2 8 8 bytes of user text 10 1 00 - zero terminator 11 1 reserved for future 12 1 reserved fot future 13 1 horizontal width in pixels 14 1 vertical length (no. of lines) 15 1 number of defined characters 16 xxx the font images An example of a beginning of a font file (written for compiling into *.fnt file): DB 'PF' ;PF recognition DB '895 6x8 ',00 ;user text - character set PC895 in 6*8 matrix DB 00,00 ;reserved DB 06 ;6 pixels wide DB 08 ;8 pixels long DB 255 ;255 characters defined DB 000,000,000,000,000,000,000,000 ;definition of ASCII 00 character DB ....... The software can calculate the number of bytes needed to store the font file into the RAM in the following way: ;16 bytes of the *.fnt file must be loaded from the disk first ;to be analized by the rutine ;result will be in AX register mov si,offset begining of *.fnt file ;offset of the file def. table mov al,[si+14] ;number of lines per 1 character mov bl,[si+15] ;total number of defined characters mul bl ;total number of bytes mov bl,[si+13] ;width of the character cmp bl,8 ;one byte or two per one line? jna label1 shr ax,1 ;if two bytes - the number is doubled label1: add ax,16 ;16 bytes added the size of ;the font def. table at the beginning CONCLUSION: ----------- Portfolio club in CZ will soon distribute free routines that support this font file standard. Bugs and comments to: sedlakj@dec59.ruk.cuni.cz Jan.Sedlak@pedf.cuni.cz ************************************************************** ************************************************************** HOW TO MAKE NEW SOFT FOR PF. This text discusses making new .EXE and .COM files. BASIC and other files (non-executable) are not discussed. There are many ways of programming Portfolio. Three main ways are used: Assembler, Pascal, and C. Assembler is the best way. The files are the shortest and quickest. If you use BIOS and DOS calls there are almost no problems. The Tech. Ref. Guide decribes in full the differences between PC and PF DOS functions and describes especially the INT 61 & 60 functions - unique for Portfolio. At this time Portfolio club in CZ has a full description of ROM that is in PF. It has been disassembled and individual routines have been marked. Martin and Milan Hrdlicka spent a lot of time on exploring the PF system and the result is a list of Portfolio In, Out addresses that enable to access the hardware in the highest speed. This list is in Czech and I will translate it into English and send to PF users on Net. The A86 is a small (23 KB) assembler that runs on Portfolio. You can compile up to 15 KB of source code on 128 KB Portfolio. This means that you can make some of your programming somewhere on the way and test it on Portfolio. A86 is available on some ftp servers and also on request from Portfolio club. Debugger - there are few debuggers that run on PF. Tomas Dusek has adapted a very powerful debugger and has changed the display functions to 40*8 screen. It works very well and takes just 17 KB on disk. Summary for programming in assembler: You can develop programs on PC (e.g. using the Borland's Turbo Assembler). Always set up the debugger to XT (8088) code. And do not use any libraries. Developing on PF: Use A86 and a good debugger. Literature: Tech. Guide is the best. ************************************************************ ************************************************************ GRAPHICS ON PORTFOLIO --------------------- Here are some tips how to new make graphic soft for Atari Portfolio. This document decribes how to work with the LCD display in assembler. It is also possible to work with higher languages but assembler is always the quickest ans shortest method. 1. starting graphic mode ------------------------ Before you work with graphic images on LCD screen you must turn on the graphic mode. Here is one way: INIT: PUSH AX MOV AX,0A INT 010 POP AX RET You can call this routine at any time. It will clear the LCD screen, clear the content of the video RAM and will turn on the graphic mode. The cursor will disappear. From now on all graphic operation must be in graphic mode. (e.g. writing text to the screen via Fn 09h INT 21h will make nonsense dots on the screen) 2. exiting the graphic mode ---------------------------- If you want to work with text, you MUST turn off the graphic mode and turn on back the text mode. Here is one way: EXIT: PUSH AX MOV AX,7 INT 010 POP AX RET You MUST always turn on the text mode if you propose to quit to DOS!!! 3. exiting to DOS ----------------- To exit a program in assembler you can use the INT 22h in the following way: TOTALEND: MOV AL,00 ; this is the value of ERRORLEVEL in DOS MOV AH,04C INT 33 If you want to transfer exit code you can load it into AL register and after exiting process the value as the ERRORLEVEL value in DOS. If you exit to DOS do not forget to empty all value from the stack that were added by your program. Once more: the text mode MUST be set before exiting to DOS. 4. setting a pixel using the BIOS --------------------------------- You can set each pixel by using BIOS and INT 10h. Here is the rutine: mov cx, ; the x coordinate 0-239 mov dx, ; the y coordinate 0-63 mov bx,0 ; must be set to 0 mov ah,12 mov al, ; 0 - will clear the pixel ; 1 - will set the pixel ; do not use other values on Portfolio int 010h This routine does not need refreshment afterwards. It displays the pixel immediately. This rutine works but is extremely slow on PF. It takes years to display all the pixels this way. You can use the rutine to set individual pixels. Please make you soft sure not go beyond the x and y coorfinates. 5. setting a pixel in Video RAM ------------------------------- There is a difference between a PF and PC. If you write a pixel or text to Video RAM on PF it will not be displayed on the screen. You must refresh it afterwards. This rutine writes a pixel to video RAM on PF but the pixel is not displayed unless you use the refreshing rutines. ;*************************** ;G_RAM writes a given pixel into video RAM ; pixel is not displayed unless ; the LCD screen id refreshed ;*************************** ;parameters ;CX - x coordinate 0-239 ;DX - y coordinate 0-63 ;AL - if AL equ 00 the pixel is cleared ; if AL <> 00 the pixel is set ;************************** G_RAM: PUSH AX,BX,CX,DX,DI,SI,DS MOV DS,0 MOV DS,0B000 XCHG AX,DX MOV BL,30 MUL BL MOV DI,AX MOV AX,DX MOV BX,CX SHR CX,1 SHR CX,1 SHR CX,1 ADD DI,CX MOV CX,BX AND CL,7 MOV DL,080 SHR DL,CL CMP AL,0 MOV SI,DI JZ R1 OR [DS:SI],DL JMP R_RET R1: NOT DL AND [DS:SI],DL R_RET: POP DS,SI,DI,DX,CX,BX,AX RET 6. refreshing the LCD display using the INT 61h ----------------------------------------------- You may use this only on Portfolio!!! There is no INT 61h service available on PC. It will lock your PC if you call INT 61h. The Portfolio BIOS has the extention in INT 61h which is fully decribed in Portfolio Tech. guide which I recommend to any PF programmer. Here is the function: MOV AH,012h INT 061h 7. refreshing the LCD display using direct access to LCD -------------------------------------------------------- Again, do not you this on PC. It will make strange things with your PC screen. Mr. Don Messerli was a pioneer in exploring the PF internal undocumented functions. Thank you, Don, very much! He found out that the PF screen can be refreshed directly up to 20 times per second which is a superb speed. Martin and Milan Hrdlicka from CZ also explored the PF and here is their fast refreshing routine: ;****************************** ;REFRESH - MAKE A FAST COPY OF VIDEO RAM INTO LCD ; DRIVER ON PORTFOLIO ; this rutine is copyrighted by: ; Milan a Martin Hrdlicka, Brno, Czech republic ; many thanks for their efforts on Portfolio ;****************************** REFRESH: cld push ax ;saves all used registers push cx push dx push bx push si push di push ds refresh_hop: mov si,0 mov ax,0b000h mov ds,ax ;DS = segment of VIDEO RAM mov di,64 ;DI = number of lines on the screen refresh_2: mov cx,30 ;CX = number of bytes on one line mov bx,si mov al,0ah mov dx,8011h cli out dx,al mov al,bl mov dx,8010h out dx,al sti mov al,0bh mov dx,8011h cli out dx,al mov dx,8010h mov al,bh and al,7 out dx,al sti refresh_1: lodsb ror al,1 mov ah,al and ah,136 ror al,1 ror al,1 mov bl,al and bl,68 or ah,bl ror al,1 ror al,1 mov bl,al and bl,34 or ah,bl ror al,1 ror al,1 and al,17 or al,ah mov ah,al inc dx mov al,0ch cli out dx,al mov al,ah mov dx,8010h out dx,al sti loop refresh_1 dec di jnz refresh_2 pop ds pop di pop si pop bx pop dx pop cx pop ax ret This rutine allows to refresh the LCD about 10 times a second. It has been tested on all Portfolio versions. 8. clearing the content of the video RAM ---------------------------------------- Here is a rutine to clear the content of the video RAM. You can use it of you want to draw a new picture on the screen. ;************** ;CLEAR_RAM CLEARS THE CONTENT ; OF ACTUAL VIDEO RAM ;************** CLEAR_RAM: PUSH AX PUSH CX PUSH DI PUSH ES CLD SUB AX,AX MOV DI,0 MOV ES,0B000 MOV CX,0800 REP STOSB POP ES POP DI POP CX POP AX RET 9. drawing a box on the screen ------------------------------- Here is an example of how to use the grahic routines. This BOX rutine uses G_RAM rutine to draw a pixel in the video RAM. If you want to see the box on the scree you must use the REFRESH rutine. For example the code to draw a box [10,10]-[30,30]: ... ... mov ax,10 mov bx,10 mov cx,30 mov dx,30 call box call refresh ... ... Here is the BOX rutine in itself: ;********************************* ;BOX DRAWS A BOX IN GIVEN COORDINATES ; x1,y1 AND x2,y2 ; ; AX = x1 ; BX = y1 ; CX = x2 ; DX = y2 ; ; IT MUST BE MADE SURE THAT ; x2>x1 AND y2>y1 ; X MAY RANGE 0-239 ; Y MAY RANGE 0-63 ;********************************** BOX: PUSH AX,BX,CX,DX,SI,DI MOV SI,CX XCHG BX,AX MOV DI,AX CALL B1 XCHG DX,DI MOV CX,SI CALL B1 XCHG DX,BX MOV CX,SI MOV SI,DX MOV DX,DI CALL B2 MOV DX,DI MOV CX,SI CALL B2 RET B1: CALL G_RAM DEC CX CMP BX,CX JL B1 CALL G_RAM RET B2: CALL G_RAM DEC DX CMP BX,DX JL B2 PUSH DI,SI,DX,CX,BX,AX RET 10. drawing an icon in the screen --------------------------------- Another example of grahic rutines put together. This rutine will draw an icon in the video RAM at given coordinates. Do not forget to refresh the screen after you draw the icon to see it. ;********************************* ;ICON DRAWS A ICON IN X,Y COORDINATES ; ; ;AL = NUMBER IF THE ICON (0 TO 6 in this version) ;CX = X COORIDINATE 0-224 ;DX = Y COORDINATE 0-48 ; ;EACH ICON IS 16*16 PIXEL LAGRE ;THE RUTINE DOES NOT PRESERVE REGISTERS IN THIS VERION ;ADD PUSH AND POP IF YOU NEED THEM ;********************************* ICON: SHL AX,1 SHL AX,1 SHL AX,1 SHL AX,1 SHL AX,1 MOV AH,0 MOV SI,AX ADD AX,0020 PUSH AX L1: PUSH CX MOV DI,0 MOV BX,[ICONS+SI] XCHG BH,BL L2: MOV AX,0C00 RCL BX,1 IF C MOV AX,0C01 CALL G_RAM INC CX INC DI CMP DI,0010 JNE L2 POP CX INC DX POP AX PUSH AX INC SI,2 CMP SI,AX JNE L1 POP AX RET ;******************************* ;BIT MAPS OF RESPECTIVE ICONS ;******************************* ICONS: ;icon 1 DB 0FF,0FF,0A0,005 DB 0A0,007,0A0,007 DB 0A0,005,0A0,005 DB 0A0,005,0BF,0FD DB 080,001,09F,0F1 DB 093,011,093,011 DB 093,011,093,011 DB 050,011,03F,0FF ;icon2 DB 000,03C,000,062 DB 000,0AD,001,02D DB 002,051,004,08F DB 009,012,012,024 DB 034,048,038,090 DB 031,020,04A,040 DB 047,080,063,000 DB 0FE,000,0E0,000 ;icon3 DB 01C,038,062,046 DB 091,089,0A5,085 DB 083,0B9,0B9,085 DB 0C5,0B9,081,085 DB 091,0B1,0A1,0C1 DB 081,099,09D,085 DB 083,081,0BD,0B9 DB 0E3,0C7,081,081 ;icon4 DB 001,000,002,080 DB 03A,0B8,03A,0B8 DB 03C,078,005,040 DB 006,0C0,006,0C0 DB 006,0C0,006,0C0 DB 006,0C0,007,0C0 DB 07B,0BC,07F,0FC DB 070,01C,01F,0F0 ;icon5 DB 00F,0F0,01F,0F8 DB 03F,0FC,07F,0FE DB 0FF,0FF,0C8,0B3 DB 0B5,055,0DD,055 DB 0ED,053,0B5,057 DB 0CD,0B7,0FF,0FF DB 07F,0FE,03F,0FC DB 01F,0F8,00F,0F0 ;icon6 DB 0FF,0FF,0F8,01F DB 073,0CE,073,0CE DB 03F,0CC,03F,09C DB 01F,038,01E,078 DB 00E,070,00E,070 DB 007,0E0,006,060 DB 002,040,003,0C0 DB 001,080,001,080 ;icon7 DB 0FD,0F0,084,010 DB 084,07C,084,038 DB 084,010,084,000 DB 085,0FF,085,047 DB 09D,045,099,045 DB 0F1,07D,001,001 DB 001,031,000,0B1 DB 000,07F,000,000 ========================================================= This is all about Portfolio graphic in assembler for now. I am working on a graphic library that will hame more sophisticated graphic functions. I will distribute as soon as it is completed. I hope more PF users will join me in making new soft for Portfolio. Jan Sedlak Portfolio Club Sarajevska 29 120 00 Praha 2 tel. + 42 2 691 11 63 home + 42 2 99 61 894 answer. fax + 42 2 29 51 86 sedlakj@dec59.ruk.cuni.cz Jan.Sedlak@pedf.cuni.cz ***************************************************************** ***************************************************************** Another Portfolio Dealer in the USA We have contacted DAYTON DISCOUNT and they have Portfolios and peripherals for sale. From their letter: IN... We have a limited no. of Portfolios. Our price is 199.50 USD. We have some of the accesories on stock. ...TS Their address: DAYTON DISCOUNT HIGHWAY 92 WEST BELLEVILLE, WI 53508 phone 424-6111 *********************************************** This issue of Portfolio News was published on JULY 27, 1995. ************************************************ Special greetings to: Don Messerli - for his soft and graphics BJ Gleason - for PBASIC and tons of other things S. Spoelstra - for his BASIC, and others Tomas Dusek - Go on developing the hardware! Martin & Milan Hrdlicka - the authors of new graphic BIOS Dave Steward - for his efforts