home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG049.ARC
/
M80PAT.MAC
< prev
next >
Wrap
Text File
|
1979-12-31
|
3KB
|
117 lines
DATESTAMP PATCH FOR MACRO-80 .PRN FILES
; M80DATE V1.0 04/12/85
; Graeme Toogood
; 46 Blandford Crescent
; North Bayswater
; Victoria, 3153.
; date stamps M80 .prn files
; Modified for the RTC KIT from Microbee Systems using the Motorola
; 146818 chip by Darren Breeze 09/01/86
;
; To install, assemble M80DATE.MAC and patch M80.COM as follows :-
; Step 1. M80 =m80date
; Step 2. L80 m80date,m80date/n/e this generates a .com file but
; don't try to run it by it's self
; Step 3. CEBUG M80.COM
; Step 4. Use cebug's A command to patch 103h with JP 4F80
; Step 5. Use cebug's F and R commands to load M80DATE.HEX into memory
; at 4F80h
; -fm80date.com
; -r4e80 ,read in at offset of 4e80h+100h=4f80h
; Step 6. use cebug's F command for the new file name
; -fm80d.com
; then write the new file with the W command
; -w
; exit CEBUG and you will have M80D.com when
; you use it with the /l switch it will generate
; a .PRN file with todays date XX/XX/XX in the heading of each page.
.Z80
ASEG
ORG 100H
;rtc constants
rtcdat equ 7 ; addr of rtc data port
rtcadd equ 4 ; rtc address port
days equ 7 ; day of month register
months equ 8 ; month of year register
years equ 9 ; year register
update equ 0ah ; bit 7 reg 0ah 1= "update in progress"
; system constants
tpa equ 0100h
buffer equ 1af8h ; Start of M80's signon msg
m80 equ 470CH ; Normal entry to M80
.phase 4f80h
rtcrd: ld hl,m80 ; load code addr. for M80
ld (0104h),hl ; fix up patched jump at 103h
ld a,0dh ; address for reg D
out (rtcadd),a ; latch address
in a,(rtcdat) ; bit 7 reg d =1 then rtc is there
cp 80h ; and time is valid
jr z,ok ; yes - read dd/mm/yy and store in buffer
jp exit ; else enter M80 normally
ok: ld hl,1b04h ; start of 'MACRO-80 3.44' logo
ld de,1b0eh ; move it a little to the right
ld bc,13 ; bytes to moveè lddr ; move 'em
ld a,20h
ld (de),a ; a space to finish
ld hl,buffer-1 ; point to new date buffer loc'n
; get month,day and year
notyet: ld a,update ;point to update reg
out (rtcadd),a
in a,(rtcdat) ;get reg
bit 7,a ;if bit is 1 then update is in progress
jr nz,notyet
ld a,days ;point to day reg
call number ;get days
ld (hl),'/' ;put in a slash
ld a,months ;point to month
call number ;get month
ld (hl),'/' ;put in a slash
ld a,years ;point to year
call number ;get year
ld (hl),09h ;put tab
ld a,0 ;clear out a?
jr exit ;finished
;number takes register num in A isolates top and bottom nibble
;and puts then in the buffer. hl points to buffer
number: out (rtcadd),a ;latch address of reg to be read
in a,(rtcdat) ;get data
ld b,a ;save data
and 0f0h ;mask out lower nibble
rrca
rrca ;move upper nibble down
rrca
rrca
add a,30h ;ascii offset
inc hl
ld (hl),a ;put it in buffer
inc hl ;next buffer location
ld a,b ;get data again
and 0fh ;mask out upper nibble
add a,30h ;ascii offset
ld (hl),a ;store in buffer
inc hl
ret
exit: ld hl,rtcrd ; point to start of rtc pgm.
ld de,rtcrd+1 ; point to second byte
ld bc,last-rtcrd ; we're going to zero out
ld (hl),0 ; memory used by this prog.
ldir ; eliminate !!!
last: jp tpa ; and restart M80, leaving
; only this jump in memory....
end
è