1 eÿprint.s
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0[
\ 2.define Mprint
8 ! This subroutine prints a zero terminated ascii string.
9 ! The registerpair AX contains the start of the string.
10 ! The subroutine WRCH is a special routine on the BBC microcomputer
11 ! which prints the character in A to the screen.
12 ! The subroutine WRCH is a special one provided by the BBC
17 stx ADDR ! start address of string (lowbyte)
18 sta ADDR+1 ! start address of string (highbyte)
20 1: lda (ADDR),y ! get ascii character
22 jsr WRCH ! put it on the screen
28 \0printhex.s
\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ê
\ 1.define Printhex
35 ! This subroutine print the contents of register A to the screen
36 ! in hexadecimal form.
37 ! The subroutine WRCH is a special one provided by the BBC
46 lsr a ! get four high bits
49 and #0x0F ! get four low bits
60 printstack.s
\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0µ
\ 3.define Printstack
67 ! This a special subroutine which prints some things to the
68 ! monitorscreen for debugging.
75 jsr WRCH ! print filename
79 jsr WRCH ! print a space
81 jsr Printhex ! print line number (highbyte)
83 jsr Printhex ! print line number (lowbyte)
85 jsr WRCH ! print a space
87 jsr Printhex ! print stackpointer (highbyte)
89 jsr Printhex ! print stackpointer (lowbyte)
91 jsr WRCH ! print a space
93 jsr Printhex ! print real localbase (highbyte)
95 jsr Printhex ! print real localbase (lowbyte)
97 jsr WRCH ! print a space
99 jsr Printhex ! print second lowerbase (highbyte)
101 jsr Printhex ! print second lowerbase (lowbyte)
103 jsr WRCH ! print a newline
105 jsr WRCH ! print a carriagereturn
109 \0mon.s
\0tack.s
\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ü
\ 2.define Mon
116 ! This subroutine performs some monitor calls.
117 ! The exit call just resets the hardware_stackpointer so
118 ! this routine will return to the operating system.
119 ! The close call just returns a zero.
120 ! The ioctl call just pops its arguments and returns a zero.
121 ! The write routine is a real one.
127 ldx STACK ! load stackpointer
129 dex ! adjust stackpointer
130 txs ! set stackpointer
141 jsr Pop ! pop first argument (fildes)
142 jsr Pop ! pop second argument (request)
143 jsr Pop ! pop third argument (argp)
149 read.s
\0ack.s
\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ú
\ 2.define Mread
156 ! This subroutine reads characters from the standard input.
157 ! It ignores the filedes.
158 ! It reads atmost 255 characters. So the runtime system must
159 ! provide a way of dealing with this.
160 ! The subroutine RDCH is a special one provided by the BBC
165 jsr Pop ! ignore filedescriptor
167 stx ADDR ! address of character buffer (lowbyte)
168 sta ADDR+1 ! address of character buffer (highbyte)
169 jsr Pop ! number of characters
172 1: jsr RDCH ! read a character from the current inputstream
181 jsr Push ! number of characters red.
182 tax ! report a succesfull read.
186 write.s
\0ck.s
\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0g
\ 2.define Mwrite
193 ! This subroutine performs the monitor call write.
194 ! Writing is always done to standardoutput.
195 ! A zero is returned on exit.
196 ! The subroutine WRCH is a special routine of the BBC
202 jsr Pop ! get address of characterbuffer
203 stx ADDR ! bufferaddress (lowbyte)
204 sta ADDR+1 ! bufferaddress (highbyte)
205 jsr Pop ! number of characters to be writen.