Fixed stack inspect debugger
This commit is contained in:
parent
b3f207b974
commit
4f03030654
|
@ -3,6 +3,7 @@
|
||||||
|0013
|
|0013
|
||||||
|
|
||||||
@Zeropage &byte $1 &short $2
|
@Zeropage &byte $1 &short $2
|
||||||
|
@id $1
|
||||||
|
|
||||||
|0100
|
|0100
|
||||||
|
|
||||||
|
@ -11,40 +12,45 @@
|
||||||
( part 1
|
( part 1
|
||||||
> LIT2: Puts a short on the stack
|
> LIT2: Puts a short on the stack
|
||||||
> LIT: Puts a byte on the stack
|
> LIT: Puts a byte on the stack
|
||||||
> #18 DEO: Write a letter in terminal
|
> #06 DEO: Write to metadata ports
|
||||||
> ;meta: Push short
|
> #18 DEO: Write a letter in terminal )
|
||||||
> #06 DEO: Write to metadata ports )
|
|
||||||
|
|
||||||
[ LIT2 "kO ] #18 DEO #18 DEO #0a18 DEO
|
|
||||||
;meta #06 DEO2
|
;meta #06 DEO2
|
||||||
|
[ LIT2 "kO ] #18 DEO #18 DEO
|
||||||
|
[ LIT2 "1 18 ] DEO #0a18 DEO
|
||||||
|
|
||||||
( part 2
|
( part 2
|
||||||
> LITr: Put a byte on return stack
|
> LITr: Put a byte on return stack
|
||||||
> STH: Move a byte from working stack to return stack
|
> STH: Move a byte from working stack to return stack
|
||||||
> STH2r: Move a short from return stack to working stack )
|
> STH2r: Move a short from return stack to working stack )
|
||||||
|
|
||||||
[ LITr "k ] [ LIT "O ] STH STH2r #18 DEO #18 DEO #0a18 DEO
|
[ LITr "k ] [ LIT "O ] STH STH2r #18 DEO #18 DEO
|
||||||
|
[ LIT2 "2 18 ] DEO #0a18 DEO
|
||||||
|
|
||||||
( part 3
|
( part 3
|
||||||
> LIT2r: Put a short on return stack
|
> LIT2r: Put a short on return stack
|
||||||
> DUP: Duplicate byte
|
> DUP: Duplicate byte
|
||||||
> ADDr: Add bytes on return stack )
|
> ADDr: Add bytes on return stack )
|
||||||
|
|
||||||
[ LIT2r "k 4d ] #01 DUP STH ADDr STH ADDr STH2r #18 DEO #18 DEO #0a18 DEO
|
[ LIT2r "k 4d ] #01 DUP STH ADDr STH ADDr STH2r #18 DEO #18 DEO
|
||||||
|
[ LIT2 "3 18 ] DEO #0a18 DEO
|
||||||
|
|
||||||
( part 4
|
( part 4
|
||||||
> JSI: Subroutine to relative absolute address
|
> JSI: Subroutine to relative short address
|
||||||
> JMP2r: Jumps to absolute address on return stack )
|
> JMP2r: Jumps to absolute address on return stack )
|
||||||
|
|
||||||
subroutine
|
subroutine
|
||||||
|
[ LIT2 "4 18 ] DEO #0a18 DEO
|
||||||
|
|
||||||
( part 5
|
( part 5
|
||||||
> POP2: Removes a short from the stack
|
> POP2: Removes a short from the stack
|
||||||
> INC2: Increments short on stack
|
> INC2: Increments short on stack
|
||||||
> LDAk: Non-destructive load byte from absolute address
|
> DUP2: Duplicate short
|
||||||
> JCI: Conditional subroutine to relative absolute address )
|
> LDA: load byte from absolute address
|
||||||
|
> JCI: Conditional subroutine to relative short address )
|
||||||
|
|
||||||
;Dict/ok pstr #0a18 DEO
|
;Dict/ok pstr
|
||||||
|
[ LIT2 "5 18 ] DEO #0a18 DEO
|
||||||
|
|
||||||
( part 6
|
( part 6
|
||||||
> GTH2k: Non-destructive greater-than short
|
> GTH2k: Non-destructive greater-than short
|
||||||
|
@ -70,6 +76,8 @@
|
||||||
STHr AND STHr AND
|
STHr AND STHr AND
|
||||||
;Dict/stack-wrap test-part
|
;Dict/stack-wrap test-part
|
||||||
|
|
||||||
|
( restore stack ) #0000 #0000
|
||||||
|
|
||||||
( Part 8
|
( Part 8
|
||||||
> Testing RAM wrapping
|
> Testing RAM wrapping
|
||||||
> Storing 12 in 0xffff, and 34 in 0x0000 )
|
> Storing 12 in 0xffff, and 34 in 0x0000 )
|
||||||
|
@ -111,7 +119,7 @@ BRK
|
||||||
( name ) "Opctest 0a
|
( name ) "Opctest 0a
|
||||||
( details ) "A 20 "Testing 20 "Program 0a
|
( details ) "A 20 "Testing 20 "Program 0a
|
||||||
( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
|
( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
|
||||||
( date ) "1 20 "Nov 20 "2023 $2
|
( date ) "18 20 "Feb 20 "2024 $2
|
||||||
|
|
||||||
@test-part ( f name* -- )
|
@test-part ( f name* -- )
|
||||||
pstr ?{
|
pstr ?{
|
||||||
|
@ -123,26 +131,28 @@ BRK
|
||||||
|
|
||||||
LDA2k JSR2 DUP ?&pass
|
LDA2k JSR2 DUP ?&pass
|
||||||
;Dict/missed pstr
|
;Dict/missed pstr
|
||||||
[ LIT2 &name $2 ] pstr/ #0a18 DEO
|
[ LIT2 &name $2 ] pstr
|
||||||
#01 ;on-reset/fail STA JMP2r
|
[ LIT2 "# 18 ] DEO
|
||||||
|
[ LIT2 "a -id ] LDZ ADD #18 DEO
|
||||||
|
#0a18 DEO
|
||||||
|
#01 ;on-reset/fail STA
|
||||||
&pass
|
&pass
|
||||||
|
.id LDZ INC .id STZ
|
||||||
|
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
@set ( name* -- f )
|
@set ( name* -- f )
|
||||||
|
|
||||||
;run-test/name STA2 #01
|
;run-test/name STA2 #01
|
||||||
|
[ LIT2 ff -id ] STZ
|
||||||
|
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
@pstr ( str* -- )
|
@pstr ( str* -- )
|
||||||
|
DUP2 LDA
|
||||||
&w ( -- )
|
DUP ?{ POP POP2 JMP2r }
|
||||||
LDAk #18 DEO
|
#18 DEO
|
||||||
INC2 & LDAk ?&w
|
INC2 !pstr
|
||||||
POP2
|
|
||||||
|
|
||||||
JMP2r
|
|
||||||
|
|
||||||
@tests
|
@tests
|
||||||
=op-equ [
|
=op-equ [
|
||||||
|
@ -216,7 +226,7 @@ JMP2r
|
||||||
=op-jmi [
|
=op-jmi [
|
||||||
=op-jmi/a ]
|
=op-jmi/a ]
|
||||||
=op-jsi [
|
=op-jsi [
|
||||||
=op-jsi/a =op-jsi/b ]
|
=op-jsi/a =op-jsi/b =op-jsi/c =op-jsi/d ]
|
||||||
&end
|
&end
|
||||||
|
|
||||||
@op-equ ;Dict/equ !set
|
@op-equ ;Dict/equ !set
|
||||||
|
@ -406,6 +416,8 @@ JMP2r
|
||||||
@op-jsi ;Dict/jsi !set
|
@op-jsi ;Dict/jsi !set
|
||||||
&a #02 #04 routine #06 EQU JMP2r
|
&a #02 #04 routine #06 EQU JMP2r
|
||||||
&b ;&return special &return JMP2r
|
&b ;&return special &return JMP2r
|
||||||
|
&c ,&skip-c JMP &routine-c ADD JMP2r &skip-c #02 #04 op-jsi/routine-c #06 EQU JMP2r
|
||||||
|
&d ,&skip-d JMP &routine-d ADD JMP2r &skip-d #02 #04 op-jsi-far-routine-d #06 EQU JMP2r
|
||||||
|
|
||||||
@special ( routine* -- f )
|
@special ( routine* -- f )
|
||||||
|
|
||||||
|
@ -416,7 +428,7 @@ JMP2r
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
@routine ( a b -- c ) ADD JMP2r
|
@routine ( a b -- c ) ADD JMP2r
|
||||||
@subroutine ( -- ) [ LIT2 "kO ] #18 DEO #18 DEO #0a18 DEO JMP2r
|
@subroutine ( -- ) [ LIT2 "kO ] #18 DEO #18 DEO JMP2r
|
||||||
@Absolute &byte $1 &short $2
|
@Absolute &byte $1 &short $2
|
||||||
|
|
||||||
@Dict [
|
@Dict [
|
||||||
|
@ -441,3 +453,4 @@ JMP2r
|
||||||
&jmi "JMI $1 &jci "JCI $1 &jsi "JSI $1
|
&jmi "JMI $1 &jci "JCI $1 &jsi "JSI $1
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|7000 @op-jsi-far-routine-d op-jsi/routine-d JMP2r
|
||||||
|
|
4
makefile
4
makefile
|
@ -5,7 +5,7 @@ EMU_src=${CLI_src} src/devices/screen.c src/devices/controller.c src/devices/mou
|
||||||
RELEASE_flags=-DNDEBUG -O2 -g0 -s
|
RELEASE_flags=-DNDEBUG -O2 -g0 -s
|
||||||
DEBUG_flags=-std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined
|
DEBUG_flags=-std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined
|
||||||
|
|
||||||
.PHONY: all debug dest run test install uninstall format clean archive
|
.PHONY: all debug dest run test install uninstall format clean grab archive
|
||||||
|
|
||||||
all: dest bin/uxnasm bin/uxncli bin/uxn11
|
all: dest bin/uxnasm bin/uxncli bin/uxn11
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ uninstall:
|
||||||
@ rm -f ~/bin/uxn11 ~/bin/uxnasm ~/bin/uxncli
|
@ rm -f ~/bin/uxn11 ~/bin/uxnasm ~/bin/uxncli
|
||||||
format:
|
format:
|
||||||
@ clang-format -i src/uxnasm.c src/uxncli.c src/uxn11.c src/devices/*
|
@ clang-format -i src/uxnasm.c src/uxncli.c src/uxn11.c src/devices/*
|
||||||
|
grab:
|
||||||
|
@ cp ../uxn-utils/cli/opctest/opctest.tal etc/opctest.tal
|
||||||
archive:
|
archive:
|
||||||
@ cp src/uxnasm.c ../oscean/etc/uxnasm.c.txt
|
@ cp src/uxnasm.c ../oscean/etc/uxnasm.c.txt
|
||||||
clean:
|
clean:
|
||||||
|
|
|
@ -45,8 +45,8 @@ static void
|
||||||
system_print(Stack *s)
|
system_print(Stack *s)
|
||||||
{
|
{
|
||||||
Uint8 i;
|
Uint8 i;
|
||||||
for(i = s->ptr - 7; i != (Uint8)(s->ptr + 1); i++)
|
for(i = s->ptr - 7; i != (Uint8)(s->ptr); i++)
|
||||||
fprintf(stderr, "%02x%c", s->dat[i], i == 0 ? '|' : ' ');
|
fprintf(stderr, "%02x%c", s->dat[i], i == 0xff ? '|' : ' ');
|
||||||
fprintf(stderr, "< \n");
|
fprintf(stderr, "< \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue