Words listing from Popular Computing Weekly 20-26 October 1983
Monitor
on Jupiter Ace These routines are for those who enjoy experimenting with the Ace. First, enter the Forth words on the listing carefully.
The first routine BYTES prints out the contents in memory with the address, the decimal contents of that address, the contents in Hex and the ASCII character of that address. It has two parameters: the starting address and the finish address. To have a peek at the ROM enter this: 0 8192 Bytes and the contents of the Rom will float up past your eyes.
|
Enter the words CODE and HALT on page 147 of the Jupiter Ace manual. You can check that you entered HALT correctly by entering this: HALT HALT 4 + BYTES and the contents of HALT will be seen.
The next routine SEARCH gives the address of the first occurrence of a given byte. So to find the address of the first asterisk (code 42) on the screen enter: 42 9216 SEARCH (make sure there is already one on the screen) If there is no asterisk in the addresses 9216 to 65535 (the top address) then the message
|
'NOT FOUND' will appear: if there is, on the other hand, the address will be given. You can try this on the ROM, on your machine code routines, anywhere (note that none of these routines are fast enough for use in games or suchlike).
The next routine STACK just prints out the contents of the stack out in hex. Use it by typing STACK.
The last routine S&R searches over a given area in memory and changes every specified byte to a given value.
This routine uses four parameters: the code to be altered, the code to change it to, the start address and the finish address.
Eg: to change every space on the screen to an asterisk type:
32 42 9216 9984 S&R
|
: BYTE5 SWAP 21 0 AT ." ADDRESS DEC. HE X CHR. " CR CR CR DO 21 0 AT I . 21 0 AT I C@ . 21 13 AT 16 BASE! I C@ . DECIMAL 21 20 AT I C@ EMIT CR CR CR ; 0 VARIABLE TAR 0 VARIABLE ADD : SEARCH ADD ! TAR ! BEGIN ADD @ C@ TAR @ = IF ADD @ 1+ ADD ! ADD @ -1 = UNTIL ." NOT FOUND" ; : STACK 15419 @ 15415 @ 12 + OVER OVER - IF DO I @ 16 ! . 2 +LOOP ELSE DROP DROP THEN ; 0 VARIABLE SEAR 0 VARIABLE REP : S&R 4 ROLL SEAR ! 3 ROLL REP ! SWAP DO I C@ SEAR @ = IF REP @ I C! THEN LOOP ; Monitor
by Ralph Lorenz |