📄 hpuboot.s
字号:
/ disk boot program to load and transfer/ to a unix entry/ entry is made by jsr pc,*$0/ so return can be rts pccore = 28... = [core*2048.]-512./ establish sp and check if running below/ intended origin, if so, copy/ program up to 'core' K words.start: mov $..,sp mov sp,r1 cmp pc,r1 bhis 2f clr r0 cmp (r0),$407 bne 1f mov $20,r01: mov (r0)+,(r1)+ cmp r1,$end blo 1b jmp (sp)/ clear core to make things clean2: clr (r0)+ cmp r0,sp blo 2b/ at origin, read pathname,/ initialize rp mov $drive,*$hpcs2 mov $preset+go,*$hpcs1 mov $fmt22,*$hpof/ spread out in array 'names', one/ component every 14 bytes. mov $names,r11: mov r1,r22: jsr pc,getc cmp r0,$'\n beq 1f cmp r0,$'/ beq 3f movb r0,(r2)+ br 2b3: cmp r1,r2 beq 2b add $14.,r1 br 1b/ now start reading the inodes/ starting at the root and/ going through directories1: mov $names,r1 mov $2,r01: clr bno jsr pc,iget tst (r1) beq 1f2: jsr pc,rmblk br start mov $buf,r23: mov r1,r3 mov r2,r4 add $16.,r2 tst (r4)+ beq 5f4: cmpb (r3)+,(r4)+ bne 5f cmp r4,r2 blo 4b mov -16.(r2),r0 add $14.,r1 br 1b5: cmp r2,$buf+512. blo 3b br 2b/ read file into core until/ a mapping error, (no disk address)1: clr r11: jsr pc,rmblk br 1f mov $buf,r22: mov (r2)+,(r1)+ cmp r2,$buf+512. blo 2b br 1b/ relocate core around/ assembler header1: clr r0 cmp (r0),$407 bne 2f1: mov 20(r0),(r0)+ cmp r0,sp blo 1b/ enter program and/ restart if return2: jsr pc,*$0 br start/ get the inode specified in r0iget: add $15.,r0 mov r0,r5 ash $-3.,r0 bic $!17777,r0 mov r0,dno clr r0 jsr pc,rblk bic $!7,r5 ash $6,r5 add $buf,r5 mov $inod,r41: mov (r5)+,(r4)+ cmp r4,$inod+64. blo 1b rts pc/ read a mapped block/ offset in file is in bno./ skip if success, no skip if fail/ the algorithm only handles a single/ indirect block. that means that/ files longer than 10+128 blocks cannot/ be loaded.rmblk: add $2,(sp) mov bno,r0 cmp r0,$10. blt 1f mov $10.,r01: mov r0,-(sp) asl r0 add (sp)+,r0 add $addr+1,r0 movb (r0)+,dno movb (r0)+,dno+1 movb -3(r0),r0 bne 1f tst dno beq 2f1: jsr pc,rblk mov bno,r0 inc bno sub $10.,r0 blt 1f ash $2,r0 mov buf+2(r0),dno mov buf(r0),r0 bne rblk tst dno bne rblk2: sub $2,(sp)1: rts pcdrive = 0cyl = 0.read = 70preset = 20go = 1fmt22 = 10000hpcs1 = 176700hpda = hpcs1+6hpcs2 = hpcs1+10hpds = hpcs1+12hpof = hpcs1+32hpca = hpcs1+34/ rp0456 disk driver./ low order address in dno,/ high order in r0.rblk: mov r1,-(sp) mov dno,r1 div $22.*19.,r0 add $cyl,r0 mov r0,*$hpca clr r0 div $22.,r0 swab r0 bis r1,r0 mov $hpda,r1 mov r0,(r1) mov $buf,-(r1) mov $-256.,-(r1) mov $read+go,-(r1)1: tstb (r1) bge 1b mov (sp)+,r1 rts pctks = 177560tkb = 177562/ read and echo a teletype charactergetc: mov $tks,r0 inc (r0)1: tstb (r0) bge 1b mov tkb,r0 bic $!177,r0 cmp r0,$'A blo 1f cmp r0,$'Z bhi 1f add $'a-'A,r01:tps = 177564tpb = 177566/ print a teletype characterputc: tstb *$tps bge putc mov r0,*$tpb cmp r0,$'\r bne 1f mov $'\n,r0 br putc1: rts pcend:inod = ..-1024.addr = inod+12.buf = inod+64.bno = buf+512.dno = bno+2names = dno+2reset = 5
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -