Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comments to commands for clarity #68

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions level1/cmds/echo.asm
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
nam Echo
ttl Echo text

* Disassembled 98/09/10 22:44:14 by Disasm v1.6 (C) 1988 by RML

ifp1
use defsfile
endc
Expand All @@ -26,18 +24,18 @@ edition set 5
mod eom,name,tylg,atrv,start,size

org 0
u0000 rmb 450
rmb 200 stack
Deek marked this conversation as resolved.
Show resolved Hide resolved
size equ .

name fcs /Echo/
fcb edition

start tfr d,y
lda #1
os9 I$WritLn
bcs Exit
clrb
Exit os9 F$Exit
start tfr d,y transfer parameter count to Y
lda #1 we are writing to standard out
os9 I$WritLn write the line
bcs ex@ branch if an error
clrb clear error and carry
ex@ os9 F$Exit exit

emod
eom equ *
Expand Down
133 changes: 68 additions & 65 deletions level1/cmds/ident.asm
Original file line number Diff line number Diff line change
Expand Up @@ -179,64 +179,65 @@ start leas >u019C,u
ldd #$0000
std <u0002
std <u0004
L0263 lda ,x+
L0265 cmpa #C$SPAC
beq L0263
cmpa #C$COMA
beq L0263
cmpa #C$CR
beq L02BB
cmpa #'-
beq L027E
ldy <u0002
bne L0263
stx <u0002
bra L0263
L027E lda ,x+
cmpa #'-
beq L027E
cmpa #'0
bcs L0265
eora #'M
anda #$DF
bne L0292
inc <dolink
bra L027E
L0292 lda -$01,x
eora #'S
anda #$DF
bne L029E
inc <short
bra L027E
L029E lda -$01,x
eora #'V
anda #$DF
bne L02AA
inc <modvfy
bra L027E
L02AA lda -$01,x
eora #'X
anda #$DF
bne L02B8
lda #EXEC.+READ.
sta <fperm
bra L027E
L02B8 lbra ShowHelp
L02BB ldx <u0002
lbeq ShowHelp
leax -$01,x
tst <dolink
beq L0314
pshs u
clra
os9 F$Link
lbcs L03D2
stu <modptr
ldd M$ID,u
cmpd #M$ID12
beq L02EB
puls u
L02DD leay >M_MInc,pcr

L0263 lda ,x+ get next parameter character
L0265 cmpa #C$SPAC space?
beq L0263 branch if so
cmpa #C$COMA comma?
beq L0263 branch if so
cmpa #C$CR carriage return?
beq L02BB branch if so
cmpa #'- option?
beq L027E branch if so
ldy <u0002 did we already store module/file name parameter?
bne L0263 no, keep going
stx <u0002 save off parameter (presumed module/file name)
bra L0263 go back and get next character
L027E lda ,x+ get character after dash
cmpa #'- is it another dash?
beq L027E branch if so
cmpa #'0 is it 0?
bcs L0265 branch if less than
eora #'M XOR with M
anda #$DF AND
bne L0292 branch if not the same
inc <dolink else set the "link module" flag
bra L027E go get next parameter character
L0292 lda -1,x get last character
eora #'S XOR with S
anda #$DF AND
bne L029E branch if not the option
inc <short else set the "short" flag
bra L027E and continue parsing
L029E lda -$01,x get last character
eora #'V XOR with V
anda #$DF AND
bne L02AA branch if not the option
inc <modvfy else set the "verify" flag
bra L027E and continue parsing
L02AA lda -$01,x get the last character
eora #'X XOR with X
anda #$DF AND
bne L02B8 branch if not the option
lda #EXEC.+READ. load file perms with exec and read
sta <fperm and save to the variable
bra L027E and continue parsing
L02B8 lbra ShowHelp show help
L02BB ldx <u0002 any file/module name specified?
lbeq ShowHelp branch if not
leax -$01,x else back up one
tst <dolink was "link module" flag set?
beq L0314 branch if so
pshs u save U
clra clear A (link to any module)
os9 F$Link link to it
lbcs L03D2 branch if error
stu <modptr else save the module pointer
ldd M$ID,u get the ID
cmpd #M$ID12 is it OS-9 module sync bytes?
beq L02EB branch if so
puls u else recover U
L02DD leay >M_MInc,pcr point to incorrect header message
lbsr L05FC
lbsr L0612
clrb
Expand Down Expand Up @@ -572,17 +573,19 @@ L05E9 lda #'$
pshs b,a
andb #$0F
bra L05E9
L05FC lda ,y
anda #$7F

L05FC lda ,y get character at Y
anda #$7F clear hi bit
bsr L0608
lda ,y+
bpl L05FC
L0606 lda #C$SPAC
L0608 pshs x
ldx <u0000
lda ,y+ get character at Y and increment
bpl L05FC branch if hi-bit clear
L0606 lda #C$SPAC load A with space character
L0608 pshs x save off X
ldx <u0000
sta ,x+
stx <u0000
puls pc,x

L0612 pshs y,x,a
lda #C$CR
bsr L0608
Expand Down
28 changes: 14 additions & 14 deletions level1/cmds/list.asm
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
nam List
ttl List a text file

* Disassembled 98/09/10 23:16:25 by Disasm v1.6 (C) 1988 by RML

ifp1
use defsfile
endc
Expand All @@ -25,10 +23,12 @@ edition set 5

mod eom,name,tylg,atrv,start,size

maxreadlen equ 200
org 0
filepath rmb 1
parmptr rmb 2
readbuff rmb 650
readbuff rmb maxreadlen+1
stack rmb 200
Deek marked this conversation as resolved.
Show resolved Hide resolved
size equ .

name fcs /List/
Expand All @@ -37,29 +37,29 @@ name fcs /List/
start stx <parmptr save parameter pointer
lda #READ. read access mode
os9 I$Open open file
bcs L0049 branch if error
bcs ex@ branch if error
sta <filepath else save path to file
stx <parmptr and updated parm pointer
L001F lda <filepath get path
stx <parmptr and updated parameter pointer
l@ lda <filepath get path
leax readbuff,u point X to read buffer
ldy #200 read up to 200 bytes
ldy #maxreadlen read up to the maximum length
os9 I$ReadLn read it!
bcs L0035 branch if error
bcs ckeof@ branch if error
lda #1 standard output
os9 I$WritLn write line to stdout
bcc L001F branch if ok
bra L0049 else exit
L0035 cmpb #E$EOF did we get an EOF error?
bne L0049 exit if not
bcc l@ branch if ok
bra ex@ else exit
ckeof@ cmpb #E$EOF did we get an EOF error?
bne ex@ exit if not
lda <filepath else get path
os9 I$Close and close it
bcs L0049 branch if error
bcs ex@ branch if error
ldx <parmptr get param pointer
lda ,x get char
cmpa #C$CR end of command line?
bne start branch if not
clrb else clear carry
L0049 os9 F$Exit and exit
ex@ os9 F$Exit and exit

emod
eom equ *
Expand Down
Loading