tsouth@pro-pac.cts.com (System Administrator) (03/25/89)
I've run into a problem in APW that I hope someone can help with.
Recently, while playing with bitmats, and the built-in unpacking
routine, I tried to unpack from the memory buffer, to another buffer,
and then to the screen. I used the 'Paintworks $C0 File Unpacking
Routine' by Jason Harper for the basis, and simply redirected the out-
put of the unpack to a memory buffer. Then I tried to move that buffer
directly to the screen. The normal routine just unpacked directly to
the screen, BTW. Anyway, the routine appears to work in principle,
but when I run it the screen comes up with the display all garbled.
Here is the just of my add-oin routine. If need be, or wanted,
I will repost the entire routine set -- but this is all that I changed
and all that appears to really matter.
---------------------------------------------------------------------
clrscbs anop
sta $E19D00,x
inx
inx
cpx #200
blt clrscbs
PushLong #0 ;allocate bigbuf
PushLong #32000
PushWord MyID
PushWord #%1100000000010000
PushLong #0
_NewHandle
pla
sta >bigbuf_Hndl
sta 0
pla
sta >bigbuf_Hndl+2
sta 2
ldy #0 ;dereference bigbuf
lda [0],y
sta ptrtoscrn ;ptr to ptr
iny
iny
lda [0],y
sta ptrtoscrn+2
lda #32000 ;store unpack space length
sta ptrtolen
PushWord #0 ;wordspace
PushLong readaddr ;pointer to packed data
PushWord readlength ;length of packed data
PushLong #ptrtoscrn ;ptr to ptr to unpack area
PushLong #ptrtolen ;ptr to max length of unpack area
_UnPackBytes
pla ;# bytes unpacked: ignore it
PushLong buffhandle ;the handle
_DisposeHandle ;our unpack area no longer needed
lda ptrtoscrn
sta 0
lda ptrtoscrn+2
sta 2
ldy #0
tyx
loop1 lda [0],y
sta >$e12000,x
cpy #32000
beq loop1out
iny
iny
tyx
bra loop1
loop1out PushLong bigbuf_Hndl
_DisposeHandle
PushWord #0 ;wordspace
PushWord #1 ;echo flag
_ReadChar ;Press Any Key To Continue
pla ;ignore key
jsr gary
shortm ;turn of SHR mode
lda $E0C029
and #$7F
sta $E0C029
longm
lda #0 ;say 'no error'
rtl ;and return to APW shell
end
gary START
using Globals
lda #31
sta count
fadeout ldx #0
next lda $e19e00,x
tay
and #$000F
beq dogreen
tya
dec a
jsr storit
tay
dogreen tya
and #$00f0
beq dored
tya
sec
sbc #$0010
jsr storit
tay
dored tya
and #$0f00
beq nomore
tya
sec
sbc #$0100
jsr storit
nomore ldy #$0aff ;set your delay 03a0
loopy2 dey
bne loopy2
inx
inx
cpx #32
bne next
dec count
bpl fadeout
;; sec
;; xce
;; longa off
;; longi off
;; jsr $fc58 Home
;; lda back
;; sta $c034 restore background
;; lda #$41
;;; sta $c029
rts
END
**************************************************************************
globals data
MyID ds 2 ;program's UserID
ptrtoscrn ds 4 ;pointers for UnPackBytes
ptrtolen ds 2 ; "
buffhandle ds 4 ;handle to unpack area
c0pathname str 'c0testfile' ;file to load
p_open anop ;P16 parm list for Open
open_ref ds 2
dc i4'c0pathname'
ds 4
p_close anop ;P16 parm list for Close
dc i2'0'
p_geteof anop ;P16 parm list for GetEOF
geteof_ref ds 2
filelength ds 4
p_readmap anop ;P16 parm list for Read
rdmap_ref ds 2
dc i4'$E19E00' ;=> color palettes
dc i4'$22' ;length
ds 4 ;trans_count: ignored
p_readinfo anop ;P16 parm list for Read
rdinfo_ref ds 2
dc i4'infobuff' ;=> ignored buffer
dc i4'$200' ;length
ds 4
p_readdata anop ;P16 parm list for Read
rddata_ref ds 2
readaddr dc i4'0' ;addr & length to be filled in by...
readlength dc i4'0' ;program
ds 4
infobuff ds $200 ;buffer for ???
back dc i1'0' previous background color
count dc i'0'
bigbuf_Hndl ds 4 ;Todd's Big Buffer
end
--------------------------------------------------------------------------
If anyone can openly see what I am doing wrong, and why the bitmap is
screwed please feel free to tell me! Thanks...
Todd South
--
UUCP: {nosc, uunet!cacilj, sdcsvax, hplabs!hp-sdd, sun.COM}
...!crash!pnet01!pro-nsfmat!pro-pac!tsouth
ARPA: crash!pnet01!pro-nsfmat!pro-pac!tsouth@nosc.MIL
INET: tsouth@pro-pac.CTS.COM - BITNET: pro-pac.UUCP!tsouth@PSUVAX1