home *** CD-ROM | disk | FTP | other *** search
- ; $$TABS=12
- exeobj
-
- INCLUDE "i:HARDWARE.asm"
- include "i:lvo.asm"
- include "i:strucdef.asm"
-
- code
-
- serper_value equ 30 ; 115.2 Kbaud
- blocksize equ 32768
- ack_byte equ $55
-
- start move.l $4,a6
- lea gfxname(pc),a1
- moveq #0,d0
- jsr _LVOOpenLibrary(a6)
- move.l d0,gfxbase
- lea dosname(pc),a1
- moveq #0,d0
- jsr _LVOOpenLibrary(a6)
- move.l d0,dosbase
-
- move.l 4,a6
- move.l #blocksize,d0
- moveq #0,d1
- jsr _LVOAllocMem(a6)
- move.l d0,bufptr
- beq done_prog
-
- bsr disable
- move.w #serper_value,$dff032 ; set baud rate
- bsr sget_byte
- cmp.b #$55,d0
- bne done_prog
- bsr sget_byte
- cmp.b #$aa,d0
- bne done_prog
- moveq #3,d2
- lea file_len(pc),a0
- len_loop: bsr sget_byte
- move.b d0,(a0)+
- dbra d2,len_loop
- lea file_name(pc),a0
- fname_loop: bsr sget_byte
- tst.b d7
- bne done_prog
- move.b d0,(a0)+
- bne.s fname_loop
- move.b chksum(pc),d2
- bsr sget_byte
- cmp.b d0,d2
- bne done_prog
- bsr enable
- got_name move.l dosbase(pc),a6
- move.l #file_name,d1
- move.l #mode_newfile,d2
- jsr _LVOOpen(a6)
- move.l d0,file_handle
- beq done_prog
- next_block bsr disable
- move.b #ack_byte,d0
- bsr send_byte
- clr.b chksum
- move.l bufptr(pc),a0
- move.l #blocksize,d2
- cmp.l file_len,d2
- ble.s full_block
- move.l file_len(pc),d2
- full_block: sub.l d2,file_len
- move.l d2,d3
- subq #1,d2
- get_loop: bsr sget_byte
- tst.b d7
- bne done_prog
- move.b d0,(a0)+
- dbra d2,get_loop
- move.b chksum(pc),d2
- bsr sget_byte
- cmp.b d2,d0
- bne done_prog
- bsr enable
- got_block move.l dosbase(pc),a6
- move.l file_handle(pc),d1
- move.l bufptr(pc),d2
- jsr _LVOWrite(a6)
- tst.l file_len
- bne next_block
- done_prog: move.l 4,a6
- tst.b disable_flag
- beq not_dis
- jsr _LVODisable(a6)
- not_dis: move.l bufptr(pc),a1
- cmp #0,a1
- beq.s no_free1
- move.l #blocksize,d0
- jsr _LVOFreeMem(a6)
- no_free1 move.l dosbase(pc),a6
- move.l file_handle(pc),d1
- beq.s no_close
- jsr _LVOClose(a6)
- no_close moveq #0,d1
- jmp _LVOExit(a6)
-
- sget_byte move.l #1500000,d1
- timeout1: move.w serdatr,d0
- btst #14,d0
- bne.s sgot_byte
- subq.l #1,d1
- bne sget_byte
- moveq #0,d0
- st d7
- rts
- sgot_byte: move d0,color00
- add.b d0,chksum
- move.w #$800,intreq
- clr d7
- rts
-
- SEND_BYTE:
- move.w #$1,intena
- MOVEM.L D0/D1,-(A7)
- POLL_LOOP:
- MOVE.W SERDATR,D1
- BTST #13,D1
- BEQ POLL_LOOP
- AND.W #$FF,D0
- BSET #8,D0
- MOVE.W D0,SERDAT
- MOVEM.L (A7)+,D0/D1
- RTS
-
- enable clr.b disable_flag
- move.l 4,a6
- jmp _LVOEnable(a6)
-
- disable st disable_flag
- move.l 4,a6
- jmp _LVODisable(a6)
-
- file_handle dc.l 0
- gfxbase dc.l 0
- dosbase dc.l 0
- bufptr dc.l 0
- file_len dc.l 0
- chksum dc.b 0
- DOSNAME: DC.B 'dos.library',0
- gfxname dc.b 'graphics.library',0
- file_name ds.b 100
- disable_flag dc.b 0
- end
-
-