1
0
mirror of https://github.com/rzzzwilson/pymlac.git synced 2025-06-10 09:32:41 +00:00

Final forms - all working

This commit is contained in:
Ross Wilson
2016-03-14 19:40:26 +10:00
parent 9094c0c7fe
commit 0d61805eb0
2 changed files with 41 additions and 38 deletions

View File

@@ -1,6 +1,6 @@
; typed in from imlacdocs/blockpunchsrc.pdf
org 037540
s hlt ; wait for first address
start hlt ; wait for first address
lda ;
dac fad ; save in FAD
hlt ; wait for end address
@@ -9,63 +9,63 @@ s hlt ; wait for first address
cma ; ones complement the count
dac mwd ; save as 'minus number of words'
asm ; test if end address < first
jmp s ; jump if so
e3 add allbits ; test if num words
jmp start ; jump if so
doblk add allbits ; test if num words
asp ; skip if
cla ;
sub allbits ;
dac wtb ; save in 'words this block'
cia ; twos complement block count
jms t ; output word count BYTE
jms pbyte ; output word count BYTE
add mwd ;
dac mwd ;
lac fad ;
jms t2 ; output block address WORD
jms pword ; output block address WORD
cla ;
dac smc ;
loop lac *fad ;
jms t2 ;
jms s1 ; update checksum
jms pword ;
jms updchs ; update checksum
isz fad ; move address to next word
isz wtb ; check block finished
jmp loop ; jump if NOT, continue
lac smc ;
jms t2 ; outp[ut checksum WORD
jms pword ; outp[ut checksum WORD
lac mwd ; are we finished the block punch?
asz ; skip if no more words to punch
jmp e3 ; punch next block
jmp s ; punch finished
jmp doblk ; punch next block
jmp start ; punch finished
;------------------------
; Punch two bytes (a WORD) from AC
;------------------------
t2 bss 1 ;
pword bss 1 ;
rar 3 ; shift high byte to lower in AC
rar 3 ;
rar 2 ;
jms t ; punch high byte
jms pbyte ; punch high byte
ral 3 ; get low byte to AC low byte
ral 3 ;
ral 2 ;
jms t ; punch low byte
jmp *t2 ;
jms pbyte ; punch low byte
jmp *pword ;
;------------------------
; Punch low byte of AC (AC left unchanged)
;------------------------
t bss 1 ;
pbyte bss 1 ;
tsf ; skip if TTYOUT free
jmp .-1 ; wait until TTYOUT is free
tpc ; punch and clear flag
jmp *t ;
jmp *pbyte ;
;------------------------
; Update checksum, new value in AC
;------------------------
s1 bss 1 ;
updchs bss 1 ;
cll ; clear link
add smc ; add new value
lsz ; skip if no overflow
iac ; else increment checksum
dac smc ; put updated checksum back
jmp *s1 ;
jmp *updchs ;
;------------------------
; What were literals in original code stored here
;------------------------
@@ -75,41 +75,41 @@ wtb data 0 ; num words in this block
smc data 0 ; checksum
allbits data 0377 ; byte of all bits
org s+0100 ; 037540 + 0100 = 037640
;------------------------
; Punch block loader
;------------------------
lwc 0100 ;
org start+0100 ; 037540 + 0100 = 037640
pbldr lwc 0100 ;
dac fad ;
lwc 076 ;
dac wtb ;
lac *fad ;
jms t2 ;
pbloop lac *fad ;
jms pword ;
isz fad ;
isz wtb ;
jmp .-4 ;
jmp s+0120 ; punch leader
jmp pbloop ;
jmp pldr ; punch leader
org s+0120 ; 037540 + 0120 = 037660
;------------------------
; Punch leader
;------------------------
lwc 012 ;
org start+0120 ; 037540 + 0120 = 037660
pldr lwc 010 ; >was 012
dac wtb ; store leader count
cla ;
jms t2 ;
jms pword ;
isz wtb ;
jmp .-2 ;
jmp s ; wait for first address
jmp start ; wait for first address
org s+0130 ; 037540 + 0130 = 037670
;------------------------
; Punch end code
;------------------------
law 0377 ;
jms t ;
jms t ;
jms t ;
jmp s+0120 ; punch more leader
org start+0130 ; 037540 + 0130 = 037670
pend law 0377 ;
jms pbyte ;
jms pbyte ;
jms pbyte ;
jmp pldr ; punch more leader
end

View File

@@ -1,7 +1,10 @@
# run the "blockpunch" program
bootrom ptr; mount ptr blockpunch.ptp; trace 03540,03677; setreg pc 040; rununtil 0
mount ttyout xyzzy.out; setreg pc 03660; rununtil 0
setreg ds 040; rununtil 0
setreg ds 077; rununtil 0
setreg pc 03670; rununtil 0
mount ttyout xyzzy.out
setreg pc 03660; rununtil 0 # punch leader
setreg pc 03640; rununtil 0 # punch block loader
setreg pc 03660; rununtil 0 # punch leader
setreg ds 040; rununtil 0 # feed in start address 040
setreg ds 077; rununtil 0 # and end address 077
setreg pc 03670; rununtil 0 # punch memory and end leader