Talk:PUSHEM

From Esolang
Jump to navigation Jump to search

Hi! Just getting started with PUSHEM, so I'm probably making some very noobish error here. Anyway, I tried to make 3 small tables using your Table macro. Opened the resulting BP file in a hex editor. The table values look OK, but it seems the last table is always repeated 1 more time (doesn't matter in what order I place them).

; PUSH'EM, PUSH'EM, PUSH THEM BYTES HARD!
; BytePushCore
;   Opcode Table Generator
;     for the BytePusher VM
;       By Javamannen (Adam Danielsson)

{ Table (name) (parameters)
  \a #FF
  \c ^1 ?
  \R #1 \t^,^2
}

Table Const |__MINOR #1 #0
Table Inc   |__MINOR #1 #1
Table Dec   |__MINOR #1 -#1

--User:Javamannen

That is a bug in PUSHEM, thanks for notifying me. (It isn't a mistake you made.) I will fix it. However for now work around it by adding a line saying ;; at the bottom of the file. --Zzo38 19:03, 14 October 2010 (UTC)

OK, that worked, thanks.

Baby steps... =) I added some space at the end of the program for the future Addition and Subtraction tables, and then put the screen pixels at the very end. I guess there's no need for fixed opcode numbers, since we can have labels for everything. I added a single test instruction which referenced 2 tables, and it assembled OK.

  • One thing I noticed is that the zeros at the end are included in the BP file. You should probably have PUSHEM omit these when saving, since they will be recreated by the VM on init anyway.
  • I was able to set the PC reset correctly. But how do I set the Pixels bank (1 byte) and the Sound page (2 bytes) in the I/O area?
{ Table (name) (parameters)
  \a #FF
  \c ^1 ?
  \R #1 \t^,^2
}

{ Label (name)
  \c ^1 ?
}

\A #2
\W #8 ; PC reset
\A #8

\x Sound Pix ; just for testing the assembled addresses

Table Const |__MINOR #1 #0
Table Inc   |__MINOR #1 #1
Table Dec   |__MINOR #1 -#1
Label Sound

\a #FFFF
Label Add
\B #0
\a #FFFF
Label Sub
\B #0
\a #FFFF
Label Pix
;;

--User:Javamannen

In the next version, one of the things I plan to fix is omit the zeros at the end. To write the pixels bank (1 byte) use \B >> followed by the number or label, which means to shift right by two bytes and write one byte. For the two byte sound page you use \B >> and \B > with the number or label. Here is an example:
\A #6
\B >>sound_page
\B >sound_page
\A #5
\B >>pixels_bank

(Also, remember you should probably sign your messages on this talk page, by typing --~~~~ at the end of the message.) --Zzo38 22:24, 15 October 2010 (UTC)