ƒ=ReadPaint       <aPRG formatted GEOS file V1.0G0#„„PSLowGC ±ÈmÔ‡Ô‡±ÈmÕBLASTER'S CONVERTER V2.5¿ÿÿÿ€ÿˆ‹ÿÁŠAŠÿñŠ€ŠŽŠ€Š¿‘Š€ŠŸŠ€Š¿‘Ž€‚¿‘ƒ€€€€ÿñÿÿÿƒÿÿWrite Image V2.1geoWrite V2.1ðŒ¿?¢É1ðÊŽ A©¢9 8%­…ÉÐLh9©2Z­¿?\, A0 ·Á½8‰ n5­þ-…­ý-…©… ©… ¶'ŠÐF & % t %ŠÐ7© €ÂŠÐ/ x9ŠÐCÁy¨©ýfç²ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿhàÊG;************************************************************ ; ReadPaint ; Routines for reading and decoding ; a GeoPaint file. ;************************************************************ .if Pass1 .noglbl .noeqin .include geosSym .include geosMac .eqin .glbl .endif .psect hà0ÊG;A GeoPaint file is made up of 45 records in VLIR format. Each record ;represents 16 raster lines (actually 2 card rows) of the GeoPaint page. ;If a record ihà0ÊG;A GeoPaint file is made up of 45 records in VLIR format. Each record ;represents 16 raster lines (actually 2 card rows) of the GeoPaint page. ;If a record is empty, then those 2 card rows are blank. ;To use these routines, first get a pointer to a filename ;into r6. Then call GetIndex. ;Provide a 1448 byte buffer (see below) and point r2 to the buffer. ;Load x with the record number to load into the buffer. ;Call LdBuf and the record will be decoded and stored ;in the buffer. This buffer will hold the data for 2 card rows. ;The breakdown of the 1448 byte buffer will be as follows: line1Buffer: .block 640 ;data for the first card row of the record. line2Buffer: .block 640 ;data for the second card row of the record. extraBytes: .block 8 ;these are not used. line1Color: .block 80 ;color data for the first card row. line2Color: .block 80 ;color data for the second card row. ;Each 640 byte card row is stored just like the 64's screen data ;is stored. The first 8 bytes make up the first card, the 2nd 8 bytes ;make up the second card and so on. ;The first byte of the color data is for the first card. The upper ;nybble is the foreground color and the lower nybble is the background ;color. ;Once you have a record loaded, you can then use it as needed, whether it ;be for printing, converting to other formats, or displaying on the screen. ;If you have room, you can load in more than one record at a time. hà0ÊG;call this routine with r6 poinhà0ÊG;call this routine with r6 pointing to a buffer holding ;the filename of a GeoPaint file. ;Any non-zero value in x upon exit indicates either an error ;or the file is not a GeoPaint. ;This will also load track and sector pointers to the ;records in two buffers at trackIndex and sectorIndex. ;This frees up fileHeader for other uses while you are ;working with the GeoPaint image. GetIndex: jsr FindFile ;is there a next page? txa bne 90$ ;branch if not. LoadW r9,#dirEntryBuf jsr GetFHdrInfo ;get some stuff on this file. txa bne 90$ ;branch if any problems. jsr CmpIfPaint ;is this file a GeoPaint file? bne 90$ MoveW dirEntryBuf+1,r1 LoadW r4,#fileHeader jsr GetBlock txa bne 90$ ldx #0 ldy #0 20$ lda fileHeader+2,x sta trackIndex,y lda fileHeader+3,x sta sectorIndex,y inx inx iny cpy #45 bne 20$ ldx #0 90$ rts hà0ÊG;load the header block for the desired file into ;fileHeader and then use this routine to verify ;that hà0ÊG;load the header block for the desired file into ;fileHeader and then use this routine to verify ;that the file is a GeoPaint data file. ;Equals flag or the x register may be checked ;upon exit. x=0 if GeoPaint. CmpIfPaint: LoadW r0,#gpName LoadW r1,#(fileHeader+77) ldx #r0 ldy #r1 lda #11 jsr CmpFString bne 90$ ldx #0 rts 90$ ldx #128 rts gpName: .byte "Paint Image",0 hà0ÊG;Before calling this routine, point r2 to a 1448 byte buhà0ÊG;Before calling this routine, point r2 to a 1448 byte buffer. ;This will load the buffer with the data from the geoPaint record ;that x points at. Therefore x should have a value between 0 and 44 ;upon entry. If any data was loaded, then dataLoaded will have ;bit 7 set, otherwise cleared. ;The calling routine might want to clear the buffer prior ;to calling this routine to erase any data from the previously ;loaded record. ;Destroys r1 - r5. ;Assume no errors, value of x is not valid upon exit. LdBuf: LoadB dataLoaded,#0 clc lda r2L adc #[1448 sta bufLength+0 lda r2H adc #]1448 sta bufLength+1 lda trackIndex,x beq 15$ sta r1L lda sectorIndex,x sta r1H LoadW r4,#diskBlkBuf LoadB r5H,#0 sta r5L 10$ jsr ReadByte ;fetch a command byte. cpx #0 bne 15$ cmp #0 bne 20$ 15$ rts 20$ sta cmdByte LoadB dataLoaded,#128 lda cmdByte cmp #$80 ;is this a $80? beq 15$ ;branch if so. (invalid) bcc 40$ ;branch if less than $80. jsr RepeatByte beq 10$ rts 40$ cmp #$40 ;is this a $40? beq 15$ ;branch if so. (invalid) bcc 50$ ;branch if less than $40. jsr Repeat8Bytes beq 10$ rts 50$ jsr DoUniqBytes beq 10$ rts hà0ÊG;this is called by LdBuf. ÊG ÊGDoUniqBytes: 10$ jhà0ÊG;this is called by LdBuf. ÊG ÊGDoUniqBytes: 10$ jsr ReadByte cpx #0 bne 90$ ldy #0 sta (r2),y inc r2L bne 60$ inc r2H 60$ CmpW r2,bufLength bcs 90$ dec cmdByte bne 10$ ldx #0 rts 90$ ldx #128 rts hà0ÊG;this is called by LdBuf. ÊG ÊGRepeatByte: hà0 and #%01111111 sta cmdByte jsr ReadByte sta uniqByte cpx #0 bne 90$ ldy #0 10$ lda uniqByte sta (r2),y inc r2L bne 60$ inc r2H 60$ CmpW r2,bufLength bcs 90$ dec cmdByte bne 10$ ldx #0 rts 90$ ldx #128 rts uniqByte: .block 1 hà0ÊG;this is called by LdBuf. ÊG;Destroys r3. hà0 Repeat8Bytes: and #%00111111 sta cmdByte LoadB hà0ÊG;this is called by LdBuf. ÊG;Destroys r3. hà0 Repeat8Bytes: and #%00111111 sta cmdByte LoadB repeatCount,#8 MoveW r2,r3 10$ jsr ReadByte cpx #0 bne 90$ ldy #0 sta (r2),y inc r2L bne 15$ inc r2H 15$ dec repeatCount bne 10$ beq 25$ 20$ AddVW #8,r2 25$ CmpW r2,bufLength bcs 90$ dec cmdByte beq 80$ ldy #0 30$ lda (r3),y sta (r2),y iny cpy #8 bne 30$ beq 20$ 80$ ldx #0 rts 90$ ldx #128 rts hà0hà0ÊGcmdByte: .block 1 dataLoaded: .block 1 bufLength: .block 2 ÊGtrackIndex: .block 45 sectorIndex: .block 45 ÊG hà0hàhà